summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWes Haggard <weshaggard@users.noreply.github.com>2018-03-30 11:59:39 -0700
committerGitHub <noreply@github.com>2018-03-30 11:59:39 -0700
commitf5720eea7e7ada0bc0f6ba05a3825c73871a8b81 (patch)
treea43d3016ce6dbe8024d171bd4dd9b9a90c3684c9
parentd845ef1c33f0283d18541714ad9469a7b1a559e6 (diff)
parent3365ac5efe5d6a7ea965ed1d17a5dd5474a033a5 (diff)
downloadcoreclr-f5720eea7e7ada0bc0f6ba05a3825c73871a8b81.tar.gz
coreclr-f5720eea7e7ada0bc0f6ba05a3825c73871a8b81.tar.bz2
coreclr-f5720eea7e7ada0bc0f6ba05a3825c73871a8b81.zip
Merge pull request #17347 from weshaggard/MergeMaster21
[release/2.1] Merge master to release/2.1
-rw-r--r--.gitignore4
-rw-r--r--BuildToolsVersion.txt2
-rw-r--r--CODE_OWNERS.TXT6
-rw-r--r--Documentation/building/debugging-instructions.md9
-rw-r--r--Documentation/building/viewing-jit-dumps.md11
-rw-r--r--Documentation/workflow/OfficalAndDailyBuilds.md7
-rw-r--r--ILAsmVersion.txt2
-rw-r--r--build-test.cmd53
-rwxr-xr-xbuild-test.sh33
-rw-r--r--build.cmd22
-rwxr-xr-xbuild.sh57
-rw-r--r--buildpipeline/DotNet-CoreClr-Trusted-Linux-Crossbuild.json39
-rw-r--r--buildpipeline/DotNet-CoreClr-Trusted-Linux.json23
-rw-r--r--buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json14
-rw-r--r--buildpipeline/DotNet-CoreClr-Trusted-Windows.json14
-rw-r--r--buildpipeline/DotNet-Trusted-Publish-Symbols.json14
-rw-r--r--buildpipeline/DotNet-Trusted-Publish.json16
-rw-r--r--buildpipeline/pipelines.json8
-rw-r--r--buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json14
-rw-r--r--clrdefinitions.cmake4
-rw-r--r--cross/arm64/tryrun.cmake4
-rw-r--r--crosscomponents.cmake6
-rw-r--r--dependencies.props20
-rwxr-xr-xnetci.groovy2314
-rw-r--r--src/ToolBox/SOS/CMakeLists.txt1
-rw-r--r--src/ToolBox/SOS/DacTableGen/CMakeLists.txt8
-rw-r--r--src/ToolBox/SOS/DacTableGen/DIALib.dllbin0 -> 42496 bytes
-rw-r--r--src/ToolBox/SOS/DacTableGen/diautil.cs36
-rw-r--r--src/ToolBox/SOS/tests/Test.cs4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_bpmd_clear.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_bpmd_clearall.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_bpmd_methoddesc.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_bpmd_module_function.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_bpmd_module_function_iloffset.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_bpmd_nofuturemodule_module_function.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_clrstack.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_clrthreads.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_clru.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dso.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumpclass.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumpheap.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumpil.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumplog.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumpmd.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumpmodule.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumpmt.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumpobj.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_dumpstack.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_eeheap.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_eestack.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_gcroot.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_histclear.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_histinit.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_histobj.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_histobjfind.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_histroot.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_ip2md.py4
-rw-r--r--src/ToolBox/SOS/tests/t_cmd_name2ee.py4
-rw-r--r--src/ToolBox/SOS/tests/test_libsosplugin.py4
-rw-r--r--src/ToolBox/SOS/tests/testutils.py4
-rw-r--r--src/binder/fusionhelpers.cpp3
-rw-r--r--src/classlibnative/bcltype/stringnative.cpp63
-rw-r--r--src/classlibnative/bcltype/stringnative.h3
-rw-r--r--src/classlibnative/bcltype/system.cpp2
-rw-r--r--src/classlibnative/inc/nlsinfo.h2
-rw-r--r--src/classlibnative/nls/nlsinfo.cpp109
-rw-r--r--src/coreclr/hosts/corerun/corerun.cpp2
-rw-r--r--src/debug/daccess/enummem.cpp19
-rw-r--r--src/debug/ee/debugger.cpp92
-rw-r--r--src/debug/ee/debugger.h4
-rw-r--r--src/debug/ee/i386/dbghelpers.S6
-rw-r--r--src/debug/shim/debugshim.cpp214
-rw-r--r--src/dlls/dbgshim/CMakeLists.txt1
-rw-r--r--src/dlls/mscoree/coreclr/CMakeLists.txt9
-rw-r--r--src/dlls/mscorrc/mscorrc.rc1
-rw-r--r--src/dlls/mscorrc/resource.h1
-rw-r--r--src/gc/env/gcenv.base.h12
-rw-r--r--src/gc/gcevent_serializers.h22
-rw-r--r--src/gc/gceventstatus.h5
-rw-r--r--src/gc/gcinterface.h3
-rw-r--r--src/gc/windows/gcenv.windows.cpp102
-rw-r--r--src/inc/UacAsInvoker.manifest11
-rw-r--r--src/inc/assemblyfilehash.h92
-rw-r--r--src/inc/clrconfig.h4
-rw-r--r--src/inc/clrconfigvalues.h6
-rw-r--r--src/inc/cordebug_mktlb.rc11
-rw-r--r--src/inc/corperm.h205
-rw-r--r--src/inc/corperme.h56
-rw-r--r--src/inc/corpermp.h57
-rw-r--r--src/inc/corpolicy.h89
-rw-r--r--src/inc/downlevel.h239
-rw-r--r--src/inc/eventtracebase.h2
-rw-r--r--src/inc/fixedsizestring.h188
-rw-r--r--src/inc/fxretarget.h340
-rw-r--r--src/inc/iilfingerprint.h128
-rw-r--r--src/inc/isolation.h2577
-rw-r--r--src/inc/isolationpriv.h18263
-rw-r--r--src/inc/marvin32.h85
-rw-r--r--src/inc/metahost.idl49
-rw-r--r--src/inc/mscoree_mktlb.rc12
-rw-r--r--src/inc/newapis.h354
-rw-r--r--src/inc/quirksapi.h37
-rw-r--r--src/inc/utilcode.h8
-rw-r--r--src/inc/winwrap.h8
-rw-r--r--src/jit/DIRS.proj4
-rw-r--r--src/jit/codegen.h2
-rw-r--r--src/jit/codegencommon.cpp64
-rw-r--r--src/jit/codegenlegacy.cpp2
-rw-r--r--src/jit/codegenlinear.cpp13
-rw-r--r--src/jit/codegenxarch.cpp42
-rw-r--r--src/jit/compiler.cpp27
-rw-r--r--src/jit/compiler.h19
-rw-r--r--src/jit/compiler.hpp30
-rw-r--r--src/jit/compphases.h2
-rw-r--r--src/jit/decomposelongs.cpp7
-rw-r--r--src/jit/emit.cpp6
-rw-r--r--src/jit/emitarm.cpp2
-rw-r--r--src/jit/emitfmtsxarch.h4
-rw-r--r--src/jit/emitxarch.cpp106
-rw-r--r--src/jit/emitxarch.h1
-rw-r--r--src/jit/flowgraph.cpp50
-rw-r--r--src/jit/gentree.cpp40
-rw-r--r--src/jit/gentree.h3
-rw-r--r--src/jit/hwintrinsiccodegenxarch.cpp75
-rw-r--r--src/jit/hwintrinsiclistxarch.h22
-rw-r--r--src/jit/hwintrinsicxarch.cpp177
-rw-r--r--src/jit/importer.cpp155
-rw-r--r--src/jit/instrsxarch.h15
-rw-r--r--src/jit/jitstd/vector.h3
-rw-r--r--src/jit/lclvars.cpp22
-rw-r--r--src/jit/lower.cpp6
-rw-r--r--src/jit/lowerarmarch.cpp45
-rw-r--r--src/jit/lowerxarch.cpp4
-rw-r--r--src/jit/lsra.cpp106
-rw-r--r--src/jit/lsra.h7
-rw-r--r--src/jit/lsraarm.cpp60
-rw-r--r--src/jit/lsraarm64.cpp11
-rw-r--r--src/jit/lsraarmarch.cpp53
-rw-r--r--src/jit/lsraxarch.cpp14
-rw-r--r--src/jit/morph.cpp61
-rw-r--r--src/jit/namedintrinsiclist.h5
-rw-r--r--src/jit/optimizer.cpp2
-rw-r--r--src/jit/simd.cpp2
-rw-r--r--src/jit/ssabuilder.cpp128
-rw-r--r--src/jit/ssabuilder.h13
-rw-r--r--src/jit/target.h8
-rw-r--r--src/md/compiler/regmeta.h1
-rw-r--r--src/mscorlib/Common/Preprocessed/AssemblyRefs.g.cs35
-rw-r--r--src/mscorlib/ILLinkTrim.xml16
-rw-r--r--src/mscorlib/System.Private.CoreLib.csproj17
-rw-r--r--src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs2
-rw-r--r--src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs5
-rw-r--r--src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs12
-rw-r--r--src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs11
-rw-r--r--src/mscorlib/shared/System.Private.CoreLib.Shared.projitems6
-rw-r--r--src/mscorlib/shared/System/Buffers/OwnedMemory.cs2
-rw-r--r--src/mscorlib/shared/System/Collections/Generic/Dictionary.cs468
-rw-r--r--src/mscorlib/shared/System/Collections/Generic/List.cs167
-rw-r--r--src/mscorlib/shared/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs8
-rw-r--r--src/mscorlib/shared/System/Collections/ListDictionaryInternal.cs8
-rw-r--r--src/mscorlib/shared/System/Convert.Base64.cs217
-rw-r--r--src/mscorlib/shared/System/Convert.cs334
-rw-r--r--src/mscorlib/shared/System/DateTime.cs18
-rw-r--r--src/mscorlib/shared/System/DateTimeOffset.cs10
-rw-r--r--src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs2
-rw-r--r--src/mscorlib/shared/System/Globalization/CompareInfo.Unix.cs (renamed from src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs)46
-rw-r--r--src/mscorlib/shared/System/Globalization/CompareInfo.Windows.cs (renamed from src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs)107
-rw-r--r--src/mscorlib/shared/System/Globalization/CompareInfo.cs50
-rw-r--r--src/mscorlib/shared/System/Globalization/DateTimeFormat.cs304
-rw-r--r--src/mscorlib/shared/System/IO/FileStream.cs24
-rw-r--r--src/mscorlib/shared/System/IO/MemoryStream.cs28
-rw-r--r--src/mscorlib/shared/System/IO/Path.Windows.cs11
-rw-r--r--src/mscorlib/shared/System/IO/PathHelper.Windows.cs2
-rw-r--r--src/mscorlib/shared/System/IO/PinnedBufferMemoryStream.cs4
-rw-r--r--src/mscorlib/shared/System/IO/StreamReader.cs12
-rw-r--r--src/mscorlib/shared/System/IO/StreamWriter.cs68
-rw-r--r--src/mscorlib/shared/System/IO/UnmanagedMemoryStream.cs44
-rw-r--r--src/mscorlib/shared/System/IO/UnmanagedMemoryStreamWrapper.cs16
-rw-r--r--src/mscorlib/shared/System/IO/Win32Marshal.cs32
-rw-r--r--src/mscorlib/shared/System/IntPtr.cs4
-rw-r--r--src/mscorlib/shared/System/Marvin.cs80
-rw-r--r--src/mscorlib/shared/System/Memory.cs46
-rw-r--r--src/mscorlib/shared/System/MemoryExtensions.Fast.cs90
-rw-r--r--src/mscorlib/shared/System/MemoryExtensions.cs137
-rw-r--r--src/mscorlib/shared/System/ReadOnlyMemory.cs40
-rw-r--r--src/mscorlib/shared/System/ReadOnlySpan.cs4
-rw-r--r--src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs68
-rw-r--r--src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.cs165
-rw-r--r--src/mscorlib/shared/System/Span.cs4
-rw-r--r--src/mscorlib/shared/System/SpanHelpers.Byte.cs362
-rw-r--r--src/mscorlib/shared/System/SpanHelpers.Char.cs209
-rw-r--r--src/mscorlib/shared/System/SpanHelpers.T.cs7
-rw-r--r--src/mscorlib/shared/System/String.Comparison.cs (renamed from src/mscorlib/src/System/String.Comparison.cs)331
-rw-r--r--src/mscorlib/shared/System/String.Manipulation.cs4
-rw-r--r--src/mscorlib/shared/System/String.Searching.cs116
-rw-r--r--src/mscorlib/shared/System/Text/StringBuilder.Debug.cs37
-rw-r--r--src/mscorlib/shared/System/Text/StringBuilder.cs39
-rw-r--r--src/mscorlib/shared/System/Text/ValueStringBuilder.cs4
-rw-r--r--src/mscorlib/shared/System/Threading/ExecutionContext.cs15
-rw-r--r--src/mscorlib/shared/System/UIntPtr.cs4
-rw-r--r--src/mscorlib/shared/System/UnitySerializationHolder.cs8
-rw-r--r--src/mscorlib/src/System/Collections/Generic/Comparer.cs9
-rw-r--r--src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs15
-rw-r--r--src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs8
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs2
-rw-r--r--src/mscorlib/src/System/IO/Stream.cs56
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs4
-rw-r--r--src/mscorlib/src/System/Resources/ResourceManager.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationToken.cs12
-rw-r--r--src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs21
-rw-r--r--src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.cs253
-rw-r--r--src/mscorlib/src/System/Text/CodePageDataItem.Unix.cs (renamed from src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs)2
-rw-r--r--src/mscorlib/src/System/Text/CodePageDataItem.cs (renamed from src/mscorlib/src/System/Globalization/EncodingDataItem.cs)2
-rw-r--r--src/mscorlib/src/System/Text/EncodingTable.Unix.cs (renamed from src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs)3
-rw-r--r--src/mscorlib/src/System/Text/EncodingTable.cs (renamed from src/mscorlib/src/System/Globalization/EncodingTable.cs)12
-rw-r--r--src/mscorlib/src/System/Threading/CancellationToken.cs8
-rw-r--r--src/mscorlib/src/System/Threading/CancellationTokenRegistration.cs10
-rw-r--r--src/mscorlib/src/System/Threading/CancellationTokenSource.cs2
-rw-r--r--src/mscorlib/src/System/Threading/ManualResetEventSlim.cs4
-rw-r--r--src/mscorlib/src/System/Threading/Overlapped.cs2
-rw-r--r--src/mscorlib/src/System/Threading/SemaphoreSlim.cs2
-rw-r--r--src/mscorlib/src/System/Threading/SpinLock.cs18
-rw-r--r--src/mscorlib/src/System/Threading/SynchronizationContext.cs2
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/Task.cs8
-rw-r--r--src/mscorlib/src/System/Threading/Thread.cs12
-rw-r--r--src/mscorlib/src/System/Threading/ThreadPool.cs6
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandle.cs6
-rw-r--r--src/mscorlib/src/mscorlib.Friends.cs10
-rw-r--r--src/pal/inc/pal.h823
-rw-r--r--src/pal/inc/palprivate.h16
-rw-r--r--src/pal/inc/rt/oleauto.h27
-rw-r--r--src/pal/prebuilt/inc/metahost.h118
-rw-r--r--src/pal/src/CMakeLists.txt98
-rw-r--r--src/pal/src/config.h.in3
-rw-r--r--src/pal/src/configure.cmake77
-rw-r--r--src/pal/src/exception/remote-unwind.cpp10
-rw-r--r--src/pal/src/exception/seh-unwind.cpp15
-rw-r--r--src/pal/src/include/pal/locale.h4
-rw-r--r--src/pal/src/include/pal/sharedmemory.h3
-rw-r--r--src/pal/src/libunwind/.gitignore79
-rw-r--r--src/pal/src/libunwind/.travis.yml18
-rw-r--r--src/pal/src/libunwind/AUTHORS1
-rw-r--r--src/pal/src/libunwind/CMakeLists.txt22
-rw-r--r--src/pal/src/libunwind/COPYING20
-rw-r--r--src/pal/src/libunwind/ChangeLog55
-rw-r--r--src/pal/src/libunwind/LICENSE18
-rw-r--r--src/pal/src/libunwind/Makefile.am106
-rw-r--r--src/pal/src/libunwind/NEWS247
-rw-r--r--src/pal/src/libunwind/README207
l---------src/pal/src/libunwind/README.md1
-rw-r--r--src/pal/src/libunwind/TODO97
-rw-r--r--src/pal/src/libunwind/acinclude.m432
-rwxr-xr-xsrc/pal/src/libunwind/autogen.sh9
-rw-r--r--src/pal/src/libunwind/aux_/config.guess1321
-rw-r--r--src/pal/src/libunwind/aux_/config.sub1443
-rw-r--r--src/pal/src/libunwind/aux_/ltmain.sh5107
-rw-r--r--src/pal/src/libunwind/configure.ac445
-rw-r--r--src/pal/src/libunwind/doc/Makefile.am80
-rw-r--r--src/pal/src/libunwind/doc/NOTES127
-rw-r--r--src/pal/src/libunwind/doc/_U_dyn_cancel.man66
-rw-r--r--src/pal/src/libunwind/doc/_U_dyn_cancel.tex46
-rw-r--r--src/pal/src/libunwind/doc/_U_dyn_register.man68
-rw-r--r--src/pal/src/libunwind/doc/_U_dyn_register.tex47
-rw-r--r--src/pal/src/libunwind/doc/common.tex.in11
-rw-r--r--src/pal/src/libunwind/doc/libunwind-dynamic.man538
-rw-r--r--src/pal/src/libunwind/doc/libunwind-dynamic.tex401
-rw-r--r--src/pal/src/libunwind/doc/libunwind-ia64.man314
-rw-r--r--src/pal/src/libunwind/doc/libunwind-ia64.tex216
-rw-r--r--src/pal/src/libunwind/doc/libunwind-ptrace.man220
-rw-r--r--src/pal/src/libunwind/doc/libunwind-ptrace.tex134
-rw-r--r--src/pal/src/libunwind/doc/libunwind-setjmp.man132
-rw-r--r--src/pal/src/libunwind/doc/libunwind-setjmp.tex87
-rw-r--r--src/pal/src/libunwind/doc/libunwind.man508
-rw-r--r--src/pal/src/libunwind/doc/libunwind.tex359
-rw-r--r--src/pal/src/libunwind/doc/libunwind.trans34
-rw-r--r--src/pal/src/libunwind/doc/unw_apply_reg_state.man90
-rw-r--r--src/pal/src/libunwind/doc/unw_apply_reg_state.tex63
-rw-r--r--src/pal/src/libunwind/doc/unw_backtrace.man86
-rw-r--r--src/pal/src/libunwind/doc/unw_backtrace.tex54
-rw-r--r--src/pal/src/libunwind/doc/unw_create_addr_space.man457
-rw-r--r--src/pal/src/libunwind/doc/unw_create_addr_space.tex265
-rw-r--r--src/pal/src/libunwind/doc/unw_destroy_addr_space.man57
-rw-r--r--src/pal/src/libunwind/doc/unw_destroy_addr_space.tex40
-rw-r--r--src/pal/src/libunwind/doc/unw_flush_cache.man93
-rw-r--r--src/pal/src/libunwind/doc/unw_flush_cache.tex58
-rw-r--r--src/pal/src/libunwind/doc/unw_get_accessors.man79
-rw-r--r--src/pal/src/libunwind/doc/unw_get_accessors.tex55
-rw-r--r--src/pal/src/libunwind/doc/unw_get_fpreg.man111
-rw-r--r--src/pal/src/libunwind/doc/unw_get_fpreg.tex77
-rw-r--r--src/pal/src/libunwind/doc/unw_get_proc_info.man203
-rw-r--r--src/pal/src/libunwind/doc/unw_get_proc_info.tex123
-rw-r--r--src/pal/src/libunwind/doc/unw_get_proc_info_by_ip.man134
-rw-r--r--src/pal/src/libunwind/doc/unw_get_proc_info_by_ip.tex91
-rw-r--r--src/pal/src/libunwind/doc/unw_get_proc_name.man123
-rw-r--r--src/pal/src/libunwind/doc/unw_get_proc_name.tex82
-rw-r--r--src/pal/src/libunwind/doc/unw_get_reg.man112
-rw-r--r--src/pal/src/libunwind/doc/unw_get_reg.tex77
-rw-r--r--src/pal/src/libunwind/doc/unw_getcontext.man93
-rw-r--r--src/pal/src/libunwind/doc/unw_getcontext.tex63
-rw-r--r--src/pal/src/libunwind/doc/unw_init_local.man124
-rw-r--r--src/pal/src/libunwind/doc/unw_init_local.tex80
-rw-r--r--src/pal/src/libunwind/doc/unw_init_local2.man1
-rw-r--r--src/pal/src/libunwind/doc/unw_init_remote.man123
-rw-r--r--src/pal/src/libunwind/doc/unw_init_remote.tex79
-rw-r--r--src/pal/src/libunwind/doc/unw_is_fpreg.man73
-rw-r--r--src/pal/src/libunwind/doc/unw_is_fpreg.tex52
-rw-r--r--src/pal/src/libunwind/doc/unw_is_signal_frame.man88
-rw-r--r--src/pal/src/libunwind/doc/unw_is_signal_frame.tex67
-rw-r--r--src/pal/src/libunwind/doc/unw_reg_states_iterate.man137
-rw-r--r--src/pal/src/libunwind/doc/unw_reg_states_iterate.tex83
-rw-r--r--src/pal/src/libunwind/doc/unw_regname.man68
-rw-r--r--src/pal/src/libunwind/doc/unw_regname.tex47
-rw-r--r--src/pal/src/libunwind/doc/unw_resume.man146
-rw-r--r--src/pal/src/libunwind/doc/unw_resume.tex99
-rw-r--r--src/pal/src/libunwind/doc/unw_set_cache_size.man88
-rw-r--r--src/pal/src/libunwind/doc/unw_set_cache_size.tex59
-rw-r--r--src/pal/src/libunwind/doc/unw_set_caching_policy.man119
-rw-r--r--src/pal/src/libunwind/doc/unw_set_caching_policy.tex81
-rw-r--r--src/pal/src/libunwind/doc/unw_set_fpreg.man117
-rw-r--r--src/pal/src/libunwind/doc/unw_set_fpreg.tex79
-rw-r--r--src/pal/src/libunwind/doc/unw_set_reg.man117
-rw-r--r--src/pal/src/libunwind/doc/unw_set_reg.tex79
-rw-r--r--src/pal/src/libunwind/doc/unw_step.man106
-rw-r--r--src/pal/src/libunwind/doc/unw_step.tex68
-rw-r--r--src/pal/src/libunwind/doc/unw_strerror.man63
-rw-r--r--src/pal/src/libunwind/doc/unw_strerror.tex42
-rw-r--r--src/pal/src/libunwind/include/compiler.h72
-rw-r--r--src/pal/src/libunwind/include/dwarf-eh.h128
-rw-r--r--src/pal/src/libunwind/include/dwarf.h450
-rw-r--r--src/pal/src/libunwind/include/dwarf_i.h490
-rw-r--r--src/pal/src/libunwind/include/libunwind-aarch64.h210
-rw-r--r--src/pal/src/libunwind/include/libunwind-arm.h303
-rw-r--r--src/pal/src/libunwind/include/libunwind-common.h.in281
-rw-r--r--src/pal/src/libunwind/include/libunwind-coredump.h73
-rw-r--r--src/pal/src/libunwind/include/libunwind-dynamic.h214
-rw-r--r--src/pal/src/libunwind/include/libunwind-hppa.h125
-rw-r--r--src/pal/src/libunwind/include/libunwind-ia64.h194
-rw-r--r--src/pal/src/libunwind/include/libunwind-mips.h160
-rw-r--r--src/pal/src/libunwind/include/libunwind-ppc32.h207
-rw-r--r--src/pal/src/libunwind/include/libunwind-ppc64.h271
-rw-r--r--src/pal/src/libunwind/include/libunwind-ptrace.h63
-rw-r--r--src/pal/src/libunwind/include/libunwind-sh.h114
-rw-r--r--src/pal/src/libunwind/include/libunwind-tilegx.h161
-rw-r--r--src/pal/src/libunwind/include/libunwind-x86.h187
-rw-r--r--src/pal/src/libunwind/include/libunwind-x86_64.h141
-rw-r--r--src/pal/src/libunwind/include/libunwind.h.in36
-rw-r--r--src/pal/src/libunwind/include/libunwind_i.h366
-rw-r--r--src/pal/src/libunwind/include/mempool.h89
-rw-r--r--src/pal/src/libunwind/include/remote.h129
-rw-r--r--src/pal/src/libunwind/include/tdep-aarch64/dwarf-config.h52
-rw-r--r--src/pal/src/libunwind/include/tdep-aarch64/jmpbuf.h33
-rw-r--r--src/pal/src/libunwind/include/tdep-aarch64/libunwind_i.h320
-rw-r--r--src/pal/src/libunwind/include/tdep-arm/dwarf-config.h51
-rw-r--r--src/pal/src/libunwind/include/tdep-arm/ex_tables.h55
-rw-r--r--src/pal/src/libunwind/include/tdep-arm/jmpbuf.h32
-rw-r--r--src/pal/src/libunwind/include/tdep-arm/libunwind_i.h326
-rw-r--r--src/pal/src/libunwind/include/tdep-hppa/dwarf-config.h54
-rw-r--r--src/pal/src/libunwind/include/tdep-hppa/jmpbuf.h33
-rw-r--r--src/pal/src/libunwind/include/tdep-hppa/libunwind_i.h279
-rw-r--r--src/pal/src/libunwind/include/tdep-ia64/jmpbuf.h32
-rw-r--r--src/pal/src/libunwind/include/tdep-ia64/libunwind_i.h281
-rw-r--r--src/pal/src/libunwind/include/tdep-ia64/rse.h67
-rw-r--r--src/pal/src/libunwind/include/tdep-ia64/script.h85
-rw-r--r--src/pal/src/libunwind/include/tdep-mips/dwarf-config.h54
-rw-r--r--src/pal/src/libunwind/include/tdep-mips/jmpbuf.h32
-rw-r--r--src/pal/src/libunwind/include/tdep-mips/libunwind_i.h331
-rw-r--r--src/pal/src/libunwind/include/tdep-ppc32/dwarf-config.h56
-rw-r--r--src/pal/src/libunwind/include/tdep-ppc32/jmpbuf.h37
-rw-r--r--src/pal/src/libunwind/include/tdep-ppc32/libunwind_i.h314
-rw-r--r--src/pal/src/libunwind/include/tdep-ppc64/dwarf-config.h56
-rw-r--r--src/pal/src/libunwind/include/tdep-ppc64/jmpbuf.h37
-rw-r--r--src/pal/src/libunwind/include/tdep-ppc64/libunwind_i.h369
-rw-r--r--src/pal/src/libunwind/include/tdep-sh/dwarf-config.h49
-rw-r--r--src/pal/src/libunwind/include/tdep-sh/jmpbuf.h48
-rw-r--r--src/pal/src/libunwind/include/tdep-sh/libunwind_i.h280
-rw-r--r--src/pal/src/libunwind/include/tdep-tilegx/dwarf-config.h50
-rw-r--r--src/pal/src/libunwind/include/tdep-tilegx/jmpbuf.h33
-rw-r--r--src/pal/src/libunwind/include/tdep-tilegx/libunwind_i.h263
-rw-r--r--src/pal/src/libunwind/include/tdep-x86/dwarf-config.h52
-rw-r--r--src/pal/src/libunwind/include/tdep-x86/jmpbuf.h42
-rw-r--r--src/pal/src/libunwind/include/tdep-x86/libunwind_i.h293
-rw-r--r--src/pal/src/libunwind/include/tdep-x86_64/dwarf-config.h57
-rw-r--r--src/pal/src/libunwind/include/tdep-x86_64/jmpbuf.h43
-rw-r--r--src/pal/src/libunwind/include/tdep-x86_64/libunwind_i.h264
-rw-r--r--src/pal/src/libunwind/include/tdep/dwarf-config.h28
-rw-r--r--src/pal/src/libunwind/include/tdep/jmpbuf.h30
-rw-r--r--src/pal/src/libunwind/include/tdep/libunwind_i.h.in37
-rw-r--r--src/pal/src/libunwind/include/unwind.h154
-rw-r--r--src/pal/src/libunwind/include/x86/jmpbuf.h31
-rwxr-xr-xsrc/pal/src/libunwind/scripts/kernel-diff.sh10
-rw-r--r--src/pal/src/libunwind/scripts/kernel-files.txt19
-rwxr-xr-xsrc/pal/src/libunwind/scripts/make-L-files30
-rw-r--r--src/pal/src/libunwind/src/CMakeLists.txt337
-rw-r--r--src/pal/src/libunwind/src/Makefile.am750
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gcreate_addr_space.c60
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gget_proc_info.c39
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gget_save_loc.c100
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gglobal.c57
-rw-r--r--src/pal/src/libunwind/src/aarch64/Ginit.c190
-rw-r--r--src/pal/src/libunwind/src/aarch64/Ginit_local.c78
-rw-r--r--src/pal/src/libunwind/src/aarch64/Ginit_remote.c45
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gis_signal_frame.c64
-rw-r--r--src/pal/src/libunwind/src/aarch64/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gregs.c118
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gresume.c198
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gstash_frame.c89
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gstep.c189
-rw-r--r--src/pal/src/libunwind/src/aarch64/Gtrace.c548
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lis_signal_frame.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lstash_frame.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/Ltrace.c5
-rw-r--r--src/pal/src/libunwind/src/aarch64/gen-offsets.c68
-rw-r--r--src/pal/src/libunwind/src/aarch64/getcontext.S52
-rw-r--r--src/pal/src/libunwind/src/aarch64/init.h126
-rw-r--r--src/pal/src/libunwind/src/aarch64/is_fpreg.c32
-rw-r--r--src/pal/src/libunwind/src/aarch64/offsets.h49
-rw-r--r--src/pal/src/libunwind/src/aarch64/regname.c106
-rw-r--r--src/pal/src/libunwind/src/aarch64/siglongjmp.S12
-rw-r--r--src/pal/src/libunwind/src/aarch64/unwind_i.h64
-rw-r--r--src/pal/src/libunwind/src/arm/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/arm/Gcreate_addr_space.c60
-rw-r--r--src/pal/src/libunwind/src/arm/Gex_tables.c549
-rw-r--r--src/pal/src/libunwind/src/arm/Gget_proc_info.c41
-rw-r--r--src/pal/src/libunwind/src/arm/Gget_save_loc.c81
-rw-r--r--src/pal/src/libunwind/src/arm/Gglobal.c65
-rw-r--r--src/pal/src/libunwind/src/arm/Ginit.c235
-rw-r--r--src/pal/src/libunwind/src/arm/Ginit_local.c78
-rw-r--r--src/pal/src/libunwind/src/arm/Ginit_remote.c45
-rw-r--r--src/pal/src/libunwind/src/arm/Gos-freebsd.c129
-rw-r--r--src/pal/src/libunwind/src/arm/Gos-linux.c182
-rw-r--r--src/pal/src/libunwind/src/arm/Gos-other.c48
-rw-r--r--src/pal/src/libunwind/src/arm/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/arm/Gregs.c83
-rw-r--r--src/pal/src/libunwind/src/arm/Gresume.c154
-rw-r--r--src/pal/src/libunwind/src/arm/Gstash_frame.c90
-rw-r--r--src/pal/src/libunwind/src/arm/Gstep.c192
-rw-r--r--src/pal/src/libunwind/src/arm/Gtrace.c557
-rw-r--r--src/pal/src/libunwind/src/arm/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lex_tables.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lis_signal_frame.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Los-freebsd.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Los-linux.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Los-other.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lstash_frame.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/arm/Ltrace.c6
-rw-r--r--src/pal/src/libunwind/src/arm/gen-offsets.c54
-rw-r--r--src/pal/src/libunwind/src/arm/getcontext.S63
-rw-r--r--src/pal/src/libunwind/src/arm/init.h77
-rw-r--r--src/pal/src/libunwind/src/arm/is_fpreg.c39
-rw-r--r--src/pal/src/libunwind/src/arm/offsets.h42
-rw-r--r--src/pal/src/libunwind/src/arm/regname.c90
-rw-r--r--src/pal/src/libunwind/src/arm/siglongjmp.S12
-rw-r--r--src/pal/src/libunwind/src/arm/unwind_i.h62
-rw-r--r--src/pal/src/libunwind/src/config.h.in16
-rw-r--r--src/pal/src/libunwind/src/configure.cmake31
-rw-r--r--src/pal/src/libunwind/src/coredump/README8
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_access_mem.c98
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_access_reg_freebsd.c137
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_access_reg_linux.c146
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_accessors.c36
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_create.c417
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_destroy.c52
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_elf_map_image.c98
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_find_proc_info.c163
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_get_proc_name.c70
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_internal.h105
-rw-r--r--src/pal/src/libunwind/src/coredump/_UCD_lib.h57
-rw-r--r--src/pal/src/libunwind/src/coredump/_UPT_access_fpreg.c34
-rw-r--r--src/pal/src/libunwind/src/coredump/_UPT_elf.c5
-rw-r--r--src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c108
-rw-r--r--src/pal/src/libunwind/src/coredump/_UPT_put_unwind_info.c36
-rw-r--r--src/pal/src/libunwind/src/coredump/_UPT_resume.c35
-rw-r--r--src/pal/src/libunwind/src/coredump/libunwind-coredump.pc.in11
-rw-r--r--src/pal/src/libunwind/src/dwarf/Gexpr.c696
-rw-r--r--src/pal/src/libunwind/src/dwarf/Gfde.c359
-rw-r--r--src/pal/src/libunwind/src/dwarf/Gfind_proc_info-lsb.c935
-rw-r--r--src/pal/src/libunwind/src/dwarf/Gfind_unwind_table.c230
-rw-r--r--src/pal/src/libunwind/src/dwarf/Gparser.c1059
-rw-r--r--src/pal/src/libunwind/src/dwarf/Gpe.c39
-rw-r--r--src/pal/src/libunwind/src/dwarf/Lexpr.c5
-rw-r--r--src/pal/src/libunwind/src/dwarf/Lfde.c5
-rw-r--r--src/pal/src/libunwind/src/dwarf/Lfind_proc_info-lsb.c5
-rw-r--r--src/pal/src/libunwind/src/dwarf/Lfind_unwind_table.c5
-rw-r--r--src/pal/src/libunwind/src/dwarf/Lparser.c5
-rw-r--r--src/pal/src/libunwind/src/dwarf/Lpe.c5
-rw-r--r--src/pal/src/libunwind/src/dwarf/global.c37
-rw-r--r--src/pal/src/libunwind/src/elf32.c4
-rw-r--r--src/pal/src/libunwind/src/elf32.h9
-rw-r--r--src/pal/src/libunwind/src/elf64.c4
-rw-r--r--src/pal/src/libunwind/src/elf64.h9
-rw-r--r--src/pal/src/libunwind/src/elfxx.c481
-rw-r--r--src/pal/src/libunwind/src/elfxx.h101
-rw-r--r--src/pal/src/libunwind/src/hppa/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/hppa/Gcreate_addr_space.c54
-rw-r--r--src/pal/src/libunwind/src/hppa/Gget_proc_info.c46
-rw-r--r--src/pal/src/libunwind/src/hppa/Gget_save_loc.c59
-rw-r--r--src/pal/src/libunwind/src/hppa/Gglobal.c55
-rw-r--r--src/pal/src/libunwind/src/hppa/Ginit.c194
-rw-r--r--src/pal/src/libunwind/src/hppa/Ginit_local.c77
-rw-r--r--src/pal/src/libunwind/src/hppa/Ginit_remote.c46
-rw-r--r--src/pal/src/libunwind/src/hppa/Gis_signal_frame.c74
-rw-r--r--src/pal/src/libunwind/src/hppa/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/hppa/Gregs.c87
-rw-r--r--src/pal/src/libunwind/src/hppa/Gresume.c145
-rw-r--r--src/pal/src/libunwind/src/hppa/Gstep.c95
-rw-r--r--src/pal/src/libunwind/src/hppa/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lis_signal_frame.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/hppa/get_accessors.c38
-rw-r--r--src/pal/src/libunwind/src/hppa/getcontext.S74
-rw-r--r--src/pal/src/libunwind/src/hppa/init.h47
-rw-r--r--src/pal/src/libunwind/src/hppa/offsets.h17
-rw-r--r--src/pal/src/libunwind/src/hppa/regname.c50
-rw-r--r--src/pal/src/libunwind/src/hppa/setcontext.S77
-rw-r--r--src/pal/src/libunwind/src/hppa/siglongjmp.S16
-rw-r--r--src/pal/src/libunwind/src/hppa/tables.c43
-rw-r--r--src/pal/src/libunwind/src/hppa/unwind_i.h47
-rw-r--r--src/pal/src/libunwind/src/ia64/Gapply_reg_state.c39
-rw-r--r--src/pal/src/libunwind/src/ia64/Gcreate_addr_space.c63
-rw-r--r--src/pal/src/libunwind/src/ia64/Gfind_unwind_table.c143
-rw-r--r--src/pal/src/libunwind/src/ia64/Gget_proc_info.c38
-rw-r--r--src/pal/src/libunwind/src/ia64/Gget_save_loc.c168
-rw-r--r--src/pal/src/libunwind/src/ia64/Gglobal.c122
-rw-r--r--src/pal/src/libunwind/src/ia64/Ginit.c505
-rw-r--r--src/pal/src/libunwind/src/ia64/Ginit_local.c110
-rw-r--r--src/pal/src/libunwind/src/ia64/Ginit_remote.c61
-rw-r--r--src/pal/src/libunwind/src/ia64/Ginstall_cursor.S348
-rw-r--r--src/pal/src/libunwind/src/ia64/Gis_signal_frame.c54
-rw-r--r--src/pal/src/libunwind/src/ia64/Gparser.c1131
-rw-r--r--src/pal/src/libunwind/src/ia64/Grbs.c319
-rw-r--r--src/pal/src/libunwind/src/ia64/Greg_states_iterate.c39
-rw-r--r--src/pal/src/libunwind/src/ia64/Gregs.c612
-rw-r--r--src/pal/src/libunwind/src/ia64/Gresume.c274
-rw-r--r--src/pal/src/libunwind/src/ia64/Gscript.c765
-rw-r--r--src/pal/src/libunwind/src/ia64/Gstep.c359
-rw-r--r--src/pal/src/libunwind/src/ia64/Gtables.c731
-rw-r--r--src/pal/src/libunwind/src/ia64/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lfind_unwind_table.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Linstall_cursor.S6
-rw-r--r--src/pal/src/libunwind/src/ia64/Lis_signal_frame.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lparser.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lrbs.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lscript.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/Ltables.c5
-rw-r--r--src/pal/src/libunwind/src/ia64/NOTES65
-rw-r--r--src/pal/src/libunwind/src/ia64/dyn_info_list.S26
-rw-r--r--src/pal/src/libunwind/src/ia64/getcontext.S177
-rw-r--r--src/pal/src/libunwind/src/ia64/init.h132
-rw-r--r--src/pal/src/libunwind/src/ia64/longjmp.S42
-rwxr-xr-xsrc/pal/src/libunwind/src/ia64/mk_cursor_i7
-rw-r--r--src/pal/src/libunwind/src/ia64/offsets.h137
-rw-r--r--src/pal/src/libunwind/src/ia64/regname.c189
-rw-r--r--src/pal/src/libunwind/src/ia64/regs.h73
-rw-r--r--src/pal/src/libunwind/src/ia64/setjmp.S51
-rw-r--r--src/pal/src/libunwind/src/ia64/siglongjmp.S69
-rw-r--r--src/pal/src/libunwind/src/ia64/sigsetjmp.S69
-rw-r--r--src/pal/src/libunwind/src/ia64/ucontext_i.h68
-rw-r--r--src/pal/src/libunwind/src/ia64/unwind_decoder.h477
-rw-r--r--src/pal/src/libunwind/src/ia64/unwind_i.h633
-rw-r--r--src/pal/src/libunwind/src/libunwind-generic.pc.in11
-rw-r--r--src/pal/src/libunwind/src/mi/Gdestroy_addr_space.c37
-rw-r--r--src/pal/src/libunwind/src/mi/Gdyn-extract.c64
-rw-r--r--src/pal/src/libunwind/src/mi/Gdyn-remote.c326
-rw-r--r--src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c91
-rw-r--r--src/pal/src/libunwind/src/mi/Gget_accessors.c37
-rw-r--r--src/pal/src/libunwind/src/mi/Gget_fpreg.c34
-rw-r--r--src/pal/src/libunwind/src/mi/Gget_proc_info_by_ip.c39
-rw-r--r--src/pal/src/libunwind/src/mi/Gget_proc_name.c118
-rw-r--r--src/pal/src/libunwind/src/mi/Gget_reg.c41
-rw-r--r--src/pal/src/libunwind/src/mi/Gput_dynamic_unwind_info.c55
-rw-r--r--src/pal/src/libunwind/src/mi/Gset_cache_size.c72
-rw-r--r--src/pal/src/libunwind/src/mi/Gset_caching_policy.c46
-rw-r--r--src/pal/src/libunwind/src/mi/Gset_fpreg.c34
-rw-r--r--src/pal/src/libunwind/src/mi/Gset_reg.c34
-rw-r--r--src/pal/src/libunwind/src/mi/Ldestroy_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Ldyn-extract.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Ldyn-remote.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lfind_dynamic_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lget_accessors.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lget_fpreg.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lget_proc_info_by_ip.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lget_proc_name.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lget_reg.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lput_dynamic_unwind_info.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lset_cache_size.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lset_caching_policy.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lset_fpreg.c5
-rw-r--r--src/pal/src/libunwind/src/mi/Lset_reg.c5
-rw-r--r--src/pal/src/libunwind/src/mi/_ReadSLEB.c25
-rw-r--r--src/pal/src/libunwind/src/mi/_ReadULEB.c20
-rw-r--r--src/pal/src/libunwind/src/mi/backtrace.c81
-rw-r--r--src/pal/src/libunwind/src/mi/dyn-cancel.c46
-rw-r--r--src/pal/src/libunwind/src/mi/dyn-info-list.c34
-rw-r--r--src/pal/src/libunwind/src/mi/dyn-register.c44
-rw-r--r--src/pal/src/libunwind/src/mi/flush_cache.c59
-rw-r--r--src/pal/src/libunwind/src/mi/init.c60
-rw-r--r--src/pal/src/libunwind/src/mi/mempool.c184
-rw-r--r--src/pal/src/libunwind/src/mi/strerror.c51
-rw-r--r--src/pal/src/libunwind/src/mips/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/mips/Gcreate_addr_space.c66
-rw-r--r--src/pal/src/libunwind/src/mips/Gget_proc_info.c41
-rw-r--r--src/pal/src/libunwind/src/mips/Gget_save_loc.c100
-rw-r--r--src/pal/src/libunwind/src/mips/Gglobal.c55
-rw-r--r--src/pal/src/libunwind/src/mips/Ginit.c210
-rw-r--r--src/pal/src/libunwind/src/mips/Ginit_local.c76
-rw-r--r--src/pal/src/libunwind/src/mips/Ginit_remote.c45
-rw-r--r--src/pal/src/libunwind/src/mips/Gis_signal_frame.c78
-rw-r--r--src/pal/src/libunwind/src/mips/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/mips/Gregs.c105
-rw-r--r--src/pal/src/libunwind/src/mips/Gresume.c45
-rw-r--r--src/pal/src/libunwind/src/mips/Gstep.c132
-rw-r--r--src/pal/src/libunwind/src/mips/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lis_signal_frame.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/mips/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/mips/elfxx.c27
-rw-r--r--src/pal/src/libunwind/src/mips/gen-offsets.c30
-rw-r--r--src/pal/src/libunwind/src/mips/getcontext.S93
-rw-r--r--src/pal/src/libunwind/src/mips/init.h59
-rw-r--r--src/pal/src/libunwind/src/mips/is_fpreg.c35
-rw-r--r--src/pal/src/libunwind/src/mips/offsets.h86
-rw-r--r--src/pal/src/libunwind/src/mips/regname.c48
-rw-r--r--src/pal/src/libunwind/src/mips/siglongjmp.S8
-rw-r--r--src/pal/src/libunwind/src/mips/unwind_i.h43
-rw-r--r--src/pal/src/libunwind/src/os-freebsd.c166
-rw-r--r--src/pal/src/libunwind/src/os-hpux.c78
-rw-r--r--src/pal/src/libunwind/src/os-linux.c73
-rw-r--r--src/pal/src/libunwind/src/os-linux.h297
-rw-r--r--src/pal/src/libunwind/src/os-qnx.c117
-rw-r--r--src/pal/src/libunwind/src/ppc/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/ppc/Gget_proc_info.c41
-rw-r--r--src/pal/src/libunwind/src/ppc/Gget_save_loc.c34
-rw-r--r--src/pal/src/libunwind/src/ppc/Ginit_local.c88
-rw-r--r--src/pal/src/libunwind/src/ppc/Ginit_remote.c60
-rw-r--r--src/pal/src/libunwind/src/ppc/Gis_signal_frame.c78
-rw-r--r--src/pal/src/libunwind/src/ppc/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/ppc/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/ppc/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/ppc/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/ppc/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/ppc/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/ppc/Lis_signal_frame.c5
-rw-r--r--src/pal/src/libunwind/src/ppc/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/ppc/longjmp.S36
-rw-r--r--src/pal/src/libunwind/src/ppc/siglongjmp.S31
-rw-r--r--src/pal/src/libunwind/src/ppc32/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/ppc32/Gcreate_addr_space.c56
-rw-r--r--src/pal/src/libunwind/src/ppc32/Gglobal.c135
-rw-r--r--src/pal/src/libunwind/src/ppc32/Ginit.c216
-rw-r--r--src/pal/src/libunwind/src/ppc32/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/ppc32/Gregs.c90
-rw-r--r--src/pal/src/libunwind/src/ppc32/Gresume.c77
-rw-r--r--src/pal/src/libunwind/src/ppc32/Gstep.c309
-rw-r--r--src/pal/src/libunwind/src/ppc32/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/ppc32/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/ppc32/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/ppc32/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/ppc32/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/ppc32/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/ppc32/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/ppc32/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/ppc32/Make-arch.in11
-rw-r--r--src/pal/src/libunwind/src/ppc32/get_func_addr.c36
-rw-r--r--src/pal/src/libunwind/src/ppc32/init.h72
-rw-r--r--src/pal/src/libunwind/src/ppc32/is_fpreg.c34
-rw-r--r--src/pal/src/libunwind/src/ppc32/regname.c112
-rw-r--r--src/pal/src/libunwind/src/ppc32/setcontext.S9
-rw-r--r--src/pal/src/libunwind/src/ppc32/ucontext_i.h128
-rw-r--r--src/pal/src/libunwind/src/ppc32/unwind_i.h46
-rw-r--r--src/pal/src/libunwind/src/ppc64/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/ppc64/Gcreate_addr_space.c71
-rw-r--r--src/pal/src/libunwind/src/ppc64/Gglobal.c182
-rw-r--r--src/pal/src/libunwind/src/ppc64/Ginit.c229
-rw-r--r--src/pal/src/libunwind/src/ppc64/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/ppc64/Gregs.c141
-rw-r--r--src/pal/src/libunwind/src/ppc64/Gresume.c111
-rw-r--r--src/pal/src/libunwind/src/ppc64/Gstep.c466
-rw-r--r--src/pal/src/libunwind/src/ppc64/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/ppc64/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/ppc64/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/ppc64/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/ppc64/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/ppc64/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/ppc64/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/ppc64/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/ppc64/get_func_addr.c51
-rw-r--r--src/pal/src/libunwind/src/ppc64/init.h82
-rw-r--r--src/pal/src/libunwind/src/ppc64/is_fpreg.c34
-rw-r--r--src/pal/src/libunwind/src/ppc64/regname.c164
-rw-r--r--src/pal/src/libunwind/src/ppc64/setcontext.S9
-rw-r--r--src/pal/src/libunwind/src/ppc64/ucontext_i.h173
-rw-r--r--src/pal/src/libunwind/src/ppc64/unwind_i.h52
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_access_fpreg.c121
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_access_mem.c123
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_access_reg.c352
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_accessors.c38
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_create.c46
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_destroy.c34
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_elf.c5
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_find_proc_info.c145
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c105
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_get_proc_name.c42
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_internal.h59
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_put_unwind_info.c35
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_reg_offset.c638
-rw-r--r--src/pal/src/libunwind/src/ptrace/_UPT_resume.c40
-rw-r--r--src/pal/src/libunwind/src/ptrace/libunwind-ptrace.pc.in11
-rw-r--r--src/pal/src/libunwind/src/setjmp/libunwind-setjmp.pc.in11
-rw-r--r--src/pal/src/libunwind/src/setjmp/longjmp.c115
-rw-r--r--src/pal/src/libunwind/src/setjmp/setjmp.c49
-rw-r--r--src/pal/src/libunwind/src/setjmp/setjmp_i.h118
-rw-r--r--src/pal/src/libunwind/src/setjmp/siglongjmp.c127
-rw-r--r--src/pal/src/libunwind/src/setjmp/sigsetjmp.c50
-rw-r--r--src/pal/src/libunwind/src/sh/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/sh/Gcreate_addr_space.c59
-rw-r--r--src/pal/src/libunwind/src/sh/Gget_proc_info.c39
-rw-r--r--src/pal/src/libunwind/src/sh/Gget_save_loc.c83
-rw-r--r--src/pal/src/libunwind/src/sh/Gglobal.c56
-rw-r--r--src/pal/src/libunwind/src/sh/Ginit.c186
-rw-r--r--src/pal/src/libunwind/src/sh/Ginit_local.c78
-rw-r--r--src/pal/src/libunwind/src/sh/Ginit_remote.c45
-rw-r--r--src/pal/src/libunwind/src/sh/Gis_signal_frame.c119
-rw-r--r--src/pal/src/libunwind/src/sh/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/sh/Gregs.c81
-rw-r--r--src/pal/src/libunwind/src/sh/Gresume.c165
-rw-r--r--src/pal/src/libunwind/src/sh/Gstep.c117
-rw-r--r--src/pal/src/libunwind/src/sh/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lis_signal_frame.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/sh/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/sh/gen-offsets.c51
-rw-r--r--src/pal/src/libunwind/src/sh/init.h73
-rw-r--r--src/pal/src/libunwind/src/sh/is_fpreg.c32
-rw-r--r--src/pal/src/libunwind/src/sh/offsets.h32
-rw-r--r--src/pal/src/libunwind/src/sh/regname.c56
-rw-r--r--src/pal/src/libunwind/src/sh/siglongjmp.S8
-rw-r--r--src/pal/src/libunwind/src/sh/unwind_i.h40
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gcreate_addr_space.c65
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gget_proc_info.c48
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gget_save_loc.c62
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gglobal.c64
-rw-r--r--src/pal/src/libunwind/src/tilegx/Ginit.c167
-rw-r--r--src/pal/src/libunwind/src/tilegx/Ginit_local.c80
-rw-r--r--src/pal/src/libunwind/src/tilegx/Ginit_remote.c47
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gis_signal_frame.c115
-rw-r--r--src/pal/src/libunwind/src/tilegx/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gregs.c76
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gresume.c94
-rw-r--r--src/pal/src/libunwind/src/tilegx/Gstep.c53
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lis_signal_frame.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/tilegx/elfxx.c27
-rw-r--r--src/pal/src/libunwind/src/tilegx/gen-offsets.c30
-rw-r--r--src/pal/src/libunwind/src/tilegx/getcontext.S36
-rw-r--r--src/pal/src/libunwind/src/tilegx/init.h63
-rw-r--r--src/pal/src/libunwind/src/tilegx/is_fpreg.c33
-rw-r--r--src/pal/src/libunwind/src/tilegx/offsets.h12
-rw-r--r--src/pal/src/libunwind/src/tilegx/regname.c55
-rw-r--r--src/pal/src/libunwind/src/tilegx/siglongjmp.S7
-rw-r--r--src/pal/src/libunwind/src/tilegx/unwind_i.h46
-rw-r--r--src/pal/src/libunwind/src/unwind/Backtrace.c56
-rw-r--r--src/pal/src/libunwind/src/unwind/DeleteException.c38
-rw-r--r--src/pal/src/libunwind/src/unwind/FindEnclosingFunction.c42
-rw-r--r--src/pal/src/libunwind/src/unwind/ForcedUnwind.c52
-rw-r--r--src/pal/src/libunwind/src/unwind/GetBSP.c42
-rw-r--r--src/pal/src/libunwind/src/unwind/GetCFA.c38
-rw-r--r--src/pal/src/libunwind/src/unwind/GetDataRelBase.c39
-rw-r--r--src/pal/src/libunwind/src/unwind/GetGR.c43
-rw-r--r--src/pal/src/libunwind/src/unwind/GetIP.c38
-rw-r--r--src/pal/src/libunwind/src/unwind/GetIPInfo.c42
-rw-r--r--src/pal/src/libunwind/src/unwind/GetLanguageSpecificData.c40
-rw-r--r--src/pal/src/libunwind/src/unwind/GetRegionStart.c39
-rw-r--r--src/pal/src/libunwind/src/unwind/GetTextRelBase.c35
-rw-r--r--src/pal/src/libunwind/src/unwind/RaiseException.c103
-rw-r--r--src/pal/src/libunwind/src/unwind/Resume.c42
-rw-r--r--src/pal/src/libunwind/src/unwind/Resume_or_Rethrow.c47
-rw-r--r--src/pal/src/libunwind/src/unwind/SetGR.c47
-rw-r--r--src/pal/src/libunwind/src/unwind/SetIP.c35
-rw-r--r--src/pal/src/libunwind/src/unwind/libunwind.pc.in11
-rw-r--r--src/pal/src/libunwind/src/unwind/unwind-internal.h140
-rw-r--r--src/pal/src/libunwind/src/x86/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/x86/Gcreate_addr_space.c58
-rw-r--r--src/pal/src/libunwind/src/x86/Gget_proc_info.c45
-rw-r--r--src/pal/src/libunwind/src/x86/Gget_save_loc.c133
-rw-r--r--src/pal/src/libunwind/src/x86/Gglobal.c67
-rw-r--r--src/pal/src/libunwind/src/x86/Ginit.c243
-rw-r--r--src/pal/src/libunwind/src/x86/Ginit_local.c79
-rw-r--r--src/pal/src/libunwind/src/x86/Ginit_remote.c56
-rw-r--r--src/pal/src/libunwind/src/x86/Gos-freebsd.c374
-rw-r--r--src/pal/src/libunwind/src/x86/Gos-linux.c331
-rw-r--r--src/pal/src/libunwind/src/x86/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/x86/Gregs.c178
-rw-r--r--src/pal/src/libunwind/src/x86/Gresume.c91
-rw-r--r--src/pal/src/libunwind/src/x86/Gstep.c115
-rw-r--r--src/pal/src/libunwind/src/x86/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Lglobal.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Los-freebsd.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Los-linux.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/x86/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/x86/getcontext-freebsd.S112
-rw-r--r--src/pal/src/libunwind/src/x86/getcontext-linux.S74
-rw-r--r--src/pal/src/libunwind/src/x86/init.h69
-rw-r--r--src/pal/src/libunwind/src/x86/is_fpreg.c34
-rw-r--r--src/pal/src/libunwind/src/x86/longjmp.S39
-rw-r--r--src/pal/src/libunwind/src/x86/offsets.h140
-rw-r--r--src/pal/src/libunwind/src/x86/regname.c27
-rw-r--r--src/pal/src/libunwind/src/x86/siglongjmp.S92
-rw-r--r--src/pal/src/libunwind/src/x86/unwind_i.h68
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gapply_reg_state.c37
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gcreate_addr_space.c61
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gget_proc_info.c48
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gget_save_loc.c73
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gglobal.c102
-rw-r--r--src/pal/src/libunwind/src/x86_64/Ginit.c342
-rw-r--r--src/pal/src/libunwind/src/x86_64/Ginit_local.c81
-rw-r--r--src/pal/src/libunwind/src/x86_64/Ginit_remote.c57
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gos-freebsd.c218
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gos-linux.c156
-rw-r--r--src/pal/src/libunwind/src/x86_64/Greg_states_iterate.c37
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gregs.c138
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gresume.c123
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gstash_frame.c119
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gstep.c227
-rw-r--r--src/pal/src/libunwind/src/x86_64/Gtrace.c551
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lapply_reg_state.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lcreate_addr_space.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lget_proc_info.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lget_save_loc.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lglobal.c6
-rw-r--r--src/pal/src/libunwind/src/x86_64/Linit.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Linit_local.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Linit_remote.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Los-freebsd.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Los-linux.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lreg_states_iterate.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lregs.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lresume.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lstash_frame.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Lstep.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/Ltrace.c5
-rw-r--r--src/pal/src/libunwind/src/x86_64/getcontext.S134
-rw-r--r--src/pal/src/libunwind/src/x86_64/init.h89
-rw-r--r--src/pal/src/libunwind/src/x86_64/is_fpreg.c38
-rw-r--r--src/pal/src/libunwind/src/x86_64/longjmp.S34
-rw-r--r--src/pal/src/libunwind/src/x86_64/offsets.h3
-rw-r--r--src/pal/src/libunwind/src/x86_64/regname.c56
-rw-r--r--src/pal/src/libunwind/src/x86_64/setcontext.S83
-rw-r--r--src/pal/src/libunwind/src/x86_64/siglongjmp.S32
-rw-r--r--src/pal/src/libunwind/src/x86_64/ucontext_i.h82
-rw-r--r--src/pal/src/libunwind/src/x86_64/unwind_i.h93
-rw-r--r--src/pal/src/libunwind/tests/Gia64-test-nat.c626
-rw-r--r--src/pal/src/libunwind/tests/Gia64-test-rbs.c193
-rw-r--r--src/pal/src/libunwind/tests/Gia64-test-readonly.c89
-rw-r--r--src/pal/src/libunwind/tests/Gia64-test-stack.c176
-rw-r--r--src/pal/src/libunwind/tests/Gperf-simple.c264
-rw-r--r--src/pal/src/libunwind/tests/Gperf-trace.c250
-rw-r--r--src/pal/src/libunwind/tests/Gtest-bt.c263
-rw-r--r--src/pal/src/libunwind/tests/Gtest-concurrent.c136
-rw-r--r--src/pal/src/libunwind/tests/Gtest-dyn1.c223
-rw-r--r--src/pal/src/libunwind/tests/Gtest-exc.c162
-rw-r--r--src/pal/src/libunwind/tests/Gtest-init.cxx107
-rw-r--r--src/pal/src/libunwind/tests/Gtest-nomalloc.c110
-rw-r--r--src/pal/src/libunwind/tests/Gtest-resume-sig-rt.c31
-rw-r--r--src/pal/src/libunwind/tests/Gtest-resume-sig.c200
-rw-r--r--src/pal/src/libunwind/tests/Gtest-trace.c282
-rw-r--r--src/pal/src/libunwind/tests/Lia64-test-nat.c5
-rw-r--r--src/pal/src/libunwind/tests/Lia64-test-rbs.c5
-rw-r--r--src/pal/src/libunwind/tests/Lia64-test-readonly.c5
-rw-r--r--src/pal/src/libunwind/tests/Lia64-test-stack.c5
-rw-r--r--src/pal/src/libunwind/tests/Lperf-simple.c5
-rw-r--r--src/pal/src/libunwind/tests/Lperf-trace.c5
-rw-r--r--src/pal/src/libunwind/tests/Lrs-race.c1514
-rw-r--r--src/pal/src/libunwind/tests/Ltest-bt.c5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-concurrent.c5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-cxx-exceptions.cxx80
-rw-r--r--src/pal/src/libunwind/tests/Ltest-dyn1.c5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-exc.c5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-init-local-signal-lib.c6
-rw-r--r--src/pal/src/libunwind/tests/Ltest-init-local-signal.c60
-rw-r--r--src/pal/src/libunwind/tests/Ltest-init.cxx5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-mem-validate.c143
-rw-r--r--src/pal/src/libunwind/tests/Ltest-nocalloc.c137
-rw-r--r--src/pal/src/libunwind/tests/Ltest-nomalloc.c5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-resume-sig-rt.c5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-resume-sig.c5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-trace.c5
-rw-r--r--src/pal/src/libunwind/tests/Ltest-varargs.c84
-rw-r--r--src/pal/src/libunwind/tests/Makefile.am234
-rw-r--r--src/pal/src/libunwind/tests/check-namespace.sh.in367
-rw-r--r--src/pal/src/libunwind/tests/crasher.c124
-rw-r--r--src/pal/src/libunwind/tests/flush-cache.S104
-rw-r--r--src/pal/src/libunwind/tests/flush-cache.h38
-rw-r--r--src/pal/src/libunwind/tests/forker.c76
-rw-r--r--src/pal/src/libunwind/tests/ia64-dyn-asm.S102
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-dyn1.c223
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-nat-asm.S508
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-rbs-asm.S275
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-rbs.h3
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-readonly-asm.S55
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-setjmp.c155
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-sig.c102
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-stack-asm.S183
-rw-r--r--src/pal/src/libunwind/tests/ia64-test-stack.h3
-rw-r--r--src/pal/src/libunwind/tests/ident.c5
-rw-r--r--src/pal/src/libunwind/tests/mapper.c78
-rwxr-xr-xsrc/pal/src/libunwind/tests/perf-startup19
-rw-r--r--src/pal/src/libunwind/tests/ppc64-test-altivec-utils.c32
-rw-r--r--src/pal/src/libunwind/tests/ppc64-test-altivec.c177
-rwxr-xr-xsrc/pal/src/libunwind/tests/run-check-namespace3
-rwxr-xr-xsrc/pal/src/libunwind/tests/run-coredump-unwind53
-rwxr-xr-xsrc/pal/src/libunwind/tests/run-coredump-unwind-mdi8
-rwxr-xr-xsrc/pal/src/libunwind/tests/run-ia64-test-dyn12
-rwxr-xr-xsrc/pal/src/libunwind/tests/run-ptrace-mapper2
-rwxr-xr-xsrc/pal/src/libunwind/tests/run-ptrace-misc2
-rw-r--r--src/pal/src/libunwind/tests/test-async-sig.c193
-rw-r--r--src/pal/src/libunwind/tests/test-coredump-unwind.c395
-rw-r--r--src/pal/src/libunwind/tests/test-flush-cache.c143
-rw-r--r--src/pal/src/libunwind/tests/test-init-remote.c103
-rw-r--r--src/pal/src/libunwind/tests/test-mem.c103
-rw-r--r--src/pal/src/libunwind/tests/test-proc-info.c171
-rw-r--r--src/pal/src/libunwind/tests/test-ptrace-misc.c120
-rw-r--r--src/pal/src/libunwind/tests/test-ptrace.c370
-rw-r--r--src/pal/src/libunwind/tests/test-reg-state.c133
-rw-r--r--src/pal/src/libunwind/tests/test-setjmp.c285
-rw-r--r--src/pal/src/libunwind/tests/test-static-link-gen.c74
-rw-r--r--src/pal/src/libunwind/tests/test-static-link-loc.c102
-rw-r--r--src/pal/src/libunwind/tests/test-strerror.c18
-rw-r--r--src/pal/src/locale/unicode.cpp110
-rw-r--r--src/pal/src/locale/utf8.cpp47
-rw-r--r--src/pal/src/misc/fmtmessage.cpp6
-rw-r--r--src/pal/src/sharedmemory/sharedmemory.cpp33
-rw-r--r--src/pal/src/synchobj/mutex.cpp1
-rw-r--r--src/pal/tests/palsuite/locale_info/CMakeLists.txt1
-rw-r--r--src/pal/tests/palsuite/locale_info/GetStringTypeExW/CMakeLists.txt5
-rw-r--r--src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/CMakeLists.txt17
-rw-r--r--src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/test1.cpp54
-rw-r--r--src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/CMakeLists.txt17
-rw-r--r--src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/test2.cpp78
-rw-r--r--src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/testinfo.dat12
-rw-r--r--src/pal/tests/palsuite/locale_info/MultiByteToWideChar/test4/test4.cpp52
-rw-r--r--src/utilcode/CMakeLists.txt2
-rw-r--r--src/utilcode/assemblyfilehash.cpp169
-rw-r--r--src/utilcode/ccomprc.cpp5
-rw-r--r--src/utilcode/clrhost.cpp1
-rw-r--r--src/utilcode/clrhost_nodependencies.cpp1
-rw-r--r--src/utilcode/downlevel.cpp2736
-rw-r--r--src/utilcode/newapis.cpp1401
-rw-r--r--src/utilcode/sstring.cpp3
-rw-r--r--src/utilcode/winfix.cpp92
-rw-r--r--src/vm/CMakeLists.txt3
-rw-r--r--src/vm/appdomain.cpp6
-rw-r--r--src/vm/arm/asmhelpers.S42
-rw-r--r--src/vm/arm/cgencpu.h1
-rw-r--r--src/vm/arm/stubs.cpp1
-rw-r--r--src/vm/arm64/stubs.cpp3
-rw-r--r--src/vm/arm64/unixstubs.cpp15
-rw-r--r--src/vm/assemblyname.cpp9
-rw-r--r--src/vm/ceeload.cpp1
-rw-r--r--src/vm/ceemain.cpp18
-rw-r--r--src/vm/codeman.cpp2
-rw-r--r--src/vm/commodule.cpp1
-rw-r--r--src/vm/comsynchronizable.cpp2
-rw-r--r--src/vm/comutilnative.cpp131
-rw-r--r--src/vm/comutilnative.h37
-rw-r--r--src/vm/corhost.cpp17
-rw-r--r--src/vm/crossgencompile.cpp2
-rw-r--r--src/vm/customattribute.h17
-rw-r--r--src/vm/debugdebugger.cpp1
-rw-r--r--src/vm/ecall.cpp12
-rw-r--r--src/vm/ecalllist.h17
-rw-r--r--src/vm/eeconfig.cpp7
-rw-r--r--src/vm/eepolicy.cpp15
-rw-r--r--src/vm/eepolicy.h4
-rw-r--r--src/vm/eetwain.cpp21
-rw-r--r--src/vm/eventpipe.cpp81
-rw-r--r--src/vm/eventpipe.h18
-rw-r--r--src/vm/eventpipeeventsource.cpp118
-rw-r--r--src/vm/eventpipeeventsource.h33
-rw-r--r--src/vm/eventpipefile.cpp10
-rw-r--r--src/vm/eventpipemetadatagenerator.cpp97
-rw-r--r--src/vm/eventpipemetadatagenerator.h63
-rw-r--r--src/vm/eventreporter.cpp160
-rw-r--r--src/vm/eventreporter.h9
-rw-r--r--src/vm/excep.cpp55
-rw-r--r--src/vm/excep.h3
-rw-r--r--src/vm/gcenv.os.cpp86
-rw-r--r--src/vm/i386/stublinkerx86.cpp1
-rw-r--r--src/vm/interoputil.cpp97
-rw-r--r--src/vm/interoputil.h16
-rw-r--r--src/vm/jithelpers.cpp1
-rw-r--r--src/vm/jitinterface.cpp66
-rw-r--r--src/vm/jitinterface.h22
-rw-r--r--src/vm/marvin32.cpp266
-rw-r--r--src/vm/method.cpp5
-rw-r--r--src/vm/methodtable.cpp4
-rw-r--r--src/vm/methodtable.h24
-rw-r--r--src/vm/methodtablebuilder.cpp26
-rw-r--r--src/vm/methodtablebuilder.h3
-rw-r--r--src/vm/object.cpp162
-rw-r--r--src/vm/object.h2
-rw-r--r--src/vm/olevariant.cpp5
-rw-r--r--src/vm/pefile.cpp2
-rw-r--r--src/vm/pefile.h2
-rw-r--r--src/vm/peimagelayout.cpp12
-rw-r--r--src/vm/peimagelayout.h4
-rw-r--r--src/vm/rcwrefcache.cpp2
-rw-r--r--src/vm/runtimehandles.cpp12
-rw-r--r--src/vm/threads.cpp1
-rw-r--r--src/vm/tieredcompilation.cpp18
-rw-r--r--src/vm/util.cpp9
-rw-r--r--src/vm/util.hpp9
-rw-r--r--tests/arm/Tests.lst2
-rw-r--r--tests/build.proj10
-rw-r--r--tests/helixpublish.proj3
-rw-r--r--tests/runtest.cmd4
-rwxr-xr-xtests/runtest.sh72
-rwxr-xr-xtests/runtesttilstable.sh158
-rwxr-xr-xtests/scripts/arm32_ci_script.sh32
-rw-r--r--tests/scripts/run-corefx-tests.py50
-rwxr-xr-xtests/scripts/run-xunit-perf.py2
-rw-r--r--tests/src/CLRTest.Execute.Bash.targets4
-rw-r--r--tests/src/CLRTest.Execute.Batch.targets4
-rw-r--r--tests/src/Interop/CMakeLists.txt1
-rw-r--r--tests/src/Interop/ClassicCOM/CMakeLists.txt13
-rw-r--r--tests/src/Interop/ClassicCOM/COMLib.cs34
-rw-r--r--tests/src/Interop/ClassicCOM/COMLib.csproj32
-rw-r--r--tests/src/Interop/ClassicCOM/COMLib2.cs34
-rw-r--r--tests/src/Interop/ClassicCOM/COMLib2.csproj32
-rw-r--r--tests/src/Interop/ClassicCOM/ClassicCOMNative.cpp28
-rw-r--r--tests/src/Interop/ClassicCOM/ClassicCOMUnitTest.cs245
-rw-r--r--tests/src/Interop/ClassicCOM/ClassicCOMUnitTest.csproj47
-rw-r--r--tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs52
-rw-r--r--tests/src/JIT/Directed/RVAInit/oddsize.ilproj1
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj18
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj18
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Double.cs40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Single.cs40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256.cs107
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32WithTruncation.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Single.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Int32.cs21
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Single.cs21
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32WithTruncation.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Single.Int32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateOddIndexed.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Byte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.SByte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.52.cs309
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.11.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.27.cs309
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.22.cs309
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.19.cs309
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.20.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.52.cs309
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.27.cs309
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.22.cs309
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.19.cs309
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.52.cs321
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.27.cs321
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.22.cs321
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.19.cs321
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.52.cs321
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.27.cs321
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.22.cs321
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.19.cs321
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad.cs140
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask.cs77
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask_r.csproj36
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask_ro.csproj36
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.2.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.2.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx_r.csproj46
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx_ro.csproj46
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Double.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Int32.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Int64.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Single.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.UInt32.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.UInt64.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/PermuteVar.Double.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/PermuteVar.Single.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs18
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256.cs241
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Double.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Single.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Byte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.SByte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Byte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.SByte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Byte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.SByte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj16
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj16
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.Byte.cs40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.SByte.cs40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Byte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.SByte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Byte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.SByte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256.cs141
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int16.SByte.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int32.Int16.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int32.SByte.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.Int16.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.Int32.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.SByte.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt16.Byte.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt32.Byte.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt32.UInt16.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.Byte.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.UInt16.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.UInt32.cs306
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256_r.csproj48
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256_ro.csproj48
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.Store.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.Load.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Byte.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Int16.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Int32.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.SByte.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.UInt16.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.UInt32.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Byte.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Int16.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Int32.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.SByte.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.UInt16.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.UInt32.cs330
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask.cs77
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask_r.csproj36
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask_ro.csproj36
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Avx2.cs22
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Int32.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Int64.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.UInt32.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.UInt64.2.cs337
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs16
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.ConvertToVector256.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/IsSupported.cs)7
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported_r.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/IsSupported_r.csproj)0
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported_ro.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/IsSupported_ro.csproj)0
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs644
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest.template30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest.template24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest.template24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest.template24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest.template14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractScalarTest.template20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractStoreTest.template20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractVector128Test.template20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx1354
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/GenericUnOpTest.template20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest.template32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmBinOpTest.template30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmUnOpTest.template20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertLoadTest.template30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertScalarTest.template20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertVector128Test.template30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest.template104
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest_DataTable.cs23
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest.template30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest.template40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest.template20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest_DataTable.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Add.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/AddScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/And.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/AndNot.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqual.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThan.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqual.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThan.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqual.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqual.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.Boolean.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThan.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqual.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqualScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThan.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqual.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqualScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrdered.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrderedScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnordered.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnorderedScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Divide.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/DivideScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Max.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/MaxScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Min.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/MinScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Multiply.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/MultiplyScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Or.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Subtract.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SubtractScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Xor.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThanOrEqual.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThanOrEqual.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotEqual.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThan.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThanOrEqual.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThan.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThanOrEqual.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareOrdered.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareUnordered.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Divide.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/DivideScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaxScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/MinScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Byte.cs56
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/MultiplyScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs108
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt16.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Byte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Double.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Single.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Double.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Single.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Byte.cs40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Double.cs40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.SByte.cs40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Single.cs40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.UInt64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.Byte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.SByte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Byte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Int16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.SByte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.UInt16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Byte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.SByte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.0.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.217.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.1.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.129.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/MinHorizontal.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultipleSumAbsoluteDifferences.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultiplyLow.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/PackUnsignedSaturate.UInt16.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Double.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Single.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Double.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Single.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Byte.cs14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int16.cs14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int32.cs14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int64.cs14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.SByte.cs14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt16.cs14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt32.cs14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt64.cs14
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Byte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.SByte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Byte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.SByte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Byte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.SByte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Byte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.SByte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Byte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.SByte.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt16.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt32.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt64.cs24
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse42/CompareGreaterThan.Int64.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.Byte.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt16.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt32.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int16.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int32.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAddSaturate.Int16.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int16.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int32.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtractSaturate.Int16.cs32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyAddAdjacent.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyHighRoundScale.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Shuffle.SByte.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int16.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int32.cs30
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.SByte.cs30
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Span/SpanBench.cs2
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_544983/DevDiv_544983.il7
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_544985/DevDiv_544985.il187
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_544985/DevDiv_544985.ilproj34
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_545497/DevDiv_545497.il117
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_545497/DevDiv_545497.ilproj23
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_545500/DevDiv_545500.il177
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_545500/DevDiv_545500.ilproj34
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_545504/DevDiv_545504.cs116
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_545504/DevDiv_545504.csproj37
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.il97
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.ilproj24
-rw-r--r--tests/src/JIT/opt/Devirtualization/box1.cs29
-rw-r--r--tests/src/JIT/opt/Devirtualization/box1.csproj34
-rw-r--r--tests/src/JIT/opt/Devirtualization/box2.cs24
-rw-r--r--tests/src/JIT/opt/Devirtualization/box2.csproj35
-rw-r--r--tests/src/baseservices/exceptions/stacktrace/Tier1StackTrace.csproj4
-rw-r--r--tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj3
-rw-r--r--tests/src/dirs.proj222
-rw-r--r--tests/src/performance/Scenario/JitBench/Runner/BenchmarkConfiguration.cs2
-rw-r--r--tests/src/performance/Scenario/JitBench/Runner/Program.cs2
-rw-r--r--tests/src/reflection/Tier1Collectible/Tier1Collectible.csproj4
-rw-r--r--tests/src/sizeondisk/sodbench/SoDBench.cs2
-rw-r--r--tests/src/tracing/tracevalidation/rundown/Rundown.cs15
-rw-r--r--tests/src/tracing/tracevalidation/tracelogging/EventSourceTest.cs5
-rw-r--r--tests/testsFailing.arm.txt1
1972 files changed, 116606 insertions, 44011 deletions
diff --git a/.gitignore b/.gitignore
index 8c2f099f09..c3d1f56b52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,8 +19,6 @@ syntax: glob
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
-x64/
-x86/
build/
bld/
[Bb]in/
@@ -54,7 +52,6 @@ dlldata.c
*_i.c
*_p.c
-*_i.h
*.ilk
*.meta
*.obj
@@ -239,6 +236,7 @@ $RECYCLE.BIN/
# Common binary extensions on Windows
*.exe
+*.exe.stackdump
*.dll
*.lib
diff --git a/BuildToolsVersion.txt b/BuildToolsVersion.txt
index ad88e711d3..7d7e2d494c 100644
--- a/BuildToolsVersion.txt
+++ b/BuildToolsVersion.txt
@@ -1 +1 @@
-2.1.0-preview2-02621-01
+2.1.0-preview3-02629-02
diff --git a/CODE_OWNERS.TXT b/CODE_OWNERS.TXT
index 9c50d35e9c..5d9db437d8 100644
--- a/CODE_OWNERS.TXT
+++ b/CODE_OWNERS.TXT
@@ -15,8 +15,8 @@ N: Mike McLaughlin
G: mikem8361
D: Debugging APIs and implementation (anything under the debug directory), sos
-N: Kshama Pawar
-G: kspawa
+N: Noah Falk, David Mason
+G: noahfalk, davmason
D: Profiling APIs and implementation
N: Gaurav Khanna
@@ -28,4 +28,4 @@ G: ericstj
D: Nuget packaging implementation
This list is incomplete, if you need to find other owners work with Jan Kotas
-to get them filled in. \ No newline at end of file
+to get them filled in.
diff --git a/Documentation/building/debugging-instructions.md b/Documentation/building/debugging-instructions.md
index 84059dfb24..0b98b8fcea 100644
--- a/Documentation/building/debugging-instructions.md
+++ b/Documentation/building/debugging-instructions.md
@@ -52,6 +52,8 @@ You can combine steps 4-8 and pass everything on the lldb command line:
`lldb-3.9 -o "plugin load libsosplugin.so" -o "process launch -s" -o "process handle -s false SIGUSR1 SIGUSR2" -o "breakpoint set -n LoadLibraryExW" corerun HelloWorld.exe linux`
+For .NET Core version 1.x and 2.0.x, libsosplugin.so is built for and will only work with version 3.6 of lldb. For .NET Core 2.1, the plugin is built for 3.9 lldb and will work with 3.8 and 3.9 lldb.
+
### SOS commands ###
This is the full list of commands currently supported by SOS. lldb is case-sensitive unlike windbg.
@@ -164,6 +166,13 @@ lldb should start debugging successfully at this point. You should see stacktrac
```
lldb-3.9 -O "settings set target.exec-search-paths /home/parallels/Downloads/System.Drawing.Common.Tests/home/helixbot/dotnetbuild/work/2a74cf82-3018-4e08-9e9a-744bb492869e/Payload/shared/Microsoft.NETCore.App/9.9.9/" -o "plugin load /home/parallels/Downloads/System.Drawing.Common.Tests/home/helixbot/dotnetbuild/work/2a74cf82-3018-4e08-9e9a-744bb492869e/Payload/shared/Microsoft.NETCore.App/9.9.9/libsosplugin.so" --core /home/parallels/Downloads/System.Drawing.Common.Tests/home/helixbot/dotnetbuild/work/2a74cf82-3018-4e08-9e9a-744bb492869e/Work/f6414a62-9b41-4144-baed-756321e3e075/Unzip/core /home/parallels/Downloads/System.Drawing.Common.Tests/home/helixbot/dotnetbuild/work/2a74cf82-3018-4e08-9e9a-744bb492869e/Payload/shared/Microsoft.NETCore.App/9.9.9/dotnet
```
+Disabling Managed Attach/Debugging
+==================================
+
+The "COMPlus_EnableDiagnostics" environment variable can be used to disable managed debugging. This prevents the various OS artifacts used for debugging like the named pipes and semaphores on Linux/MacOS and shared memory on Windows from being created.
+
+ export COMPlus_EnableDiagnostics=0
+
Using Visual Studio Code
========================
diff --git a/Documentation/building/viewing-jit-dumps.md b/Documentation/building/viewing-jit-dumps.md
index b16b43197f..58dd2257fe 100644
--- a/Documentation/building/viewing-jit-dumps.md
+++ b/Documentation/building/viewing-jit-dumps.md
@@ -8,8 +8,9 @@ To make sense of the results, it is recommended you also read the [Reading a Jit
The first thing we want to do is setup the .NET Core app we want to dump. Here are the steps to do this, if you don't have one ready:
-* Perform a debug build of the CoreCLR repo. You don't need to build tests, so you can pass `skiptests` to the build command to make it faster.
-* Install the [.NET CLI 2.0 preview](https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/dogfooding.md), which we'll use to compile/publish our app.
+* Perform a release build of the CoreCLR repo by passing `release` to the build command. You don't need to build tests, so you can pass `skiptests` to the build command to make it faster. Note: the release build can be skipped, but in order to see optimized in the core library it is needed.
+* Perform a debug build of the CoreCLR repo. Tests aren't needed as in the release build, so you can pass `skiptests` to the build command. Note: the debug build is necessary, so that the JIT recognizes the configuration knobs.
+* Install the [.NET CLI 2.1 preview](https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/dogfooding.md), which we'll use to compile/publish our app.
* `cd` to where you want your app to be placed, and run `dotnet new console`.
* Modify your `csproj` file so that it contains a RID (runtime ID) corresponding to the OS you're using in the `<RuntimeIdentifier>` tag. For example, for Windows 10 x64 machine, the project file is:
@@ -61,10 +62,12 @@ The first thing we want to do is setup the .NET Core app we want to dump. Here a
```shell
# Windows
- robocopy /e <coreclr path>\bin\Product\Windows_NT.<arch>.Debug <app root>\bin\Release\netcoreapp2.0\<rid>\publish > NUL
+ robocopy /e <coreclr path>\bin\Product\Windows_NT.<arch>.Release <app root>\bin\Release\netcoreapp2.0\<rid>\publish > NUL
+ copy <coreclr path>\bin\Product\Windows_NT.<arch>.Debug\clrjit.dll <app root>\bin\Release\netcoreapp2.0\<rid>\publish > NUL
# Unix
- cp -rT <coreclr path>/bin/Product/<OS>.<arch>.Debug <app root>/bin/Release/netcoreapp2.0/<rid>/publish
+ cp -rT <coreclr path>/bin/Product/<OS>.<arch>.Release <app root>/bin/Release/netcoreapp2.0/<rid>/publish
+ cp <coreclr path>/bin/Product/<OS>.<arch>.Debug/libclrjit.so <app root>/bin/Release/netcoreapp2.0/<rid>/publish
```
* Set the configuration knobs you need (see below) and run your published app. The info you want should be dumped to stdout.
diff --git a/Documentation/workflow/OfficalAndDailyBuilds.md b/Documentation/workflow/OfficalAndDailyBuilds.md
index 7aa1fa0699..083df3e282 100644
--- a/Documentation/workflow/OfficalAndDailyBuilds.md
+++ b/Documentation/workflow/OfficalAndDailyBuilds.md
@@ -16,6 +16,13 @@ repositories. You can see what is available from
* CoreCLR at <https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.NETCore.Runtime.CoreCLR>
* NETCore.App at <https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.NETCore.App>
+These builds have a version number that follows the the versioning scheme described below (month number/day of month),
+but they also will have a component that indicate which Git Branch the are working from (note these names were
+correct as of 1/2018 and may change but the concept of a suffix that designates the branch is likely to persist)
+
+ * preview1 - are daily builds from the 'release/\*' branch where \* is the next official version to be released
+ * preview2 - are daily builds from the 'master' branch (where active work happens first (typically))
+
Thus if your goal is just to get the latest bug fixes and features, you don't need to build CoreCLR yourself you
can simply add <https://dotnet.myget.org/F/dotnet-core/api/v3/index.json> to your Nuget Feed list and set the
`RuntimeFrameworkVersion` in your project file to a `Microsoft.NETCore.App` version. You need to restore
diff --git a/ILAsmVersion.txt b/ILAsmVersion.txt
index eebefdbcfd..65333c1815 100644
--- a/ILAsmVersion.txt
+++ b/ILAsmVersion.txt
@@ -1 +1 @@
-2.1.0-preview2-26324-04
+2.1.0-preview3-26329-01
diff --git a/build-test.cmd b/build-test.cmd
index bd03d6f74d..e65cbcacff 100644
--- a/build-test.cmd
+++ b/build-test.cmd
@@ -51,6 +51,12 @@ set __ZipTests=
set __TargetsWindows=1
set __DoCrossgen=
+@REM CMD has a nasty habit of eating "=" on the argument list, so passing:
+@REM -priority=1
+@REM appears to CMD parsing as "-priority 1". Handle -priority specially to avoid problems,
+@REM and allow the "-priority=1" syntax.
+set __Priority=0
+
:Arg_Loop
if "%1" == "" goto ArgsDone
@@ -75,6 +81,7 @@ if /i "%1" == "crossgen" (set __DoCrossgen=1&set processedArgs=!pro
if /i "%1" == "runtimeid" (set __RuntimeId=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
if /i "%1" == "targetsNonWindows" (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "Exclude" (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
+if /i "%1" == "-priority" (set __Priority=%2&shift&set processedArgs=!processedArgs! %1=%2&shift&goto Arg_Loop)
if [!processedArgs!]==[] (
set __UnprocessedBuildArgs=%__args%
@@ -87,6 +94,9 @@ if [!processedArgs!]==[] (
:ArgsDone
+@REM Special handling for -priority=N argument.
+if %__Priority% GTR 0 (set "__UnprocessedBuildArgs=!__UnprocessedBuildArgs! -priority=%__Priority%")
+
if defined __BuildAgainstPackagesArg (
if not defined __RuntimeID (
echo %__MsgPrefix%Error: When building against packages, you must supply a target Runtime ID.
@@ -267,22 +277,43 @@ if not defined VSINSTALLDIR (
echo %__MsgPrefix%Error: build-test.cmd should be run from a Visual Studio Command Prompt. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
exit /b 1
)
-
+set __AppendToLog=false
set __BuildLogRootName=Tests_Managed
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
-set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
-set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
-set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
-call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
-if errorlevel 1 (
- echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
- echo %__BuildLog%
- echo %__BuildWrn%
- echo %__BuildErr%
- exit /b 1
+REM Execute msbuild test build in stages - workaround for excessive data retention in MSBuild ConfigCache
+REM See https://github.com/Microsoft/msbuild/issues/2993
+
+set __SkipPackageRestore=false
+set __SkipTargetingPackBuild=false
+set __BuildLoopCount=2
+set __TestGroupToBuild=1
+
+if %__Priority% GTR 0 (set __BuildLoopCount=16&set __TestGroupToBuild=2)
+echo %__MsgPrefix%Building tests group %__TestGroupToBuild% with %__BuildLoopCount% subgroups
+
+for /l %%G in (1, 1, %__BuildLoopCount%) do (
+
+ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%";Append=!__AppendToLog!
+ set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%";Append=!__AppendToLog!
+ set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%";Append=!__AppendToLog!
+
+ set TestBuildSlice=%%G
+ call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
+
+ if errorlevel 1 (
+ echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
+ echo %__BuildLog%
+ echo %__BuildWrn%
+ echo %__BuildErr%
+ exit /b 1
+ )
+
+ set __SkipPackageRestore=true
+ set __SkipTargetingPackBuild=true
+ set __AppendToLog=true
)
REM Prepare the Test Drop
diff --git a/build-test.sh b/build-test.sh
index 2ccc3b663a..7cb4c02fac 100755
--- a/build-test.sh
+++ b/build-test.sh
@@ -338,7 +338,7 @@ usage()
echo "BuildType can be: debug, checked, release"
echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)."
echo "ninja - target ninja instead of GNU make"
- echo "clangx.y - optional argument to build using clang version x.y."
+ echo "clangx.y - optional argument to build using clang version x.y - supported version 3.5 - 6.0"
echo "cross - optional argument to signify cross compilation,"
echo " - will use ROOTFS_DIR environment variable if set."
echo "crosscomponent - optional argument to build cross-architecture component,"
@@ -543,31 +543,46 @@ while :; do
__VerboseBuild=1
;;
- clang3.5)
+ clang3.5|-clang3.5)
__ClangMajorVersion=3
__ClangMinorVersion=5
;;
- clang3.6)
+ clang3.6|-clang3.6)
__ClangMajorVersion=3
__ClangMinorVersion=6
;;
- clang3.7)
+ clang3.7|-clang3.7)
__ClangMajorVersion=3
__ClangMinorVersion=7
;;
- clang3.8)
+ clang3.8|-clang3.8)
__ClangMajorVersion=3
__ClangMinorVersion=8
;;
- clang3.9)
+ clang3.9|-clang3.9)
__ClangMajorVersion=3
__ClangMinorVersion=9
;;
+ clang4.0|-clang4.0)
+ __ClangMajorVersion=4
+ __ClangMinorVersion=0
+ ;;
+
+ clang5.0|-clang5.0)
+ __ClangMajorVersion=5
+ __ClangMinorVersion=0
+ ;;
+
+ clang6.0|-clang6.0)
+ __ClangMajorVersion=6
+ __ClangMinorVersion=0
+ ;;
+
ninja)
__UseNinja=1
;;
@@ -686,9 +701,9 @@ export __CMakeBinDir="$__BinDir"
if [ ! -d "$__BinDir" ] || [ ! -d "$__BinDir/bin" ]; then
- echo "Cannot find build directory for the CoreCLR Product."
- echo "Please make sure CoreCLR is built before building tests."
- echo "Example use: './build.sh $__BuildArch $__BuildType'"
+ echo "Cannot find build directory for the CoreCLR Product or native tests."
+ echo "Please make sure CoreCLR and native tests are built before building managed tests."
+ echo "Example use: './build.sh $__BuildArch $__BuildType' without -skiptests switch"
exit 1
fi
diff --git a/build.cmd b/build.cmd
index b94ab56965..be6b2a7fde 100644
--- a/build.cmd
+++ b/build.cmd
@@ -12,23 +12,6 @@ set __ThisScriptDir="%~dp0"
call "%__ThisScriptDir%"\setup_vs_tools.cmd
if NOT '%ERRORLEVEL%' == '0' exit /b 1
-REM Make the work-around to a bug in the microsoft.dotnet.buildtools.coreclr package until it is fixed.
-reg query HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3BFCEA48-620F-4B6B-81F7-B9AF75454C7D}\InprocServer32 > NUL: 2>&1
-if NOT '%ERRORLEVEL%' == '0' (
- echo.
- echo.**********************************************************************************
- echo.Error: We have detected that the msdia120.dll is not registered.
- echo.This is necessary for the build to complete without a Class_Not_Registered error.
- echo.
- echo.You can fix this by
- echo. 1. Launching the "Developer Command Prompt for VS2017" with Administrative privileges
- echo. 2. Running regsvr32.exe "%%VSINSTALLDIR%%\Common7\IDE\msdia120.dll"
- echo.
- echo.This will only need to be done once for the lifetime of the machine.
- echo.For more details see: https://github.com/dotnet/coreclr/issues/11305
- exit /b 1
-)
-
if defined VS150COMNTOOLS (
set "__VSToolsRoot=%VS150COMNTOOLS%"
set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
@@ -39,6 +22,11 @@ if defined VS150COMNTOOLS (
set __VSVersion=vs2015
)
+:: Work around Jenkins CI + msbuild problem: Jenkins sometimes creates very large environment
+:: variables, and msbuild can't handle environment blocks with such large variables. So clear
+:: out the variables that might be too large.
+set ghprbCommentBody=
+
:: Note that the msbuild project files (specifically, dir.proj) will use the following variables, if set:
:: __BuildArch -- default: x64
:: __BuildType -- default: Debug
diff --git a/build.sh b/build.sh
index e450186628..1cb0d7e0dc 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,10 @@
#!/usr/bin/env bash
+# Work around Jenkins CI + msbuild problem: Jenkins sometimes creates very large environment
+# variables, and msbuild can't handle environment blocks with such large variables. So clear
+# out the variables that might be too large.
+export ghprbCommentBody=
+
# resolve python-version to use
if [ "$PYTHON" == "" ] ; then
if ! PYTHON=$(command -v python2.7 || command -v python2 || command -v python)
@@ -394,34 +399,29 @@ isMSBuildOnNETCoreSupported()
build_CoreLib_ni()
{
- if [ $__SkipCrossgen == 1 ]; then
- echo "Skipping generating native image"
- return
+ local __CrossGenExec=$1
+
+ echo "Generating native image for System.Private.CoreLib.dll"
+ echo "$__CrossGenExec /Platform_Assemblies_Paths $__BinDir/IL $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__BinDir/IL/System.Private.CoreLib.dll"
+ $__CrossGenExec /Platform_Assemblies_Paths $__BinDir/IL $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__BinDir/IL/System.Private.CoreLib.dll
+ if [ $? -ne 0 ]; then
+ echo "Failed to generate native image for System.Private.CoreLib."
+ exit 1
fi
- if [ $__SkipCoreCLR == 0 -a -e $__BinDir/crossgen ]; then
- echo "Generating native image for System.Private.CoreLib."
- echo "$__BinDir/crossgen /Platform_Assemblies_Paths $__BinDir/IL $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__BinDir/IL/System.Private.CoreLib.dll"
- $__BinDir/crossgen /Platform_Assemblies_Paths $__BinDir/IL $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__BinDir/IL/System.Private.CoreLib.dll
+ if [ "$__BuildOS" == "Linux" ]; then
+ echo "Generating symbol file for System.Private.CoreLib.dll"
+ echo "$__CrossGenExec /Platform_Assemblies_Paths $__BinDir /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll"
+ $__CrossGenExec /Platform_Assemblies_Paths $__BinDir /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll
if [ $? -ne 0 ]; then
- echo "Failed to generate native image for System.Private.CoreLib."
+ echo "Failed to generate symbol file for System.Private.CoreLib."
exit 1
fi
-
- if [ "$__BuildOS" == "Linux" ]; then
- echo "Generating symbol file for System.Private.CoreLib."
- $__BinDir/crossgen /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll
- if [ $? -ne 0 ]; then
- echo "Failed to generate symbol file for System.Private.CoreLib."
- exit 1
- fi
- fi
fi
}
build_CoreLib()
{
-
if [ $__isMSBuildOnNETCoreSupported == 0 ]; then
echo "System.Private.CoreLib.dll build unsupported."
return
@@ -447,18 +447,31 @@ build_CoreLib()
exit 1
fi
+ if [ $__SkipCrossgen == 1 ]; then
+ echo "Skipping generating native image"
+ return
+ fi
+
# The cross build generates a crossgen with the target architecture.
- if [ $__CrossBuild != 1 ]; then
+ if [ $__CrossBuild == 0 ]; then
+ if [ $__SkipCoreCLR == 1 ]; then
+ return
+ fi
+
# The architecture of host pc must be same architecture with target.
if [[ ( "$__HostArch" == "$__BuildArch" ) ]]; then
- build_CoreLib_ni
+ build_CoreLib_ni "$__BinDir/crossgen"
elif [[ ( "$__HostArch" == "x64" ) && ( "$__BuildArch" == "x86" ) ]]; then
- build_CoreLib_ni
+ build_CoreLib_ni "$__BinDir/crossgen"
elif [[ ( "$__HostArch" == "arm64" ) && ( "$__BuildArch" == "arm" ) ]]; then
- build_CoreLib_ni
+ build_CoreLib_ni "$__BinDir/crossgen"
else
exit 1
fi
+ elif [ $__DoCrossArchBuild == 1 ]; then
+ if [[ ( "$__CrossArch" == "x86" ) && ( "$__BuildArch" == "arm" ) ]]; then
+ build_CoreLib_ni "$__CrossComponentBinDir/crossgen"
+ fi
fi
}
diff --git a/buildpipeline/DotNet-CoreClr-Trusted-Linux-Crossbuild.json b/buildpipeline/DotNet-CoreClr-Trusted-Linux-Crossbuild.json
index 04a837f8a6..a278d1b433 100644
--- a/buildpipeline/DotNet-CoreClr-Trusted-Linux-Crossbuild.json
+++ b/buildpipeline/DotNet-CoreClr-Trusted-Linux-Crossbuild.json
@@ -155,7 +155,7 @@
},
"inputs": {
"filename": "docker",
- "arguments": "run --rm -e ROOTFS_DIR $(DockerCommonRunArgs) ./build.sh $(PB_BuildType) $(Architecture) skipnuget cross -skiprestore stripSymbols -OfficialBuildId=$(OfficialBuildId) -- /flp:\"v=diag\"",
+ "arguments": "run --rm -e ROOTFS_DIR=$(ROOTFS_DIR) -e CAC_ROOTFS_DIR=$(CAC_ROOTFS_DIR) $(DockerCommonRunArgs) ./build.sh $(PB_BuildType) $(Architecture) skipnuget cross $(CrossArchBuildArgs) -skiprestore stripSymbols -OfficialBuildId=$(OfficialBuildId) -- /flp:\"v=diag\"",
"workingFolder": "",
"failOnStandardError": "false"
}
@@ -175,7 +175,7 @@
},
"inputs": {
"filename": "docker",
- "arguments": "run --rm $(DockerCommonRunArgs) ./build-packages.sh -BuildType=$(PB_BuildType) -BuildArch=$(Architecture) -- /p:OfficialBuildId=$(OfficialBuildId)",
+ "arguments": "run --rm $(DockerCommonRunArgs) ./build-packages.sh -BuildType=$(PB_BuildType) -BuildArch=$(Architecture) $(CrossArchBuildPackagesArgs) -- /p:OfficialBuildId=$(OfficialBuildId)",
"workingFolder": "",
"failOnStandardError": "false"
}
@@ -367,27 +367,6 @@
"workingFolder": "",
"failOnStandardError": "false"
}
- },
- {
- "environment": {},
- "enabled": true,
- "continueOnError": true,
- "alwaysRun": false,
- "displayName": "Cleanup VSTS Agent",
- "timeoutInMinutes": 0,
- "condition": "always()",
- "refName": "Task17",
- "task": {
- "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9",
- "versionSpec": "1.*",
- "definitionType": "task"
- },
- "inputs": {
- "filename": "$(Build.SourcesDirectory)/Tools/msbuild.sh",
- "arguments": "cleanupagent.proj /p:AgentDirectory=$(Agent.HomeDirectory) /p:DoClean=$(PB_CleanAgent)",
- "workingFolder": "$(Build.SourcesDirectory)/Tools/scripts/vstsagent/",
- "failOnStandardError": "false"
- }
}
],
"options": [
@@ -479,6 +458,14 @@
"Architecture": {
"value": "arm"
},
+ "CrossArchBuildArgs": {
+ "value": "",
+ "allowOverride": true
+ },
+ "CrossArchBuildPackagesArgs": {
+ "value": "",
+ "allowOverride": true
+ },
"CommitToCheckout": {
"value": "HEAD",
"allowOverride": true
@@ -489,6 +476,10 @@
"ROOTFS_DIR": {
"value": "/crossrootfs/$(Architecture)"
},
+ "CAC_ROOTFS_DIR": {
+ "value": "",
+ "allowOverride": true
+ },
"DockerVolumeName": {
"value": "coreclr-cross-$(Build.BuildId)"
},
@@ -579,4 +570,4 @@
"revision": 418098432,
"visibility": "organization"
}
-} \ No newline at end of file
+}
diff --git a/buildpipeline/DotNet-CoreClr-Trusted-Linux.json b/buildpipeline/DotNet-CoreClr-Trusted-Linux.json
index 1b13a3c743..077b68b5de 100644
--- a/buildpipeline/DotNet-CoreClr-Trusted-Linux.json
+++ b/buildpipeline/DotNet-CoreClr-Trusted-Linux.json
@@ -327,27 +327,6 @@
"workingFolder": "",
"failOnStandardError": "false"
}
- },
- {
- "environment": {},
- "enabled": true,
- "continueOnError": true,
- "alwaysRun": false,
- "displayName": "Cleanup VSTS Agent",
- "timeoutInMinutes": 0,
- "condition": "always()",
- "refName": "Task15",
- "task": {
- "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9",
- "versionSpec": "1.*",
- "definitionType": "task"
- },
- "inputs": {
- "filename": "$(Build.SourcesDirectory)/Tools/msbuild.sh",
- "arguments": "cleanupagent.proj /p:AgentDirectory=$(Agent.HomeDirectory) /p:DoClean=$(PB_CleanAgent)",
- "workingFolder": "$(Build.SourcesDirectory)/Tools/scripts/vstsagent/",
- "failOnStandardError": "false"
- }
}
],
"options": [
@@ -539,4 +518,4 @@
"revision": 418098432,
"visibility": "organization"
}
-} \ No newline at end of file
+}
diff --git a/buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json b/buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json
index b451efff39..ad596adde4 100644
--- a/buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json
+++ b/buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json
@@ -403,11 +403,17 @@
"quality": "definition",
"drafts": [],
"queue": {
- "id": 36,
- "name": "DotNet-Build",
+ "_links": {
+ "self": {
+ "href": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330"
+ }
+ },
+ "id": 330,
+ "name": "DotNetCore-Build",
+ "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330",
"pool": {
- "id": 39,
- "name": "DotNet-Build"
+ "id": 97,
+ "name": "DotNetCore-Build"
}
},
"id": 1828,
diff --git a/buildpipeline/DotNet-CoreClr-Trusted-Windows.json b/buildpipeline/DotNet-CoreClr-Trusted-Windows.json
index a0ed7b71c2..39b4e2a293 100644
--- a/buildpipeline/DotNet-CoreClr-Trusted-Windows.json
+++ b/buildpipeline/DotNet-CoreClr-Trusted-Windows.json
@@ -396,11 +396,17 @@
"quality": "definition",
"drafts": [],
"queue": {
- "id": 36,
- "name": "DotNet-Build",
+ "_links": {
+ "self": {
+ "href": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330"
+ }
+ },
+ "id": 330,
+ "name": "DotNetCore-Build",
+ "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330",
"pool": {
- "id": 39,
- "name": "DotNet-Build"
+ "id": 97,
+ "name": "DotNetCore-Build"
}
},
"id": 1676,
diff --git a/buildpipeline/DotNet-Trusted-Publish-Symbols.json b/buildpipeline/DotNet-Trusted-Publish-Symbols.json
index 617fff0516..d796a21c93 100644
--- a/buildpipeline/DotNet-Trusted-Publish-Symbols.json
+++ b/buildpipeline/DotNet-Trusted-Publish-Symbols.json
@@ -250,11 +250,17 @@
"processParameters": {},
"quality": "definition",
"queue": {
- "id": 36,
- "name": "DotNet-Build",
+ "_links": {
+ "self": {
+ "href": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330"
+ }
+ },
+ "id": 330,
+ "name": "DotNetCore-Build",
+ "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330",
"pool": {
- "id": 39,
- "name": "DotNet-Build"
+ "id": 97,
+ "name": "DotNetCore-Build"
}
},
"id": -1,
diff --git a/buildpipeline/DotNet-Trusted-Publish.json b/buildpipeline/DotNet-Trusted-Publish.json
index 3eca08ae29..d0a26190e7 100644
--- a/buildpipeline/DotNet-Trusted-Publish.json
+++ b/buildpipeline/DotNet-Trusted-Publish.json
@@ -585,7 +585,7 @@
"allowOverride": true
},
"BuildConfiguration": {
- "value": "release"
+ "value": "Release"
},
"BuildPlatform": {
"value": "any cpu"
@@ -737,11 +737,17 @@
"quality": "definition",
"drafts": [],
"queue": {
- "id": 36,
- "name": "DotNet-Build",
+ "_links": {
+ "self": {
+ "href": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330"
+ }
+ },
+ "id": 330,
+ "name": "DotNetCore-Build",
+ "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330",
"pool": {
- "id": 39,
- "name": "DotNet-Build"
+ "id": 97,
+ "name": "DotNetCore-Build"
}
},
"id": 2943,
diff --git a/buildpipeline/pipelines.json b/buildpipeline/pipelines.json
index b38243fdcc..94370eda93 100644
--- a/buildpipeline/pipelines.json
+++ b/buildpipeline/pipelines.json
@@ -130,9 +130,13 @@
{
"Name": "DotNet-CoreClr-Trusted-Linux-Crossbuild",
"Parameters": {
- "DockerTag": "ubuntu-14.04-cross-0cd4667-20170319080304",
+ "DockerTag": "ubuntu-14.04-cross-e435274-20180323032140",
"Architecture": "arm",
- "Rid": "linux"
+ "Rid": "linux",
+ "CrossArchitecture": "x86",
+ "CrossArchBuildArgs": "crosscomponent",
+ "CrossArchBuildPackagesArgs": "-__DoCrossArchBuild=1",
+ "CAC_ROOTFS_DIR": "/crossrootfs/$(CrossArchitecture)"
},
"ReportingParameters": {
"OperatingSystem": "Linux",
diff --git a/buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json b/buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json
index 58c2b7eda2..58a6b80c12 100644
--- a/buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json
+++ b/buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json
@@ -402,11 +402,17 @@
"quality": "definition",
"drafts": [],
"queue": {
- "id": 36,
- "name": "DotNet-Build",
+ "_links": {
+ "self": {
+ "href": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330"
+ }
+ },
+ "id": 330,
+ "name": "DotNetCore-Build",
+ "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/build/Queues/330",
"pool": {
- "id": 39,
- "name": "DotNet-Build"
+ "id": 97,
+ "name": "DotNetCore-Build"
}
},
"id": 5159,
diff --git a/clrdefinitions.cmake b/clrdefinitions.cmake
index 918b94985f..66490e5b69 100644
--- a/clrdefinitions.cmake
+++ b/clrdefinitions.cmake
@@ -204,8 +204,10 @@ if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
add_definitions(-DFEATURE_MULTIREG_RETURN)
- add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING)
endif (CLR_CMAKE_PLATFORM_UNIX_AMD64)
+if(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
+ add_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING)
+endif(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
if(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR (CLR_CMAKE_PLATFORM_ARCH_ARM64 AND NOT WIN32))
add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
diff --git a/cross/arm64/tryrun.cmake b/cross/arm64/tryrun.cmake
index 6626fe1523..4f17beb471 100644
--- a/cross/arm64/tryrun.cmake
+++ b/cross/arm64/tryrun.cmake
@@ -55,7 +55,7 @@ SET( HAVE_COMPATIBLE_ASIN_EXITCODE
CACHE STRING "Result from TRY_RUN" FORCE)
SET( HAVE_COMPATIBLE_POW_EXITCODE
- 1
+ 0
CACHE STRING "Result from TRY_RUN" FORCE)
SET( HAVE_VALID_NEGATIVE_INF_POW_EXITCODE
@@ -107,7 +107,7 @@ SET( HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE
CACHE STRING "Result from TRY_RUN" FORCE)
SET( HAVE_PROCFS_CTL_EXITCODE
- 0
+ 1
CACHE STRING "Result from TRY_RUN" FORCE)
SET( HAVE_PROCFS_MAPS_EXITCODE
diff --git a/crosscomponents.cmake b/crosscomponents.cmake
index be50ffa9d9..cedb1e2013 100644
--- a/crosscomponents.cmake
+++ b/crosscomponents.cmake
@@ -1,12 +1,16 @@
add_definitions(-DCROSS_COMPILE)
+if(CLR_CMAKE_PLATFORM_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM)
+ set(FEATURE_CROSSBITNESS 1)
+endif(CLR_CMAKE_PLATFORM_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM)
+
set (CLR_CROSS_COMPONENTS_LIST
crossgen
clrjit
legacyjit
)
-if(NOT CLR_CMAKE_PLATFORM_LINUX)
+if(NOT CLR_CMAKE_PLATFORM_LINUX AND NOT FEATURE_CROSSBITNESS)
list (APPEND CLR_CROSS_COMPONENTS_LIST
mscordaccore
mscordbi
diff --git a/dependencies.props b/dependencies.props
index 08558225eb..a5bb0f9525 100644
--- a/dependencies.props
+++ b/dependencies.props
@@ -23,18 +23,18 @@
<!-- Source of truth for dependency tooling: the commit hash of the dotnet/versions master branch as of the last auto-upgrade. -->
<PropertyGroup>
- <CoreFxCurrentRef>11d07e3818c16b6b43be0fc3379b9719dc0cf8b9</CoreFxCurrentRef>
- <CoreClrCurrentRef>11d07e3818c16b6b43be0fc3379b9719dc0cf8b9</CoreClrCurrentRef>
- <BuildToolsCurrentRef>11d07e3818c16b6b43be0fc3379b9719dc0cf8b9</BuildToolsCurrentRef>
+ <CoreFxCurrentRef>fc1fbe0b638a97baf2aa3bf403a7db7dbfc0b8b5</CoreFxCurrentRef>
+ <CoreClrCurrentRef>fc1fbe0b638a97baf2aa3bf403a7db7dbfc0b8b5</CoreClrCurrentRef>
+ <BuildToolsCurrentRef>0e6f6fa6b335fa1e0c26c6f24031003cb2d48b81</BuildToolsCurrentRef>
<PgoDataCurrentRef>11d07e3818c16b6b43be0fc3379b9719dc0cf8b9</PgoDataCurrentRef>
</PropertyGroup>
<!-- Tests/infrastructure dependency versions. -->
<PropertyGroup>
- <MicrosoftPrivateCoreFxNETCoreAppPackageVersion>4.5.0-preview2-26324-01</MicrosoftPrivateCoreFxNETCoreAppPackageVersion>
- <MicrosoftNETCorePlatformsPackageVersion>2.1.0-preview2-26324-01</MicrosoftNETCorePlatformsPackageVersion>
- <PgoDataPackageVersion>2.1.0-release-20180228-0037</PgoDataPackageVersion>
- <MicrosoftNETCoreRuntimeCoreCLRPackageVersion>2.1.0-preview2-26324-04</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
+ <MicrosoftPrivateCoreFxNETCoreAppPackageVersion>4.5.0-preview3-26329-05</MicrosoftPrivateCoreFxNETCoreAppPackageVersion>
+ <MicrosoftNETCorePlatformsPackageVersion>2.1.0-preview3-26329-05</MicrosoftNETCorePlatformsPackageVersion>
+ <PgoDataPackageVersion>99.99.99-master-20180228-0037</PgoDataPackageVersion>
+ <MicrosoftNETCoreRuntimeCoreCLRPackageVersion>2.1.0-preview3-26329-01</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
<XunitPackageVersion>2.2.0-beta2-build3300</XunitPackageVersion>
<XunitConsoleNetcorePackageVersion>1.0.2-prerelease-00177</XunitConsoleNetcorePackageVersion>
<XunitPerformanceApiPackageVersion>1.0.0-beta-build0015</XunitPerformanceApiPackageVersion>
@@ -45,13 +45,13 @@
<!-- Scenario tests install this version of Microsoft.NetCore.App, then patch coreclr binaries via xcopy. At the moment it is
updated manually whenever breaking changes require it to move forward, but it would be nice if we could update it automatically
as we do with many of the package versions above -->
- <BaselineMicrosoftNetCoreAppPackageVersion>2.1.0-preview2-26326-03</BaselineMicrosoftNetCoreAppPackageVersion>
+ <BaselineMicrosoftNetCoreAppPackageVersion>2.1.0-preview3-26327-01</BaselineMicrosoftNetCoreAppPackageVersion>
</PropertyGroup>
<!-- Package versions used as toolsets -->
<PropertyGroup>
<FeedTasksPackage>Microsoft.DotNet.Build.Tasks.Feed</FeedTasksPackage>
- <FeedTasksPackageVersion>2.1.0-preview2-02621-01</FeedTasksPackageVersion>
+ <FeedTasksPackageVersion>2.1.0-preview3-02629-02</FeedTasksPackageVersion>
</PropertyGroup>
<!-- Package dependency verification/auto-upgrade configuration. -->
@@ -61,7 +61,7 @@
<CurrentRefXmlPath>$(MSBuildThisFileFullPath)</CurrentRefXmlPath>
</PropertyGroup>
- <!-- ILLinik.Tasks package version -->
+ <!-- ILLink.Tasks package version -->
<PropertyGroup>
<ILLinkTasksPackage>ILLink.Tasks</ILLinkTasksPackage>
<ILLinkTasksPackageVersion>0.1.5-preview-1461378</ILLinkTasksPackageVersion>
diff --git a/netci.groovy b/netci.groovy
index 6b45ff7014..2984308eff 100755
--- a/netci.groovy
+++ b/netci.groovy
@@ -56,7 +56,13 @@ class Constants {
'Fedora24',
'Tizen']
- def static crossList = ['Ubuntu', 'OSX10.12', 'CentOS7.1', 'RHEL7.2', 'Debian8.4', 'Windows_NT']
+ def static crossList = [
+ 'Ubuntu',
+ 'Debian8.4',
+ 'OSX10.12',
+ 'Windows_NT',
+ 'CentOS7.1',
+ 'RHEL7.2']
// This is a set of JIT stress modes combined with the set of variables that
// need to be set to actually enable that stress mode. The key of the map is the stress mode and
@@ -169,7 +175,7 @@ class Constants {
'Checked'
]
],
- 'Windows_NT_buildOnly': [
+ 'Windows_NT_BuildOnly': [
'x64': [
'Checked',
'Release'
@@ -178,6 +184,9 @@ class Constants {
'Checked',
'Release'
],
+ 'arm': [
+ 'Checked'
+ ],
],
'Ubuntu': [
'x64': [
@@ -185,6 +194,9 @@ class Constants {
],
'arm64': [
'Debug'
+ ],
+ 'arm': [
+ 'Checked'
]
],
'CentOS7.1': [
@@ -198,11 +210,6 @@ class Constants {
'Checked'
]
],
- 'Tizen': [
- 'arm': [
- 'Checked'
- ]
- ],
]
// A set of scenarios that are valid for arm/arm64/armlb tests run on hardware. This is a map from valid scenario name
@@ -317,17 +324,75 @@ class Constants {
]
def static validLinuxArm64Scenarios = [
- 'normal',
- 'r2r',
- 'innerloop',
- 'gcstress0x3',
- 'gcstress0xc'
+ 'innerloop',
+ 'normal',
+ 'r2r',
+ 'gcstress0x3',
+ 'gcstress0xc'
+ ]
+
+ def static validLinuxArmScenarios = [
+ 'innerloop',
+ 'normal',
+ 'r2r',
+ 'r2r_jitstress1',
+ 'r2r_jitstress2',
+ 'r2r_jitstressregs1',
+ 'r2r_jitstressregs2',
+ 'r2r_jitstressregs3',
+ 'r2r_jitstressregs4',
+ 'r2r_jitstressregs8',
+ 'r2r_jitstressregs0x10',
+ 'r2r_jitstressregs0x80',
+ 'r2r_jitstressregs0x1000',
+ 'r2r_jitminopts',
+ 'r2r_jitforcerelocs',
+ 'r2r_gcstress15',
+ 'minopts',
+ 'forcerelocs',
+ 'jitstress1',
+ 'jitstress2',
+ 'jitstressregs1',
+ 'jitstressregs2',
+ 'jitstressregs3',
+ 'jitstressregs4',
+ 'jitstressregs8',
+ 'jitstressregs0x10',
+ 'jitstressregs0x80',
+ 'jitstressregs0x1000',
+ 'jitstress2_jitstressregs1',
+ 'jitstress2_jitstressregs2',
+ 'jitstress2_jitstressregs3',
+ 'jitstress2_jitstressregs4',
+ 'jitstress2_jitstressregs8',
+ 'jitstress2_jitstressregs0x10',
+ 'jitstress2_jitstressregs0x80',
+ 'jitstress2_jitstressregs0x1000',
+ 'tailcallstress',
+ 'gcstress0x3',
+ 'gcstress0xc',
+ 'zapdisable',
+ 'heapverify1',
+ 'gcstress0xc_zapdisable',
+ 'gcstress0xc_zapdisable_jitstress2',
+ 'gcstress0xc_zapdisable_heapverify1',
+ 'gcstress0xc_jitstress1',
+ 'gcstress0xc_jitstress2',
+ 'gcstress0xc_minopts_heapverify1'
]
def static configurationList = ['Debug', 'Checked', 'Release']
// This is the set of architectures
- def static architectureList = ['arm', 'armlb', 'x86_arm_altjit', 'x64_arm64_altjit', 'arm64', 'x64', 'x86']
+ // Some of these are pseudo-architectures:
+ // armlb -- same as arm, but use the LEGACY_BACKEND JIT
+ // armem -- ARM builds/runs using an emulator. Used for Ubuntu/Ubuntu16.04/Tizen runs.
+ // x86_arm_altjit -- ARM runs on x86 using the ARM altjit
+ // x64_arm64_altjit -- ARM64 runs on x64 using the ARM64 altjit
+ def static architectureList = ['arm', 'armlb', 'armem', 'x86_arm_altjit', 'x64_arm64_altjit', 'arm64', 'x64', 'x86']
+
+ // This set of architectures that cross build on Windows and run on Windows ARM64 hardware.
+ def static armWindowsCrossArchitectureList = ['arm', 'armlb', 'arm64']
}
// **************************************************************
@@ -465,7 +530,7 @@ def static setMachineAffinity(def job, def os, def architecture, def options = n
assert os instanceof String
assert architecture instanceof String
- def armArches = ['arm', 'armlb', 'arm64']
+ def armArches = ['arm', 'armlb', 'armem', 'arm64']
def supportedArmLinuxOs = ['Ubuntu', 'Ubuntu16.04', 'Tizen']
if (!(architecture in armArches)) {
@@ -482,9 +547,9 @@ def static setMachineAffinity(def job, def os, def architecture, def options = n
// Windows_NT
//
// Arm32 (Build) -> latest-arm64
- // |-> os == "Windows_NT" && architecture == "arm" || architecture == "armlb" && options['use_arm64_build_machine'] == true
+ // |-> os == "Windows_NT" && (architecture == "arm" || architecture == "armlb") && options['use_arm64_build_machine'] == true
// Arm32 (Test) -> arm64-windows_nt
- // |-> os == "Windows_NT" && architecture == "arm" || architecture == "armlb" && options['use_arm64_build_machine'] == false
+ // |-> os == "Windows_NT" && (architecture == "arm" || architecture == "armlb") && options['use_arm64_build_machine'] == false
//
// Arm64 (Build) -> latest-arm64
// |-> os == "Windows_NT" && architecture == "arm64" && options['use_arm64_build_machine'] == true
@@ -493,10 +558,15 @@ def static setMachineAffinity(def job, def os, def architecture, def options = n
//
// Ubuntu
//
- // Arm32 (Build) -> arm-cross-latest
- // |-> os in supportedArmLinuxOs && architecture == "arm" || architecture == "armlb"
- // Arm32 (Test) -> NYI Arch not supported
- // |->
+ // Arm32 emulator (Build, Test) -> arm-cross-latest
+ // |-> os in supportedArmLinuxOs && (architecture == "armem")
+ //
+ // Arm32 hardware (Flow) -> Ubuntu 16.04 latest-or-auto (don't use limited arm hardware)
+ // |-> os == "Ubuntu" && (architecture == "arm") && options['is_flow_job'] == true
+ // Arm32 hardware (Build) -> Ubuntu 16.04 latest-or-auto
+ // |-> os == "Ubuntu" && (architecture == "arm") && options['is_build_job'] == true
+ // Arm32 hardware (Test) -> ubuntu.1404.arm32.open
+ // |-> os == "Ubuntu" && (architecture == "arm")
//
// Arm64 (Build) -> arm64-cross-latest
// |-> os != "Windows_NT" && architecture == "arm64" && options['is_build_only'] == true
@@ -508,7 +578,7 @@ def static setMachineAffinity(def job, def os, def architecture, def options = n
// This has to be a arm arch
assert architecture in armArches
if (os == "Windows_NT") {
- // Arm(64) Windows jobs share the same machines for now
+ // arm32/arm64 Windows jobs share the same machines for now
def isBuild = options['use_arm64_build_machine'] == true
if (isBuild == true) {
@@ -520,22 +590,88 @@ def static setMachineAffinity(def job, def os, def architecture, def options = n
assert os != 'Windows_NT'
assert os in supportedArmLinuxOs
- if (architecture == 'arm' || architecture == 'armlb') {
- Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
- } else {
- // Arm64 Linux
- if (options['is_build_only'] == true) {
+ if (architecture == 'arm64') {
+ if ((options != null) && (options['is_build_only'] == true)) {
+ // Arm64 Linux build machine
Utilities.setMachineAffinity(job, os, 'arm64-cross-latest')
} else {
- // Arm64 Test Machines
- if (options['large_pages'] == false) {
- Utilities.setMachineAffinity(job, os, 'arm64-small-page-size')
- } else {
+ // Arm64 Linux test machines
+ if ((options != null) && (options['large_pages'] == true)) {
Utilities.setMachineAffinity(job, os, 'arm64-huge-page-size')
+ } else {
+ Utilities.setMachineAffinity(job, os, 'arm64-small-page-size')
}
}
}
+ else if (architecture == 'armem') {
+ // arm emulator (Ubuntu/Ubuntu16.04/Tizen). Build and test on same machine,
+ // using Docker.
+ Utilities.setMachineAffinity(job, 'Ubuntu', 'arm-cross-latest')
+ }
+ else {
+ // arm Ubuntu on hardware.
+ assert (architecture == 'arm') && (os == 'Ubuntu')
+ def isFlow = (options != null) && (options['is_flow_job'] == true)
+ def isBuild = (options != null) && (options['is_build_job'] == true)
+ if (isFlow || isBuild) {
+ // arm Ubuntu build machine. Build uses docker, so the actual host OS is not
+ // very important. Therefore, use latest or auto. Flow jobs don't need to use
+ // arm hardware.
+ Utilities.setMachineAffinity(job, 'Ubuntu16.04', 'latest-or-auto')
+ } else {
+ // arm Ubuntu test machine
+ // There is no tag (like, e.g., "arm-latest") for this, so don't call
+ // Utilities.setMachineAffinity. Just add the machine affinity
+ // manually. We specify the Helix queue name here.
+ job.with {
+ label('ubuntu.1404.arm32.open')
+ }
+ }
+ }
+ }
+}
+
+// setJobMachineAffinity: compute the machine affinity options for a job,
+// then set the job with those affinity options.
+def static setJobMachineAffinity(def architecture, def os, def isBuildJob, def isTestJob, def isFlowJob, def job)
+{
+ assert (isBuildJob && !isTestJob && !isFlowJob) ||
+ (!isBuildJob && isTestJob && !isFlowJob) ||
+ (!isBuildJob && !isTestJob && isFlowJob)
+
+ def affinityOptions = null
+ def affinityArchitecture = architecture
+
+ if (os == "Windows_NT") {
+ if (architecture in Constants.armWindowsCrossArchitectureList) {
+ if (isBuildJob) {
+ affinityOptions = [ "use_arm64_build_machine" : true ]
+ } else if (isTestJob) {
+ affinityOptions = [ "use_arm64_build_machine" : false ]
+ } else if (isFlowJob) {
+ // For the flow jobs set the machine affinity as x64
+ affinityArchitecture = 'x64'
+ }
+ }
+ }
+ else {
+ if (architecture == 'arm64') {
+ if (isBuildJob) {
+ affinityOptions = ['is_build_only': true]
+ } else if (isTestJob) {
+ affinityOptions = [ "large_pages" : false ]
+ }
+ }
+ else if (architecture == 'arm') {
+ if (isBuildJob) {
+ affinityOptions = ['is_build_job': true]
+ } else if (isFlowJob) {
+ affinityOptions = ['is_flow_job': true]
+ }
+ }
}
+
+ setMachineAffinity(job, os, affinityArchitecture, affinityOptions)
}
def static isGCStressRelatedTesting(def scenario) {
@@ -599,7 +735,7 @@ def static isArmWindowsScenario(def scenario) {
def static isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly) {
if (isBuildOnly == true) {
- os = 'Windows_NT_buildOnly'
+ os = 'Windows_NT_BuildOnly'
}
def validOsPrTriggerArchConfigs = Constants.prTriggeredValidInnerLoopCombos[os]
@@ -655,9 +791,14 @@ def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, is
else if (isGcReliabilityFramework(scenario)) {
timeout = 1440
}
- else if (architecture == 'arm' || architecture == 'armlb' || architecture == 'arm64') {
+ else if (architecture == 'armlb' || architecture == 'armem' || architecture == 'arm64') {
timeout = 240
}
+
+ if (architecture == 'arm') {
+ // ARM32 machines are particularly slow.
+ timeout += 120
+ }
}
if (configuration == 'Debug') {
@@ -665,6 +806,11 @@ def static setJobTimeout(newJob, isPR, architecture, configuration, scenario, is
timeout += 60
}
+ if (architecture == 'x86_arm_altjit' || architecture == 'x64_arm64_altjit') {
+ // AltJit runs compile all methods twice.
+ timeout *= 2
+ }
+
// If we've changed the timeout from the default, set it in the job.
if (timeout != 120) {
@@ -797,8 +943,11 @@ def static isNeedDocker(def architecture, def os, def isBuild) {
if (architecture == 'x86' && os == 'Ubuntu') {
return true
}
+ else if (architecture == 'armem') {
+ return true
+ }
else if (architecture == 'arm') {
- if (os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen') {
+ if (os == 'Ubuntu') {
return true
}
}
@@ -817,7 +966,7 @@ def static getDockerImageName(def architecture, def os, def isBuild) {
if (architecture == 'x86' && os == 'Ubuntu') {
return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
}
- else if (architecture == 'arm') {
+ else if (architecture == 'armem') {
if (os == 'Ubuntu') {
return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20172211042239"
}
@@ -828,6 +977,11 @@ def static getDockerImageName(def architecture, def os, def isBuild) {
return "hqueue/dotnetcore:ubuntu1404_cross_prereqs_v4-tizen_rootfs"
}
}
+ else if (architecture == 'arm') {
+ if (os == 'Ubuntu') {
+ return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-e435274-20180323032140"
+ }
+ }
}
else {
if (architecture == 'x86' && os == 'Ubuntu') {
@@ -838,6 +992,22 @@ def static getDockerImageName(def architecture, def os, def isBuild) {
assert false
}
+
+// We have a limited amount of some hardware. For these, scale back the periodic testing we do.
+def static jobRequiresLimitedHardware(def architecture, def os) {
+ if (((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) && (os == 'Windows_NT')) {
+ // These test jobs require ARM64 hardware
+ return true
+ }
+ else if ((architecture == 'arm') && (os == 'Ubuntu')) {
+ // These test jobs require Linux/arm32 hardware
+ return true
+ }
+ else {
+ return false
+ }
+}
+
// Calculates the name of the build job based on some typical parameters.
//
def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
@@ -874,7 +1044,7 @@ def static getJobName(def configuration, def architecture, def os, def scenario,
baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + "small_page_size"
}
break
- case 'arm':
+ case 'armem':
// These are cross builds
if (os == 'Tizen') {
// ABI: softfp
@@ -885,6 +1055,7 @@ def static getJobName(def configuration, def architecture, def os, def scenario,
}
break
case 'armlb':
+ case 'arm':
baseName = architecture.toLowerCase() + '_cross_' + configuration.toLowerCase() + '_' + os.toLowerCase()
break
case 'x86':
@@ -912,6 +1083,12 @@ def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def
}
}
+ if ((architecture == 'arm') && (os != 'Windows_NT') && isGCStressRelatedTesting(scenario)) {
+ // Non-Windows Arm GCStress jobs currently don't get cron or push triggers (until they are functional).
+ // See https://github.com/dotnet/coreclr/issues/17241.
+ return
+ }
+
// Check scenario.
switch (scenario) {
case 'innerloop':
@@ -928,6 +1105,19 @@ def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def
}
break
case 'arm':
+ if (os == 'Windows_NT') {
+ addGithubPushTriggerHelper(job)
+ }
+ else {
+ // Currently no push triggers, with limited arm Linux hardware.
+ // TODO: If we have enough machine capacity, add some arm Linux push triggers.
+ assert os == 'Ubuntu'
+ if (isFlowJob) {
+ addPeriodicTriggerHelper(job, '@daily')
+ }
+ }
+ break
+ case 'armem':
case 'armlb':
case 'x86_arm_altjit':
case 'x64_arm64_altjit':
@@ -1102,35 +1292,34 @@ def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def
case 'corefx_jitstressregs0x80':
case 'corefx_jitstressregs0x1000':
case 'zapdisable':
- if (os != 'CentOS7.1' && !(os in bidailyCrossList)) {
- assert (os == 'Windows_NT') || (os in Constants.crossList)
- if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
- if (os == 'Windows_NT') {
- // We don't have enough ARM64 machines to run these more frequently than weekly.
- addPeriodicTriggerHelper(job, '@weekly')
- }
- }
- else {
- addPeriodicTriggerHelper(job, '@daily')
- }
+ if (os == 'CentOS7.1') {
+ break
+ }
+ if (os in bidailyCrossList) {
+ break
+ }
+ assert (os == 'Windows_NT') || (os in Constants.crossList)
+ if (jobRequiresLimitedHardware(architecture, os)) {
+ addPeriodicTriggerHelper(job, '@weekly')
+ }
+ else {
+ addPeriodicTriggerHelper(job, '@daily')
}
break
case 'heapverify1':
case 'gcstress0x3':
- if (os != 'CentOS7.1' && !(os in bidailyCrossList)) {
- assert (os == 'Windows_NT') || (os in Constants.crossList)
- if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
- if (os == 'Windows_NT') {
- // We don't have enough ARM64 machines to run these more frequently than weekly.
- addPeriodicTriggerHelper(job, '@weekly')
- }
- // TODO: Add once external email sending is available again
- // addEmailPublisher(job, 'dotnetonarm64@microsoft.com')
- }
- else {
- addPeriodicTriggerHelper(job, '@weekly')
- }
+ if (os == 'CentOS7.1') {
+ break
+ }
+ if (os in bidailyCrossList) {
+ break
}
+ if ((architecture == 'arm64') && (os != 'Windows_NT')) {
+ // TODO: should we have cron jobs for arm64 Linux GCStress?
+ break
+ }
+ assert (os == 'Windows_NT') || (os in Constants.crossList)
+ addPeriodicTriggerHelper(job, '@weekly')
break
case 'gcstress0xc':
case 'gcstress0xc_zapdisable':
@@ -1139,21 +1328,22 @@ def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def
case 'gcstress0xc_jitstress1':
case 'gcstress0xc_jitstress2':
case 'gcstress0xc_minopts_heapverify1':
- // GCStress=C is currently not supported on OS X
- if (os != 'CentOS7.1' && os != 'OSX10.12' && !(os in bidailyCrossList)) {
- assert (os == 'Windows_NT') || (os in Constants.crossList)
- if ((architecture == 'arm64') || (architecture == 'arm') || (architecture == 'armlb')) {
- if (os == 'Windows_NT') {
- // We don't have enough ARM64 machines to run these more frequently than weekly.
- addPeriodicTriggerHelper(job, '@weekly')
- }
- // TODO: Add once external email sending is available again
- // addEmailPublisher(job, 'dotnetonarm64@microsoft.com')
- }
- else {
- addPeriodicTriggerHelper(job, '@weekly')
- }
+ if (os == 'CentOS7.1') {
+ break
+ }
+ if (os == 'OSX10.12') {
+ // GCStress=C is currently not supported on OS X
+ break
+ }
+ if (os in bidailyCrossList) {
+ break
}
+ if ((architecture == 'arm64') && (os != 'Windows_NT')) {
+ // TODO: should we have cron jobs for arm64 Linux GCStress?
+ break
+ }
+ assert (os == 'Windows_NT') || (os in Constants.crossList)
+ addPeriodicTriggerHelper(job, '@weekly')
break
case 'illink':
@@ -1209,13 +1399,12 @@ def static addTriggers(def job, def branch, def isPR, def architecture, def os,
'BruceForstall',
'CarolEidt',
'cmckinsey',
+ 'echesakovMSFT',
'erozenfeld',
'janvorli',
'jashook',
'JosephTremoulet',
'pgodeq',
- 'pgavlin',
- 'rartemev',
'russellhadley',
'RussKeldorph',
'sandreenko',
@@ -1481,82 +1670,88 @@ def static addTriggers(def job, def branch, def isPR, def architecture, def os,
}
break
-
// editor brace matching: }
- case 'armlb':
- case 'arm': // editor brace matching: {
+
+ case 'armem': // editor brace matching: {
+ job.with {
+ publishers {
+ azureVMAgentPostBuildAction {
+ agentPostBuildAction('Delete agent if the build was not successful (when idle).')
+ }
+ }
+ }
+
switch (os) {
case 'Ubuntu':
case 'Ubuntu16.04':
- if (architecture == 'armlb') { // No arm legacy backend testing for Ubuntu
- break
- }
-
assert scenario != 'innerloop'
- job.with {
- publishers {
- azureVMAgentPostBuildAction {
- agentPostBuildAction('Delete agent if the build was not successful (when idle).')
- }
- }
- }
Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
- "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
+ "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
break
case 'Tizen':
- if (architecture == 'armlb') { // No arm legacy backend testing for Tizen armel
- break
- }
-
architecture = 'armel'
- job.with {
- publishers {
- azureVMAgentPostBuildAction {
- agentPostBuildAction('Delete agent if the build was not successful (when idle).')
- }
- }
+
+ assert scenario != 'innerloop'
+ Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
+ "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
+ break
+ }
+
+ break
+ // editor brace matching: }
+
+ case 'armlb':
+ case 'arm': // editor brace matching: {
+
+ // Triggers on the non-flow jobs aren't necessary
+ if (!isFlowJob) {
+ break
+ }
+
+ // Set up a private trigger
+ def contextString = "${os} ${architecture} Cross ${configuration}"
+ def triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
+ if (scenario == 'innerloop') {
+ contextString += " Innerloop"
+ triggerString += "\\W+Innerloop"
+ }
+ else {
+ contextString += " ${scenario}"
+ triggerString += "\\W+${scenario}"
+ }
+
+ if (configuration == 'Debug') {
+ contextString += " Build"
+ triggerString += "\\W+Build"
+ } else {
+ contextString += " Build and Test"
+ triggerString += "\\W+Build and Test"
+ }
+
+ triggerString += ".*"
+
+ switch (os) {
+ case 'Ubuntu':
+ if (architecture == 'armlb') { // No arm legacy backend testing for Ubuntu
+ break
}
if (scenario == 'innerloop') {
if (configuration == 'Checked') {
- Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Innerloop Build and Test")
+ Utilities.addGithubPRTriggerForBranch(job, branch, contextString)
}
}
else {
- Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Cross ${configuration} Build",
- "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}\\W+Build.*")
+ Utilities.addGithubPRTriggerForBranch(job, branch, contextString, triggerString)
}
break
case 'Windows_NT':
- // Triggers on the non-flow jobs aren't necessary here
- if (!isFlowJob) {
+ if (architecture == "armlb") {
+ // Disable armlb windows jobs
break
}
-
- // Set up a private trigger
- def contextString = "${os} ${architecture} Cross ${configuration}"
- def triggerString = "(?i).*test\\W+${os}\\W+${architecture}\\W+Cross\\W+${configuration}"
- if (scenario == 'innerloop') {
- contextString += " Innerloop"
- triggerString += "\\W+Innerloop"
- }
- else {
- contextString += " ${scenario}"
- triggerString += "\\W+${scenario}"
- }
-
- if (configuration == 'Debug') {
- contextString += " Build"
- triggerString += "\\W+Build"
- } else {
- contextString += " Build and Test"
- triggerString += "\\W+Build and Test"
- }
-
- triggerString += ".*"
-
switch (scenario) {
case 'innerloop':
// Only Checked is an innerloop trigger.
@@ -1771,7 +1966,7 @@ def static addTriggers(def job, def branch, def isPR, def architecture, def os,
}
def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR, def architecture, def configuration, def os, def isBuildOnly) {
- def buildCommands = [];
+ def buildCommands = []
def osGroup = getOSGroup(os)
def lowerConfiguration = configuration.toLowerCase()
@@ -1780,9 +1975,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
priority = '0'
}
- setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
-
- def enableCorefxTesting = isCoreFxScenario(scenario)
+ def doCoreFxTesting = isCoreFxScenario(scenario)
// Calculate the build steps, archival, and xunit results
switch (os) {
@@ -1811,7 +2004,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
buildCommands += "tests\\scripts\\build_illink.cmd clone ${arch}"
}
- // If it is a release build for windows, ensure PGO is used, else fail the build
+ // If it is a release build for Windows, ensure PGO is used, else fail the build.
if ((lowerConfiguration == 'release') &&
(scenario in Constants.basicScenarios) &&
(architecture != 'x86_arm_altjit') &&
@@ -1820,7 +2013,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
buildOpts += ' -enforcepgo'
}
- if (enableCorefxTesting) {
+ if (doCoreFxTesting) {
buildOpts += ' skiptests';
} else {
buildOpts += " -priority=${priority}"
@@ -1918,7 +2111,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
runtestArguments = "${lowerConfiguration} ${arch} ${testOpts}"
- if (enableCorefxTesting) {
+ if (doCoreFxTesting) {
def workspaceRelativeFxRoot = "_/fx"
def absoluteFxRoot = "%WORKSPACE%\\_\\fx"
@@ -1939,15 +2132,15 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
else {
buildCommands += "tests\\runtest.cmd ${runtestArguments}"
}
- }
+ } // end if (!isBuildOnly)
- if (!enableCorefxTesting) {
+ if (!doCoreFxTesting) {
// Run the rest of the build
// Build the mscorlib for the other OS's
buildCommands += "build.cmd ${lowerConfiguration} ${arch} linuxmscorlib"
buildCommands += "build.cmd ${lowerConfiguration} ${arch} osxmscorlib"
- if (arch == "x64") {
+ if (arch == 'x64') {
buildCommands += "build.cmd ${lowerConfiguration} arm64 linuxmscorlib"
}
@@ -1978,9 +2171,6 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
case 'arm':
assert isArmWindowsScenario(scenario)
- def machineAffinityOptions = ['use_arm64_build_machine' : true]
- setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
-
def buildArchitecture = 'arm'
def buildOpts = ''
@@ -1991,7 +2181,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
buildOpts += ' -crossgenaltjit legacyjit.dll'
}
- if (enableCorefxTesting) {
+ if (doCoreFxTesting) {
// We shouldn't need to build the tests. However, run-corefx-tests.py currently depends on having the restored corefx
// package available, to determine the correct corefx version git commit hash, and we need to build the tests before
// running "tests\\runtest.cmd GenerateLayoutOnly". So build the pri-0 tests to make this happen.
@@ -2005,7 +2195,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
// This is now a build only job. Do not run tests. Use the flow job.
buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${buildArchitecture} ${buildOpts}"
- if (enableCorefxTesting) {
+ if (doCoreFxTesting) {
assert isBuildOnly
assert architecture == 'arm'
@@ -2046,9 +2236,6 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
case 'arm64':
assert isArmWindowsScenario(scenario)
- def machineAffinityOptions = ['use_arm64_build_machine' : true]
- setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
-
// This is now a build only job. Do not run tests. Use the flow job.
buildCommands += "set __TestIntermediateDir=int&&build.cmd ${lowerConfiguration} ${architecture} toolset_dir C:\\ats2 -priority=${priority}"
@@ -2065,7 +2252,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
break
}
break
- // editor brace matching: }
+ // end case 'Windows_NT'; editor brace matching: }
case 'Ubuntu':
case 'Ubuntu16.04':
case 'Ubuntu16.10':
@@ -2100,7 +2287,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
buildCommands += "./tests/scripts/build_illink.sh --clone --arch=${architecture}"
}
- if (!enableCorefxTesting) {
+ if (!doCoreFxTesting) {
// We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
// only on supported OS platforms.
def bootstrapRid = Utilities.getBoostrapPublishRid(os)
@@ -2143,7 +2330,7 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
}
break
case 'arm64':
- if (!enableCorefxTesting) {
+ if (!doCoreFxTesting) {
buildCommands += "ROOTFS_DIR=/opt/arm64-xenial-rootfs ./build.sh verbose ${lowerConfiguration} ${architecture} cross clang3.8"
// HACK -- Arm64 does not have corefx jobs yet.
@@ -2156,19 +2343,19 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
}
break
- case 'arm':
- // Cross builds for ARM runs on Ubuntu, Ubuntu16.04 and Tizen currently
+ case 'armem':
+ // Emulator cross builds for ARM runs on Ubuntu, Ubuntu16.04 and Tizen currently
assert (os == 'Ubuntu') || (os == 'Ubuntu16.04') || (os == 'Tizen')
// default values for Ubuntu
- def arm_abi="arm"
- def linuxCodeName="trusty"
+ def arm_abi = "arm"
+ def linuxCodeName = "trusty"
if (os == 'Ubuntu16.04') {
- linuxCodeName="xenial"
+ linuxCodeName = "xenial"
}
else if (os == 'Tizen') {
- arm_abi="armel"
- linuxCodeName="tizen"
+ arm_abi = "armel"
+ linuxCodeName = "tizen"
}
// Unzip the Windows test binaries first. Exit with 0
@@ -2199,6 +2386,40 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
// Basic archiving of the build, no pal tests
Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.dylib,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
break
+ case 'arm':
+ // Non-Windows ARM cross builds on hardware run on Ubuntu only
+ assert (os == 'Ubuntu')
+
+ // Add some useful information to the log file. Ignore return codes.
+ buildCommands += "uname -a || true"
+
+ // Cross build the Ubuntu/arm product using docker with a docker image that contains the correct
+ // Ubuntu cross-compilation toolset (running on a Ubuntu x64 host).
+
+ def dockerImage = getDockerImageName(architecture, os, true)
+ def dockerCmd = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} -e ROOTFS_DIR=/crossrootfs/arm ${dockerImage} "
+
+ buildCommands += "${dockerCmd}\${WORKSPACE}/build.sh ${lowerConfiguration} ${architecture} cross"
+
+ // Then, using the same docker image, generate the CORE_ROOT layout using build-test.sh to
+ // download the appropriate CoreFX packages.
+ // Note that docker should not be necessary here, for the "generatelayoutonly" case, but we use it
+ // just to be consistent with the "build.sh" case -- so both are run with the same environment.
+
+ buildCommands += "${dockerCmd}\${WORKSPACE}/build-test.sh ${lowerConfiguration} ${architecture} cross generatelayoutonly"
+
+ // ZIP up for the test job (created in the flow job code):
+ // (1) the built CORE_ROOT, /home/user/coreclr/bin/tests/Linux.arm.Checked/Tests/Core_Root,
+ // used by runtest.sh as the "--coreOverlayDir" argument.
+ // (2) the native parts of the test build: /home/user/coreclr/bin/obj/Linux.arm.Checked/tests,
+ // used by runtest.sh as the "--testNativeBinDir" argument.
+
+ // These commands are assumed to be run from the root of the workspace.
+ buildCommands += "zip -r coreroot.${lowerConfiguration}.zip ./bin/tests/Linux.arm.${configuration}/Tests/Core_Root"
+ buildCommands += "zip -r testnativebin.${lowerConfiguration}.zip ./bin/obj/Linux.arm.${configuration}/tests"
+
+ Utilities.addArchival(newJob, "coreroot.${lowerConfiguration}.zip,testnativebin.${lowerConfiguration}.zip", "")
+ break
default:
println("Unknown architecture: ${architecture}");
assert false
@@ -2215,6 +2436,235 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
return buildCommands
}
+// Determine if we should generate a job for the given parameters. This is for non-flow jobs: either build and test, or build only.
+// Returns true if the job should be generated.
+def static shouldGenerateJob(def scenario, def isPR, def architecture, def configuration, def os, def isBuildOnly)
+{
+ // The "innerloop" (Pri-0 testing) scenario is only available as PR triggered.
+ // All other scenarios do Pri-1 testing.
+ if (scenario == 'innerloop' && !isPR) {
+ return false
+ }
+
+ // Tizen is only supported for armem architecture
+ if (os == 'Tizen' && architecture != 'armem') {
+ return false
+ }
+
+ // Filter based on architecture.
+
+ switch (architecture) {
+ case 'arm64':
+ case 'arm':
+ if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
+ return false
+ }
+ break
+ case 'armem':
+ if ((os != 'Ubuntu') && (os != 'Ubuntu16.04') && (os != 'Tizen')) {
+ return false
+ }
+ break
+ case 'armlb':
+ // Do not create armlb jobs
+ return false
+ case 'x86_arm_altjit':
+ case 'x64_arm64_altjit':
+ if (os != 'Windows_NT') {
+ return false
+ }
+ break
+ case 'x86':
+ if ((os != 'Windows_NT') && (os != 'Ubuntu')) {
+ return false
+ }
+ break
+ case 'x64':
+ // Everything implemented
+ break
+ default:
+ println("Unknown architecture: ${architecture}")
+ assert false
+ break
+ }
+
+ // Which (Windows) build only jobs are required?
+
+ def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
+
+ if (isBuildOnly) {
+ switch (architecture) {
+ case 'arm':
+ // We use build only jobs for Windows arm cross-compilation corefx testing, so we need to generate builds for that.
+ if (!isCoreFxScenario(scenario)) {
+ return false
+ }
+ break
+ case 'x64':
+ case 'x86':
+ if (!isNormalOrInnerloop) {
+ return false
+ }
+ break
+ default:
+ return false
+ }
+ }
+
+ // Filter based on scenario.
+
+ if (isJitStressScenario(scenario)) {
+ if (configuration != 'Checked') {
+ return false
+ }
+
+ def isEnabledOS = (os == 'Windows_NT') || (os == 'Ubuntu' && architecture == 'arm') || (os == 'Ubuntu' && isCoreFxScenario(scenario))
+ if (!isEnabledOS) {
+ return false
+ }
+
+ switch (architecture) {
+ case 'x64':
+ case 'x86_arm_altjit':
+ case 'x64_arm64_altjit':
+ break
+
+ case 'x86':
+ // x86 ubuntu: no stress modes
+ if (os == 'Ubuntu') {
+ return false
+ }
+ break
+
+ case 'arm':
+ // We use build only jobs for Windows arm cross-compilation corefx testing, so we need to generate builds for that.
+ if (! (isBuildOnly && isCoreFxScenario(scenario)) ) {
+ return false
+ }
+ break
+
+ default:
+ // arm64, armlb: stress is handled through flow jobs.
+ // armem: no stress jobs for ARM emulator.
+ return false
+ }
+ }
+ else if (isR2RScenario(scenario)) {
+ if (os != 'Windows_NT') {
+ return false
+ }
+ // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
+ if ((configuration != 'Checked') && isR2RStressScenario(scenario)) {
+ return false
+ }
+ }
+ else {
+ // Skip scenarios
+ switch (scenario) {
+ case 'ilrt':
+ // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
+ // the default scenario build
+ if (os != 'Windows_NT') {
+ return false
+ }
+ // Only x64 for now
+ if (architecture != 'x64') {
+ return false
+ }
+ // Release only
+ if (configuration != 'Release') {
+ return false
+ }
+ break
+ case 'jitdiff':
+ if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
+ return false
+ }
+ if (architecture != 'x64') {
+ return false
+ }
+ if (configuration != 'Checked') {
+ return false
+ }
+ break
+ case 'longgc':
+ case 'gcsimulator':
+ if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
+ return false
+ }
+ if (architecture != 'x64') {
+ return false
+ }
+ if (configuration != 'Release') {
+ return false
+ }
+ break
+ case 'gc_reliability_framework':
+ case 'standalone_gc':
+ if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
+ return false
+ }
+
+ if (architecture != 'x64') {
+ return false
+ }
+
+ if (configuration != 'Release' && configuration != 'Checked') {
+ return false
+ }
+ break
+ // We only run Windows and Ubuntu x64 Checked for formatting right now
+ case 'formatting':
+ if (os != 'Windows_NT' && os != 'Ubuntu') {
+ return false
+ }
+ if (architecture != 'x64') {
+ return false
+ }
+ if (configuration != 'Checked') {
+ return false
+ }
+ break
+ case 'illink':
+ if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
+ return false
+ }
+ if (architecture != 'x64' && architecture != 'x86') {
+ return false
+ }
+ break
+ case 'normal':
+ // Nothing skipped
+ break
+ case 'innerloop':
+ if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly)) {
+ return false
+ }
+ break
+ default:
+ println("Unknown scenario: ${scenario}")
+ assert false
+ break
+ }
+ }
+
+ // For altjit, don't do any scenarios that don't change compilation. That is, scenarios that only change
+ // runtime behavior, not compile-time behavior, are not interesting.
+ switch (architecture) {
+ case 'x86_arm_altjit':
+ case 'x64_arm64_altjit':
+ if (isGCStressRelatedTesting(scenario)) {
+ return false
+ }
+ break
+ default:
+ break
+ }
+
+ // The job was not filtered out, so we should generate it!
+ return true
+}
+
Constants.allScenarios.each { scenario ->
[true, false].each { isPR ->
Constants.architectureList.each { architecture ->
@@ -2228,213 +2678,11 @@ Constants.allScenarios.each { scenario ->
os = 'Windows_NT'
}
- // Tizen is only supported for arm architecture
- if (os == 'Tizen' && architecture != 'arm') {
+ if (!shouldGenerateJob(scenario, isPR, architecture, configuration, os, isBuildOnly)) {
return
}
- // Skip totally unimplemented (in CI) configurations.
- switch (architecture) {
- case 'arm64':
- if (os == 'Ubuntu16.04') {
- os = 'Ubuntu'
- }
-
- // Windows and Ubuntu only
- if ((os != 'Windows_NT' && os != 'Ubuntu') || isBuildOnly) {
- return
- }
- break
- case 'arm':
- if ((os != 'Ubuntu') && (os != 'Ubuntu16.04') && (os != 'Tizen') && (os != 'Windows_NT')) {
- return
- }
- break
- case 'armlb':
- if (os != 'Windows_NT') {
- return
- }
- break
- case 'x86':
- if ((os != 'Ubuntu') && (os != 'Windows_NT')) {
- return
- }
- break
- case 'x86_arm_altjit':
- case 'x64_arm64_altjit':
- if (os != 'Windows_NT') {
- return
- }
- break
- case 'x64':
- // Everything implemented
- break
- default:
- println("Unknown architecture: ${architecture}")
- assert false
- break
- }
-
- // Skip scenarios (blanket skipping for jit stress modes, which are good most everywhere
- // with checked builds)
- if (isJitStressScenario(scenario)) {
- if (configuration != 'Checked') {
- return
- }
-
- // Since these are just execution time differences,
- // skip platforms that don't execute the tests here (Windows_NT only)
- def isEnabledOS = (os == 'Windows_NT') || (os == 'Ubuntu' && isCoreFxScenario(scenario))
- if (!isEnabledOS) {
- return
- }
-
- switch (architecture) {
- case 'x64':
- case 'x86':
- case 'x86_arm_altjit':
- case 'x64_arm64_altjit':
- // x86 ubuntu: default only
- if ((os == 'Ubuntu') && (architecture == 'x86')) {
- return
- }
- if (isBuildOnly) {
- return
- }
- break
-
- case 'arm':
- // We use build only jobs for Windows arm cross-compilation corefx testing, so we need to generate builds for that.
- if (!isBuildOnly || !isCoreFxScenario(scenario)) {
- return
- }
- break
-
- default:
- // arm64, armlb: stress is handled through flow jobs.
- return
- }
- }
- else if (isR2RScenario(scenario)) {
- if (os != 'Windows_NT') {
- return
- }
- // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
- if ((configuration != 'Checked') && isR2RStressScenario(scenario)) {
- return
- }
- }
- else {
- // Skip scenarios
- switch (scenario) {
- case 'ilrt':
- // The ilrt build isn't necessary except for Windows_NT2003. Non-Windows NT uses
- // the default scenario build
- if (os != 'Windows_NT') {
- return
- }
- // Only x64 for now
- if (architecture != 'x64') {
- return
- }
- // Release only
- if (configuration != 'Release') {
- return
- }
- break
- case 'jitdiff':
- if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
- return
- }
- if (architecture != 'x64') {
- return
- }
- if (configuration != 'Checked') {
- return
- }
- break
- case 'longgc':
- case 'gcsimulator':
- if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
- return
- }
- if (architecture != 'x64') {
- return
- }
- if (configuration != 'Release') {
- return
- }
- break
- case 'gc_reliability_framework':
- case 'standalone_gc':
- if (os != 'Windows_NT' && os != 'Ubuntu' && os != 'OSX10.12') {
- return
- }
-
- if (architecture != 'x64') {
- return
- }
-
- if (configuration != 'Release' && configuration != 'Checked') {
- return
- }
- break
- // We only run Windows and Ubuntu x64 Checked for formatting right now
- case 'formatting':
- if (os != 'Windows_NT' && os != 'Ubuntu') {
- return
- }
- if (architecture != 'x64') {
- return
- }
- if (configuration != 'Checked') {
- return
- }
- if (isBuildOnly) {
- return
- }
- break
- case 'illink':
- if (os != 'Windows_NT' && (os != 'Ubuntu' || architecture != 'x64')) {
- return
- }
- if (architecture != 'x64' && architecture != 'x86') {
- return
- }
- if (isBuildOnly) {
- return
- }
- break
- case 'normal':
- // Nothing skipped
- break
- case 'innerloop':
- if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, isBuildOnly)) {
- return
- }
- break
- default:
- println("Unknown scenario: ${scenario}")
- assert false
- break
- }
- }
-
- // For altjit, don't do any scenarios that don't change compilation. That is, scenarios that only change
- // runtime behavior, not compile-time behavior, are not interesting.
- switch (architecture) {
- case 'x86_arm_altjit':
- case 'x64_arm64_altjit':
- if (isGCStressRelatedTesting(scenario)) {
- return
- }
- break
- default:
- break
- }
-
// Calculate names
- def lowerConfiguration = configuration.toLowerCase()
def jobName = getJobName(configuration, architecture, os, scenario, isBuildOnly)
def folderName = getJobFolder(scenario)
@@ -2442,23 +2690,59 @@ Constants.allScenarios.each { scenario ->
def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folderName)) {}
addToViews(newJob, isPR, architecture, os)
- def machineAffinityOptions = null
-
- if (os != 'Windows_NT') {
- machineAffinityOptions = architecture == 'arm64' ? ['is_build_only': true] : null
- }
- else {
- machineAffinityOptions = (architecture == 'arm' || architecture == 'armlb' || architecture == 'arm64') ? ['use_arm64_build_machine': false] : null
- }
-
- setMachineAffinity(newJob, os, architecture, machineAffinityOptions)
+ setJobMachineAffinity(architecture, os, true, false, false, newJob) // isBuildJob = true, isTestJob = false, isFlowJob = false
- // Add all the standard options
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
addTriggers(newJob, branch, isPR, architecture, os, configuration, scenario, false, isBuildOnly) // isFlowJob==false
+ setJobTimeout(newJob, isPR, architecture, configuration, scenario, isBuildOnly)
+
+ // Copy Windows build test binaries and corefx build artifacts for Linux cross build for armem.
+ // We don't use a flow job for this, but we do depend on there being existing builds with these
+ // artifacts produced.
+ if (architecture == 'armem' && (os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen')) {
+ // Define the Windows Tests and Corefx build job names
+ def lowerConfiguration = configuration.toLowerCase()
+ def WindowsTestsName = projectFolder + '/' +
+ Utilities.getFullJobName(project,
+ getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'normal', true),
+ false)
+ def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
+ Utilities.getFolderName(branch)
+
+ def arm_abi = 'arm'
+ def corefx_os = 'linux'
+ if (os == 'Tizen') {
+ arm_abi = 'armel'
+ corefx_os = 'tizen'
+ }
+
+ // Let's use release CoreFX to test checked CoreCLR,
+ // because we do not generate checked CoreFX in CoreFX CI yet.
+ def corefx_lowerConfiguration = lowerConfiguration
+ if (lowerConfiguration == 'checked') {
+ corefx_lowerConfiguration = 'release'
+ }
+
+ // Copy the Windows test binaries and the Corefx build binaries
+ newJob.with {
+ steps {
+ copyArtifacts(WindowsTestsName) {
+ includePatterns('bin/tests/tests.zip')
+ buildSelector {
+ latestSuccessful(true)
+ }
+ }
+ copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
+ includePatterns('bin/build.tar.gz')
+ buildSelector {
+ latestSuccessful(true)
+ }
+ }
+ } // steps
+ } // newJob.with
+ }
def buildCommands = calculateBuildCommands(newJob, scenario, branch, isPR, architecture, configuration, os, isBuildOnly)
- def osGroup = getOSGroup(os)
newJob.with {
steps {
@@ -2468,52 +2752,11 @@ Constants.allScenarios.each { scenario ->
}
}
else {
- // Setup corefx and Windows test binaries for Linux cross build for ubuntu-arm, ubuntu16.04-arm and tizen-armel
- if ( architecture == 'arm' && ( os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen')) {
- // Cross build for ubuntu-arm, ubuntu16.04-arm and tizen-armel
- // Define the Windows Tests and Corefx build job names
- def WindowsTestsName = projectFolder + '/' +
- Utilities.getFullJobName(project,
- getJobName(lowerConfiguration, 'x64' , 'windows_nt', 'normal', true),
- false)
- def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' +
- Utilities.getFolderName(branch)
-
- // Copy the Windows test binaries and the Corefx build binaries
- copyArtifacts(WindowsTestsName) {
- includePatterns('bin/tests/tests.zip')
- buildSelector {
- latestSuccessful(true)
- }
- }
-
- def arm_abi = 'arm'
- def corefx_os = 'linux'
- if (os == 'Tizen') {
- arm_abi = 'armel'
- corefx_os = 'tizen'
- }
-
- // Let's use release CoreFX to test checked CoreCLR,
- // because we do not generate checked CoreFX in CoreFX CI yet.
- def corefx_lowerConfiguration = lowerConfiguration
- if ( lowerConfiguration == 'checked' ) {
- corefx_lowerConfiguration='release'
- }
-
- copyArtifacts("${corefxFolder}/${corefx_os}_${arm_abi}_cross_${corefx_lowerConfiguration}") {
- includePatterns('bin/build.tar.gz')
- buildSelector {
- latestSuccessful(true)
- }
- }
- }
-
buildCommands.each { buildCommand ->
shell(buildCommand)
}
}
- }
+ } // steps
} // newJob.with
} // os
@@ -2522,681 +2765,792 @@ Constants.allScenarios.each { scenario ->
} // isPR
} // scenario
+// Create a Windows ARM/ARMLB/ARM64 test job that will be used by a flow job.
+// Returns the newly created job.
+def static CreateWindowsArmTestJob(def dslFactory, def project, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName)
+{
+ def osGroup = getOSGroup(os)
+ def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
-// Create jobs requiring flow jobs. This includes x64 non-Windows, arm64 Ubuntu, and arm/arm64/armlb Windows.
-Constants.allScenarios.each { scenario ->
- def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
+ def jobFolder = getJobFolder(scenario)
+ def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
+ parameters {
+ stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
+ }
- [true, false].each { isPR ->
- ['arm', 'armlb', 'x64', 'arm64', 'x86'].each { architecture ->
- Constants.crossList.each { os ->
- if (architecture == 'arm64') {
- if (os != "Ubuntu" && os != "Windows_NT") {
- return
- }
- } else if (architecture == 'arm' || architecture == 'armlb') {
- if (os != 'Windows_NT') {
- return
- }
- } else if (architecture == 'x86') {
- if (os != "Ubuntu") {
- return
- }
- }
+ steps {
+ // Set up the copies
- def validWindowsNTCrossArches = ["arm", "armlb", "arm64"]
+ // Coreclr build we are trying to test
+ //
+ // ** NOTE ** This will, correctly, overwrite the CORE_ROOT from the Windows test archive
- if (os == "Windows_NT" && !(architecture in validWindowsNTCrossArches)) {
- return
+ copyArtifacts(inputCoreCLRBuildName) {
+ excludePatterns('**/testResults.xml', '**/*.ni.dll')
+ buildSelector {
+ buildNumber('${CORECLR_BUILD}')
}
+ }
- Constants.configurationList.each { configuration ->
+ if (isCoreFxScenario(scenario)) {
- // First, filter based on OS.
+ // Only arm supported for corefx testing now.
+ assert architecture == 'arm'
- if (os == 'Windows_NT') {
- if (!isArmWindowsScenario(scenario)) {
- return
- }
+ // Unzip CoreFx runtime
+ batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxruntime.zip', '_\\fx\\bin\\testhost\\netcoreapp-Windows_NT-Release-arm')")
+
+ // Unzip CoreFx tests.
+ batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxtests.zip', '_\\fx\\bin\\tests')")
+
+ // Add the script to run the corefx tests
+ def corefx_runtime_path = "%WORKSPACE%\\_\\fx\\bin\\testhost\\netcoreapp-Windows_NT-Release-arm"
+ def corefx_tests_dir = "%WORKSPACE%\\_\\fx\\bin\\tests"
+ def corefx_exclusion_file = "%WORKSPACE%\\tests\\arm\\corefx_test_exclusions.txt"
+ batchFile("call %WORKSPACE%\\tests\\scripts\\run-corefx-tests.bat ${corefx_runtime_path} ${corefx_tests_dir} ${corefx_exclusion_file}")
+
+ } else { // !isCoreFxScenario(scenario)
+
+ // Unzip tests.
+ batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('bin\\tests\\tests.zip', 'bin\\tests\\${osGroup}.${architecture}.${configuration}')")
+
+ def buildCommands = ""
+
+ def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
+ def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
+ def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
+
+ // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
+ addCommand("SETLOCAL ENABLEEXTENSIONS")
+
+ // For all jobs
+ addEnvVariable("CORE_ROOT", coreRootLocation)
+ addEnvVariable("COMPlus_NoGuiOnAssert", "1")
+ addEnvVariable("COMPlus_ContinueOnAssert", "0")
+
+ // ARM legacy backend; this is an altjit.
+ if (architecture == 'armlb') {
+ addEnvVariable("COMPlus_AltJit", "*")
+ addEnvVariable("COMPlus_AltJitNgen", "*")
+ addEnvVariable("COMPlus_AltJitName", "legacyjit.dll")
+ addEnvVariable("COMPlus_AltJitAssertOnNYI", "1")
+ }
+
+ // If we are running a stress mode, we'll set those variables as well
+ if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
+ def stressValues = null
+ if (isJitStressScenario(scenario)) {
+ stressValues = Constants.jitStressModeScenarios[scenario]
}
else {
- // Non-Windows
- if (architecture == 'arm64') {
- if (!(scenario in Constants.validLinuxArm64Scenarios)) {
- return
- }
- }
- else if (architecture == 'x86') {
- // Linux/x86 only want innerloop and default test
- if (!isNormalOrInnerloop) {
- return
- }
- }
+ stressValues = Constants.r2rStressScenarios[scenario]
}
- // For CentOS, we only want Checked/Release builds.
- if (os == 'CentOS7.1') {
- if (configuration != 'Checked' && configuration != 'Release') {
- return
- }
- if (!isNormalOrInnerloop && !isR2RScenario(scenario) && !isJitStressScenario(scenario)) {
- return
- }
+ stressValues.each { key, value ->
+ addEnvVariable(key, value)
}
+ }
- // For RedHat and Debian, we only do Release builds.
- else if (os == 'RHEL7.2' || os == 'Debian8.4') {
- if (configuration != 'Release') {
- return
- }
- if (!isNormalOrInnerloop) {
- return
- }
- }
+ if (isR2RScenario(scenario)) {
+ // Crossgen the framework assemblies.
+ buildCommands += """
+@for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
+@goto skip_PrecompileAssembly
- // Next, filter based on scenario.
+:PrecompileAssembly
+@REM Skip mscorlib since it is already precompiled.
+@if /I "%3" == "mscorlib.dll" exit /b 0
+@if /I "%3" == "mscorlib.ni.dll" exit /b 0
- if (isJitStressScenario(scenario)) {
- if (configuration != 'Checked') {
- return
- }
+"%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
+@if "%errorlevel%" == "-2146230517" (
+ echo %2 is not a managed assembly.
+) else if "%errorlevel%" == "-2146234344" (
+ echo %2 is not a managed assembly.
+) else if %errorlevel% neq 0 (
+ echo Unable to precompile %2
+) else (
+ echo Precompiled %2
+)
+@exit /b 0
- // CoreFx JIT stress tests currently only implemented for ARM.
- if (isCoreFxScenario(scenario) && (architecture != 'arm')) {
- return
- }
- }
- else if (isR2RBaselineScenario(scenario)) {
- if (configuration != 'Checked' && configuration != 'Release') {
- return
- }
- }
- else if (isR2RStressScenario(scenario)) {
- if (configuration != 'Checked') {
- return
- }
- }
- else {
- // Skip scenarios
- switch (scenario) {
- case 'ilrt':
- case 'longgc':
- case 'gcsimulator':
- // Long GC tests take a long time on non-Release builds
- // ilrt is also Release only
- if (configuration != 'Release') {
- return
- }
- break
+:skip_PrecompileAssembly
+"""
- case 'jitdiff':
- if (configuration != 'Checked') {
- return;
- }
- break
+ // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
+ // crossgen on tests before running them.
+ addEnvVariable("RunCrossGen", "true")
+ } // isR2RScenario(scenario)
- case 'gc_reliability_framework':
- case 'standalone_gc':
- if (configuration != 'Release' && configuration != 'Checked') {
- return
- }
- break
+ // Create the smarty command
+ def smartyCommand = "C:\\Tools\\Smarty.exe /noecid /noie /workers 9 /inc EXPECTED_PASS "
+ def addSmartyFlag = { flag -> smartyCommand += flag + " "}
+ def addExclude = { exclude -> addSmartyFlag("/exc " + exclude)}
+ def addArchSpecificExclude = { architectureToExclude, exclude -> if (architectureToExclude == "armlb") { addExclude("LEGACYJIT_" + exclude) } else { addExclude(exclude) } }
- case 'formatting':
- return
- case 'illink':
- if (os != 'Windows_NT' && os != 'Ubuntu') {
- return
- }
- break
+ if (architecture == 'armlb') {
+ addExclude("LEGACYJIT_FAIL")
+ }
- case 'normal':
- // Nothing skipped
- break
+ // Exclude tests based on scenario.
+ Constants.validArmWindowsScenarios[scenario].each { excludeTag ->
+ addArchSpecificExclude(architecture, excludeTag)
+ }
- case 'innerloop':
- // Nothing skipped
- if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, false)) {
- return
- }
- break
+ // Innerloop jobs run Pri-0 tests; everyone else runs Pri-1.
+ if (scenario == 'innerloop') {
+ addExclude("pri1")
+ }
- default:
- println("Unknown scenario: ${scenario}")
- assert false
- break
- }
- }
+ // Exclude any test marked LONG_RUNNING; these often exceed the standard timeout and fail as a result.
+ // TODO: We should create a "long running" job that runs these with a longer timeout.
+ addExclude("LONG_RUNNING")
- // Done filtering. Now, create the jobs.
+ smartyCommand += "/lstFile Tests.lst"
- // =============================================================================================
- // Create the test job
- // =============================================================================================
+ def testListArch = [
+ 'arm64': 'arm64',
+ 'arm': 'arm',
+ 'armlb': 'arm'
+ ]
- def windowsArmJob = (os == "Windows_NT" && architecture in validWindowsNTCrossArches)
+ def archLocation = testListArch[architecture]
- def lowerConfiguration = configuration.toLowerCase()
- def osGroup = getOSGroup(os)
- def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
+ addCommand("copy %WORKSPACE%\\tests\\${archLocation}\\Tests.lst bin\\tests\\${osGroup}.${architecture}.${configuration}")
+ addCommand("pushd bin\\tests\\${osGroup}.${architecture}.${configuration}")
+ addCommand("${smartyCommand}")
- def inputCoreCLRBuildScenario = scenario == 'innerloop' ? 'innerloop' : 'normal'
- def inputCoreCLRBuildIsBuildOnly = false
- if (isCoreFxScenario(scenario)) {
- // Every CoreFx test depends on its own unique build.
- inputCoreCLRBuildScenario = scenario
- inputCoreCLRBuildIsBuildOnly = true
- }
- def inputCoreCLRFolderName = getJobFolder(inputCoreCLRBuildScenario)
- def inputCoreCLRBuildName = projectFolder + '/' +
- Utilities.getFullJobName(project, getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, inputCoreCLRBuildIsBuildOnly), isPR, inputCoreCLRFolderName)
+ // Save the errorlevel from the smarty command to be used as the errorlevel of this batch file.
+ // However, we also need to remove all the variables that were set during this batch file, so we
+ // can run the ZIP powershell command (below) in a clean environment. (We can't run the powershell
+ // command with the COMPlus_AltJit variables set, for example.) To do that, we do ENDLOCAL as well
+ // as save the current errorlevel on the same line. This works because CMD evaluates the %errorlevel%
+ // variable expansion (or any variable expansion on the line) BEFORE it executes the ENDLOCAL command.
+ // Note that the ENDLOCAL also undoes the pushd command, but we add the popd here for clarity.
+ addCommand("popd & ENDLOCAL & set __save_smarty_errorlevel=%errorlevel%")
- def inputWindowsTestsBuildName = ""
- if (windowsArmJob != true) {
- // If this is a stress scenario, there isn't any difference in the build job, so we didn't create a build only
- // job for Windows_NT specific to that stress mode. Just copy from the default scenario.
+ // ZIP up the smarty output, no matter what the smarty result.
+ addCommand("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('.\\bin\\tests\\${osGroup}.${architecture}.${configuration}\\Smarty.run.0', '.\\bin\\tests\\${osGroup}.${architecture}.${configuration}\\Smarty.run.0.zip')\"")
- def testBuildScenario = scenario == 'innerloop' ? 'innerloop' : 'normal'
+ addCommand("echo %errorlevel%")
+ addCommand("dir .\\bin\\tests\\${osGroup}.${architecture}.${configuration}")
- def inputWindowsTestBuildArch = architecture
- if (architecture == "arm64" && os != "Windows_NT") {
- // Use the x64 test build for arm64 unix
- inputWindowsTestBuildArch = "x64"
- }
+ // Use the smarty errorlevel as the script errorlevel.
+ addCommand("exit /b %__save_smarty_errorlevel%")
- if (isJitStressScenario(scenario)) {
- inputWindowsTestsBuildName = projectFolder + '/' +
- Utilities.getFullJobName(project, getJobName(configuration, inputWindowsTestBuildArch, 'windows_nt', testBuildScenario, false), isPR)
- } else {
- inputWindowsTestsBuildName = projectFolder + '/' +
- Utilities.getFullJobName(project, getJobName(configuration, inputWindowsTestBuildArch, 'windows_nt', testBuildScenario, true), isPR)
- }
- } // if (windowsArmJob != true)
+ batchFile(buildCommands)
+ } // non-corefx testing
+ } // steps
+ } // job
- def serverGCString = ''
- def testOpts = ''
+ if (!isCoreFxScenario(scenario)) {
+ Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0/*.smrt", '', true, false)
- if (windowsArmJob != true) {
- // Enable Server GC for Ubuntu PR builds
- if (os == 'Ubuntu' && isPR) {
- serverGCString = '--useServerGC'
- }
+ // Archive a ZIP file of the entire Smarty.run.0 directory. This is possibly a little too much,
+ // but there is no easy way to only archive the HTML/TXT files of the failing tests, so we get
+ // all the passing test info as well. Not necessarily a bad thing, but possibly somewhat large.
+ Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0.zip", '', true, false)
+ }
- if (isR2RScenario(scenario)) {
+ return newJob
+}
- testOpts += ' --crossgen --runcrossgentests'
+// Create a test job not covered by the "Windows ARM" case that will be used by a flow job.
+// E.g., non-Windows tests.
+// Returns the newly created job.
+def static CreateOtherTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName, def inputTestsBuildName)
+{
+ def isUbuntuArmJob = ((os == "Ubuntu") && (architecture == 'arm')) // ARM Ubuntu running on hardware (not emulator)
- if (scenario == 'r2r_jitstress1') {
- testOpts += ' --jitstress=1'
- }
- else if (scenario == 'r2r_jitstress2') {
- testOpts += ' --jitstress=2'
- }
- else if (scenario == 'r2r_jitstressregs1') {
- testOpts += ' --jitstressregs=1'
- }
- else if (scenario == 'r2r_jitstressregs2') {
- testOpts += ' --jitstressregs=2'
- }
- else if (scenario == 'r2r_jitstressregs3') {
- testOpts += ' --jitstressregs=3'
- }
- else if (scenario == 'r2r_jitstressregs4') {
- testOpts += ' --jitstressregs=4'
- }
- else if (scenario == 'r2r_jitstressregs8') {
- testOpts += ' --jitstressregs=8'
- }
- else if (scenario == 'r2r_jitstressregs0x10') {
- testOpts += ' --jitstressregs=0x10'
- }
- else if (scenario == 'r2r_jitstressregs0x80') {
- testOpts += ' --jitstressregs=0x80'
- }
- else if (scenario == 'r2r_jitstressregs0x1000') {
- testOpts += ' --jitstressregs=0x1000'
- }
- else if (scenario == 'r2r_jitminopts') {
- testOpts += ' --jitminopts'
- }
- else if (scenario == 'r2r_jitforcerelocs') {
- testOpts += ' --jitforcerelocs'
- }
- else if (scenario == 'r2r_gcstress15') {
- testOpts += ' --gcstresslevel=0xF'
- }
- }
- else if (scenario == 'jitdiff') {
- testOpts += ' --jitdisasm --crossgen'
- }
- else if (scenario == 'illink') {
- testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
- }
- else if (isLongGc(scenario)) {
- // Long GC tests behave very poorly when they are not
- // the only test running (many of them allocate until OOM).
- testOpts += ' --sequential'
-
- // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
- // for running long GC and GCSimulator tests, respectively. We don't use them
- // here because using a playlist file produces much more readable output on the CI machines
- // and reduces running time.
- //
- // The Long GC playlist contains all of the tests that are
- // going to be run. The GCSimulator playlist contains all of
- // the GC simulator tests.
- if (scenario == 'longgc') {
- testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
- }
- else if (scenario == 'gcsimulator') {
- testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
- }
- }
- else if (isGcReliabilityFramework(scenario)) {
- testOpts += ' --build-overlay-only'
- }
- else if (scenario == 'standalone_gc') {
- if (osGroup == 'OSX') {
- testOpts += ' --gcname=libclrgc.dylib'
- }
- else if (osGroup == 'Linux') {
- testOpts += ' --gcname=libclrgc.so'
- }
- else {
- println("Unexpected OS group: ${osGroup} for os ${os}")
- assert false
- }
- }
- } // if (windowsArmJob != true)
+ def osGroup = getOSGroup(os)
+ def jobName = getJobName(configuration, architecture, os, scenario, false) + "_tst"
- def folder = getJobFolder(scenario)
- def newJob = job(Utilities.getFullJobName(project, jobName, isPR, folder)) {
- // Add parameters for the inputs
+ def testOpts = ''
+ def useServerGC = false
- if (windowsArmJob == true) {
- parameters {
- stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
- }
- }
- else {
- parameters {
- stringParam('CORECLR_WINDOWS_BUILD', '', 'Build number to copy CoreCLR Windows test binaries from')
- stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
- }
- }
+ // Enable Server GC for Ubuntu PR builds
+ // REVIEW: why? Does this apply to all architectures? Why only PR?
+ if (os == 'Ubuntu' && isPR) {
+ testOpts += ' --useServerGC'
+ useServerGC = true
+ }
- steps {
- // Set up the copies
+ if (isR2RScenario(scenario)) {
- // Coreclr build containing the tests and mscorlib
- // pri1 jobs still need to copy windows_nt built tests
- if (windowsArmJob != true) {
- copyArtifacts(inputWindowsTestsBuildName) {
- excludePatterns('**/testResults.xml', '**/*.ni.dll')
- buildSelector {
- buildNumber('${CORECLR_WINDOWS_BUILD}')
- }
- }
- }
+ testOpts += ' --crossgen --runcrossgentests'
- // Coreclr build we are trying to test
- //
- // ** NOTE ** This will, correctly, overwrite the CORE_ROOT from the Windows test archive
+ if (scenario == 'r2r_jitstress1') {
+ testOpts += ' --jitstress=1'
+ }
+ else if (scenario == 'r2r_jitstress2') {
+ testOpts += ' --jitstress=2'
+ }
+ else if (scenario == 'r2r_jitstressregs1') {
+ testOpts += ' --jitstressregs=1'
+ }
+ else if (scenario == 'r2r_jitstressregs2') {
+ testOpts += ' --jitstressregs=2'
+ }
+ else if (scenario == 'r2r_jitstressregs3') {
+ testOpts += ' --jitstressregs=3'
+ }
+ else if (scenario == 'r2r_jitstressregs4') {
+ testOpts += ' --jitstressregs=4'
+ }
+ else if (scenario == 'r2r_jitstressregs8') {
+ testOpts += ' --jitstressregs=8'
+ }
+ else if (scenario == 'r2r_jitstressregs0x10') {
+ testOpts += ' --jitstressregs=0x10'
+ }
+ else if (scenario == 'r2r_jitstressregs0x80') {
+ testOpts += ' --jitstressregs=0x80'
+ }
+ else if (scenario == 'r2r_jitstressregs0x1000') {
+ testOpts += ' --jitstressregs=0x1000'
+ }
+ else if (scenario == 'r2r_jitminopts') {
+ testOpts += ' --jitminopts'
+ }
+ else if (scenario == 'r2r_jitforcerelocs') {
+ testOpts += ' --jitforcerelocs'
+ }
+ else if (scenario == 'r2r_gcstress15') {
+ testOpts += ' --gcstresslevel=0xF'
+ }
+ }
+ else if (scenario == 'jitdiff') {
+ testOpts += ' --jitdisasm --crossgen'
+ }
+ else if (scenario == 'illink') {
+ testOpts += ' --link=\$WORKSPACE/linker/linker/bin/netcore_Release/netcoreapp2.0/ubuntu-x64/publish/illink'
+ }
+ else if (isLongGc(scenario)) {
+ // Long GC tests behave very poorly when they are not
+ // the only test running (many of them allocate until OOM).
+ testOpts += ' --sequential'
+
+ // A note - runtest.sh does have "--long-gc" and "--gcsimulator" options
+ // for running long GC and GCSimulator tests, respectively. We don't use them
+ // here because using a playlist file produces much more readable output on the CI machines
+ // and reduces running time.
+ //
+ // The Long GC playlist contains all of the tests that are
+ // going to be run. The GCSimulator playlist contains all of
+ // the GC simulator tests.
+ if (scenario == 'longgc') {
+ testOpts += ' --long-gc --playlist=./tests/longRunningGcTests.txt'
+ }
+ else if (scenario == 'gcsimulator') {
+ testOpts += ' --gcsimulator --playlist=./tests/gcSimulatorTests.txt'
+ }
+ }
+ else if (isGcReliabilityFramework(scenario)) {
+ testOpts += ' --build-overlay-only'
+ }
+ else if (scenario == 'standalone_gc') {
+ if (osGroup == 'OSX') {
+ testOpts += ' --gcname=libclrgc.dylib'
+ }
+ else if (osGroup == 'Linux') {
+ testOpts += ' --gcname=libclrgc.so'
+ }
+ else {
+ println("Unexpected OS group: ${osGroup} for os ${os}")
+ assert false
+ }
+ }
- copyArtifacts(inputCoreCLRBuildName) {
- excludePatterns('**/testResults.xml', '**/*.ni.dll')
- buildSelector {
- buildNumber('${CORECLR_BUILD}')
- }
- }
+ def jobFolder = getJobFolder(scenario)
+ def newJob = dslFactory.job(Utilities.getFullJobName(project, jobName, isPR, jobFolder)) {
+ parameters {
+ stringParam('CORECLR_WINDOWS_BUILD', '', 'Build number to copy CoreCLR Windows test binaries from')
+ stringParam('CORECLR_BUILD', '', "Build number to copy CoreCLR ${osGroup} binaries from")
+ }
- // Windows CoreCLR Arm(64) will restore corefx
- // packages correctly.
- //
- // In addition, test steps are entirely different
- // because we do not have a unified runner
- if (windowsArmJob != true) {
- def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(branch)
-
- // HACK -- Arm64 does not have corefx jobs yet.
- // Clone corefx and build the native packages overwriting the x64 packages.
- if (architecture == 'arm64') {
- shell("cp ./bin/Product/Linux.arm64.${configuration}/corefxNative/* ./bin/CoreFxBinDir")
- shell("chmod +x ./bin/Product/Linux.arm64.${configuration}/corerun")
- }
- else if (architecture == 'x86') {
- shell("mkdir ./bin/CoreFxNative")
-
- copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
- includePatterns('bin/build.tar.gz')
- targetDirectory('bin/CoreFxNative')
- buildSelector {
- latestSuccessful(true)
- }
- }
+ steps {
+ // Set up the copies
- shell("tar -xf ./bin/CoreFxNative/bin/build.tar.gz -C ./bin/CoreFxBinDir")
- }
+ // Coreclr build containing the tests and mscorlib
+ // pri1 jobs still need to copy windows_nt built tests
+ assert inputTestsBuildName != null
+ copyArtifacts(inputTestsBuildName) {
+ excludePatterns('**/testResults.xml', '**/*.ni.dll')
+ buildSelector {
+ buildNumber('${CORECLR_WINDOWS_BUILD}')
+ }
+ }
- // Unzip the tests first. Exit with 0
- shell("unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/${osGroup}.${architecture}.${configuration} || exit 0")
- shell("rm -r ./bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root || exit 0")
+ // Coreclr build we are trying to test
+ //
+ // ** NOTE ** This will, correctly, overwrite the CORE_ROOT from the Windows test archive
- shell("./build-test.sh ${architecture} ${configuration} generatelayoutonly")
+ copyArtifacts(inputCoreCLRBuildName) {
+ excludePatterns('**/testResults.xml', '**/*.ni.dll')
+ buildSelector {
+ buildNumber('${CORECLR_BUILD}')
+ }
+ }
- // Execute the tests
- def runDocker = isNeedDocker(architecture, os, false)
- def dockerPrefix = ""
- def dockerCmd = ""
- if (runDocker) {
- def dockerImage = getDockerImageName(architecture, os, false)
- dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
- dockerCmd = dockerPrefix + "${dockerImage} "
- }
+ if (isUbuntuArmJob) {
+ // Add some useful information to the log file. Ignore return codes.
+ shell("uname -a || true")
+ }
- // If we are running a stress mode, we'll set those variables first
- def testEnvOpt = ""
- if (isJitStressScenario(scenario)) {
- def scriptFileName = "\$WORKSPACE/set_stress_test_env.sh"
- def envScriptCmds = envScriptCreate(os, scriptFileName)
- envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
- envScriptCmds += envScriptFinalize(os, scriptFileName)
- shell("${envScriptCmds}")
- testEnvOpt = "--test-env=" + scriptFileName
- }
+ if (architecture == 'arm64') {
+ shell("mkdir -p ./bin/CoreFxBinDir")
+ shell("cp ./bin/Product/Linux.arm64.${configuration}/corefxNative/* ./bin/CoreFxBinDir")
+ shell("chmod +x ./bin/Product/Linux.arm64.${configuration}/corerun")
+ }
+ else if (architecture == 'x86') {
+ shell("mkdir ./bin/CoreFxNative")
- if (isGCStressRelatedTesting(scenario)) {
- shell('./init-tools.sh')
- }
+ def corefxFolder = Utilities.getFolderName('dotnet/corefx') + '/' + Utilities.getFolderName(branch)
- shell("""${dockerCmd}./tests/runtest.sh \\
- --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
- --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
- --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
- --copyNativeTestBin --limitedDumpGeneration ${testEnvOpt} ${serverGCString} ${testOpts}""")
-
- if (isGcReliabilityFramework(scenario)) {
- // runtest.sh doesn't actually execute the reliability framework - do it here.
- if (serverGCString != '') {
- if (runDocker) {
- dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
- }
- else {
- shell("export COMPlus_gcServer=1")
- }
- }
+ copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
+ includePatterns('bin/build.tar.gz')
+ targetDirectory('bin/CoreFxNative')
+ buildSelector {
+ latestSuccessful(true)
+ }
+ }
- shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
- }
- }
- else { // windowsArmJob == true
-
- if (isCoreFxScenario(scenario)) {
+ shell("tar -xf ./bin/CoreFxNative/bin/build.tar.gz -C ./bin/CoreFxBinDir")
+ }
- // Only arm supported for corefx testing now.
- assert architecture == 'arm'
+ // Unzip the tests first. Exit with 0
+ shell("unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/${osGroup}.${architecture}.${configuration} || exit 0")
+ shell("rm -r ./bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root || exit 0")
+
+ // For arm Ubuntu (on hardware), we do the "build-test" step on the build machine, not on the test
+ // machine. The arm Ubuntu test machines do no building -- they have no CLI, for example.
+ // We should probably do the "generatelayoutonly" step on the build machine for all architectures.
+ // However, it's believed that perhaps there's an issue with executable permission bits not getting
+ // copied correctly.
+ if (isUbuntuArmJob) {
+ def lowerConfiguration = configuration.toLowerCase()
+ shell("unzip -o ./coreroot.${lowerConfiguration}.zip || exit 0") // unzips to ./bin/tests/Linux.arm.${configuration}/Tests/Core_Root
+ shell("unzip -o ./testnativebin.${lowerConfiguration}.zip || exit 0") // unzips to ./bin/obj/Linux.arm.${configuration}/tests
+ }
+ else {
+ shell("./build-test.sh ${architecture} ${configuration} generatelayoutonly")
+ }
- // Unzip CoreFx runtime
- batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxruntime.zip', '_\\fx\\bin\\testhost\\netcoreapp-Windows_NT-Release-arm')")
+ // Execute the tests
+ def runDocker = isNeedDocker(architecture, os, false)
+ def dockerPrefix = ""
+ def dockerCmd = ""
+ if (runDocker) {
+ def dockerImage = getDockerImageName(architecture, os, false)
+ dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
+ dockerCmd = dockerPrefix + "${dockerImage} "
+ }
- // Unzip CoreFx tests.
- batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('_\\fx\\fxtests.zip', '_\\fx\\bin\\tests')")
+ // If we are running a stress mode, we'll set those variables first
+ if (isJitStressScenario(scenario)) {
+ def scriptFileName = "\${WORKSPACE}/set_stress_test_env.sh"
+ def envScriptCmds = envScriptCreate(os, scriptFileName)
+ envScriptCmds += envScriptSetStressModeVariables(os, Constants.jitStressModeScenarios[scenario], scriptFileName)
+ envScriptCmds += envScriptFinalize(os, scriptFileName)
+ shell("${envScriptCmds}")
+ testOpts += " --test-env=${scriptFileName}"
+ }
- // Add the script to run the corefx tests
- def corefx_runtime_path = "%WORKSPACE%\\_\\fx\\bin\\testhost\\netcoreapp-Windows_NT-Release-arm"
- def corefx_tests_dir = "%WORKSPACE%\\_\\fx\\bin\\tests"
- def corefx_exclusion_file = "%WORKSPACE%\\tests\\arm\\corefx_test_exclusions.txt"
- batchFile("call %WORKSPACE%\\tests\\scripts\\run-corefx-tests.bat ${corefx_runtime_path} ${corefx_tests_dir} ${corefx_exclusion_file}")
+ // setup-stress-dependencies.sh, invoked by runtest.sh to download the coredistools package, depends on the "dotnet"
+ // tool downloaded by the "init-tools.sh" script. However, it only invokes setup-stress-dependencies.sh for x64. The
+ // coredistools package is used by GCStress on x86 and x64 to disassemble code to determine instruction boundaries.
+ // On arm/arm64, it is not required as determining instruction boundaries is trivial.
+ if (isGCStressRelatedTesting(scenario)) {
+ if (architecture == 'x64') {
+ shell('./init-tools.sh')
+ }
+ }
- } else { // !isCoreFxScenario(scenario)
+ def runScript = ""
+ if (isUbuntuArmJob) {
+ // Use 'runtesttilstable.sh' to rerun failing tests (in sequential mode);
+ // there are many tests that pass on rerun (currently), and we don't want
+ // that flakiness to affect overall test job robustness.
+ runScript = "${dockerCmd}./tests/runtesttilstable.sh"
+ } else {
+ runScript = "${dockerCmd}./tests/runtest.sh"
+ }
- // Unzip tests.
- batchFile("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('bin\\tests\\tests.zip', 'bin\\tests\\${osGroup}.${architecture}.${configuration}')")
+ shell("""\
+${runScript} \\
+ --testRootDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}\" \\
+ --coreOverlayDir=\"\${WORKSPACE}/bin/tests/${osGroup}.${architecture}.${configuration}/Tests/Core_Root\" \\
+ --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
+ --copyNativeTestBin --limitedDumpGeneration ${testOpts}""")
- def buildCommands = ""
+ if (isGcReliabilityFramework(scenario)) {
+ // runtest.sh doesn't actually execute the reliability framework - do it here.
+ if (useServerGC) {
+ if (runDocker) {
+ dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
+ }
+ else {
+ shell("export COMPlus_gcServer=1")
+ }
+ }
- def coreRootLocation = "%WORKSPACE%\\bin\\tests\\Windows_NT.${architecture}.${configuration}\\Tests\\Core_Root"
- def addEnvVariable = { variable, value -> buildCommands += "set ${variable}=${value}\r\n"}
- def addCommand = { cmd -> buildCommands += "${cmd}\r\n"}
+ shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
+ }
+ } // steps
+ } // job
+
+ // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
+ if (os in ['Ubuntu']) {
+ SummaryBuilder summaries = new SummaryBuilder()
+ summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
+ summaries.emit(newJob)
+ }
- // Make sure Command Extensions are enabled. Used so %ERRORLEVEL% is available.
- addCommand("SETLOCAL ENABLEEXTENSIONS")
-
- // For all jobs
- addEnvVariable("CORE_ROOT", coreRootLocation)
-
- addEnvVariable("COMPlus_NoGuiOnAssert", "1")
- addEnvVariable("COMPlus_ContinueOnAssert", "0")
-
- // ARM legacy backend; this is an altjit.
- if (architecture == "armlb") {
- addEnvVariable("COMPlus_AltJit", "*")
- addEnvVariable("COMPlus_AltJitNgen", "*")
- addEnvVariable("COMPlus_AltJitName", "legacyjit.dll")
- addEnvVariable("COMPlus_AltJitAssertOnNYI", "1")
- }
+ Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/coreclrtests.*.txt")
+ Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
- // If we are running a stress mode, we'll set those variables as well
- if (isJitStressScenario(scenario) || isR2RStressScenario(scenario)) {
- def stressValues = null
- if (isJitStressScenario(scenario)) {
- stressValues = Constants.jitStressModeScenarios[scenario]
- }
- else {
- stressValues = Constants.r2rStressScenarios[scenario]
- }
-
- stressValues.each { key, value ->
- addEnvVariable(key, value)
- }
- }
+ return newJob
+}
- if (isR2RScenario(scenario)) {
- // Crossgen the framework assemblies.
- buildCommands += """
-@for %%F in (%CORE_ROOT%\\*.dll) do @call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nxF
-@goto skip_PrecompileAssembly
+// Create a test job that will be used by a flow job.
+// Returns the newly created job.
+def static CreateTestJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def inputCoreCLRBuildName, def inputTestsBuildName)
+{
+ def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
-:PrecompileAssembly
-@REM Skip mscorlib since it is already precompiled.
-@if /I "%3" == "mscorlib.dll" exit /b 0
-@if /I "%3" == "mscorlib.ni.dll" exit /b 0
+ def newJob = null
+ if (windowsArmJob) {
+ assert inputTestsBuildName == null
+ newJob = CreateWindowsArmTestJob(dslFactory, project, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName)
+ } else {
+ newJob = CreateOtherTestJob(dslFactory, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName, inputTestsBuildName)
+ }
-"%CORE_ROOT%\\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" %2 >nul 2>nul
-@if "%errorlevel%" == "-2146230517" (
- echo %2 is not a managed assembly.
-) else if "%errorlevel%" == "-2146234344" (
- echo %2 is not a managed assembly.
-) else if %errorlevel% neq 0 (
- echo Unable to precompile %2
-) else (
- echo Precompiled %2
-)
-@exit /b 0
+ setJobMachineAffinity(architecture, os, false, true, false, newJob) // isBuildJob = false, isTestJob = true, isFlowJob = false
-:skip_PrecompileAssembly
-"""
+ addToViews(newJob, isPR, architecture, os)
- // Set RunCrossGen variable to cause test wrappers to invoke their logic to run
- // crossgen on tests before running them.
- addEnvVariable("RunCrossGen", "true")
- } // isR2RScenario(scenario)
+ if (scenario == 'jitdiff') {
+ def osGroup = getOSGroup(os)
+ Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
+ }
- // Create the smarty command
- def smartyCommand = "C:\\Tools\\Smarty.exe /noecid /noie /workers 9 /inc EXPECTED_PASS "
- def addSmartyFlag = { flag -> smartyCommand += flag + " "}
- def addExclude = { exclude -> addSmartyFlag("/exc " + exclude)}
+ Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
+ setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
- def addArchSpecificExclude = { architectureToExclude, exclude -> if (architectureToExclude == "armlb") { addExclude("LEGACYJIT_" + exclude) } else { addExclude(exclude) } }
+ return newJob
+}
- if (architecture == "armlb") {
- addExclude("LEGACYJIT_FAIL")
- }
+// Create a flow job to tie together a build job with the given test job.
+// Returns the new flow job.
+def static CreateFlowJob(def dslFactory, def project, def branch, def architecture, def os, def configuration, def scenario, def isPR, def fullTestJobName, def inputCoreCLRBuildName, def inputTestsBuildName)
+{
+ // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
+ // Linux CoreCLR test
+ def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
+ def jobFolder = getJobFolder(scenario)
- // Exclude tests based on scenario.
- Constants.validArmWindowsScenarios[scenario].each { excludeTag ->
- addArchSpecificExclude(architecture, excludeTag)
- }
+ def newFlowJob = null
- // Innerloop jobs run Pri-0 tests; everyone else runs Pri-1.
- if (scenario == 'innerloop') {
- addExclude("pri1")
- }
+ def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
+ if (windowsArmJob) {
- // Exclude any test marked LONG_RUNNING; these often exceed the standard timeout and fail as a result.
- // TODO: We should create a "long running" job that runs these with a longer timeout.
- addExclude("LONG_RUNNING")
+ assert inputTestsBuildName == null
- smartyCommand += "/lstFile Tests.lst"
+ // For Windows arm jobs there is no reason to build a parallel test job.
+ // The product build supports building and archiving the tests.
- def testListArch = [
- 'arm64': 'arm64',
- 'arm': 'arm',
- 'armlb': 'arm'
- ]
+ newFlowJob = dslFactory.buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, jobFolder)) {
+ buildFlow("""\
+coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
- def archLocation = testListArch[architecture]
+// And then build the test build
+build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
+""")
+ }
+ JobReport.Report.addReference(inputCoreCLRBuildName)
+ JobReport.Report.addReference(fullTestJobName)
+ }
+ else {
+ newFlowJob = dslFactory.buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, jobFolder)) {
+ buildFlow("""\
+// Build the input jobs in parallel
+parallel (
+{ coreclrBuildJob = build(params, '${inputCoreCLRBuildName}') },
+{ windowsBuildJob = build(params, '${inputTestsBuildName}') }
+)
- addCommand("copy %WORKSPACE%\\tests\\${archLocation}\\Tests.lst bin\\tests\\${osGroup}.${architecture}.${configuration}")
- addCommand("pushd bin\\tests\\${osGroup}.${architecture}.${configuration}")
- addCommand("${smartyCommand}")
+// And then build the test build
+build(params + [CORECLR_BUILD: coreclrBuildJob.build.number,
+ CORECLR_WINDOWS_BUILD: windowsBuildJob.build.number], '${fullTestJobName}')
+""")
+ }
+ JobReport.Report.addReference(inputCoreCLRBuildName)
+ JobReport.Report.addReference(inputTestsBuildName)
+ JobReport.Report.addReference(fullTestJobName)
+ }
- // Save the errorlevel from the smarty command to be used as the errorlevel of this batch file.
- // However, we also need to remove all the variables that were set during this batch file, so we
- // can run the ZIP powershell command (below) in a clean environment. (We can't run the powershell
- // command with the COMPlus_AltJit variables set, for example.) To do that, we do ENDLOCAL as well
- // as save the current errorlevel on the same line. This works because CMD evaluates the %errorlevel%
- // variable expansion (or any variable expansion on the line) BEFORE it executes the ENDLOCAL command.
- // Note that the ENDLOCAL also undoes the pushd command, but we add the popd here for clarity.
- addCommand("popd & ENDLOCAL & set __save_smarty_errorlevel=%errorlevel%")
+ addToViews(newFlowJob, isPR, architecture, os)
- // ZIP up the smarty output, no matter what the smarty result.
- addCommand("powershell -NoProfile -Command \"Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('.\\bin\\tests\\${osGroup}.${architecture}.${configuration}\\Smarty.run.0', '.\\bin\\tests\\${osGroup}.${architecture}.${configuration}\\Smarty.run.0.zip')\"")
+ setJobMachineAffinity(architecture, os, false, false, true, newFlowJob) // isBuildJob = false, isTestJob = false, isFlowJob = true
- addCommand("echo %errorlevel%")
- addCommand("dir .\\bin\\tests\\${osGroup}.${architecture}.${configuration}")
+ Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
+ addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
- // Use the smarty errorlevel as the script errorlevel.
- addCommand("exit /b %__save_smarty_errorlevel%")
+ return newFlowJob
+}
- batchFile(buildCommands)
- } // non-corefx testing
- } // windowsArmJob == true
- } // steps
- } // job
+// Determine if we should generate a flow job for the given parameters.
+// Returns true if the job should be generated.
+def static shouldGenerateFlowJob(def scenario, def isPR, def architecture, def configuration, def os)
+{
+ // The "innerloop" (Pri-0 testing) scenario is only available as PR triggered.
+ // All other scenarios do Pri-1 testing.
+ if (scenario == 'innerloop' && !isPR) {
+ return false
+ }
- addToViews(newJob, isPR, architecture, os)
+ // Filter based on OS and architecture.
- if (scenario == 'jitdiff') {
- Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/dasm/**")
- }
+ switch (architecture) {
+ case 'arm64':
+ if (os != "Ubuntu" && os != "Windows_NT") {
+ return false
+ }
+ break
+ case 'armlb':
+ if (os != 'Windows_NT') {
+ return false
+ }
+ // Do not create armlb windows jobs.
+ return false
+ case 'arm':
+ if (os != "Ubuntu" && os != "Windows_NT") {
+ return false
+ }
+ break
+ case 'x86':
+ if (os != "Ubuntu") {
+ return false
+ }
+ break
+ case 'x64':
+ if (!(os in Constants.crossList)) {
+ return false
+ }
+ if (os == "Windows_NT") {
+ return false
+ }
+ break
+ case 'armem':
+ case 'x86_arm_altjit':
+ case 'x64_arm64_altjit':
+ // No flow jobs
+ return false
+ default:
+ println("Unknown architecture: ${architecture}")
+ assert false
+ break
+ }
- // Experimental: If on Ubuntu 14.04, then attempt to pull in crash dump links
- if (os in ['Ubuntu']) {
- SummaryBuilder summaries = new SummaryBuilder()
- summaries.addLinksSummaryFromFile('Crash dumps from this run:', 'dumplings.txt')
- summaries.emit(newJob)
- }
+ def isNormalOrInnerloop = (scenario == 'innerloop' || scenario == 'normal')
- def affinityOptions = null
+ // Filter based on scenario in OS.
- if (windowsArmJob == true) {
- affinityOptions = [
- "use_arm64_build_machine" : false
- ]
- }
+ if (os == 'Windows_NT') {
+ if (!isArmWindowsScenario(scenario)) {
+ return false
+ }
+ }
+ else {
+ // Non-Windows
+ if (architecture == 'arm64') {
+ if (!(scenario in Constants.validLinuxArm64Scenarios)) {
+ return false
+ }
+ }
+ else if (architecture == 'arm') {
+ if (!(scenario in Constants.validLinuxArmScenarios)) {
+ return false
+ }
+ }
+ else if (architecture == 'x86') {
+ // Linux/x86 only want innerloop and default test
+ if (!isNormalOrInnerloop) {
+ return false
+ }
+ }
+ }
- else if (architecture == 'arm64' && os != 'Windows_NT') {
- affinityOptions = [
- "large_pages" : false
- ]
- }
+ // For CentOS, we only want Checked/Release builds.
+ if (os == 'CentOS7.1') {
+ if (configuration != 'Checked' && configuration != 'Release') {
+ return false
+ }
+ if (!isNormalOrInnerloop && !isR2RScenario(scenario) && !isJitStressScenario(scenario)) {
+ return false
+ }
+ }
- setMachineAffinity(newJob, os, architecture, affinityOptions)
- Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
+ // For RedHat and Debian, we only do Release builds.
+ else if (os == 'RHEL7.2' || os == 'Debian8.4') {
+ if (configuration != 'Release') {
+ return false
+ }
+ if (!isNormalOrInnerloop) {
+ return false
+ }
+ }
- setJobTimeout(newJob, isPR, architecture, configuration, scenario, false)
+ // Next, filter based on scenario.
- if (windowsArmJob != true) {
- Utilities.addXUnitDotNETResults(newJob, '**/coreclrtests.xml')
- }
- else {
- if (!isCoreFxScenario(scenario)) {
- Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0/*.smrt", '', true, false)
+ if (isJitStressScenario(scenario)) {
+ if (configuration != 'Checked') {
+ return false
+ }
- // Archive a ZIP file of the entire Smarty.run.0 directory. This is possibly a little too much,
- // but there is no easy way to only archive the HTML/TXT files of the failing tests, so we get
- // all the passing test info as well. Not necessarily a bad thing, but possibly somewhat large.
- Utilities.addArchival(newJob, "bin/tests/${osGroup}.${architecture}.${configuration}/Smarty.run.0.zip", '', true, false)
- }
- }
+ // CoreFx JIT stress tests currently only implemented for Windows ARM.
+ if (isCoreFxScenario(scenario) && !( (architecture == 'arm') && (os == 'Windows_NT') )) {
+ return false
+ }
+ }
+ else if (isR2RBaselineScenario(scenario)) {
+ if (configuration != 'Checked' && configuration != 'Release') {
+ return false
+ }
+ }
+ else if (isR2RStressScenario(scenario)) {
+ if (configuration != 'Checked') {
+ return false
+ }
+ }
+ else {
+ // Skip scenarios
+ switch (scenario) {
+ case 'ilrt':
+ case 'longgc':
+ case 'gcsimulator':
+ // Long GC tests take a long time on non-Release builds
+ // ilrt is also Release only
+ if (configuration != 'Release') {
+ return false
+ }
+ break
- // =============================================================================================
- // Create a build flow to join together the build and tests required to run this test.
- // =============================================================================================
+ case 'jitdiff':
+ if (configuration != 'Checked') {
+ return false
+ }
+ break
- // Windows CoreCLR build and Linux CoreCLR build (in parallel) ->
- // Linux CoreCLR test
- def flowJobName = getJobName(configuration, architecture, os, scenario, false) + "_flow"
- def fullTestJobName = projectFolder + '/' + newJob.name
- // Add a reference to the input jobs for report purposes
- JobReport.Report.addReference(inputCoreCLRBuildName)
- if (windowsArmJob != true) {
- JobReport.Report.addReference(inputWindowsTestsBuildName)
- }
- JobReport.Report.addReference(fullTestJobName)
- def newFlowJob = null
+ case 'gc_reliability_framework':
+ case 'standalone_gc':
+ if (configuration != 'Release' && configuration != 'Checked') {
+ return false
+ }
+ break
- if (os == 'RHEL7.2' || os == 'Debian8.4') {
- // Do not create the flow job for RHEL jobs.
+ case 'formatting':
+ return false
+ case 'illink':
+ if (os != 'Windows_NT' && os != 'Ubuntu') {
+ return false
+ }
+ break
+
+ case 'normal':
+ // Nothing skipped
+ break
+
+ case 'innerloop':
+ // Nothing skipped
+ if (!isValidPrTriggeredInnerLoopJob(os, architecture, configuration, false)) {
+ return false
+ }
+ break
+
+ default:
+ println("Unknown scenario: ${scenario}")
+ assert false
+ break
+ }
+ }
+
+ // The job was not filtered out, so we should generate it!
+ return true
+}
+
+// Create jobs requiring flow jobs. This includes x64 non-Windows, arm/arm64 Ubuntu, and arm/arm64/armlb Windows.
+// Note: no armlb non-Windows; we expect to deprecate/remove armlb soon, so don't want to add new testing for it.
+Constants.allScenarios.each { scenario ->
+ [true, false].each { isPR ->
+ Constants.architectureList.each { architecture ->
+ Constants.configurationList.each { configuration ->
+ Constants.osList.each { os ->
+
+ if (!shouldGenerateFlowJob(scenario, isPR, architecture, configuration, os)) {
return
}
-
- // For pri0 jobs we can build tests on unix
- if (windowsArmJob) {
- // For Windows arm jobs there is no reason to build a parallel test job.
- // The product build supports building and archiving the tests.
- newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, folder)) {
- buildFlow("""\
-coreclrBuildJob = build(params, '${inputCoreCLRBuildName}')
+ // Figure out the job name of the CoreCLR build the test will depend on.
-// And then build the test build
-build(params + [CORECLR_BUILD: coreclrBuildJob.build.number], '${fullTestJobName}')
-""")
- }
+ def inputCoreCLRBuildScenario = scenario == 'innerloop' ? 'innerloop' : 'normal'
+ def inputCoreCLRBuildIsBuildOnly = false
+ if (isCoreFxScenario(scenario)) {
+ // Every CoreFx test depends on its own unique build.
+ inputCoreCLRBuildScenario = scenario
+ inputCoreCLRBuildIsBuildOnly = true
}
- else {
- newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR, folder)) {
- buildFlow("""\
-// Build the input jobs in parallel
-parallel (
-{ coreclrBuildJob = build(params, '${inputCoreCLRBuildName}') },
-{ windowsBuildJob = build(params, '${inputWindowsTestsBuildName}') }
-)
+ def inputCoreCLRFolderName = getJobFolder(inputCoreCLRBuildScenario)
+ def inputCoreCLRBuildName = projectFolder + '/' +
+ Utilities.getFullJobName(project, getJobName(configuration, architecture, os, inputCoreCLRBuildScenario, inputCoreCLRBuildIsBuildOnly), isPR, inputCoreCLRFolderName)
-// And then build the test build
-build(params + [CORECLR_BUILD: coreclrBuildJob.build.number,
- CORECLR_WINDOWS_BUILD: windowsBuildJob.build.number], '${fullTestJobName}')
-""")
+ // Figure out the name of the build job that the test job will depend on.
+ // For Windows ARM tests, this is not used, as the CoreCLR build creates the tests. For other
+ // tests (e.g., Linux ARM), we depend on a Windows build to get the tests.
+
+ def inputTestsBuildName = null
+
+ def windowsArmJob = ((os == "Windows_NT") && (architecture in Constants.armWindowsCrossArchitectureList))
+ if (!windowsArmJob) {
+ def testBuildScenario = scenario == 'innerloop' ? 'innerloop' : 'normal'
+
+ def inputTestsBuildArch = architecture
+ if (architecture == "arm64") {
+ // Use the x64 test build for arm64 unix
+ inputTestsBuildArch = "x64"
+ }
+ else if (architecture == "arm") {
+ // Use the x86 test build for arm unix
+ inputTestsBuildArch = "x86"
}
+
+ def inputTestsBuildIsBuildOnly = true
+
+ inputTestsBuildName = projectFolder + '/' +
+ Utilities.getFullJobName(project, getJobName(configuration, inputTestsBuildArch, 'windows_nt', testBuildScenario, inputTestsBuildIsBuildOnly), isPR)
}
- addToViews(newFlowJob, isPR, architecture, os)
+ // =============================================================================================
+ // Create the test job
+ // =============================================================================================
+
+ def testJob = CreateTestJob(this, project, branch, architecture, os, configuration, scenario, isPR, inputCoreCLRBuildName, inputTestsBuildName)
- // For the flow jobs set the machine affinity as x64 if an armarch.
- def flowArch = architecture
+ // =============================================================================================
+ // Create a build flow to join together the build and tests required to run this test.
+ // =============================================================================================
- if (flowArch in validWindowsNTCrossArches) {
- flowArch = 'x64'
- affinityOptions = null
+ if (os == 'RHEL7.2' || os == 'Debian8.4') {
+ // Do not create the flow job for RHEL jobs.
+ return
}
- setMachineAffinity(newFlowJob, os, flowArch, affinityOptions)
- Utilities.standardJobSetup(newFlowJob, project, isPR, "*/${branch}")
- addTriggers(newFlowJob, branch, isPR, architecture, os, configuration, scenario, true, false) // isFlowJob==true, isWindowsBuildOnlyJob==false
- } // configuration
- } // os
+ def fullTestJobName = projectFolder + '/' + testJob.name
+ def flowJob = CreateFlowJob(this, project, branch, architecture, os, configuration, scenario, isPR, fullTestJobName, inputCoreCLRBuildName, inputTestsBuildName)
+
+ } // os
+ } // configuration
} // architecture
} // isPR
} // scenario
diff --git a/src/ToolBox/SOS/CMakeLists.txt b/src/ToolBox/SOS/CMakeLists.txt
index 9380dc1de6..212f4eebd7 100644
--- a/src/ToolBox/SOS/CMakeLists.txt
+++ b/src/ToolBox/SOS/CMakeLists.txt
@@ -1,3 +1,4 @@
if(WIN32)
+ add_subdirectory(DacTableGen)
add_subdirectory(Strike)
endif(WIN32)
diff --git a/src/ToolBox/SOS/DacTableGen/CMakeLists.txt b/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
index 01ee51f7a4..c980cc2ff8 100644
--- a/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
+++ b/src/ToolBox/SOS/DacTableGen/CMakeLists.txt
@@ -7,13 +7,13 @@ set(DACTABLEGEN_SOURCES
# Cmake does not support csharp sources so add custom command
add_custom_target(dactablegen ALL
- COMMAND csc.exe /t:exe /platform:anycpu /r:System.dll /r:$<TARGET_FILE:dialib_dll> /out:${CMAKE_CURRENT_BINARY_DIR}/dactablegen.exe ${DACTABLEGEN_SOURCES}
- COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:dialib_dll> $<TARGET_FILE_DIR:dactablegen_exe>
- DEPENDS ${DACTABLEGEN_SOURCES} dialib
+ COMMAND csc.exe /t:exe /platform:anycpu32bitpreferred /r:System.dll /r:DiaLib.dll /out:${CMAKE_CURRENT_BINARY_DIR}/dactablegen.exe ${DACTABLEGEN_SOURCES}
+ COMMAND ${CMAKE_COMMAND} -E copy DIAlib.dll ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${DACTABLEGEN_SOURCES} DIAlib.dll
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# In order to use dactablegen as an executable target it needs to be imported.
# Target is used in dll/mscoree/coreclr/cmakelists.txt
add_executable(dactablegen_exe IMPORTED GLOBAL)
-set_property(TARGET dactablegen_exe PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/dactablegen.exe) \ No newline at end of file
+set_property(TARGET dactablegen_exe PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/dactablegen.exe)
diff --git a/src/ToolBox/SOS/DacTableGen/DIALib.dll b/src/ToolBox/SOS/DacTableGen/DIALib.dll
new file mode 100644
index 0000000000..06665740dc
--- /dev/null
+++ b/src/ToolBox/SOS/DacTableGen/DIALib.dll
Binary files differ
diff --git a/src/ToolBox/SOS/DacTableGen/diautil.cs b/src/ToolBox/SOS/DacTableGen/diautil.cs
index d0e9c811a7..f0937b190e 100644
--- a/src/ToolBox/SOS/DacTableGen/diautil.cs
+++ b/src/ToolBox/SOS/DacTableGen/diautil.cs
@@ -97,7 +97,7 @@ class Util
public class DiaFile
{
- DiaSourceClass m_dsc;
+ IDiaDataSource m_dsc;
IDiaSession m_session;
DiaSymbol m_global;
IDiaEnumSymbols m_publicsEnum;
@@ -106,7 +106,7 @@ public class DiaFile
public DiaFile(String pdbFile, String dllFile)
{
- m_dsc = new DiaSourceClass();
+ m_dsc = GetDiaSourceClass();
string pdbPath = System.IO.Path.GetDirectoryName(pdbFile);
// Open the PDB file, validating it matches the supplied DLL file
@@ -414,6 +414,37 @@ public class DiaFile
E_PDB_SYMSRV_CACHE_FULL ,
E_PDB_MAX
}
+
+ // Get the DiaSourceClass from the msdia140.dll in the app directory without using COM activation
+ static IDiaDataSource GetDiaSourceClass() {
+ // This is Class ID for the DiaSourceClass used by msdia140.
+ var diaSourceClassGuid = new Guid("{e6756135-1e65-4d17-8576-610761398c3c}");
+ var comClassFactory = (IClassFactory)DllGetClassObject(diaSourceClassGuid, typeof(IClassFactory).GUID);
+
+ // As the DLL to create a new instance of it
+ object comObject = null;
+ Guid iDiaDataSourceGuid = typeof(IDiaDataSource).GUID;
+ comClassFactory.CreateInstance(null, ref iDiaDataSourceGuid, out comObject);
+
+ // And return it as the type we expect
+ return (comObject as IDiaDataSource);
+ }
+
+ [return: MarshalAs(UnmanagedType.Interface)]
+ [DllImport("msdia140.dll", CharSet = CharSet.Unicode, ExactSpelling = true, PreserveSig = false)]
+ private static extern object DllGetClassObject(
+ [In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
+ [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid);
+
+ [ComImport, ComVisible(false), Guid("00000001-0000-0000-C000-000000000046"),
+ InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ private interface IClassFactory
+ {
+ void CreateInstance([MarshalAs(UnmanagedType.Interface)] object aggregator,
+ ref Guid refiid,
+ [MarshalAs(UnmanagedType.Interface)] out object createdObject);
+ void LockServer(bool incrementRefCount);
+ }
}
/***************************************************************************************
@@ -806,4 +837,5 @@ public class DiaDataSymbol : DiaSymbol
}
}
+
} // Namespace Dia.Util
diff --git a/src/ToolBox/SOS/tests/Test.cs b/src/ToolBox/SOS/tests/Test.cs
index e4ef76b30a..bd3829739f 100644
--- a/src/ToolBox/SOS/tests/Test.cs
+++ b/src/ToolBox/SOS/tests/Test.cs
@@ -1,3 +1,7 @@
+// 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;
class Test
diff --git a/src/ToolBox/SOS/tests/t_cmd_bpmd_clear.py b/src/ToolBox/SOS/tests/t_cmd_bpmd_clear.py
index 814d114d16..a1ed820cd1 100644
--- a/src/ToolBox/SOS/tests/t_cmd_bpmd_clear.py
+++ b/src/ToolBox/SOS/tests/t_cmd_bpmd_clear.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_bpmd_clearall.py b/src/ToolBox/SOS/tests/t_cmd_bpmd_clearall.py
index 8da9239f57..98d86df935 100644
--- a/src/ToolBox/SOS/tests/t_cmd_bpmd_clearall.py
+++ b/src/ToolBox/SOS/tests/t_cmd_bpmd_clearall.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_bpmd_methoddesc.py b/src/ToolBox/SOS/tests/t_cmd_bpmd_methoddesc.py
index dfd75432f3..a6a85f00d1 100644
--- a/src/ToolBox/SOS/tests/t_cmd_bpmd_methoddesc.py
+++ b/src/ToolBox/SOS/tests/t_cmd_bpmd_methoddesc.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_bpmd_module_function.py b/src/ToolBox/SOS/tests/t_cmd_bpmd_module_function.py
index e407ab3e4e..f66fe5019f 100644
--- a/src/ToolBox/SOS/tests/t_cmd_bpmd_module_function.py
+++ b/src/ToolBox/SOS/tests/t_cmd_bpmd_module_function.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_bpmd_module_function_iloffset.py b/src/ToolBox/SOS/tests/t_cmd_bpmd_module_function_iloffset.py
index 91fb1cd125..1c4441f790 100644
--- a/src/ToolBox/SOS/tests/t_cmd_bpmd_module_function_iloffset.py
+++ b/src/ToolBox/SOS/tests/t_cmd_bpmd_module_function_iloffset.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_bpmd_nofuturemodule_module_function.py b/src/ToolBox/SOS/tests/t_cmd_bpmd_nofuturemodule_module_function.py
index 64efad7b65..daeac12ca9 100644
--- a/src/ToolBox/SOS/tests/t_cmd_bpmd_nofuturemodule_module_function.py
+++ b/src/ToolBox/SOS/tests/t_cmd_bpmd_nofuturemodule_module_function.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_clrstack.py b/src/ToolBox/SOS/tests/t_cmd_clrstack.py
index 28a1a8b950..76bb5169ee 100644
--- a/src/ToolBox/SOS/tests/t_cmd_clrstack.py
+++ b/src/ToolBox/SOS/tests/t_cmd_clrstack.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_clrthreads.py b/src/ToolBox/SOS/tests/t_cmd_clrthreads.py
index ff731da990..5e374dd062 100644
--- a/src/ToolBox/SOS/tests/t_cmd_clrthreads.py
+++ b/src/ToolBox/SOS/tests/t_cmd_clrthreads.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_clru.py b/src/ToolBox/SOS/tests/t_cmd_clru.py
index 81a583e963..6f2971f613 100644
--- a/src/ToolBox/SOS/tests/t_cmd_clru.py
+++ b/src/ToolBox/SOS/tests/t_cmd_clru.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dso.py b/src/ToolBox/SOS/tests/t_cmd_dso.py
index 492204da5e..fc6761559f 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dso.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dso.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumpclass.py b/src/ToolBox/SOS/tests/t_cmd_dumpclass.py
index 6a69070eb5..8026122d6f 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumpclass.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumpclass.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumpheap.py b/src/ToolBox/SOS/tests/t_cmd_dumpheap.py
index 8546de79e1..0186435664 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumpheap.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumpheap.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumpil.py b/src/ToolBox/SOS/tests/t_cmd_dumpil.py
index 295cf19e6f..1ddd482b00 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumpil.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumpil.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumplog.py b/src/ToolBox/SOS/tests/t_cmd_dumplog.py
index ab33b66d4b..631beb48ae 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumplog.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumplog.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumpmd.py b/src/ToolBox/SOS/tests/t_cmd_dumpmd.py
index 0340eb5222..b2b020b4db 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumpmd.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumpmd.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumpmodule.py b/src/ToolBox/SOS/tests/t_cmd_dumpmodule.py
index 2dd004818a..5f256b12fb 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumpmodule.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumpmodule.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumpmt.py b/src/ToolBox/SOS/tests/t_cmd_dumpmt.py
index 059060b9b4..3640a4b55f 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumpmt.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumpmt.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumpobj.py b/src/ToolBox/SOS/tests/t_cmd_dumpobj.py
index 93f32cd9ab..a6f2e3934c 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumpobj.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumpobj.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_dumpstack.py b/src/ToolBox/SOS/tests/t_cmd_dumpstack.py
index 3e15f8b1d9..24ae1a5bdb 100644
--- a/src/ToolBox/SOS/tests/t_cmd_dumpstack.py
+++ b/src/ToolBox/SOS/tests/t_cmd_dumpstack.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_eeheap.py b/src/ToolBox/SOS/tests/t_cmd_eeheap.py
index 50d8977422..8c9596467f 100644
--- a/src/ToolBox/SOS/tests/t_cmd_eeheap.py
+++ b/src/ToolBox/SOS/tests/t_cmd_eeheap.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_eestack.py b/src/ToolBox/SOS/tests/t_cmd_eestack.py
index bc36592f87..8764bccf44 100644
--- a/src/ToolBox/SOS/tests/t_cmd_eestack.py
+++ b/src/ToolBox/SOS/tests/t_cmd_eestack.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_gcroot.py b/src/ToolBox/SOS/tests/t_cmd_gcroot.py
index e6b727c9a1..636578d694 100644
--- a/src/ToolBox/SOS/tests/t_cmd_gcroot.py
+++ b/src/ToolBox/SOS/tests/t_cmd_gcroot.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_histclear.py b/src/ToolBox/SOS/tests/t_cmd_histclear.py
index db29bd85f7..b5206a7cd3 100644
--- a/src/ToolBox/SOS/tests/t_cmd_histclear.py
+++ b/src/ToolBox/SOS/tests/t_cmd_histclear.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_histinit.py b/src/ToolBox/SOS/tests/t_cmd_histinit.py
index 51191283c7..d0b2e89296 100644
--- a/src/ToolBox/SOS/tests/t_cmd_histinit.py
+++ b/src/ToolBox/SOS/tests/t_cmd_histinit.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_histobj.py b/src/ToolBox/SOS/tests/t_cmd_histobj.py
index c88bdac16e..402f04214c 100644
--- a/src/ToolBox/SOS/tests/t_cmd_histobj.py
+++ b/src/ToolBox/SOS/tests/t_cmd_histobj.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_histobjfind.py b/src/ToolBox/SOS/tests/t_cmd_histobjfind.py
index ffe5dbf52d..611639978d 100644
--- a/src/ToolBox/SOS/tests/t_cmd_histobjfind.py
+++ b/src/ToolBox/SOS/tests/t_cmd_histobjfind.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_histroot.py b/src/ToolBox/SOS/tests/t_cmd_histroot.py
index 7b73caafda..e212b1f089 100644
--- a/src/ToolBox/SOS/tests/t_cmd_histroot.py
+++ b/src/ToolBox/SOS/tests/t_cmd_histroot.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_ip2md.py b/src/ToolBox/SOS/tests/t_cmd_ip2md.py
index 1384c38f0c..78bebe95ff 100644
--- a/src/ToolBox/SOS/tests/t_cmd_ip2md.py
+++ b/src/ToolBox/SOS/tests/t_cmd_ip2md.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/t_cmd_name2ee.py b/src/ToolBox/SOS/tests/t_cmd_name2ee.py
index b617020e36..71d4212519 100644
--- a/src/ToolBox/SOS/tests/t_cmd_name2ee.py
+++ b/src/ToolBox/SOS/tests/t_cmd_name2ee.py
@@ -1,3 +1,7 @@
+# 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.
+
import lldb
import re
import testutils as test
diff --git a/src/ToolBox/SOS/tests/test_libsosplugin.py b/src/ToolBox/SOS/tests/test_libsosplugin.py
index e5a5906264..e7bab14538 100644
--- a/src/ToolBox/SOS/tests/test_libsosplugin.py
+++ b/src/ToolBox/SOS/tests/test_libsosplugin.py
@@ -1,3 +1,7 @@
+# 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.
+
from __future__ import print_function
import unittest
import argparse
diff --git a/src/ToolBox/SOS/tests/testutils.py b/src/ToolBox/SOS/tests/testutils.py
index 1f784b48f6..80139aee4c 100644
--- a/src/ToolBox/SOS/tests/testutils.py
+++ b/src/ToolBox/SOS/tests/testutils.py
@@ -1,3 +1,7 @@
+# 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.
+
from __future__ import print_function
import lldb
import re
diff --git a/src/binder/fusionhelpers.cpp b/src/binder/fusionhelpers.cpp
index bb32856a52..4372bcf344 100644
--- a/src/binder/fusionhelpers.cpp
+++ b/src/binder/fusionhelpers.cpp
@@ -12,7 +12,6 @@
#include "fusionhelpers.hpp"
#include "shlwapi.h"
-#include "newapis.h"
#define IS_UPPER_A_TO_Z(x) (((x) >= L'A') && ((x) <= L'Z'))
#define IS_LOWER_A_TO_Z(x) (((x) >= L'a') && ((x) <= L'z'))
@@ -36,7 +35,7 @@ namespace
#ifdef FEATURE_USE_LCID
int iRet = WszLCMapString(g_lcid, LCMAP_UPPERCASE, &wc, 1, &wTmp, 1);
#else
- int iRet = NewApis::LCMapStringEx(g_lcid, LCMAP_UPPERCASE, &wc, 1, &wTmp, 1, NULL, NULL, 0);
+ int iRet = LCMapStringEx(g_lcid, LCMAP_UPPERCASE, &wc, 1, &wTmp, 1, NULL, NULL, 0);
#endif
if (!iRet) {
_ASSERTE(!"LCMapString failed!");
diff --git a/src/classlibnative/bcltype/stringnative.cpp b/src/classlibnative/bcltype/stringnative.cpp
index 63eed7345a..6bf6deaf7e 100644
--- a/src/classlibnative/bcltype/stringnative.cpp
+++ b/src/classlibnative/bcltype/stringnative.cpp
@@ -31,31 +31,6 @@
#pragma optimize("tgy", on)
#endif
-inline COMNlsHashProvider * GetCurrentNlsHashProvider()
-{
- LIMITED_METHOD_CONTRACT;
- return &COMNlsHashProvider::s_NlsHashProvider;
-}
-
-FCIMPL1(INT32, COMString::Marvin32HashString, StringObject* thisRefUNSAFE) {
- FCALL_CONTRACT;
-
- int iReturnHash = 0;
-
- if (thisRefUNSAFE == NULL) {
- FCThrow(kNullReferenceException);
- }
-
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException));
- iReturnHash = GetCurrentNlsHashProvider()->HashString(thisRefUNSAFE->GetBuffer(), thisRefUNSAFE->GetStringLength());
- END_SO_INTOLERANT_CODE;
-
- FC_GC_POLL_RET();
-
- return iReturnHash;
-}
-FCIMPLEND
-
/*===============================IsFastSort===============================
**Action: Call the helper to walk the string and see if we have any high chars.
**Returns: void. The appropriate bits are set on the String.
@@ -134,44 +109,6 @@ FCIMPL2(INT32, COMString::FCCompareOrdinalIgnoreCaseWC, StringObject* strA, __in
}
FCIMPLEND
-/*================================CompareOrdinalEx===============================
-**Args: typedef struct {STRINGREF thisRef; INT32 options; INT32 length; INT32 valueOffset;\
- STRINGREF value; INT32 thisOffset;} _compareOrdinalArgsEx;
-==============================================================================*/
-
-FCIMPL6(INT32, COMString::CompareOrdinalEx, StringObject* strA, INT32 indexA, INT32 countA, StringObject* strB, INT32 indexB, INT32 countB)
-{
- FCALL_CONTRACT;
-
- VALIDATEOBJECT(strA);
- VALIDATEOBJECT(strB);
- DWORD *strAChars, *strBChars;
- int strALength, strBLength;
-
- // These runtime tests are handled in the managed wrapper.
- _ASSERTE(strA != NULL && strB != NULL);
- _ASSERTE(indexA >= 0 && indexB >= 0);
- _ASSERTE(countA >= 0 && countB >= 0);
-
- strA->RefInterpretGetStringValuesDangerousForGC((WCHAR **) &strAChars, &strALength);
- strB->RefInterpretGetStringValuesDangerousForGC((WCHAR **) &strBChars, &strBLength);
-
- _ASSERTE(countA <= strALength - indexA);
- _ASSERTE(countB <= strBLength - indexB);
-
- // Set up the loop variables.
- strAChars = (DWORD *) ((WCHAR *) strAChars + indexA);
- strBChars = (DWORD *) ((WCHAR *) strBChars + indexB);
-
- INT32 result = StringObject::FastCompareStringHelper(strAChars, countA, strBChars, countB);
-
- FC_GC_POLL_RET();
- return result;
-
-}
-FCIMPLEND
-
-
/*==================================GETCHARAT===================================
**Returns the character at position index. Thows IndexOutOfRangeException as
**appropriate.
diff --git a/src/classlibnative/bcltype/stringnative.h b/src/classlibnative/bcltype/stringnative.h
index f0df0503e5..1f3970b0a0 100644
--- a/src/classlibnative/bcltype/stringnative.h
+++ b/src/classlibnative/bcltype/stringnative.h
@@ -61,9 +61,6 @@ public:
static FCDECL2(FC_BOOL_RET, FCTryGetTrailByte, StringObject* thisRefUNSAFE, UINT8 *pbData);
static FCDECL2(VOID, FCSetTrailByte, StringObject* thisRefUNSAFE, UINT8 bData);
#endif // FEATURE_COMINTEROP
-
- static FCDECL1(INT32, Marvin32HashString, StringObject* thisRefUNSAFE);
-
};
// Revert to command line compilation flags
diff --git a/src/classlibnative/bcltype/system.cpp b/src/classlibnative/bcltype/system.cpp
index 57a4aa12df..a28adace88 100644
--- a/src/classlibnative/bcltype/system.cpp
+++ b/src/classlibnative/bcltype/system.cpp
@@ -460,7 +460,7 @@ void SystemNative::GenericFailFast(STRINGREF refMesgString, EXCEPTIONREF refExce
WszOutputDebugString(W("\"\r\n"));
}
- const WCHAR * argExceptionString = NULL;
+ LPCWSTR argExceptionString = NULL;
StackSString msg;
if (gc.refExceptionForWatsonBucketing != NULL)
{
diff --git a/src/classlibnative/inc/nlsinfo.h b/src/classlibnative/inc/nlsinfo.h
index 0593a4f034..ec06913f92 100644
--- a/src/classlibnative/inc/nlsinfo.h
+++ b/src/classlibnative/inc/nlsinfo.h
@@ -43,8 +43,6 @@ class COMNlsInfo
{
public:
- static INT32 CallGetUserDefaultUILanguage();
-
//
// Native helper functions for methods in DateTimeFormatInfo
//
diff --git a/src/classlibnative/nls/nlsinfo.cpp b/src/classlibnative/nls/nlsinfo.cpp
index 76c08c2301..7699b4a231 100644
--- a/src/classlibnative/nls/nlsinfo.cpp
+++ b/src/classlibnative/nls/nlsinfo.cpp
@@ -34,115 +34,6 @@
#include "nls.h"
#include "nlsinfo.h"
-#include "newapis.h"
-
-//
-// Constant Declarations.
-//
-
-#define MAX_STRING_VALUE 512
-
-// TODO: NLS Arrowhead -Be nice if we could depend more on the OS for this
-// Language ID for CHT (Taiwan)
-#define LANGID_ZH_TW 0x0404
-// Language ID for CHT (Hong-Kong)
-#define LANGID_ZH_HK 0x0c04
-
-
-INT32 COMNlsInfo::CallGetUserDefaultUILanguage()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- SO_TOLERANT;
- } CONTRACTL_END;
-
- static INT32 s_lcid = 0;
-
- // The user UI language cannot change within a process (in fact it cannot change within a logon session),
- // so we cache it. We dont take a lock while initializing s_lcid for the same reason. If two threads are
- // racing to initialize s_lcid, the worst thing that'll happen is that one thread will call
- // GetUserDefaultUILanguage needlessly, but the final result is going to be the same.
- if (s_lcid == 0)
- {
- INT32 s_lcidTemp = GetUserDefaultUILanguage();
- if (s_lcidTemp == LANGID_ZH_TW)
- {
- // If the UI language ID is 0x0404, we need to do extra check to decide
- // the real UI language, since MUI (in CHT)/HK/TW Windows SKU all uses 0x0404 as their CHT language ID.
- if (!NewApis::IsZhTwSku())
- {
- s_lcidTemp = LANGID_ZH_HK;
- }
- }
- s_lcid = s_lcidTemp;
- }
-
- return s_lcid;
-}
-
-////////////////////////////////////////////////////////////////////////////
-//
-// InternalGetGlobalizedHashCode
-//
-////////////////////////////////////////////////////////////////////////////
-INT32 QCALLTYPE COMNlsInfo::InternalGetGlobalizedHashCode(INT_PTR handle, LPCWSTR localeName, LPCWSTR string, INT32 length, INT32 dwFlagsIn)
-{
- CONTRACTL
- {
- QCALL_CHECK;
- PRECONDITION(CheckPointer(localeName));
- PRECONDITION(CheckPointer(string, NULL_OK));
- } CONTRACTL_END;
-
- INT32 iReturnHash = 0;
- BEGIN_QCALL;
-
- int byteCount = 0;
-
- //
- // Make sure there is a string.
- //
- if (!string) {
- COMPlusThrowArgumentNull(W("string"),W("ArgumentNull_String"));
- }
-
- DWORD dwFlags = (LCMAP_SORTKEY | dwFlagsIn);
-
- //
- // Caller has already verified that the string is not of zero length
- //
- // Assert if we might hit an AV in LCMapStringEx for the invariant culture.
- _ASSERTE(length > 0 || (dwFlags & LCMAP_LINGUISTIC_CASING) == 0);
- {
- byteCount=NewApis::LCMapStringEx(handle != NULL ? NULL : localeName, dwFlags, string, length, NULL, 0, NULL, NULL, (LPARAM) handle);
- }
-
- //A count of 0 indicates that we either had an error or had a zero length string originally.
- if (byteCount==0)
- {
- COMPlusThrow(kArgumentException, W("Arg_MustBeString"));
- }
-
- // We used to use a NewArrayHolder here, but it turns out that hurts our large # process
- // scalability in ASP.Net hosting scenarios, using the quick bytes instead mostly stack
- // allocates and ups throughput by 8% in 100 process case, 5% in 1000 process case
- {
- CQuickBytesSpecifySize<MAX_STRING_VALUE * sizeof(WCHAR)> qbBuffer;
- BYTE* pByte = (BYTE*)qbBuffer.AllocThrows(byteCount);
-
- {
- NewApis::LCMapStringEx(handle != NULL ? NULL : localeName, dwFlags, string, length, (LPWSTR)pByte, byteCount, NULL,NULL, (LPARAM) handle);
- }
-
- iReturnHash = COMNlsHashProvider::s_NlsHashProvider.HashSortKey(pByte, byteCount);
- }
- END_QCALL;
- return(iReturnHash);
-}
-
/**
* This function returns a pointer to this table that we use in System.Globalization.EncodingTable.
* No error checking of any sort is performed. Range checking is entirely the responsibility of the managed
diff --git a/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/hosts/corerun/corerun.cpp
index 814aac9fc4..55875c2713 100644
--- a/src/coreclr/hosts/corerun/corerun.cpp
+++ b/src/coreclr/hosts/corerun/corerun.cpp
@@ -264,7 +264,7 @@ public:
W("*.dll"),
W("*.ni.exe"),
W("*.exe"),
- W("*.ni.winmd")
+ W("*.ni.winmd"),
W("*.winmd")
};
diff --git a/src/debug/daccess/enummem.cpp b/src/debug/daccess/enummem.cpp
index 007af0ba4b..50bf408dd6 100644
--- a/src/debug/daccess/enummem.cpp
+++ b/src/debug/daccess/enummem.cpp
@@ -273,10 +273,10 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_runtimeLoadedBaseAddress.EnumMem(); )
#endif // !FEATURE_PAL
- // These are the structures that are pointed by global pointers and we care.
- // Some may reside in heap and some may reside as a static byte array in mscorwks.dll
- // That is ok. We will report them explicitly.
- //
+ // These are the structures that are pointed by global pointers and we care.
+ // Some may reside in heap and some may reside as a static byte array in mscorwks.dll
+ // That is ok. We will report them explicitly.
+ //
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pConfig.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pPredefinedArrayTypes.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pObjectClass.EnumMem(); )
@@ -295,14 +295,17 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pFreeObjectMethodTable.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_fHostConfig.EnumMem(); )
- // These two static pointers are pointed to static data of byte[]
- // then run constructor in place
- //
+ // These two static pointers are pointed to static data of byte[]
+ // then run constructor in place
+ //
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( SystemDomain::m_pSystemDomain.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( SharedDomain::m_pSharedDomain.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pDebugger.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pEEInterface.EnumMem(); )
- CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pDebugInterface.EnumMem(); )
+ if (g_pDebugInterface != nullptr)
+ {
+ CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED(g_pDebugInterface.EnumMem(); )
+ }
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pEEDbgInterfaceImpl.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_CORDebuggerControlFlags.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_Mscorlib.EnumMem(); )
diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp
index 1f70f17d1f..8363b1f658 100644
--- a/src/debug/ee/debugger.cpp
+++ b/src/debug/ee/debugger.cpp
@@ -1885,29 +1885,6 @@ CLR_ENGINE_METRICS g_CLREngineMetrics = {
CorDebugVersion_4_0,
&g_hContinueStartupEvent};
-
-bool IsTelestoDebugPackInstalled()
-{
- RegKeyHolder hKey;
- if (ERROR_SUCCESS != WszRegOpenKeyEx(HKEY_LOCAL_MACHINE, FRAMEWORK_REGISTRY_KEY_W, 0, KEY_READ, &hKey))
- return false;
-
- bool debugPackInstalled = false;
-
- DWORD cbValue = 0;
-
- if (ERROR_SUCCESS == WszRegQueryValueEx(hKey, CLRConfig::EXTERNAL_DbgPackShimPath, NULL, NULL, NULL, &cbValue))
- {
- if (cbValue != 0)
- {
- debugPackInstalled = true;
- }
- }
-
- // RegCloseKey called by holder
- return debugPackInstalled;
-}
-
#define StartupNotifyEventNamePrefix W("TelestoStartupEvent_")
const int cchEventNameBufferSize = sizeof(StartupNotifyEventNamePrefix)/sizeof(WCHAR) + 8; // + hex DWORD (8). NULL terminator is included in sizeof(StartupNotifyEventNamePrefix)
HANDLE OpenStartupNotificationEvent()
@@ -1919,7 +1896,7 @@ HANDLE OpenStartupNotificationEvent()
return WszOpenEvent(MAXIMUM_ALLOWED | SYNCHRONIZE | EVENT_MODIFY_STATE, FALSE, szEventName);
}
-void NotifyDebuggerOfTelestoStartup()
+void NotifyDebuggerOfStartup()
{
// Create the continue event first so that we guarantee that any
// enumeration of this process will get back a valid continue event
@@ -1980,26 +1957,9 @@ HRESULT Debugger::Startup(void)
_ASSERTE(g_pEEInterface != NULL);
#if !defined(FEATURE_PAL)
- if (IsWatsonEnabled() || IsTelestoDebugPackInstalled())
- {
- // Iff the debug pack is installed, then go through the telesto debugging pipeline.
- LOG((LF_CORDB, LL_INFO10, "Debugging service is enabled because debug pack is installed or Watson support is enabled)\n"));
-
- // This may block while an attach occurs.
- NotifyDebuggerOfTelestoStartup();
- }
- else
- {
- // On Windows, it's actually safe to finish the initialization here even without the debug pack.
- // However, doing so causes a perf regression because we used to bail out early if the debug
- // pack is not installed.
- //
- // Unlike Windows, we can't continue executing this function if the debug pack is not installed.
- // The transport requires the debug pack to be present. Otherwise it'll raise a fatal error.
- return S_FALSE;
- }
+ // This may block while an attach occurs.
+ NotifyDebuggerOfStartup();
#endif // !FEATURE_PAL
-
{
DebuggerLockHolder dbgLockHolder(this);
@@ -2010,7 +1970,6 @@ HRESULT Debugger::Startup(void)
// threads running and throwing debug events. Keep these stress procs separate so that
// we can focus on certain problem areas.
#ifdef _DEBUG
-
g_DbgShouldntUseDebugger = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_DbgNoDebugger) != 0;
@@ -2078,6 +2037,29 @@ HRESULT Debugger::Startup(void)
InitializeHijackFunctionAddress();
+ // Also initialize the AppDomainEnumerationIPCBlock
+ #if !defined(FEATURE_IPCMAN) || defined(FEATURE_DBGIPC_TRANSPORT_VM)
+ m_pAppDomainCB = new (nothrow) AppDomainEnumerationIPCBlock();
+ #else
+ m_pAppDomainCB = g_pIPCManagerInterface->GetAppDomainBlock();
+ #endif
+
+ if (m_pAppDomainCB == NULL)
+ {
+ LOG((LF_CORDB, LL_INFO100, "D::S: Failed to get AppDomain IPC block from IPCManager.\n"));
+ ThrowHR(E_FAIL);
+ }
+
+ hr = InitAppDomainIPC();
+ _ASSERTE(SUCCEEDED(hr)); // throws on error.
+
+ // Allows the debugger (and profiler) diagnostics to be disabled so resources like
+ // the named pipes and semaphores are not created.
+ if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableDiagnostics) == 0)
+ {
+ return S_OK;
+ }
+
// Create the runtime controller thread, a.k.a, the debug helper thread.
// Don't use the interop-safe heap b/c we don't want to lazily create it.
m_pRCThread = new DebuggerRCThread(this);
@@ -2103,22 +2085,6 @@ HRESULT Debugger::Startup(void)
RaiseStartupNotification();
- // Also initialize the AppDomainEnumerationIPCBlock
- #if !defined(FEATURE_IPCMAN) || defined(FEATURE_DBGIPC_TRANSPORT_VM)
- m_pAppDomainCB = new (nothrow) AppDomainEnumerationIPCBlock();
- #else
- m_pAppDomainCB = g_pIPCManagerInterface->GetAppDomainBlock();
- #endif
-
- if (m_pAppDomainCB == NULL)
- {
- LOG((LF_CORDB, LL_INFO100, "D::S: Failed to get AppDomain IPC block from IPCManager.\n"));
- ThrowHR(E_FAIL);
- }
-
- hr = InitAppDomainIPC();
- _ASSERTE(SUCCEEDED(hr)); // throws on error.
-
// See if we need to spin up the helper thread now, rather than later.
DebuggerIPCControlBlock* pIPCControlBlock = m_pRCThread->GetDCB();
(void)pIPCControlBlock; //prevent "unused variable" error from GCC
@@ -7234,7 +7200,8 @@ void Debugger::JitAttach(Thread * pThread, EXCEPTION_POINTERS * pExceptionInfo,
}
CONTRACTL_END;
- if (IsDebuggerPresent())
+ // Don't do anything if there is a native debugger already attached or the debugging support has been disabled.
+ if (IsDebuggerPresent() || m_pRCThread == NULL)
return;
GCX_PREEMP_EEINTERFACE_TOGGLE_IFTHREAD();
@@ -14165,8 +14132,7 @@ DWORD Debugger::GetHelperThreadID(void )
{
LIMITED_METHOD_CONTRACT;
- return m_pRCThread->GetDCB()
- ->m_temporaryHelperThreadId;
+ return m_pRCThread ? m_pRCThread->GetDCB()->m_temporaryHelperThreadId : 0;
}
diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h
index 6ba4e69868..f3206f1f35 100644
--- a/src/debug/ee/debugger.h
+++ b/src/debug/ee/debugger.h
@@ -3945,10 +3945,10 @@ protected:
#if _DEBUG
#define MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT \
- if (!m_pRCThread->IsRCThreadReady()) { THROWS; } else { NOTHROW; }
+ if ((m_pRCThread == NULL) || !m_pRCThread->IsRCThreadReady()) { THROWS; } else { NOTHROW; }
#define MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT \
- if (!m_pRCThread->IsRCThreadReady() || (GetThread() != NULL)) { GC_TRIGGERS; } else { GC_NOTRIGGER; }
+ if ((m_pRCThread == NULL) || !m_pRCThread->IsRCThreadReady() || (GetThread() != NULL)) { GC_TRIGGERS; } else { GC_NOTRIGGER; }
#define GC_TRIGGERS_FROM_GETJITINFO if (GetThreadNULLOk() != NULL) { GC_TRIGGERS; } else { GC_NOTRIGGER; }
diff --git a/src/debug/ee/i386/dbghelpers.S b/src/debug/ee/i386/dbghelpers.S
index d0a11011ca..f15ca5abd8 100644
--- a/src/debug/ee/i386/dbghelpers.S
+++ b/src/debug/ee/i386/dbghelpers.S
@@ -9,10 +9,14 @@
// @dbgtodo- once we port Funceval, use the ExceptionHijack stub instead of this func-eval stub.
NESTED_ENTRY FuncEvalHijack, _TEXT, UnhandledExceptionHandlerUnix
+#define STK_ALIGN_PADDING 12
+ sub esp, STK_ALIGN_PADDING
push eax // the ptr to the DebuggerEval
+ CHECK_STACK_ALIGNMENT
call C_FUNC(FuncEvalHijackWorker)
+ add esp, (4 + STK_ALIGN_PADDING)
jmp eax // return is the patch addresss to jmp to
-
+#undef STK_ALIGN_PADDING
NESTED_END FuncEvalHijack, _TEXT
//
diff --git a/src/debug/shim/debugshim.cpp b/src/debug/shim/debugshim.cpp
index 08f1ec58a1..b4e709adcf 100644
--- a/src/debug/shim/debugshim.cpp
+++ b/src/debug/shim/debugshim.cpp
@@ -90,116 +90,170 @@ STDMETHODIMP CLRDebuggingImpl::OpenVirtualProcess(
CLR_DEBUGGING_VERSION version;
BOOL versionSupportedByCaller = FALSE;
-
+ // argument checking
+ if( (ppProcess != NULL || pFlags != NULL) && pLibraryProvider == NULL)
+ {
+ hr = E_POINTER; // the library provider must be specified if either
+ // ppProcess or pFlags is non-NULL
+ }
+ else if( (ppProcess != NULL || pFlags != NULL) && pMaxDebuggerSupportedVersion == NULL)
+ {
+ hr = E_POINTER; // the max supported version must be specified if either
+ // ppProcess or pFlags is non-NULL
+ }
+ else if(pVersion != NULL && pVersion->wStructVersion != 0)
+ {
+ hr = CORDBG_E_UNSUPPORTED_VERSION_STRUCT;
+ }
+ else if(FAILED(pDataTarget->QueryInterface(__uuidof(ICorDebugDataTarget), (void**) &pDt)))
+ {
+ hr = CORDBG_E_MISSING_DATA_TARGET_INTERFACE;
+ }
- // argument checking
- if( (ppProcess != NULL || pFlags != NULL) && pLibraryProvider == NULL)
- {
- hr = E_POINTER; // the library provider must be specified if either
- // ppProcess or pFlags is non-NULL
- }
- else if( (ppProcess != NULL || pFlags != NULL) && pMaxDebuggerSupportedVersion == NULL)
- {
- hr = E_POINTER; // the max supported version must be specified if either
- // ppProcess or pFlags is non-NULL
- }
- else if(pVersion != NULL && pVersion->wStructVersion != 0)
- {
- hr = CORDBG_E_UNSUPPORTED_VERSION_STRUCT;
- }
- else if(FAILED(pDataTarget->QueryInterface(__uuidof(ICorDebugDataTarget), (void**) &pDt)))
- {
- hr = CORDBG_E_MISSING_DATA_TARGET_INTERFACE;
- }
+ if(SUCCEEDED(hr))
+ {
+ // get CLR version
+ // The expectation is that new versions of the CLR will continue to use the same GUID
+ // (unless there's a reason to hide them from older shims), but debuggers will tell us the
+ // CLR version they're designed for and mscordbi.dll can decide whether or not to accept it.
+ version.wStructVersion = 0;
+ hr = GetCLRInfo(pDt,
+ moduleBaseAddress,
+ &version,
+ &dbiTimestamp,
+ &dbiSizeOfImage,
+ dbiName,
+ MAX_PATH_FNAME,
+ &dacTimestamp,
+ &dacSizeOfImage,
+ dacName,
+ MAX_PATH_FNAME);
+ }
- if(SUCCEEDED(hr))
+ // If we need to fetch either the process info or the flags info then we need to find
+ // mscordbi and DAC and do the version specific OVP work
+ if(SUCCEEDED(hr) && (ppProcess != NULL || pFlags != NULL))
+ {
+ ICLRDebuggingLibraryProvider2* pLibraryProvider2;
+ if (SUCCEEDED(pLibraryProvider->QueryInterface(__uuidof(ICLRDebuggingLibraryProvider2), (void**)&pLibraryProvider2)))
{
- // get CLR version
- // The expectation is that new versions of the CLR will continue to use the same GUID
- // (unless there's a reason to hide them from older shims), but debuggers will tell us the
- // CLR version they're designed for and mscordbi.dll can decide whether or not to accept it.
- version.wStructVersion = 0;
- hr = GetCLRInfo(pDt,
- moduleBaseAddress,
- &version,
- &dbiTimestamp,
- &dbiSizeOfImage,
- dbiName,
- MAX_PATH_FNAME,
- &dacTimestamp,
- &dacSizeOfImage,
- dacName,
- MAX_PATH_FNAME);
- }
+ LPWSTR pDbiModulePath;
+ if (FAILED(pLibraryProvider2->ProvideLibrary2(dbiName, dbiTimestamp, dbiSizeOfImage, &pDbiModulePath)) ||
+ pDbiModulePath == NULL)
+ {
+ hr = CORDBG_E_LIBRARY_PROVIDER_ERROR;
+ }
- // If we need to fetch either the process info or the flags info then we need to find
- // mscordbi and DAC and do the version specific OVP work
- if(SUCCEEDED(hr) && (ppProcess != NULL || pFlags != NULL))
- {
+ if (SUCCEEDED(hr))
+ {
+ hDbi = LoadLibraryW(pDbiModulePath);
+ if (hDbi == NULL)
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ }
+#ifdef FEATURE_PAL
+ free(pDbiModulePath);
+#else
+ CoTaskMemFree(pDbiModulePath);
+#endif
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ // Adjust the timestamp and size of image if this DAC is a known buggy version and needs to be retargeted
+ RetargetDacIfNeeded(&dacTimestamp, &dacSizeOfImage);
+
+ // ask library provider for dac
+ LPWSTR pDacModulePath;
+ if (FAILED(pLibraryProvider2->ProvideLibrary2(dacName, dacTimestamp, dacSizeOfImage, &pDacModulePath)) ||
+ pDacModulePath == NULL)
+ {
+ hr = CORDBG_E_LIBRARY_PROVIDER_ERROR;
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ hDac = LoadLibraryW(pDacModulePath);
+ if (hDac == NULL)
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ }
+#ifdef FEATURE_PAL
+ free(pDacModulePath);
+#else
+ CoTaskMemFree(pDacModulePath);
+#endif
+ }
+ }
+
+ pLibraryProvider2->Release();
+ }
+ else {
// ask library provider for dbi
- if(FAILED(pLibraryProvider->ProvideLibrary(dbiName, dbiTimestamp, dbiSizeOfImage, &hDbi)) ||
+ if (FAILED(pLibraryProvider->ProvideLibrary(dbiName, dbiTimestamp, dbiSizeOfImage, &hDbi)) ||
hDbi == NULL)
{
hr = CORDBG_E_LIBRARY_PROVIDER_ERROR;
}
- if(SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
{
// Adjust the timestamp and size of image if this DAC is a known buggy version and needs to be retargeted
RetargetDacIfNeeded(&dacTimestamp, &dacSizeOfImage);
// ask library provider for dac
- if(FAILED(pLibraryProvider->ProvideLibrary(dacName, dacTimestamp, dacSizeOfImage, &hDac)) ||
+ if (FAILED(pLibraryProvider->ProvideLibrary(dacName, dacTimestamp, dacSizeOfImage, &hDac)) ||
hDac == NULL)
{
hr = CORDBG_E_LIBRARY_PROVIDER_ERROR;
}
}
+ }
- if(SUCCEEDED(hr))
+ if(SUCCEEDED(hr))
+ {
+ // get access to OVP and call it
+ OpenVirtualProcessImplFnPtr ovpFn = (OpenVirtualProcessImplFnPtr) GetProcAddress(hDbi, "OpenVirtualProcessImpl");
+ if(ovpFn == NULL)
{
- // get access to OVP and call it
- OpenVirtualProcessImplFnPtr ovpFn = (OpenVirtualProcessImplFnPtr) GetProcAddress(hDbi, "OpenVirtualProcessImpl");
- if(ovpFn == NULL)
+ // Fallback to CLR v4 Beta1 path, but skip some of the checking we'd normally do (maxSupportedVersion, etc.)
+ OpenVirtualProcess2FnPtr ovp2Fn = (OpenVirtualProcess2FnPtr) GetProcAddress(hDbi, "OpenVirtualProcess2");
+ if (ovp2Fn == NULL)
{
- // Fallback to CLR v4 Beta1 path, but skip some of the checking we'd normally do (maxSupportedVersion, etc.)
- OpenVirtualProcess2FnPtr ovp2Fn = (OpenVirtualProcess2FnPtr) GetProcAddress(hDbi, "OpenVirtualProcess2");
- if (ovp2Fn == NULL)
- {
- hr = CORDBG_E_LIBRARY_PROVIDER_ERROR;
- }
- else
- {
- hr = ovp2Fn(moduleBaseAddress, pDataTarget, hDac, riidProcess, ppProcess, pFlags);
- }
+ hr = CORDBG_E_LIBRARY_PROVIDER_ERROR;
}
else
{
- // Have a CLR v4 Beta2+ DBI, call it and let it do the version check
- hr = ovpFn(moduleBaseAddress, pDataTarget, hDac, pMaxDebuggerSupportedVersion, riidProcess, ppProcess, pFlags);
- if(FAILED(hr))
- {
- _ASSERTE(ppProcess == NULL || *ppProcess == NULL);
- _ASSERTE(pFlags == NULL || *pFlags == 0);
- }
+ hr = ovp2Fn(moduleBaseAddress, pDataTarget, hDac, riidProcess, ppProcess, pFlags);
+ }
+ }
+ else
+ {
+ // Have a CLR v4 Beta2+ DBI, call it and let it do the version check
+ hr = ovpFn(moduleBaseAddress, pDataTarget, hDac, pMaxDebuggerSupportedVersion, riidProcess, ppProcess, pFlags);
+ if(FAILED(hr))
+ {
+ _ASSERTE(ppProcess == NULL || *ppProcess == NULL);
+ _ASSERTE(pFlags == NULL || *pFlags == 0);
}
}
}
-
- //version is still valid in some failure cases
- if(pVersion != NULL &&
- (SUCCEEDED(hr) ||
- (hr == CORDBG_E_UNSUPPORTED_DEBUGGING_MODEL) ||
- (hr == CORDBG_E_UNSUPPORTED_FORWARD_COMPAT)))
- {
- memcpy(pVersion, &version, sizeof(CLR_DEBUGGING_VERSION));
- }
+ }
- // free the data target we QI'ed earlier
- if(pDt != NULL)
- {
- pDt->Release();
- }
+ //version is still valid in some failure cases
+ if(pVersion != NULL &&
+ (SUCCEEDED(hr) ||
+ (hr == CORDBG_E_UNSUPPORTED_DEBUGGING_MODEL) ||
+ (hr == CORDBG_E_UNSUPPORTED_FORWARD_COMPAT)))
+ {
+ memcpy(pVersion, &version, sizeof(CLR_DEBUGGING_VERSION));
+ }
+
+ // free the data target we QI'ed earlier
+ if(pDt != NULL)
+ {
+ pDt->Release();
+ }
return hr;
}
diff --git a/src/dlls/dbgshim/CMakeLists.txt b/src/dlls/dbgshim/CMakeLists.txt
index 4e72ee219a..7e6ae61de1 100644
--- a/src/dlls/dbgshim/CMakeLists.txt
+++ b/src/dlls/dbgshim/CMakeLists.txt
@@ -66,6 +66,7 @@ if(WIN32)
uuid.lib
user32.lib
advapi32.lib
+ ole32.lib
oleaut32.lib
WtsApi32.lib
version.lib
diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt
index fb5cc90291..8b727a0efa 100644
--- a/src/dlls/mscoree/coreclr/CMakeLists.txt
+++ b/src/dlls/mscoree/coreclr/CMakeLists.txt
@@ -162,11 +162,18 @@ if(WIN32)
clr_unknown_arch()
endif()
+ set(DACTABLEGEN_EXE ${CMAKE_BINARY_DIR}/src/ToolBox/SOS/DacTableGen/dactablegen.exe)
+ # The DactTableGen executable that we build needs an msdia140.dll supplied by Visual Studio.
+ # however VS2015 may not have this, so fall back to the DactTableGen in the tools package (which is old)
+ if($ENV{__VSVersion} STREQUAL "vs2015")
+ set(DACTABLEGEN_EXE ${BuildToolsDir}/dactablegen.exe)
+ endif()
+
add_custom_command(
DEPENDS coreclr mscordaccore mscordbi ${CLR_DIR}/src/debug/daccess/daccess.cpp
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp
COMMAND ${CMAKE_CXX_COMPILER} /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/src/debug/daccess/daccess.cpp
- COMMAND ${BuildToolsDir}/dactablegen.exe /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/coreclr.pdb /dll:$<TARGET_FILE:coreclr> /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin
+ COMMAND ${DACTABLEGEN_EXE} /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/coreclr.pdb /dll:$<TARGET_FILE:coreclr> /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin
COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$<TARGET_FILE:coreclr>
COMMAND ${BuildToolsDir}/GenClrDebugResource.exe /dac:$<TARGET_FILE:mscordaccore> /dbi:$<TARGET_FILE:mscordbi> /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin
COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$<TARGET_FILE:coreclr> /name:CLRDEBUGINFO
diff --git a/src/dlls/mscorrc/mscorrc.rc b/src/dlls/mscorrc/mscorrc.rc
index 00a068c9b1..61f5c9af1b 100644
--- a/src/dlls/mscorrc/mscorrc.rc
+++ b/src/dlls/mscorrc/mscorrc.rc
@@ -2065,6 +2065,7 @@ BEGIN
IDS_EE_BADMARSHAL_TYPE_ASANYA "Marshalling arbitrary types is not supported"
IDS_EE_BADMARSHAL_TYPE_IDISPATCH "Marshalling as IDispatch is not supported"
IDS_EE_ERROR_IDISPATCH "IDispatch and IDispatchEx are not supported"
+ IDS_EE_ERROR_COM "COM is not supported"
END
STRINGTABLE DISCARDABLE
diff --git a/src/dlls/mscorrc/resource.h b/src/dlls/mscorrc/resource.h
index 0fbbf1ce1a..b8e1b2b2a9 100644
--- a/src/dlls/mscorrc/resource.h
+++ b/src/dlls/mscorrc/resource.h
@@ -897,3 +897,4 @@
#define IDS_EE_NDIRECT_LOADLIB_LINUX 0x263e
#define IDS_EE_NDIRECT_LOADLIB_MAC 0x263f
#define IDS_EE_NDIRECT_GETPROCADDRESS_UNIX 0x2640
+#define IDS_EE_ERROR_COM 0x2641
diff --git a/src/gc/env/gcenv.base.h b/src/gc/env/gcenv.base.h
index e1d40d6003..b695abc7fa 100644
--- a/src/gc/env/gcenv.base.h
+++ b/src/gc/env/gcenv.base.h
@@ -253,12 +253,18 @@ inline uint8_t BitScanForward64(uint32_t *bitIndex, uint64_t mask)
uint32_t hi = (mask >> 32) & 0xFFFFFFFF;
uint32_t lo = mask & 0xFFFFFFFF;
uint32_t fakeBitIndex = 0;
- if (BitScanForward(&fakeBitIndex, hi))
+
+ uint8_t result = BitScanForward(bitIndex, lo);
+ if (result == 0)
{
- *bitIndex = fakeBitIndex + 32;
+ result = BitScanForward(&fakeBitIndex, hi);
+ if (result != 0)
+ {
+ *bitIndex = fakeBitIndex + 32;
+ }
}
- return BitScanForward(bitIndex, lo);
+ return result;
#else
return _BitScanForward64((unsigned long*)bitIndex, mask);
#endif // _WIN32
diff --git a/src/gc/gcevent_serializers.h b/src/gc/gcevent_serializers.h
index 643ab82a15..ac6e9915ff 100644
--- a/src/gc/gcevent_serializers.h
+++ b/src/gc/gcevent_serializers.h
@@ -106,33 +106,33 @@ struct EventSerializationTraits<uint32_t>
* Given a list of arguments , returns the total size of
* the buffer required to fully serialize the list of arguments.
*/
-template<class Head, class... Tail>
-size_t SerializedSize(Head head, Tail... tail)
-{
- return EventSerializationTraits<Head>::SerializedSize(head) + SerializedSize(tail...);
-}
-
template<class Head>
size_t SerializedSize(Head head)
{
return EventSerializationTraits<Head>::SerializedSize(head);
}
+template<class Head, class... Tail>
+size_t SerializedSize(Head head, Tail... tail)
+{
+ return EventSerializationTraits<Head>::SerializedSize(head) + SerializedSize(tail...);
+}
+
/*
* Given a list of arguments and a list of actual parameters, serialize
* the arguments into the buffer that's given to us.
*/
-template<class Head, class... Tail>
-void Serialize(uint8_t** buf, Head head, Tail... tail)
+template<class Head>
+void Serialize(uint8_t** buf, Head head)
{
EventSerializationTraits<Head>::Serialize(head, buf);
- Serialize(buf, tail...);
}
-template<class Head>
-void Serialize(uint8_t** buf, Head head)
+template<class Head, class... Tail>
+void Serialize(uint8_t** buf, Head head, Tail... tail)
{
EventSerializationTraits<Head>::Serialize(head, buf);
+ Serialize(buf, tail...);
}
} // namespace gc_event
diff --git a/src/gc/gceventstatus.h b/src/gc/gceventstatus.h
index 95ed337475..5482fb51a6 100644
--- a/src/gc/gceventstatus.h
+++ b/src/gc/gceventstatus.h
@@ -85,7 +85,7 @@ public:
*/
static void Set(GCEventProvider provider, GCEventKeyword keywords, GCEventLevel level)
{
- assert(level >= GCEventLevel_None && level < GCEventLevel_Max);
+ assert((level >= GCEventLevel_None && level < GCEventLevel_Max) || level == GCEventLevel_LogAlways);
size_t index = static_cast<size_t>(provider);
@@ -134,6 +134,9 @@ private:
case GCEventLevel_Verbose:
fprintf(stderr, " level: Verbose\n");
break;
+ case GCEventLevel_LogAlways:
+ fprintf(stderr, " level: LogAlways");
+ break;
default:
fprintf(stderr, " level: %d?\n", level);
break;
diff --git a/src/gc/gcinterface.h b/src/gc/gcinterface.h
index d0b6334e3b..c7c6424d00 100644
--- a/src/gc/gcinterface.h
+++ b/src/gc/gcinterface.h
@@ -211,7 +211,8 @@ enum GCEventLevel
GCEventLevel_Warning = 3,
GCEventLevel_Information = 4,
GCEventLevel_Verbose = 5,
- GCEventLevel_Max = 6
+ GCEventLevel_Max = 6,
+ GCEventLevel_LogAlways = 255
};
// Event keywords corresponding to events that can be fired by the GC. These
diff --git a/src/gc/windows/gcenv.windows.cpp b/src/gc/windows/gcenv.windows.cpp
index e258834abc..85bcd851a7 100644
--- a/src/gc/windows/gcenv.windows.cpp
+++ b/src/gc/windows/gcenv.windows.cpp
@@ -21,6 +21,10 @@ static PGET_PROCESS_MEMORY_INFO GCGetProcessMemoryInfo = 0;
static size_t g_RestrictedPhysicalMemoryLimit = (size_t)UINTPTR_MAX;
+// For 32-bit processes the virtual address range could be smaller than the amount of physical
+// memory on the machine/in the container, we need to restrict by the VM.
+static bool g_UseRestrictedVirtualMemory = false;
+
typedef BOOL (WINAPI *PIS_PROCESS_IN_JOB)(HANDLE processHandle, HANDLE jobHandle, BOOL* result);
typedef BOOL (WINAPI *PQUERY_INFORMATION_JOB_OBJECT)(HANDLE jobHandle, JOBOBJECTINFOCLASS jobObjectInfoClass, void* lpJobObjectInfo, DWORD cbJobObjectInfoLength, LPDWORD lpReturnLength);
@@ -31,13 +35,6 @@ void GetProcessMemoryLoad(LPMEMORYSTATUSEX pMSEX)
pMSEX->dwLength = sizeof(MEMORYSTATUSEX);
BOOL fRet = ::GlobalMemoryStatusEx(pMSEX);
assert(fRet);
-
- // If the machine has more RAM than virtual address limit, let us cap it.
- // Our GC can never use more than virtual address limit.
- if (pMSEX->ullAvailPhys > pMSEX->ullTotalVirtual)
- {
- pMSEX->ullAvailPhys = pMSEX->ullAvailVirtual;
- }
}
static size_t GetRestrictedPhysicalMemoryLimit()
@@ -49,6 +46,8 @@ static size_t GetRestrictedPhysicalMemoryLimit()
return g_RestrictedPhysicalMemoryLimit;
size_t job_physical_memory_limit = (size_t)UINTPTR_MAX;
+ uint64_t total_virtual = 0;
+ uint64_t total_physical = 0;
BOOL in_job_p = FALSE;
HINSTANCE hinstKernel32 = 0;
@@ -109,6 +108,8 @@ static size_t GetRestrictedPhysicalMemoryLimit()
MEMORYSTATUSEX ms;
::GetProcessMemoryLoad(&ms);
+ total_virtual = ms.ullTotalVirtual;
+ total_physical = ms.ullAvailPhys;
// A sanity check in case someone set a larger limit than there is actual physical memory.
job_physical_memory_limit = (size_t) min (job_physical_memory_limit, ms.ullTotalPhys);
@@ -120,7 +121,40 @@ exit:
{
job_physical_memory_limit = 0;
- FreeLibrary(hinstKernel32);
+ if (hinstKernel32 != 0)
+ {
+ FreeLibrary(hinstKernel32);
+ hinstKernel32 = 0;
+ GCGetProcessMemoryInfo = 0;
+ }
+ }
+
+ // Check to see if we are limited by VM.
+ if (total_virtual == 0)
+ {
+ MEMORYSTATUSEX ms;
+ ::GetProcessMemoryLoad(&ms);
+
+ total_virtual = ms.ullTotalVirtual;
+ total_physical = ms.ullTotalPhys;
+ }
+
+ if (job_physical_memory_limit != 0)
+ {
+ total_physical = job_physical_memory_limit;
+ }
+
+ if (total_virtual < total_physical)
+ {
+ if (hinstKernel32 != 0)
+ {
+ // We can also free the lib here - if we are limited by VM we will not be calling
+ // GetProcessMemoryInfo.
+ FreeLibrary(hinstKernel32);
+ GCGetProcessMemoryInfo = 0;
+ }
+ g_UseRestrictedVirtualMemory = true;
+ job_physical_memory_limit = (size_t)total_virtual;
}
VolatileStore(&g_RestrictedPhysicalMemoryLimit, job_physical_memory_limit);
@@ -495,13 +529,26 @@ void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available
uint64_t restricted_limit = GetRestrictedPhysicalMemoryLimit();
if (restricted_limit != 0)
{
- PROCESS_MEMORY_COUNTERS pmc;
- if (GCGetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)))
+ size_t workingSetSize;
+ BOOL status = FALSE;
+ if (!g_UseRestrictedVirtualMemory)
+ {
+ PROCESS_MEMORY_COUNTERS pmc;
+ status = GCGetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
+ workingSetSize = pmc.WorkingSetSize;
+ }
+
+ if(status)
{
if (memory_load)
- *memory_load = (uint32_t)((float)pmc.WorkingSetSize * 100.0 / (float)restricted_limit);
+ *memory_load = (uint32_t)((float)workingSetSize * 100.0 / (float)restricted_limit);
if (available_physical)
- *available_physical = restricted_limit - pmc.WorkingSetSize;
+ {
+ if(workingSetSize > restricted_limit)
+ *available_physical = 0;
+ else
+ *available_physical = restricted_limit - workingSetSize;
+ }
// Available page file doesn't mean much when physical memory is restricted since
// we don't know how much of it is available to this process so we are not going to
// bother to make another OS call for it.
@@ -514,13 +561,30 @@ void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available
MEMORYSTATUSEX ms;
::GetProcessMemoryLoad(&ms);
-
- if (memory_load != nullptr)
- *memory_load = ms.dwMemoryLoad;
- if (available_physical != nullptr)
- *available_physical = ms.ullAvailPhys;
- if (available_page_file != nullptr)
- *available_page_file = ms.ullAvailPageFile;
+
+ if (g_UseRestrictedVirtualMemory)
+ {
+ _ASSERTE (ms.ullTotalVirtual == restricted_limit);
+ if (memory_load != NULL)
+ *memory_load = (uint32_t)((float)(ms.ullTotalVirtual - ms.ullAvailVirtual) * 100.0 / (float)ms.ullTotalVirtual);
+ if (available_physical != NULL)
+ *available_physical = ms.ullTotalVirtual;
+
+ // Available page file isn't helpful when we are restricted by virtual memory
+ // since the amount of memory we can reserve is less than the amount of
+ // memory we can commit.
+ if (available_page_file != NULL)
+ *available_page_file = 0;
+ }
+ else
+ {
+ if (memory_load != NULL)
+ *memory_load = ms.dwMemoryLoad;
+ if (available_physical != NULL)
+ *available_physical = ms.ullAvailPhys;
+ if (available_page_file != NULL)
+ *available_page_file = ms.ullAvailPageFile;
+ }
}
// Get a high precision performance counter
diff --git a/src/inc/UacAsInvoker.manifest b/src/inc/UacAsInvoker.manifest
deleted file mode 100644
index 80a5e05e20..0000000000
--- a/src/inc/UacAsInvoker.manifest
+++ /dev/null
@@ -1,11 +0,0 @@
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
- <ms_asmv3:security>
- <ms_asmv3:requestedPrivileges>
- <ms_asmv3:requestedExecutionLevel
- level="asInvoker"
- uiAccess="false"/>
- </ms_asmv3:requestedPrivileges>
- </ms_asmv3:security>
- </ms_asmv3:trustInfo>
-</assembly>
diff --git a/src/inc/assemblyfilehash.h b/src/inc/assemblyfilehash.h
deleted file mode 100644
index 5f6fb23f68..0000000000
--- a/src/inc/assemblyfilehash.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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.
-
-
-
-#ifndef __ASSEMBLYHASH_H__
-#define __ASSEMBLYHASH_H__
-
-#include "wincrypt.h"
-#include "ex.h"
-
-
-
-class AssemblyFileHash
-{
-protected:
- BOOL m_bDataOwner;
- PBYTE m_pbData;
- DWORD m_cbData;
- PBYTE m_pbHash;
- DWORD m_cbHash;
- HRESULT HashData(HCRYPTHASH);
- HANDLE m_hFile;
- BOOL m_NeedToReadData;
-
- HRESULT ReadData();
-public:
-
- HRESULT SetFileName(LPCWSTR wszFileName);
- HRESULT ReleaseFileHandle()
- {
- WRAPPER_NO_CONTRACT;
- return SetFileHandle(INVALID_HANDLE_VALUE);
- };
- HRESULT SetFileHandle(HANDLE hFile)
- {
- LIMITED_METHOD_CONTRACT;
- m_hFile=hFile;
- return S_OK;
- };
-
- HRESULT SetData(PBYTE pbData, DWORD cbData) // Owned by owners context. Will not be deleted
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- m_pbData = pbData;
- m_cbData = cbData;
- m_bDataOwner = FALSE;
- m_NeedToReadData=FALSE;
- return S_OK;
- }
-
- PBYTE GetHash() { LIMITED_METHOD_CONTRACT; _ASSERTE(!m_NeedToReadData);return m_pbHash; }
- DWORD GetHashSize() { LIMITED_METHOD_CONTRACT;_ASSERTE(!m_NeedToReadData); return m_cbHash; }
-
- HRESULT CalculateHash(DWORD algid);
-
- AssemblyFileHash()
- : m_pbData( NULL ),
- m_cbData( 0 ),
- m_pbHash( NULL ),
- m_cbHash( 0 ),
- m_hFile(INVALID_HANDLE_VALUE),
- m_NeedToReadData(TRUE)
- {
- CONTRACTL
- {
- CONSTRUCTOR_CHECK;
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
- }
-
- ~AssemblyFileHash()
- {
- delete [] m_pbHash;
- if (m_bDataOwner)
- delete [] m_pbData;
- if (m_hFile!=INVALID_HANDLE_VALUE)
- CloseHandle(m_hFile);
- m_hFile=INVALID_HANDLE_VALUE;
- }
-};
-
-#endif
diff --git a/src/inc/clrconfig.h b/src/inc/clrconfig.h
index bb49dde6a2..7e74e65147 100644
--- a/src/inc/clrconfig.h
+++ b/src/inc/clrconfig.h
@@ -19,7 +19,6 @@
#include "utilcode.h"
#include "holder.h"
-#include "quirksapi.h"
#ifndef __CLRConfig_h__
#define __CLRConfig_h__
@@ -65,9 +64,6 @@ public:
REGUTIL_default = IgnoreConfigFiles,
// Legacy EEConfig-style lookup.
EEConfig_default = 0,
-
- // If set, Ignore windows quirk DB lookup
- IgnoreWindowsQuirkDB = 0x400,
};
// Function pointer definition used for calling EEConfig::GetConfigValueCallback .
diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h
index b6d4a941b9..2e66f12244 100644
--- a/src/inc/clrconfigvalues.h
+++ b/src/inc/clrconfigvalues.h
@@ -174,6 +174,7 @@ CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnUncaughtException, W("BreakOnUncaughtExcept
/// Debugger
///
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_EnableDiagnostics, W("EnableDiagnostics"), 1, "Allows the debugger and profiler diagnostics to be disabled", CLRConfig::REGUTIL_default)
CONFIG_DWORD_INFO_EX(INTERNAL_D__FCE, W("D::FCE"), 0, "Allows an assert when crawling the managed stack for an exception handler", CLRConfig::REGUTIL_default)
CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakIfLocksUnavailable, W("DbgBreakIfLocksUnavailable"), 0, "Allows an assert when the debugger can't take a lock ", CLRConfig::REGUTIL_default)
CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakOnErr, W("DbgBreakOnErr"), 0, "Allows an assert when we get a failing hresult", CLRConfig::REGUTIL_default)
@@ -380,7 +381,7 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TailCallLoopOpt, W("TailCallLoopOpt"), 1, "Con
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Jit_NetFx40PInvokeStackResilience, W("NetFx40_PInvokeStackResilience"), (DWORD)-1, "Makes P/Invoke resilient against mismatched signature and calling convention (significant perf penalty).")
// AltJitAssertOnNYI should be 0 on targets where JIT is under development or bring up stage, so as to facilitate fallback to main JIT on hitting a NYI.
-#if defined(_TARGET_ARM64_) || defined(_TARGET_X86_)
+#if defined(_TARGET_X86_)
RETAIL_CONFIG_DWORD_INFO(INTERNAL_AltJitAssertOnNYI, W("AltJitAssertOnNYI"), 0, "Controls the AltJit behavior of NYI stuff")
#else
RETAIL_CONFIG_DWORD_INFO(INTERNAL_AltJitAssertOnNYI, W("AltJitAssertOnNYI"), 1, "Controls the AltJit behavior of NYI stuff")
@@ -649,7 +650,8 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_GainExponent,
/// Tiered Compilation
///
#ifdef FEATURE_TIERED_COMPILATION
-RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TieredCompilation, W("EXPERIMENTAL_TieredCompilation"), 0, "Enables tiered compilation")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TieredCompilation, W("TieredCompilation"), 0, "Enables tiered compilation")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_LEGACY_TieredCompilation, W("EXPERIMENTAL_TieredCompilation"), 0, "Deprecated - Use COMPLUS_TieredCompilation")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TieredCompilation_Tier1CallCountThreshold, W("TieredCompilation_Tier1CallCountThreshold"), 30, "Number of times a method must be called after which it is promoted to tier 1.")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TieredCompilation_Tier1CallCountingDelayMs, W("TieredCompilation_Tier1CallCountingDelayMs"), 100, "Delay in milliseconds since process startup or the last tier 0 JIT before call counting begins for tier 1 promotion.")
#endif
diff --git a/src/inc/cordebug_mktlb.rc b/src/inc/cordebug_mktlb.rc
deleted file mode 100644
index 58e83bc64e..0000000000
--- a/src/inc/cordebug_mktlb.rc
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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.
-
-#define FX_VER_FILEDESCRIPTION_STR "Microsoft .NET Runtime Debugging Interfaces\0"
-#define FX_VER_INTERNALNAME_STR CORDEBUG.IDL
-
-#include <fxver.h>
-#include <fxver.rc>
-
-1 typelib REAL_CORDEBUG_TLB_FILE
diff --git a/src/inc/corperm.h b/src/inc/corperm.h
deleted file mode 100644
index e8c7cc7c99..0000000000
--- a/src/inc/corperm.h
+++ /dev/null
@@ -1,205 +0,0 @@
-// 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.
-//*****************************************************************************
-// File: CorPerm.H
-//
-// Defines the public routines defined in the security libraries. All these
-// routines are defined within CorPerm.lib.
-//
-//*****************************************************************************
-
-#ifndef _CORPERM_H_
-#define _CORPERM_H_
-
-#include <ole2.h> // Definitions of OLE types.
-
-#ifndef FEATURE_PAL
-#include <wintrust.h>
-#endif
-
-#include <specstrings.h>
-#include "corhdr.h"
-#include "corpolicy.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-//--------------------------------------------------------------------------
-// Global security settings
-// ------------------------
-//
-
-// Needs to be in sync with URLZONE
-typedef enum {
- LocalMachine = 0, /* URLZONE_LOCAL_MACHINE */ // 0, My Computer
- Intranet = 1, /* URLZONE_INTRANET */ // 1, The Intranet
- Trusted = 2, /* URLZONE_TRUSTED */ // 2, Trusted Zone
- Internet = 3, /* URLZONE_INTERNET */ // 3, The Internet
- Untrusted = 4, /* URLZONE_UNTRUSTED */ // 4, Untrusted Zone
- NumZones = 5,
- NoZone = -1
-} SecZone;
-
-// Managed URL action flags (see urlmon.idl)
-#define URLACTION_MANAGED_MIN 0x00002000
-#define URLACTION_MANAGED_SIGNED 0x00002001
-#define URLACTION_MANAGED_UNSIGNED 0x00002004
-#define URLACTION_MANAGED_MANIFEST_PERMISSIONS 0x00002007
-#define URLACTION_MANAGED_MAX 0x000020FF
-
-// Global disable flags. These are set for every zone.
-#define CORSETTING_EXECUTION_PERMISSION_CHECK_DISABLED 0x00000100
-
-// Trust Levels
-#define URLPOLICY_COR_NOTHING 0x00000000
-#define URLPOLICY_COR_TIME 0x00010000
-#define URLPOLICY_COR_EQUIPMENT 0x00020000
-#define URLPOLICY_COR_EVERYTHING 0x00030000
-#define URLPOLICY_COR_CUSTOM 0x00800000
-
-// Manifest permission settings - note that URLPOLICY_DISABLED is also a valid value
-#define URLPOLICY_COR_HIGH_SAFETY 0x00010000
-#define URLPOLICY_COR_LOW_SAFETY 0x00030000
-
-#define KEY_COM_SECURITY_POLICY L"\\Security\\Policy"
-#define KEY_COM_SECURITY_ZONEOVERRIDE L"TreatCustomZonesAsInternetZone"
-#define HKEY_POLICY_ROOT HKEY_LOCAL_MACHINE
-
-#ifndef FEATURE_PAL
-
-//--------------------------------------------------------------------
-// GetPublisher
-// ------------
-// Returns signature information (Encoded signature and permissions)
-// NOTE: This does perform any policy checks on the certificates. All
-// that can be determined is the File was signed and the bits are OK.
-//
-// Free information with CoTaskMemFree (just the pointer not the contents)
-//
-
-#define COR_UNSIGNED_NO 0x0
-#define COR_UNSIGNED_YES 0x1
-#define COR_UNSIGNED_ALWAYS 0x2
-
-extern HRESULT DisplayUnsignedRequestDialog(HWND hParent, // Parents hwnd
- PCRYPT_PROVIDER_DATA pData,
- LPCWSTR pURL, // Url associated with code
- LPCWSTR pZONE, // Zone associated with code
- DWORD* pdwState); // Return COR_UNSIGNED_YES or COR_UNSIGNED_NO
-
-// For dwFlag values
-#define COR_NOUI 0x01
-#define COR_NOPOLICY 0x02
-#define COR_DISPLAYGRANTED 0x04 // Intersect the requested permissions with the policy to
- // to display the granted set
-
-HRESULT STDMETHODCALLTYPE
-GetPublisher(__in __in_z IN LPWSTR pwsFileName, // File name, this is required even with the handle
- IN HANDLE hFile, // Optional file name
- IN DWORD dwFlags, // COR_NOUI or COR_NOPOLICY
- OUT PCOR_TRUST *pInfo, // Returns a PCOR_TRUST (Use CoTaskMemFree)
- OUT DWORD *dwInfo); // Size of pInfo.
-
-#endif // !FEATURE_PAL
-
-interface IMetaDataAssemblyImport;
-
-// Structure used to describe an individual security permission.
-class CORSEC_ATTRIBUTE
-{
-public:
- DWORD dwIndex; // Unique permission index used for error tracking
- CHAR* pName; // Fully qualified permission class name
- mdMemberRef tkCtor; // Custom attribute constructor
- mdTypeRef tkTypeRef; // Custom attribute class ref
- mdAssemblyRef tkAssemblyRef; // Custom attribute class assembly
- BYTE *pbValues; // Serialized field/property initializers
- SIZE_T cbValues; // Byte count for above
- WORD wValues; // Count of values in above
-
- CORSEC_ATTRIBUTE()
- {
- pbValues = NULL;
- pName = NULL;
- }
-
- ~CORSEC_ATTRIBUTE()
- {
- delete [] pbValues;
- delete [] pName;
- }
-};
-
-// Context structure that tracks the creation of a security permission set from
-// individual permission requests.
-class CORSEC_ATTRSET
-{
-public:
- mdToken tkObj; // Parent object
- DWORD dwAction; // Security action type (CorDeclSecurity)
- DWORD dwAttrCount; // Number of attributes in set
- CORSEC_ATTRIBUTE *pAttrs; // Pointer to array of attributes
- DWORD dwAllocated; // Number of elements in above array
-#ifdef __cplusplus
- IMetaDataAssemblyImport *pImport; // Current meta data scope
- IUnknown *pAppDomain; // AppDomain in which managed security code will be run.
-
-#else
- void *pImport;
- void *pAppDomain;
-#endif
-
- CORSEC_ATTRSET()
- {
- pAttrs = NULL;
- }
-
- ~CORSEC_ATTRSET()
- {
- delete [] pAttrs;
- }
-};
-
-// Reads permission requests (if any) from the manifest of an assembly.
-HRESULT STDMETHODCALLTYPE
-GetPermissionRequests(LPCWSTR pwszFileName,
- BYTE **ppbMinimal,
- DWORD *pcbMinimal,
- BYTE **ppbOptional,
- DWORD *pcbOptional,
- BYTE **ppbRefused,
- DWORD *pcbRefused);
-
-// Translate a set of security custom attributes into a serialized permission set blob.
-HRESULT STDMETHODCALLTYPE
-TranslateSecurityAttributes(CORSEC_ATTRSET *pPset,
- BYTE **ppbOutput,
- DWORD *pcbOutput,
- BYTE **ppbNonCasOutput,
- DWORD *pcbNonCasOutput,
- DWORD *pdwErrorIndex);
-
-class CMiniMdRW;
-struct IMDInternalImport;
-
-HRESULT STDMETHODCALLTYPE
-GroupSecurityAttributesByAction(CORSEC_ATTRSET /*OUT*/rPermSets[],
- COR_SECATTR rSecAttrs[],
- ULONG cSecAttrs,
- mdToken tkObj,
- ULONG *pulErrorAttr,
- CMiniMdRW* pMiniMd,
- IMDInternalImport* pInternalImport);
-
-// if pBuffer is NULL, this just sets *pCount to the number of bytes required
-// if pBuffer is not NULL, it serializes pAttrSet into pBuffer
-HRESULT AttributeSetToBlob(CORSEC_ATTRSET* pAttrSet, BYTE* pBuffer, SIZE_T* pCount, IMetaDataAssemblyImport *pImport, DWORD dwAction);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/inc/corperme.h b/src/inc/corperme.h
deleted file mode 100644
index 7b2eec9639..0000000000
--- a/src/inc/corperme.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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.
-//*****************************************************************************
-// File: CorPermE.H
-//
-// Defines the Memory and Error routines defined in the secuirty libraries.
-// These routines are mainly for the security dll and the runtime.
-//
-//*****************************************************************************
-
-#ifndef _CORPERME_H_
-#define _CORPERME_H_
-
-//=============================================================================
-// Error macros so we do not have to see goto's in the code
-// Adds structure to where error handling and clean up code goes. Be careful
-// when rethrowing EE exceptions, the routine must be cleaned up first.
-//=============================================================================
-typedef struct _CorError {
- HRESULT corError;
-} CorError;
-
-#define CORTRY HRESULT _tcorError = 0;
-#define CORTHROW(x) {_tcorError = x; goto CORERROR;} //
-#define CORCATCH(x) goto CORCONT; \
- CORERROR: \
- { CorError x; x.corError = _tcorError;
-#define COREND } CORCONT: //
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define WIDEN_CP CP_UTF8
-
-// Helper macros for security logging
-#define WIDEN(psz, pwsz) \
- LPCSTR _##psz = (LPCSTR) psz; \
- int _cc##psz = _##psz ? strlen(_##psz) + 1 : 0; \
- LPWSTR pwsz = (LPWSTR) (_cc##psz ? _alloca((_cc##psz) * sizeof(WCHAR)) : NULL); \
- if(pwsz) WszMultiByteToWideChar(WIDEN_CP, 0, _##psz, _cc##psz, pwsz, _cc##psz);
-
-
-#define NARROW(pwsz, psz) \
- LPCWSTR _##pwsz = (LPCWSTR) pwsz; \
- int _cc##psz = _##pwsz ? WszWideCharToMultiByte(WIDEN_CP, 0, _##pwsz, -1, NULL, 0, NULL, NULL) : 0; \
- LPSTR psz = (LPSTR) (_cc##psz ? _alloca(_cc##psz) : NULL); \
- if(psz) WszWideCharToMultiByte(WIDEN_CP, 0, _##pwsz, -1, psz, _cc##psz, NULL, NULL);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/inc/corpermp.h b/src/inc/corpermp.h
deleted file mode 100644
index 3f77893425..0000000000
--- a/src/inc/corpermp.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.
-//*****************************************************************************
-// File: CorPermP.H
-//
-// Defines the Private routines defined in the secuirty libraries. These routines
-// are mainly for the security dll and the runtime.
-//
-//*****************************************************************************
-
-#ifndef _CORPERMP_H_
-#define _CORPERMP_H_
-
-#include "utilcode.h"
-#include "corperme.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//==========================================================================
-// Encoding and Decoding PermissionSets
-
-//==========================================================================
-// Initialization routines for registering installable OIDS for capi20
-// Currently there is no C/C++ support for OID parsing. It is only supported
-// by using the permission objects within the runtime
-//
-// Parameter:
-// dllName The name of the module (eg. mscorsec.dll)
-// Returns:
-// S_OK This routines only returns S_OK currently
-//==========================================================================
-HRESULT WINAPI CorPermRegisterServer(LPCWSTR dllName);
-HRESULT WINAPI CorPermUnregisterServer();
-
-//==========================================================================
-// Removes the capi entries for installable OID's. Is not currently supported
-// so does nothing
-//
-// Returns:
-// S_OK This routines only returns S_OK currently
-//==========================================================================
-HRESULT WINAPI CorFactoryRegister(HINSTANCE hInst);
-
-HRESULT WINAPI CorFactoryUnregister();
-
-HRESULT WINAPI CorFactoryCanUnloadNow();
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#include "corperm.h"
-#endif
diff --git a/src/inc/corpolicy.h b/src/inc/corpolicy.h
deleted file mode 100644
index 21d615bc82..0000000000
--- a/src/inc/corpolicy.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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.
-
-
-#ifndef _CORPOLICY_H
-#define _CORPOLICY_H
-
-#include <ole2.h> // Definitions of OLE types.
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "product_version.h"
-
-// {D41E4F1D-A407-11d1-8BC9-00C04FA30A41}
-#define COR_POLICY_PROVIDER_DOWNLOAD \
-{ 0xd41e4f1d, 0xa407, 0x11d1, {0x8b, 0xc9, 0x0, 0xc0, 0x4f, 0xa3, 0xa, 0x41 } }
-
-// {D41E4F1E-A407-11d1-8BC9-00C04FA30A41}
-#define COR_POLICY_PROVIDER_CHECK \
-{ 0xd41e4f1e, 0xa407, 0x11d1, {0x8b, 0xc9, 0x0, 0xc0, 0x4f, 0xa3, 0xa, 0x41 } }
-
-
-// {D41E4F1F-A407-11d1-8BC9-00C04FA30A41}
-#define COR_POLICY_LOCKDOWN_CHECK \
-{ 0xd41e4f1f, 0xa407, 0x11d1, {0x8b, 0xc9, 0x0, 0xc0, 0x4f, 0xa3, 0xa, 0x41 } }
-
-
-
-// This structure is returned from the winverify trust call, free up the structure
-// using CoTaskMemAlloc except for COREE_POLICY_PROVIDER which uses LocalALLoc.
-
-typedef struct _COR_TRUST {
- DWORD cbSize; // Size of structure
- DWORD flag; // Reserved
- BOOL fAllActiveXPermissions; // ActiveX explicitly asked for all (must have been signed)
- BOOL fAllPermissions; // Cor permissions, explicit ask for all
- DWORD dwEncodingType; // Encoding type
- PBYTE pbCorPermissions; // Encoded cor permission blob
- DWORD cbCorPermissions;
- PBYTE pbSigner; // Encoded signer.
- DWORD cbSigner;
- LPCWSTR pwszZone; // Zone index (copied from action data)
- GUID guidZone; // Not used currently
- HRESULT hVerify; // Authenticode policy return
-} COR_TRUST, *PCOR_TRUST;
-
-// Pass this structure into WinVerifyTrust (corpol trust provider). The result
-// is returned in pbCorTrust.
-typedef struct _COR_POLICY_PROVIDER {
- DWORD cbSize; // Size of policy provider
- LPVOID pZoneManager; // Zone interface manager
- LPCWSTR pwszZone; // Zone index
- BOOL fNoBadUI; // Optional bad ui
- PCOR_TRUST pbCorTrust; // Returned cor information (CoTaskMemAlloc)
- DWORD cbCorTrust; // Total allocated size of pCorTrust
- DWORD dwActionID; // Optional ActionID ID
- DWORD dwUnsignedActionID; // Optional ActionID ID
- BOOL VMBased; // Called from VM (FALSE by DEFAULT)
- DWORD dwZoneIndex; // IE zone numbers
-} COR_POLICY_PROVIDER, *PCOR_POLICY_PROVIDER;
-
-// Returned flags in COR_TRUST flag
-#define COR_NOUI_DISPLAYED 0x1
-#define COR_DELAYED_PERMISSIONS 0x02 // The subject was unsigned, returned
- // look up information in pbCorPermissions
- // to be passed into GetUnsignedPermissions().
- // If this flag is not set and pbCorPermissions
- // is not NULL then pbCorPermissions contains
- // encoded permissions
-
-//--------------------------------------------------------------------
-// For COR_POLICY_LOCKDOWN_CHECK:
-// -----------------------------
-
-// Structure to pass into WVT
-typedef struct _COR_LOCKDOWN {
- DWORD cbSize; // Size of policy provider
- DWORD flag; // reserved
- BOOL fAllPublishers; // Trust all publishers or just ones in the trusted data base
-} COR_LOCKDOWN, *PCOR_LOCKDOWN;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _CORPOLICY_H
diff --git a/src/inc/downlevel.h b/src/inc/downlevel.h
deleted file mode 100644
index b32673288c..0000000000
--- a/src/inc/downlevel.h
+++ /dev/null
@@ -1,239 +0,0 @@
-// 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.
-////////////////////////////////////////////////////////////////////////////
-//
-// File: downlevel.h
-//
-
-
-//
-// Purpose: emulation on downlevel platforms.
-//
-////////////////////////////////////////////////////////////////////////////
-
-
-
-// Vista LCTYPES
-#ifndef LOCALE_SNAN
-#define LOCALE_SNAN 0x00000069 // Not a Number
-#endif
-
-#ifndef LOCALE_SPOSINFINITY
-#define LOCALE_SPOSINFINITY 0x0000006a // + Infinity
-#endif
-
-#ifndef LOCALE_SNEGINFINITY
-#define LOCALE_SNEGINFINITY 0x0000006b // - Infinity
-#endif
-
-#ifndef LOCALE_SPARENT
-#define LOCALE_SPARENT 0x0000006d // Fallback name for resources, eg "en" for "en-US"
-#endif
-
-// Win7 LCTYPES
-#ifndef LOCALE_IREADINGLAYOUT
-#define LOCALE_IREADINGLAYOUT 0x00000070 // Returns one of the following 4 reading layout values:
- // 0 - Left to right (eg en-US)
- // 1 - Right to left (eg arabic locales)
- // 2 - Vertical top to bottom with columns to the left and also left to right (ja-JP locales)
- // 3 - Vertical top to bottom with columns proceeding to the right
-#endif
-
-#ifndef LOCALE_INEUTRAL
-#define LOCALE_INEUTRAL 0x00000071 // Returns 0 for specific cultures, 1 for neutral cultures.
-#endif
-
-// Win7 LCTypes
-//
-// These are the various forms of the name of the locale:
-//
-#define LOCALE_SLOCALIZEDDISPLAYNAME 0x00000002 // localized name of locale, eg "German (Germany)" in UI language
-#define LOCALE_SENGLISHDISPLAYNAME 0x00000072 // Display name (language + country usually) in English, eg "German (Germany)"
-#define LOCALE_SNATIVEDISPLAYNAME 0x00000073 // Display name in native locale language, eg "Deutsch (Deutschland)
-
-#define LOCALE_SLOCALIZEDLANGUAGENAME 0x0000006f // Language Display Name for a language, eg "German" in UI language
-#define LOCALE_SENGLISHLANGUAGENAME 0x00001001 // English name of language, eg "German"
-#define LOCALE_SNATIVELANGUAGENAME 0x00000004 // native name of language, eg "Deutsch"
-
-#define LOCALE_SLOCALIZEDCOUNTRYNAME 0x00000006 // localized name of country, eg "Germany" in UI language
-#define LOCALE_SENGLISHCOUNTRYNAME 0x00001002 // English name of country, eg "Germany"
-#define LOCALE_SNATIVECOUNTRYNAME 0x00000008 // native name of country, eg "Deutschland"
-
-#define LOCALE_INEGATIVEPERCENT 0x00000074 // Returns 0-11 for the negative percent format
-#define LOCALE_IPOSITIVEPERCENT 0x00000075 // Returns 0-3 for the positive percent formatIPOSITIVEPERCENT
-#define LOCALE_SPERCENT 0x00000076 // Returns the percent symbol
-#define LOCALE_SPERMILLE 0x00000077 // Returns the permille (U+2030) symbol
-#define LOCALE_SMONTHDAY 0x00000078 // Returns the preferred month/day format
-#define LOCALE_SSHORTTIME 0x00000079 // Returns the preferred short time format (ie: no seconds, just h:mm)
-#define LOCALE_SOPENTYPELANGUAGETAG 0x0000007a // Open type language tag, eg: "latn" or "dflt"
-#define LOCALE_SSORTLOCALE 0x0000007b // Name of locale to use for sorting/collation/casing behavior.
-
-// TODO: These didn't make it to windows
-// const LCTYPE RESERVED_SADERA = 0x000008b; // Era name for gregorian calendar (ie: A.D.)
-// const LCTYPE RESERVED_SABBREVADERA = 0x000008c; // Abbreviated era name for gregorian calendar (ie: AD)
-
-// Vista CALTypes
-#ifndef CAL_SSHORTESTDAYNAME1
-#define CAL_SSHORTESTDAYNAME1 0x00000031
-#define CAL_SSHORTESTDAYNAME2 0x00000032
-#define CAL_SSHORTESTDAYNAME3 0x00000033
-#define CAL_SSHORTESTDAYNAME4 0x00000034
-#define CAL_SSHORTESTDAYNAME5 0x00000035
-#define CAL_SSHORTESTDAYNAME6 0x00000036
-#define CAL_SSHORTESTDAYNAME7 0x00000037
-#endif
-
-// Win7 CALTypes
-#define CAL_SMONTHDAY 0x00000038 // Month/day format
-#define CAL_SABBREVERASTRING 0x00000039 // Abbreviated era string (eg: AD)
-
-// Vista linguistic comparison flags
-#ifndef LINGUISTIC_IGNORECASE
-#define LINGUISTIC_IGNORECASE 0x00000010 // linguistically appropriate 'ignore case'
-#endif
-
-#ifndef LINGUISTIC_IGNOREDIACRITIC
-#define LINGUISTIC_IGNOREDIACRITIC 0x00000020 // linguistically appropriate 'ignore nonspace'
-#endif
-
-#ifndef NORM_LINGUISTIC_CASING
-#define NORM_LINGUISTIC_CASING 0x08000000 // use linguistic rules for casing
-#endif
-
-#ifndef LCMAP_TITLECASE
-#define LCMAP_TITLECASE 0x00000300 // reserved for title case behavior
-#endif
-
-#ifndef CALINFO_ENUMPROCEXEX
-typedef BOOL (CALLBACK* CALINFO_ENUMPROCEXEX)(LPWSTR, CALID, LPWSTR, LPARAM);
-#endif
-
-#ifndef DATEFMT_ENUMPROCEXEX
-typedef BOOL (CALLBACK* DATEFMT_ENUMPROCEXEX)(LPWSTR, CALID, LPARAM);
-#endif
-
-#ifndef TIMEFMT_ENUMPROCEX
-typedef BOOL (CALLBACK* TIMEFMT_ENUMPROCEX)(LPWSTR, LPARAM);
-#endif
-
-#ifndef HIGH_SURROGATE_START
-#define HIGH_SURROGATE_START 0xd800
-#define HIGH_SURROGATE_END 0xdbff
-#define LOW_SURROGATE_START 0xdc00
-#define LOW_SURROGATE_END 0xdfff
-#endif
-
-#ifndef PRIVATE_USE_BEGIN
-#define PRIVATE_USE_BEGIN 0xe000
-#define PRIVATE_USE_END 0xf8ff
-#endif
-
-#ifndef LCMAP_TITLECASE
-#define LCMAP_TITLECASE 0x00000300 // Title Case Letters
-#endif
-
-#ifndef __out_xcount_opt
-#define __out_xcount_opt(var) __out
-#endif
-
-namespace DownLevel
-{
- // User /system defaults
- // TODO: I don't think we need all of these.
- int GetSystemDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
- __success(return == 1) DWORD GetUserPreferredUILanguages (__in DWORD dwFlags, __out PULONG pulNumLanguages, __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer, __in PULONG pcchLanguagesBuffer);
- int GetUserDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
-
- // Locale and calendar information
- int GetLocaleInfoEx (__in LPCWSTR lpLocaleName, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData);
- int GetDateFormatEx(__in LPCWSTR lpLocaleName, __in DWORD dwFlags, __in_opt CONST SYSTEMTIME* lpDate, __in_opt LPCWSTR lpFormat,
- __out_ecount(cchDate) LPWSTR lpDateStr, __in int cchDate, __in_opt LPCWSTR lpCalendar);
- __success(return != 0)
- int GetCalendarInfoEx(__in LPCWSTR lpLocaleName,
- __in CALID Calendar,
- __in_opt LPCWSTR pReserved,
- __in CALTYPE CalType,
- __out_ecount_opt(cchData) LPWSTR lpCalData,
- __in int cchData,
- __out_opt LPDWORD lpValue);
-
- // Compareinfo type information
- int TurkishCompareStringIgnoreCase(LCID lcid, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2);
-
- int CompareStringEx(__in LPCWSTR lpLocaleName, __in DWORD dwCmpFlags, __in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2,
- __in int cchCount2, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam );
-
- int CompareStringOrdinal(__in_ecount(cchCount1) LPCWSTR string1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR string2, __in int cchCount2, __in BOOL bIgnoreCase);
-
- __success(return != 0)
- int LCMapStringEx(__in LPCWSTR lpLocaleName,
- __in DWORD dwMapFlags,
- __in_ecount(cchSrc) LPCWSTR lpSrcStr,
- __in int cchSrc,
- __out_xcount_opt(cchDest) LPWSTR lpDestStr,
- __in int cchDest,
- __in_opt LPNLSVERSIONINFO lpVersionInformation,
- __in_opt LPVOID lpReserved,
- __in_opt LPARAM lParam);
-
- __success(return != -1)
- int FindNLSStringEx(__in LPCWSTR lpLocaleName,
- __in DWORD dwFindNLSStringFlags,
- __in_ecount(cchSource) LPCWSTR lpStringSource,
- __in int cchSource,
- __in_ecount(cchValue) LPCWSTR lpStringValue,
- __in int cchValue,
- __out_opt LPINT pcchFound,
- __in_opt LPNLSVERSIONINFO lpVersionInformation,
- __in_opt LPVOID lpReserved,
- __in_opt LPARAM lParam);
-
- BOOL IsNLSDefinedString(NLS_FUNCTION Function, DWORD dwFlags, LPNLSVERSIONINFOEX lpVersionInfo, LPCWSTR lpString, int cchStr );
-
- // Enumerations
- namespace LegacyCallbacks
- {
- BOOL EnumDateFormatsExEx(DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
- BOOL EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
- BOOL EnumCalendarInfoExEx(CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, LPCWSTR lpLocaleName, CALID Calendar, LPCWSTR lpReserved, CALTYPE CalType, LPARAM lParam);
- }
-
- // This is where we fudge data the OS doesn't know (even on Vista)
- namespace UplevelFallback
- {
- __success(return != 0)
- int LCMapStringEx(__in LPCWSTR lpLocaleName,
- __in DWORD dwMapFlags,
- __in_ecount(cchSrc) LPCWSTR lpSrcStr,
- __in int cchSrc,
- __out_xcount_opt(cchDest) LPWSTR lpDestStr,
- __in int cchDest,
- __in_opt LPNLSVERSIONINFO lpVersionInformation,
- __in_opt LPVOID lpReserved,
- __in_opt LPARAM lParam);
-
- int GetLocaleInfoEx(__in LPCWSTR lpLocaleName, __in LCID lcid, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData);
- int GetCalendarInfoEx(__in LPCWSTR lpLocaleName,
- __in CALID Calendar,
- __in_opt LPCWSTR pReserved,
- __in CALTYPE CalType,
- __out_ecount_opt(cchData) LPWSTR lpCalData,
- __in int cchData,
- __out_opt LPDWORD lpValue);
- }
-
- int LCIDToLocaleName(__in LCID Locale, __out_ecount_opt(cchName) LPWSTR lpName, __in int cchName, __in DWORD dwFlags);
- LCID LocaleNameToLCID(__in LPCWSTR lpName , __in DWORD dwFlags);
-
- int ResolveLocaleName(__in LPCWSTR lpNameToResolve, __in_ecount_opt(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
-
- __success(return)
- BOOL GetThreadPreferredUILanguages( __in DWORD dwFlags,
- __out PULONG pulNumLanguages,
- __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer,
- __inout PULONG pcchLanguagesBuffer);
-
-};
-
-
diff --git a/src/inc/eventtracebase.h b/src/inc/eventtracebase.h
index c46cb8abab..9437e605e4 100644
--- a/src/inc/eventtracebase.h
+++ b/src/inc/eventtracebase.h
@@ -611,7 +611,7 @@ namespace ETW
#else // FEATURE_EVENT_TRACE
public:
static VOID MethodJitting(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL) {};
- static VOID MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL, SIZE_T pCode = 0, ReJITID rejitID = 0) {};
+ static VOID MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL, SIZE_T pCode = 0, ReJITID rejitID = 0, BOOL bProfilerRejectedPrecompiledCode = FALSE, BOOL bReadyToRunRejectedPrecompiledCode = FALSE) {};
static VOID StubInitialized(ULONGLONG ullHelperStartAddress, LPCWSTR pHelperName) {};
static VOID StubsInitialized(PVOID *pHelperStartAddresss, PVOID *pHelperNames, LONG ulNoOfHelpers) {};
static VOID MethodRestored(MethodDesc * pMethodDesc) {};
diff --git a/src/inc/fixedsizestring.h b/src/inc/fixedsizestring.h
deleted file mode 100644
index 18becea349..0000000000
--- a/src/inc/fixedsizestring.h
+++ /dev/null
@@ -1,188 +0,0 @@
-// 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.
-
-//
-
-// Fixed size string: no dynamic memory allocation, no destructor, no exception
-template<typename T>
-class FixedSizeString
-{
- enum { FixedStringSize = 256 };
-
- T m_string[FixedStringSize]; // Using template to support both char and wchar_t
- HRESULT m_error;
- unsigned m_pos;
-
-public:
- FixedSizeString()
- {
- Reset();
- }
-
- void Reset()
- {
- m_string[0] = 0;
- m_pos = 0;
- m_error = S_OK;
- }
-
- HRESULT GetError() const
- {
- return m_error;
- }
-
- void Append(char ch)
- {
- _ASSERTE((m_pos + 1) < FixedStringSize);
-
- if ((m_pos + 1) < FixedStringSize)
- {
- m_string[m_pos ++] = ch;
- m_string[m_pos ] = 0;
- }
- else
- {
- m_error = E_OUTOFMEMORY;
- }
- }
-
- void Append(const char * pStr)
- {
- while (* pStr)
- {
- _ASSERTE((m_pos + 1) < FixedStringSize);
-
- if ((m_pos + 1) < FixedStringSize)
- {
- _ASSERTE((pStr[0] & 0x80) == 0);
- m_string[m_pos ++] = * pStr ++;
- }
- else
- {
- m_error = E_OUTOFMEMORY;
- return;
- }
- }
-
- m_string[m_pos] = 0;
- }
-
- operator const T * () const
- {
- return m_string;
- }
-
- // Decode encoded assembly/function/field/attribute name back to string, add '.' as seperator
- void DecodeName(int count, const unsigned char * pCode, const LPCSTR * pDic)
- {
- Reset();
-
- for (int i = 0; i < count; i ++)
- {
- unsigned char code = pCode[i];
-
- if (code == 0)
- {
- break;
- }
-
- if (i != 0)
- {
- Append('.');
- }
-
- Append(pDic[code]);
- }
-
- _ASSERTE(SUCCEEDED(GetError()));
- }
-};
-
-
-// Same as fusion\utils\helpers.cpp HashString(wsKey, 0, dwHashSize, FALSE), duplicated here because cee_wks does not include fusion\utils\helpers.cpp
-
-// Needs to match public static uint HashLCString(string str) in OptimizeFxRetarget.csscript
-
-inline DWORD HashLCString(LPCSTR pKey)
-{
- DWORD dwHash = 0;
-
- while (* pKey)
- {
- char ch = * pKey ++;
-
- if ((ch >= 'A') && (ch <= 'Z'))
- {
- ch += 32;
- }
-
- dwHash = (dwHash * 65599) + (DWORD) ch;
- }
-
- return dwHash;
-}
-
-
-inline DWORD HashLCString(LPCWSTR pKey)
-{
- DWORD dwHash = 0;
-
- while (* pKey)
- {
- wchar_t ch = * pKey ++;
-
- if ((ch >= 'A') && (ch <= 'Z'))
- {
- ch += 32;
- }
-
- dwHash = (dwHash * 65599) + (DWORD) ch;
- }
-
- return dwHash;
-}
-
-
-// Enumerator for auto-generated hash table
-
-// There are two arrays in the hash: hash array and collision array
-// Each entry is two bytes : <index + 1, collision index>
-// The first entry in collision array is always (0, 0) for termination
-
-class StringHashEnumerator
-{
- const BYTE * m_pHash;
- const BYTE * m_pCollision;
-
-public:
-
- StringHashEnumerator(LPCWSTR pStr, const BYTE * pHash, size_t hashCount, const BYTE * pCollision)
- {
- // lower case string hashing, half the size of hash array
- DWORD hash = HashLCString(pStr) % ((DWORD) hashCount / 2);
-
- m_pCollision = pCollision;
- m_pHash = pHash + hash * 2; // pointing to entry in hash array
- }
-
- StringHashEnumerator(LPCSTR pStr, const BYTE * pHash, size_t hashCount, const BYTE * pCollision)
- {
- // lower case string hashing, half the size of hash array
- DWORD hash = HashLCString(pStr) % ((DWORD) hashCount / 2);
-
- m_pCollision = pCollision;
- m_pHash = pHash + hash * 2; // pointing to entry in hash array
- }
-
- int GetNext() // negative is ending
- {
- BYTE index = m_pHash[0];
-
- m_pHash = m_pCollision + m_pHash[1] * 2; // move to the next one: collision array
-
- return index - 1;
- }
-};
-
-
diff --git a/src/inc/fxretarget.h b/src/inc/fxretarget.h
deleted file mode 100644
index abac8d8047..0000000000
--- a/src/inc/fxretarget.h
+++ /dev/null
@@ -1,340 +0,0 @@
-// 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.
-
-// ==++==
-//
-
-//
-// This header file contains the .NET Framework unification list. It is included by
-// fusion\binder\fxretarget.cpp for clr.dll, and dlls\mscorsvc\taskhelper.cpp for mscorsvc.dll.
-//
-// ==--==
-
-
-//
-
-
-// Automatically roll forward FX 2.0/3.0/3.5 -> 4.0
-#define NDP4_AUTO_VERSION_ROLLFORWARD
-
-#define VER_VS_ASSEMBLYVERSION_STR_L L"10.0.0.0"
-#define VER_VC_STLCLR_ASSEMBLYVERSION_STR_L L"2.0.0.0"
-
-
-// Working set optimization: using file:..\..\bin\OptimizeFxRetarget.cs (.exe) to generate condensed tables with less string data and less pointers
-
-#include "fixedsizestring.h"
-
-namespace FxPolicyHelper
-{
- // Forward declarations from file:fxretarget_generated.hpp
- extern LPCSTR const g_rgAssemblyNamePartStrings[];
- extern LPCWSTR const g_rgAssemblyKeyVersionStrings[];
-
- enum AppXBinderSupport
- {
- AppXBinder_Blocked = 0,
- AppXBinder_Supported = 1
- };
-};
-
-struct FrameworkConfig
-{
- // Working set optimization, store assembly name as 4-bytes, PKT/Version as 1-byte; long assembly names broken into parts stored in ANSI
- unsigned char m_compressedName[4];
- unsigned char m_nPKT;
- unsigned char m_nNewVersion : 7;
- unsigned char m_fSupportedInAppXBinder : 1;
-
- const LPCWSTR GetPKT() const
- {
- return FxPolicyHelper::g_rgAssemblyKeyVersionStrings[m_nPKT];
- }
-
- const LPCWSTR GetNewVersion() const
- {
- return FxPolicyHelper::g_rgAssemblyKeyVersionStrings[m_nNewVersion];
- }
-
- BOOL IsSupportedInAppXBinder() const
- {
- _ASSERTE((m_fSupportedInAppXBinder == FxPolicyHelper::AppXBinder_Blocked) ||
- (m_fSupportedInAppXBinder == FxPolicyHelper::AppXBinder_Supported));
-
- return (m_fSupportedInAppXBinder == FxPolicyHelper::AppXBinder_Supported);
- }
-
- // Using template to avoid converting it to UNICODE when possible,
- // more important avoid converting the ANSI string it's going to be compared with to be converted to UNICODE
- template<typename T>
- void GetFxAssemblyName(FixedSizeString<T> & output) const
- {
- output.DecodeName(_countof(m_compressedName), m_compressedName, FxPolicyHelper::g_rgAssemblyNamePartStrings);
- }
-};
-
-#define StringHashIterator(name, table, asmName) StringHashEnumerator name(asmName, table ## _Hash, _countof(table ## _Hash), table ## _HashCollision);
-
-#ifdef NEEDDATA
-
-// This file is auto generated by file:..\..\bin\OptimizeFxRetarget.cs (.exe), saved in intermediate directory
-#include "fxretarget_generated.hpp"
-
-#endif
-
-#ifdef ORIGINAL_SOURCE
-
-typedef struct tagFrameworkConfig
-{
- LPCWSTR pwzName;
-// culture by default is NULL/Neutral
-// LPCWSTR pwzCulture;
- LPCWSTR pwzPKT;
- LPCWSTR pwzNewVersion;
- FxPolicyHelper::AppXBinderSupport fSupportedInAppXBinder;
-} FrameworkConfig;
-
-const FrameworkConfig g_arFxPolicy[] =
-{
-// This table is parsed and processed by file:..\..\bin\OptimizeFxRetarget.cs (.exe):
-// STARTDICTIONARY(FxPolicyHelper,AssemblyNamePart,AssemblyKeyVersion,FrameworkConfig,g_arFxPolicy)
- {L"Accessibility", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"CustomMarshalers", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"ISymWrapper", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.JScript", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.VisualBasic", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"Microsoft.VisualBasic.Compatibility", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.VisualBasic.Compatibility.Data", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.VisualC", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"mscorlib", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Configuration", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Configuration.Install", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Data", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Data.OracleClient", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Data.SqlXml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Deployment", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Design", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.DirectoryServices", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.DirectoryServices.Protocols", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Drawing", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Drawing.Design", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.EnterpriseServices", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Management", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Messaging", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Runtime.Remoting", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.Serialization.Formatters.Soap", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Security", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceProcess", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Transactions", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Web", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.Mobile", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.RegularExpressions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.Services", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported}, // Has to be supported in AppX, because it is in transitive closure of supported assemblies
- {L"System.Windows.Forms", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Xml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
-
-#ifdef NDP4_AUTO_VERSION_ROLLFORWARD
-
- // Post-Everett FX 2.0 assemblies:
- {L"AspNetMMCExt", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"sysglobl", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.Build.Engine", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.Build.Framework", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
-
- // FX 3.0 assemblies:
- // Note: we shipped .NET 4.0 with entries in this list for PresentationCFFRasterizer and System.ServiceModel.Install
- // even though these assemblies did not ship with .NET 4.0. To maintain 100% compatibility with 4.0 we will keep
- // these in .NET 4.5, but we should remove them in a future SxS version of the Framework.
- {L"PresentationCFFRasterizer", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked}, // See note above
- {L"PresentationCore", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework.Aero", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework.Classic", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework.Luna", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework.Royale", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationUI", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"ReachFramework", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Printing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Speech", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"UIAutomationClient", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"UIAutomationClientsideProviders", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"UIAutomationProvider", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"UIAutomationTypes", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"WindowsBase", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"WindowsFormsIntegration", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"SMDiagnostics", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.IdentityModel", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.IdentityModel.Selectors", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.IO.Log", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Runtime.Serialization", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.Install", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked}, // See note above
- {L"System.ServiceModel.WasHosting", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Workflow.Activities", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Workflow.ComponentModel", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Workflow.Runtime", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.Transactions.Bridge", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"Microsoft.Transactions.Bridge.Dtc", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
-
- // FX 3.5 assemblies:
- {L"System.AddIn", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.AddIn.Contract", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.ComponentModel.Composition", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported}, // Shipping out-of-band
- {L"System.Core", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Data.DataSetExtensions", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Data.Linq", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Xml.Linq", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.DirectoryServices.AccountManagement", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Management.Instrumentation", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Net", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.Web", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported}, // Needed for portable libraries
- {L"System.Web.Extensions", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.Extensions.Design", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Windows.Presentation", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.WorkflowServices", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- // Microsoft.Data.Entity.Build.Tasks.dll should not be unified on purpose - it is supported SxS, i.e. both 3.5 and 4.0 versions can be loaded into CLR 4.0+.
- // {L"Microsoft.Data.Entity.Build.Tasks", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L},
-
- // FX 3.5 SP1 assemblies:
- {L"System.ComponentModel.DataAnnotations", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Data.Entity", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Data.Entity.Design", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Data.Services", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Data.Services.Client", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Data.Services.Design", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.Abstractions", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.DynamicData", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.DynamicData.Design", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.Entity", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.Entity.Design", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.Routing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
-
- // FX 4.0 assemblies:
- {L"Microsoft.Build", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.CSharp", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Dynamic", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Numerics", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Xaml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- // Microsoft.Workflow.Compiler.exe:
- // System.Workflow.ComponentModel.dll started to depend on Microsoft.Workflow.Compiler.exe in 4.0 RTM
- {L"Microsoft.Workflow.Compiler", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
-
- // FX 4.5 assemblies:
- {L"Microsoft.Activities.Build", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.Build.Conversion.v4.0", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.Build.Tasks.v4.0", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.Build.Utilities.v4.0", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.Internal.Tasks.Dataflow", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.VisualBasic.Activities.Compiler", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.VisualC.STLCLR", MICROSOFT_PUBLICKEY_STR_L, VER_VC_STLCLR_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"Microsoft.Windows.ApplicationServer.Applications", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationBuildTasks", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework.Aero2", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework.AeroLite", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework-SystemCore", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework-SystemData", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework-SystemDrawing", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework-SystemXml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"PresentationFramework-SystemXmlLinq", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Activities", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Activities.Core.Presentation", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Activities.DurableInstancing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Activities.Presentation", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.ComponentModel.Composition.Registration", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Device", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.IdentityModel.Services", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.IO.Compression", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.IO.Compression.FileSystem", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Net.Http", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Net.Http.WebRequest", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Reflection.Context", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.Caching", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Runtime.DurableInstancing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.WindowsRuntime", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.WindowsRuntime.UI.Xaml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.Activation", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.ServiceModel.Activities", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.ServiceModel.Channels", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.ServiceModel.Discovery", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.ServiceModel.Internals", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.Routing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.ServiceModel.ServiceMoniker40", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.ApplicationServices", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported}, // Has to be supported in AppX, because it is in transitive closure of supported assemblies
- {L"System.Web.DataVisualization", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Web.DataVisualization.Design", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Windows.Controls.Ribbon", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Windows.Forms.DataVisualization", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Windows.Forms.DataVisualization.Design", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Windows.Input.Manipulations", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Xaml.Hosting", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"XamlBuildTask", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"XsdBuildTask", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
- {L"System.Numerics.Vectors", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
-
- // FX 4.5 facade assemblies:
- {L"System.Collections", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Collections.Concurrent", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ComponentModel", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ComponentModel.Annotations", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ComponentModel.EventBasedAsync", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Diagnostics.Contracts", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Diagnostics.Debug", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Diagnostics.Tools", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Diagnostics.Tracing", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Dynamic.Runtime", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Globalization", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.IO", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Linq", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Linq.Expressions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Linq.Parallel", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Linq.Queryable", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Net.Http.Rtc", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Net.NetworkInformation", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Net.Primitives", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Net.Requests", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Net.WebHeaderCollection", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ObjectModel", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Reflection", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Reflection.Emit", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Reflection.Emit.ILGeneration", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Reflection.Emit.Lightweight", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Reflection.Extensions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Reflection.Primitives", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Resources.ResourceManager", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.Extensions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.Handles", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.InteropServices", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.InteropServices.WindowsRuntime", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.Numerics", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.Serialization.Json", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.Serialization.Primitives", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Runtime.Serialization.Xml", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Security.Principal", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.Duplex", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.Http", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.NetTcp", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.Primitives", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.ServiceModel.Security", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Text.Encoding", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Text.Encoding.Extensions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Text.RegularExpressions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Threading", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Threading.Tasks", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Threading.Tasks.Parallel", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Threading.Timer", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Xml.ReaderWriter", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Xml.XDocument", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Xml.XmlSerializer", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- // Manually added facades
- {L"System.Windows", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
- {L"System.Xml.Serialization", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
-
-#endif // NDP4_AUTO_VERSION_ROLLFORWARD
-
-// ENDDICTIONARY
-}; //g_arFxPolicy
-
-#endif //ORIGINAL_SOURCE
diff --git a/src/inc/iilfingerprint.h b/src/inc/iilfingerprint.h
deleted file mode 100644
index e5a26986e8..0000000000
--- a/src/inc/iilfingerprint.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// 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.
-// ===========================================================================
-// File: IILFingerprint.h
-// ===========================================================================
-
-#ifndef __IILFingerprint_h__
-#define __IILFingerprint_h__
-
-#include "cor.h"
-
-//**********************************************************************
-// IILFingerprint:
-//
-// When ngen images are present, the CLR often avoids opening IL files altogether while
-// still making assumptions about their contents (in particular when binding native images.)
-// This raise a vulnerability where someone may overwrite the IL during a running process.
-// Should the runtime need to delay-load the IL file (e.g. in an IJW app), it may find to
-// its dismay that the IL file's contents have changed, or were out of sync with the native image
-// cache's data all along.
-//
-// To address this, the CLR maintains a process-wide "ILFingerprint" object for each IL file with a unique path.
-// As the process runs, and components (i.e. native binder) makes assumptions about the contents
-// of the unopened IL file, the fingerprint collects these assumptions and ensures that everyone
-// work off the same assumptions.
-//
-// If the file is ever opened, the fingerprint reads the actual data from the IL file and compares
-// it to the stored assumptions. If they are conflict, the runtime raises a torn state condition
-// and refuses to load the file.
-//
-// Data model:
-//
-// The fingerprint is conceptually a property bag. For efficiency purposes, each property type
-// is associated with a fixed-size memory blob with non-customizable copy and compare operations
-// (they are memcpy and memcmp, respectively.)
-//
-// This allows for efficient operation (native binding is perf sensitive) at the expense of
-// some flexibility. (Given the free-for-all that IAssemblyNames became when it became too accomodating a
-// property bag, that inflexibility is by design, actually.)
-//
-// Implementation:
-// The actual implementation of ILFingerprint is the PEFingerprint class, implemented in VM\PEFingerprint.cpp.
-// Since PEImages are already memoized by pathname, they serve as the fingerprint custodian.
-
-
-typedef enum
-{
- ILFTagTimestamp = 0, // datatype == FILETIME (8 bytes)
- ILFTagSize = 1, // datatype == DWORD (4 bytes)
- ILFTagMvid = 2, // datatype == GUID (16 bytes)
-
- // NB: If you add or change constants here, you must update PEFingerprint::s_offsets and PEFingerprint::s_sizes in PEFingerprint.cpp
-
- ILFTagCount = 3, // used for range verification
-} ILFingerprintTag;
-
-typedef struct
-{
- ILFingerprintTag _tag;
- LPCVOID _data;
-} ILFingerprintComponent;
-
-interface IILFingerprint
-{
- public:
- //---------------------------------------------------------------------------------------------
- // Lifetime management methods.
- //---------------------------------------------------------------------------------------------
- STDMETHOD_(ULONG, AddRef)() = 0;
- STDMETHOD_(ULONG, Release)() = 0;
-
- //---------------------------------------------------------------------------------------------
- // Convenience fcn: equivalent to calling CommitAndCompareMulti() with one component.
- //---------------------------------------------------------------------------------------------
- STDMETHOD_(BOOL, CommitAndCompare)(
- ILFingerprintTag componentType,
- LPCVOID data) = 0;
-
- //---------------------------------------------------------------------------------------------
- // CommitAndCompareMulti(): Atomically commits one or more fingerprint components into
- // the fingerprint. Once a component is committed, its value can never change.
- //
- // An attempt to commit a component succeeds only if the component was not already committed
- // or the prior value maches the new one exactly.
- //
- // Calling CommitAndCompare() multiple times is not equivalent to calling CommitAndCompareMulti().
- // CommitAndCompareMulti() is atomic - either all the commits happen or none of them do.
- //
- // Returns:
- // TRUE: All passed components committed successful.
- // FALSE: At leat one component failed to commit successfully.
- //---------------------------------------------------------------------------------------------
- STDMETHOD_(BOOL, CommitAndCompareMulti)(
- UINT numComponents,
- const ILFingerprintComponent *pComponents) = 0;
-
-
- //---------------------------------------------------------------------------------------------
- // LockAndLoadIL()
- //
- // Forces the runtime to open the IL file and lock it against future overwrites. This
- // is bad for working set so this should be avoided.
- //
- // Once opened and locked, this method extracts the actual fingerprint from the IL file
- // and attempts to commit it into the ILFingerprint. If successful, all future commits
- // will now be compared against this trusted data. If unsuccessful, this is a torn state
- // situation and LockAndLoadIL() throws the torn state exception.
- //---------------------------------------------------------------------------------------------
- STDMETHOD_(VOID, LockAndLoadIL)() = 0;
-};
-
-interface IILFingerprintFactory
-{
- public:
- //---------------------------------------------------------------------------------------------
- // Lifetime management methods.
- //---------------------------------------------------------------------------------------------
- STDMETHOD_(ULONG, AddRef)() = 0;
- STDMETHOD_(ULONG, Release)() = 0;
-
- STDMETHOD(GetILFingerprintForPath)(
- LPCWSTR path,
- IILFingerprint **ppFingerprint) = 0;
-};
-
-#endif // __IILFingerprint_h__
-
diff --git a/src/inc/isolation.h b/src/inc/isolation.h
deleted file mode 100644
index 04fe165319..0000000000
--- a/src/inc/isolation.h
+++ /dev/null
@@ -1,2577 +0,0 @@
-// 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.
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 475
-#endif
-
-#include <specstrings.h>
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __isolation_h__
-#define __isolation_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */
-
-#ifndef __IReferenceIdentity_FWD_DEFINED__
-#define __IReferenceIdentity_FWD_DEFINED__
-typedef interface IReferenceIdentity IReferenceIdentity;
-#endif /* __IReferenceIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IDefinitionIdentity_FWD_DEFINED__
-#define __IDefinitionIdentity_FWD_DEFINED__
-typedef interface IDefinitionIdentity IDefinitionIdentity;
-#endif /* __IDefinitionIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
-#define __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
-typedef interface IEnumIDENTITY_ATTRIBUTE IEnumIDENTITY_ATTRIBUTE;
-#endif /* __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumDefinitionIdentity_FWD_DEFINED__
-#define __IEnumDefinitionIdentity_FWD_DEFINED__
-typedef interface IEnumDefinitionIdentity IEnumDefinitionIdentity;
-#endif /* __IEnumDefinitionIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IEnumReferenceIdentity_FWD_DEFINED__
-#define __IEnumReferenceIdentity_FWD_DEFINED__
-typedef interface IEnumReferenceIdentity IEnumReferenceIdentity;
-#endif /* __IEnumReferenceIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IDefinitionAppId_FWD_DEFINED__
-#define __IDefinitionAppId_FWD_DEFINED__
-typedef interface IDefinitionAppId IDefinitionAppId;
-#endif /* __IDefinitionAppId_FWD_DEFINED__ */
-
-
-#ifndef __IReferenceAppId_FWD_DEFINED__
-#define __IReferenceAppId_FWD_DEFINED__
-typedef interface IReferenceAppId IReferenceAppId;
-#endif /* __IReferenceAppId_FWD_DEFINED__ */
-
-
-#ifndef __IIdentityAuthority_FWD_DEFINED__
-#define __IIdentityAuthority_FWD_DEFINED__
-typedef interface IIdentityAuthority IIdentityAuthority;
-#endif /* __IIdentityAuthority_FWD_DEFINED__ */
-
-
-#ifndef __IAppIdAuthority_FWD_DEFINED__
-#define __IAppIdAuthority_FWD_DEFINED__
-typedef interface IAppIdAuthority IAppIdAuthority;
-#endif /* __IAppIdAuthority_FWD_DEFINED__ */
-
-
-#ifndef __IIdentityAuthority_FWD_DEFINED__
-#define __IIdentityAuthority_FWD_DEFINED__
-typedef interface IIdentityAuthority IIdentityAuthority;
-#endif /* __IIdentityAuthority_FWD_DEFINED__ */
-
-
-#ifndef __IAppIdAuthority_FWD_DEFINED__
-#define __IAppIdAuthority_FWD_DEFINED__
-typedef interface IAppIdAuthority IAppIdAuthority;
-#endif /* __IAppIdAuthority_FWD_DEFINED__ */
-
-
-#ifndef __IDefinitionIdentity_FWD_DEFINED__
-#define __IDefinitionIdentity_FWD_DEFINED__
-typedef interface IDefinitionIdentity IDefinitionIdentity;
-#endif /* __IDefinitionIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IReferenceIdentity_FWD_DEFINED__
-#define __IReferenceIdentity_FWD_DEFINED__
-typedef interface IReferenceIdentity IReferenceIdentity;
-#endif /* __IReferenceIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IDefinitionAppId_FWD_DEFINED__
-#define __IDefinitionAppId_FWD_DEFINED__
-typedef interface IDefinitionAppId IDefinitionAppId;
-#endif /* __IDefinitionAppId_FWD_DEFINED__ */
-
-
-#ifndef __IReferenceAppId_FWD_DEFINED__
-#define __IReferenceAppId_FWD_DEFINED__
-typedef interface IReferenceAppId IReferenceAppId;
-#endif /* __IReferenceAppId_FWD_DEFINED__ */
-
-
-#ifndef __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
-#define __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
-typedef interface IEnumIDENTITY_ATTRIBUTE IEnumIDENTITY_ATTRIBUTE;
-#endif /* __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumDefinitionIdentity_FWD_DEFINED__
-#define __IEnumDefinitionIdentity_FWD_DEFINED__
-typedef interface IEnumDefinitionIdentity IEnumDefinitionIdentity;
-#endif /* __IEnumDefinitionIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IEnumReferenceIdentity_FWD_DEFINED__
-#define __IEnumReferenceIdentity_FWD_DEFINED__
-typedef interface IEnumReferenceIdentity IEnumReferenceIdentity;
-#endif /* __IEnumReferenceIdentity_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "unknwn.h"
-#include "oaidl.h"
-#include "ocidl.h"
-#include "propidl.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-_Success_(return != NULL)
-_Ret_maybenull_
-_Post_writable_byte_size_(size)
-void * __RPC_USER MIDL_user_allocate(size_t size);
-#pragma warning(suppress: 4985) // Windows annotates with declspecs
-
-
-typedef struct _IDENTITY_ATTRIBUTE
- {
- LPCWSTR pszNamespace;
- LPCWSTR pszName;
- LPCWSTR pszValue;
- } IDENTITY_ATTRIBUTE;
-
-typedef struct _IDENTITY_ATTRIBUTE *PIDENTITY_ATTRIBUTE;
-
-typedef const IDENTITY_ATTRIBUTE *PCIDENTITY_ATTRIBUTE;
-
-
-#ifndef __IReferenceIdentity_INTERFACE_DEFINED__
-#define __IReferenceIdentity_INTERFACE_DEFINED__
-
-/* interface IReferenceIdentity */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IReferenceIdentity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("6eaf5ace-7917-4f3c-b129-e046a9704766")
- IReferenceIdentity : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE GetAttribute(
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetAttribute(
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAttributes(
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
- /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IReferenceIdentityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IReferenceIdentity * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IReferenceIdentity * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IReferenceIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *GetAttribute )(
- IReferenceIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue);
-
- HRESULT ( STDMETHODCALLTYPE *SetAttribute )(
- IReferenceIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAttributes )(
- IReferenceIdentity * This,
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IReferenceIdentity * This,
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
- /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity);
-
- END_INTERFACE
- } IReferenceIdentityVtbl;
-
- interface IReferenceIdentity
- {
- CONST_VTBL struct IReferenceIdentityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IReferenceIdentity_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IReferenceIdentity_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IReferenceIdentity_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IReferenceIdentity_GetAttribute(This,pszNamespace,pszName,ppszValue) \
- (This)->lpVtbl -> GetAttribute(This,pszNamespace,pszName,ppszValue)
-
-#define IReferenceIdentity_SetAttribute(This,pszNamespace,pszName,pszValue) \
- (This)->lpVtbl -> SetAttribute(This,pszNamespace,pszName,pszValue)
-
-#define IReferenceIdentity_EnumAttributes(This,ppIEnumIDENTITY_ATTRIBUTE) \
- (This)->lpVtbl -> EnumAttributes(This,ppIEnumIDENTITY_ATTRIBUTE)
-
-#define IReferenceIdentity_Clone(This,cDeltas,rgDeltas,ppIReferenceIdentity) \
- (This)->lpVtbl -> Clone(This,cDeltas,rgDeltas,ppIReferenceIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IReferenceIdentity_GetAttribute_Proxy(
- IReferenceIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue);
-
-
-void __RPC_STUB IReferenceIdentity_GetAttribute_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IReferenceIdentity_SetAttribute_Proxy(
- IReferenceIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue);
-
-
-void __RPC_STUB IReferenceIdentity_SetAttribute_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IReferenceIdentity_EnumAttributes_Proxy(
- IReferenceIdentity * This,
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
-
-
-void __RPC_STUB IReferenceIdentity_EnumAttributes_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IReferenceIdentity_Clone_Proxy(
- IReferenceIdentity * This,
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
- /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity);
-
-
-void __RPC_STUB IReferenceIdentity_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IReferenceIdentity_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDefinitionIdentity_INTERFACE_DEFINED__
-#define __IDefinitionIdentity_INTERFACE_DEFINED__
-
-/* interface IDefinitionIdentity */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IDefinitionIdentity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("587bf538-4d90-4a3c-9ef1-58a200a8a9e7")
- IDefinitionIdentity : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE GetAttribute(
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetAttribute(
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAttributes(
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
- /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IDefinitionIdentityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IDefinitionIdentity * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IDefinitionIdentity * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IDefinitionIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *GetAttribute )(
- IDefinitionIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue);
-
- HRESULT ( STDMETHODCALLTYPE *SetAttribute )(
- IDefinitionIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAttributes )(
- IDefinitionIdentity * This,
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IDefinitionIdentity * This,
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
- /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity);
-
- END_INTERFACE
- } IDefinitionIdentityVtbl;
-
- interface IDefinitionIdentity
- {
- CONST_VTBL struct IDefinitionIdentityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IDefinitionIdentity_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IDefinitionIdentity_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IDefinitionIdentity_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IDefinitionIdentity_GetAttribute(This,pszNamespace,pszName,ppszValue) \
- (This)->lpVtbl -> GetAttribute(This,pszNamespace,pszName,ppszValue)
-
-#define IDefinitionIdentity_SetAttribute(This,pszNamespace,pszName,pszValue) \
- (This)->lpVtbl -> SetAttribute(This,pszNamespace,pszName,pszValue)
-
-#define IDefinitionIdentity_EnumAttributes(This,ppIEAIA) \
- (This)->lpVtbl -> EnumAttributes(This,ppIEAIA)
-
-#define IDefinitionIdentity_Clone(This,cDeltas,prgDeltas,ppIDefinitionIdentity) \
- (This)->lpVtbl -> Clone(This,cDeltas,prgDeltas,ppIDefinitionIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionIdentity_GetAttribute_Proxy(
- IDefinitionIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue);
-
-
-void __RPC_STUB IDefinitionIdentity_GetAttribute_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionIdentity_SetAttribute_Proxy(
- IDefinitionIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue);
-
-
-void __RPC_STUB IDefinitionIdentity_SetAttribute_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionIdentity_EnumAttributes_Proxy(
- IDefinitionIdentity * This,
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA);
-
-
-void __RPC_STUB IDefinitionIdentity_EnumAttributes_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionIdentity_Clone_Proxy(
- IDefinitionIdentity * This,
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
- /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity);
-
-
-void __RPC_STUB IDefinitionIdentity_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IDefinitionIdentity_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0320 */
-/* [local] */
-
-typedef struct _IDENTITY_ATTRIBUTE_BLOB
- {
- DWORD ofsNamespace;
- DWORD ofsName;
- DWORD ofsValue;
- } IDENTITY_ATTRIBUTE_BLOB;
-
-typedef struct _IDENTITY_ATTRIBUTE_BLOB *PIDENTITY_ATTRIBUTE_BLOB;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0320_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0320_v0_0_s_ifspec;
-
-#ifndef __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__
-#define __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__
-
-/* interface IEnumIDENTITY_ATTRIBUTE */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumIDENTITY_ATTRIBUTE;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("9cdaae75-246e-4b00-a26d-b9aec137a3eb")
- IEnumIDENTITY_ATTRIBUTE : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
- /* [optional][out] */ ULONG *pceltWritten) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CurrentIntoBuffer(
- /* [in] */ SIZE_T cbAvailable,
- /* [length_is][size_is][out][in] */ BYTE pbData[ ],
- /* [out] */ SIZE_T *pcbUsed) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumIDENTITY_ATTRIBUTEVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumIDENTITY_ATTRIBUTE * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumIDENTITY_ATTRIBUTE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
- /* [optional][out] */ ULONG *pceltWritten);
-
- HRESULT ( STDMETHODCALLTYPE *CurrentIntoBuffer )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ SIZE_T cbAvailable,
- /* [length_is][size_is][out][in] */ BYTE pbData[ ],
- /* [out] */ SIZE_T *pcbUsed);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumIDENTITY_ATTRIBUTE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
-
- END_INTERFACE
- } IEnumIDENTITY_ATTRIBUTEVtbl;
-
- interface IEnumIDENTITY_ATTRIBUTE
- {
- CONST_VTBL struct IEnumIDENTITY_ATTRIBUTEVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumIDENTITY_ATTRIBUTE_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumIDENTITY_ATTRIBUTE_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumIDENTITY_ATTRIBUTE_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumIDENTITY_ATTRIBUTE_Next(This,celt,rgAttributes,pceltWritten) \
- (This)->lpVtbl -> Next(This,celt,rgAttributes,pceltWritten)
-
-#define IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer(This,cbAvailable,pbData,pcbUsed) \
- (This)->lpVtbl -> CurrentIntoBuffer(This,cbAvailable,pbData,pcbUsed)
-
-#define IEnumIDENTITY_ATTRIBUTE_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumIDENTITY_ATTRIBUTE_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumIDENTITY_ATTRIBUTE_Clone(This,ppIEnumIDENTITY_ATTRIBUTE) \
- (This)->lpVtbl -> Clone(This,ppIEnumIDENTITY_ATTRIBUTE)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Next_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
- /* [optional][out] */ ULONG *pceltWritten);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ SIZE_T cbAvailable,
- /* [length_is][size_is][out][in] */ BYTE pbData[ ],
- /* [out] */ SIZE_T *pcbUsed);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Skip_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Reset_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Clone_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumDefinitionIdentity_INTERFACE_DEFINED__
-#define __IEnumDefinitionIdentity_INTERFACE_DEFINED__
-
-/* interface IEnumDefinitionIdentity */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumDefinitionIdentity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("f3549d9c-fc73-4793-9c00-1cd204254c0c")
- IEnumDefinitionIdentity : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [out] */ ULONG *pceltWritten) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumDefinitionIdentityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumDefinitionIdentity * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumDefinitionIdentity * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumDefinitionIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumDefinitionIdentity * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [out] */ ULONG *pceltWritten);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumDefinitionIdentity * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumDefinitionIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumDefinitionIdentity * This,
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
-
- END_INTERFACE
- } IEnumDefinitionIdentityVtbl;
-
- interface IEnumDefinitionIdentity
- {
- CONST_VTBL struct IEnumDefinitionIdentityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumDefinitionIdentity_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumDefinitionIdentity_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumDefinitionIdentity_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumDefinitionIdentity_Next(This,celt,rgpIDefinitionIdentity,pceltWritten) \
- (This)->lpVtbl -> Next(This,celt,rgpIDefinitionIdentity,pceltWritten)
-
-#define IEnumDefinitionIdentity_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumDefinitionIdentity_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumDefinitionIdentity_Clone(This,ppIEnumDefinitionIdentity) \
- (This)->lpVtbl -> Clone(This,ppIEnumDefinitionIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Next_Proxy(
- IEnumDefinitionIdentity * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [out] */ ULONG *pceltWritten);
-
-
-void __RPC_STUB IEnumDefinitionIdentity_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Skip_Proxy(
- IEnumDefinitionIdentity * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumDefinitionIdentity_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Reset_Proxy(
- IEnumDefinitionIdentity * This);
-
-
-void __RPC_STUB IEnumDefinitionIdentity_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Clone_Proxy(
- IEnumDefinitionIdentity * This,
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
-
-
-void __RPC_STUB IEnumDefinitionIdentity_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumDefinitionIdentity_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumReferenceIdentity_INTERFACE_DEFINED__
-#define __IEnumReferenceIdentity_INTERFACE_DEFINED__
-
-/* interface IEnumReferenceIdentity */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumReferenceIdentity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("b30352cf-23da-4577-9b3f-b4e6573be53b")
- IEnumReferenceIdentity : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
- /* [out] */ ULONG *pceltWritten) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- IEnumReferenceIdentity **ppIEnumReferenceIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumReferenceIdentityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumReferenceIdentity * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumReferenceIdentity * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumReferenceIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumReferenceIdentity * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
- /* [out] */ ULONG *pceltWritten);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumReferenceIdentity * This,
- ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumReferenceIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumReferenceIdentity * This,
- IEnumReferenceIdentity **ppIEnumReferenceIdentity);
-
- END_INTERFACE
- } IEnumReferenceIdentityVtbl;
-
- interface IEnumReferenceIdentity
- {
- CONST_VTBL struct IEnumReferenceIdentityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumReferenceIdentity_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumReferenceIdentity_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumReferenceIdentity_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumReferenceIdentity_Next(This,celt,prgpIReferenceIdentity,pceltWritten) \
- (This)->lpVtbl -> Next(This,celt,prgpIReferenceIdentity,pceltWritten)
-
-#define IEnumReferenceIdentity_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumReferenceIdentity_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumReferenceIdentity_Clone(This,ppIEnumReferenceIdentity) \
- (This)->lpVtbl -> Clone(This,ppIEnumReferenceIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Next_Proxy(
- IEnumReferenceIdentity * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
- /* [out] */ ULONG *pceltWritten);
-
-
-void __RPC_STUB IEnumReferenceIdentity_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Skip_Proxy(
- IEnumReferenceIdentity * This,
- ULONG celt);
-
-
-void __RPC_STUB IEnumReferenceIdentity_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Reset_Proxy(
- IEnumReferenceIdentity * This);
-
-
-void __RPC_STUB IEnumReferenceIdentity_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Clone_Proxy(
- IEnumReferenceIdentity * This,
- IEnumReferenceIdentity **ppIEnumReferenceIdentity);
-
-
-void __RPC_STUB IEnumReferenceIdentity_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumReferenceIdentity_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDefinitionAppId_INTERFACE_DEFINED__
-#define __IDefinitionAppId_INTERFACE_DEFINED__
-
-/* interface IDefinitionAppId */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IDefinitionAppId;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("d91e12d8-98ed-47fa-9936-39421283d59b")
- IDefinitionAppId : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubscriptionId(
- /* [retval][out] */ LPWSTR *ppszSubscription) = 0;
-
- virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubscriptionId(
- /* [in] */ LPCWSTR pszSubscription) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
- /* [retval][out] */ LPWSTR *ppszCodebase) = 0;
-
- virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Codebase(
- /* [in] */ LPCWSTR pszCodebase) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAppPath(
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetAppPath(
- /* [in] */ ULONG cIDefinitionIdentity,
- /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IDefinitionAppIdVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IDefinitionAppId * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IDefinitionAppId * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IDefinitionAppId * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriptionId )(
- IDefinitionAppId * This,
- /* [retval][out] */ LPWSTR *ppszSubscription);
-
- /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubscriptionId )(
- IDefinitionAppId * This,
- /* [in] */ LPCWSTR pszSubscription);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
- IDefinitionAppId * This,
- /* [retval][out] */ LPWSTR *ppszCodebase);
-
- /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Codebase )(
- IDefinitionAppId * This,
- /* [in] */ LPCWSTR pszCodebase);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAppPath )(
- IDefinitionAppId * This,
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *SetAppPath )(
- IDefinitionAppId * This,
- /* [in] */ ULONG cIDefinitionIdentity,
- /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]);
-
- END_INTERFACE
- } IDefinitionAppIdVtbl;
-
- interface IDefinitionAppId
- {
- CONST_VTBL struct IDefinitionAppIdVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IDefinitionAppId_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IDefinitionAppId_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IDefinitionAppId_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IDefinitionAppId_get_SubscriptionId(This,ppszSubscription) \
- (This)->lpVtbl -> get_SubscriptionId(This,ppszSubscription)
-
-#define IDefinitionAppId_put_SubscriptionId(This,pszSubscription) \
- (This)->lpVtbl -> put_SubscriptionId(This,pszSubscription)
-
-#define IDefinitionAppId_get_Codebase(This,ppszCodebase) \
- (This)->lpVtbl -> get_Codebase(This,ppszCodebase)
-
-#define IDefinitionAppId_put_Codebase(This,pszCodebase) \
- (This)->lpVtbl -> put_Codebase(This,pszCodebase)
-
-#define IDefinitionAppId_EnumAppPath(This,ppIEnumDefinitionIdentity) \
- (This)->lpVtbl -> EnumAppPath(This,ppIEnumDefinitionIdentity)
-
-#define IDefinitionAppId_SetAppPath(This,cIDefinitionIdentity,rgIDefinitionIdentity) \
- (This)->lpVtbl -> SetAppPath(This,cIDefinitionIdentity,rgIDefinitionIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_get_SubscriptionId_Proxy(
- IDefinitionAppId * This,
- /* [retval][out] */ LPWSTR *ppszSubscription);
-
-
-void __RPC_STUB IDefinitionAppId_get_SubscriptionId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propput] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_put_SubscriptionId_Proxy(
- IDefinitionAppId * This,
- /* [in] */ LPCWSTR pszSubscription);
-
-
-void __RPC_STUB IDefinitionAppId_put_SubscriptionId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_get_Codebase_Proxy(
- IDefinitionAppId * This,
- /* [retval][out] */ _Outptr_result_maybenull_ LPWSTR *ppszCodebase);
-
-
-void __RPC_STUB IDefinitionAppId_get_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propput] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_put_Codebase_Proxy(
- IDefinitionAppId * This,
- /* [in] */ LPCWSTR pszCodebase);
-
-
-void __RPC_STUB IDefinitionAppId_put_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionAppId_EnumAppPath_Proxy(
- IDefinitionAppId * This,
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
-
-
-void __RPC_STUB IDefinitionAppId_EnumAppPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionAppId_SetAppPath_Proxy(
- IDefinitionAppId * This,
- /* [in] */ ULONG cIDefinitionIdentity,
- /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]);
-
-
-void __RPC_STUB IDefinitionAppId_SetAppPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IDefinitionAppId_INTERFACE_DEFINED__ */
-
-
-#ifndef __IReferenceAppId_INTERFACE_DEFINED__
-#define __IReferenceAppId_INTERFACE_DEFINED__
-
-/* interface IReferenceAppId */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IReferenceAppId;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("054f0bef-9e45-4363-8f5a-2f8e142d9a3b")
- IReferenceAppId : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubscriptionId(
- /* [retval][out] */ LPWSTR *ppszSubscription) = 0;
-
- virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubscriptionId(
- /* [in] */ LPCWSTR pszSubscription) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
- /* [retval][out] */ LPWSTR *ppszCodebase) = 0;
-
- virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Codebase(
- /* [in] */ LPCWSTR pszCodebase) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAppPath(
- /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IReferenceAppIdVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IReferenceAppId * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IReferenceAppId * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IReferenceAppId * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriptionId )(
- IReferenceAppId * This,
- /* [retval][out] */ LPWSTR *ppszSubscription);
-
- /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubscriptionId )(
- IReferenceAppId * This,
- /* [in] */ LPCWSTR pszSubscription);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
- IReferenceAppId * This,
- /* [retval][out] */ LPWSTR *ppszCodebase);
-
- /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Codebase )(
- IReferenceAppId * This,
- /* [in] */ LPCWSTR pszCodebase);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAppPath )(
- IReferenceAppId * This,
- /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId);
-
- END_INTERFACE
- } IReferenceAppIdVtbl;
-
- interface IReferenceAppId
- {
- CONST_VTBL struct IReferenceAppIdVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IReferenceAppId_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IReferenceAppId_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IReferenceAppId_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IReferenceAppId_get_SubscriptionId(This,ppszSubscription) \
- (This)->lpVtbl -> get_SubscriptionId(This,ppszSubscription)
-
-#define IReferenceAppId_put_SubscriptionId(This,pszSubscription) \
- (This)->lpVtbl -> put_SubscriptionId(This,pszSubscription)
-
-#define IReferenceAppId_get_Codebase(This,ppszCodebase) \
- (This)->lpVtbl -> get_Codebase(This,ppszCodebase)
-
-#define IReferenceAppId_put_Codebase(This,pszCodebase) \
- (This)->lpVtbl -> put_Codebase(This,pszCodebase)
-
-#define IReferenceAppId_EnumAppPath(This,ppIReferenceAppId) \
- (This)->lpVtbl -> EnumAppPath(This,ppIReferenceAppId)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_get_SubscriptionId_Proxy(
- IReferenceAppId * This,
- /* [retval][out] */ LPWSTR *ppszSubscription);
-
-
-void __RPC_STUB IReferenceAppId_get_SubscriptionId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propput] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_put_SubscriptionId_Proxy(
- IReferenceAppId * This,
- /* [in] */ LPCWSTR pszSubscription);
-
-
-void __RPC_STUB IReferenceAppId_put_SubscriptionId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_get_Codebase_Proxy(
- IReferenceAppId * This,
- /* [retval][out] */ _Outptr_result_maybenull_ LPWSTR *ppszCodebase);
-
-
-void __RPC_STUB IReferenceAppId_get_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propput] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_put_Codebase_Proxy(
- IReferenceAppId * This,
- /* [in] */ LPCWSTR pszCodebase);
-
-
-void __RPC_STUB IReferenceAppId_put_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IReferenceAppId_EnumAppPath_Proxy(
- IReferenceAppId * This,
- /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId);
-
-
-void __RPC_STUB IReferenceAppId_EnumAppPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IReferenceAppId_INTERFACE_DEFINED__ */
-
-
-#ifndef __IIdentityAuthority_INTERFACE_DEFINED__
-#define __IIdentityAuthority_INTERFACE_DEFINED__
-
-/* interface IIdentityAuthority */
-/* [local][unique][uuid][object] */
-
-/* [v1_enum] */
-enum _TEXT_TO_DEFINITION_IDENTITY_FLAGS
- { TEXT_TO_DEFINITION_IDENTITY_FLAG_ALLOW_UNKNOWN_ATTRIBUTES_IN_NULL_NAMESPACE = 0x1
- } ;
-/* [v1_enum] */
-enum _TEXT_TO_REFERENCE_IDENTITY_FLAGS
- { TEXT_TO_REFERENCE_IDENTITY_FLAG_ALLOW_UNKNOWN_ATTRIBUTES_IN_NULL_NAMESPACE = 0x1
- } ;
-/* [v1_enum] */
-enum _DEFINITION_IDENTITY_TO_TEXT_FLAGS
- { DEFINITION_IDENTITY_TO_TEXT_FLAG_CANONICAL = 0x1
- } ;
-/* [v1_enum] */
-enum _REFERENCE_IDENTITY_TO_TEXT_FLAGS
- { REFERENCE_IDENTITY_TO_TEXT_FLAG_CANONICAL = 0x1
- } ;
-/* [v1_enum] */
-enum _IIDENTITYAUTHORITY_DOES_DEFINITION_MATCH_REFERENCE_FLAGS
- { IIDENTITYAUTHORITY_DOES_DEFINITION_MATCH_REFERENCE_FLAG_EXACT_MATCH_REQUIRED = 0x1
- } ;
-/* [v1_enum] */
-enum _IIDENTITYAUTHORITY_DOES_TEXTUAL_DEFINITION_MATCH_TEXTUAL_REFERENCE_FLAGS
- { IIDENTITYAUTHORITY_DOES_TEXTUAL_DEFINITION_MATCH_TEXTUAL_REFERENCE_FLAG_EXACT_MATCH_REQUIRED = 0x1
- } ;
-
-EXTERN_C const IID IID_IIdentityAuthority;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("261a6983-c35d-4d0d-aa5b-7867259e77bc")
- IIdentityAuthority : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE TextToDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE TextToReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceIdentity **ppIReferenceIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DefinitionToText(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DefinitionToTextBuffer(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReferenceToText(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReferenceToTextBuffer(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreDefinitionsEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinition1,
- /* [in] */ IDefinitionIdentity *pDefinition2,
- /* [out] */ BOOL *pfEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreReferencesEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pReference1,
- /* [in] */ IReferenceIdentity *pReference2,
- /* [out] */ BOOL *pfEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreTextualDefinitionsEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreTextualReferencesEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DoesDefinitionMatchReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DoesTextualDefinitionMatchTextualReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE HashReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE HashDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GenerateDefinitionKey(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GenerateReferenceKey(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateDefinition(
- /* [retval][out] */ IDefinitionIdentity **ppNewIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateReference(
- /* [retval][out] */ IReferenceIdentity **ppNewIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IIdentityAuthorityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IIdentityAuthority * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IIdentityAuthority * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IIdentityAuthority * This);
-
- HRESULT ( STDMETHODCALLTYPE *TextToDefinition )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *TextToReference )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceIdentity **ppIReferenceIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *DefinitionToText )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *DefinitionToTextBuffer )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired);
-
- HRESULT ( STDMETHODCALLTYPE *ReferenceToText )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *ReferenceToTextBuffer )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired);
-
- HRESULT ( STDMETHODCALLTYPE *AreDefinitionsEqual )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinition1,
- /* [in] */ IDefinitionIdentity *pDefinition2,
- /* [out] */ BOOL *pfEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreReferencesEqual )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pReference1,
- /* [in] */ IReferenceIdentity *pReference2,
- /* [out] */ BOOL *pfEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreTextualDefinitionsEqual )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreTextualReferencesEqual )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual);
-
- HRESULT ( STDMETHODCALLTYPE *DoesDefinitionMatchReference )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches);
-
- HRESULT ( STDMETHODCALLTYPE *DoesTextualDefinitionMatchTextualReference )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches);
-
- HRESULT ( STDMETHODCALLTYPE *HashReference )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
- HRESULT ( STDMETHODCALLTYPE *HashDefinition )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
- HRESULT ( STDMETHODCALLTYPE *GenerateDefinitionKey )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
- HRESULT ( STDMETHODCALLTYPE *GenerateReferenceKey )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
- HRESULT ( STDMETHODCALLTYPE *CreateDefinition )(
- IIdentityAuthority * This,
- /* [retval][out] */ IDefinitionIdentity **ppNewIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *CreateReference )(
- IIdentityAuthority * This,
- /* [retval][out] */ IReferenceIdentity **ppNewIdentity);
-
- END_INTERFACE
- } IIdentityAuthorityVtbl;
-
- interface IIdentityAuthority
- {
- CONST_VTBL struct IIdentityAuthorityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IIdentityAuthority_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IIdentityAuthority_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IIdentityAuthority_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IIdentityAuthority_TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionIdentity) \
- (This)->lpVtbl -> TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionIdentity)
-
-#define IIdentityAuthority_TextToReference(This,dwFlags,pszIdentity,ppIReferenceIdentity) \
- (This)->lpVtbl -> TextToReference(This,dwFlags,pszIdentity,ppIReferenceIdentity)
-
-#define IIdentityAuthority_DefinitionToText(This,dwFlags,pIDefinitionIdentity,ppszFormattedIdentity) \
- (This)->lpVtbl -> DefinitionToText(This,dwFlags,pIDefinitionIdentity,ppszFormattedIdentity)
-
-#define IIdentityAuthority_DefinitionToTextBuffer(This,dwFlags,pIDefinitionIdentity,cchBufferSize,wchBuffer,pcchBufferRequired) \
- (This)->lpVtbl -> DefinitionToTextBuffer(This,dwFlags,pIDefinitionIdentity,cchBufferSize,wchBuffer,pcchBufferRequired)
-
-#define IIdentityAuthority_ReferenceToText(This,dwFlags,pIReferenceIdentity,ppszFormattedIdentity) \
- (This)->lpVtbl -> ReferenceToText(This,dwFlags,pIReferenceIdentity,ppszFormattedIdentity)
-
-#define IIdentityAuthority_ReferenceToTextBuffer(This,dwFlags,pIReferenceIdentity,cchBufferSize,wchBuffer,pcchBufferRequired) \
- (This)->lpVtbl -> ReferenceToTextBuffer(This,dwFlags,pIReferenceIdentity,cchBufferSize,wchBuffer,pcchBufferRequired)
-
-#define IIdentityAuthority_AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfEqual) \
- (This)->lpVtbl -> AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfEqual)
-
-#define IIdentityAuthority_AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfEqual) \
- (This)->lpVtbl -> AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfEqual)
-
-#define IIdentityAuthority_AreTextualDefinitionsEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual) \
- (This)->lpVtbl -> AreTextualDefinitionsEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual)
-
-#define IIdentityAuthority_AreTextualReferencesEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual) \
- (This)->lpVtbl -> AreTextualReferencesEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual)
-
-#define IIdentityAuthority_DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches) \
- (This)->lpVtbl -> DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches)
-
-#define IIdentityAuthority_DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches) \
- (This)->lpVtbl -> DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches)
-
-#define IIdentityAuthority_HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey) \
- (This)->lpVtbl -> HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey)
-
-#define IIdentityAuthority_HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey) \
- (This)->lpVtbl -> HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey)
-
-#define IIdentityAuthority_GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm) \
- (This)->lpVtbl -> GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm)
-
-#define IIdentityAuthority_GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm) \
- (This)->lpVtbl -> GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm)
-
-#define IIdentityAuthority_CreateDefinition(This,ppNewIdentity) \
- (This)->lpVtbl -> CreateDefinition(This,ppNewIdentity)
-
-#define IIdentityAuthority_CreateReference(This,ppNewIdentity) \
- (This)->lpVtbl -> CreateReference(This,ppNewIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_TextToDefinition_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_TextToDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_TextToReference_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceIdentity **ppIReferenceIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_TextToReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_DefinitionToText_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszFormattedIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_DefinitionToText_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_DefinitionToTextBuffer_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired);
-
-
-void __RPC_STUB IIdentityAuthority_DefinitionToTextBuffer_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_ReferenceToText_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszFormattedIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_ReferenceToText_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_ReferenceToTextBuffer_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired);
-
-
-void __RPC_STUB IIdentityAuthority_ReferenceToTextBuffer_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreDefinitionsEqual_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinition1,
- /* [in] */ IDefinitionIdentity *pDefinition2,
- /* [out] */ BOOL *pfEqual);
-
-
-void __RPC_STUB IIdentityAuthority_AreDefinitionsEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreReferencesEqual_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pReference1,
- /* [in] */ IReferenceIdentity *pReference2,
- /* [out] */ BOOL *pfEqual);
-
-
-void __RPC_STUB IIdentityAuthority_AreReferencesEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreTextualDefinitionsEqual_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual);
-
-
-void __RPC_STUB IIdentityAuthority_AreTextualDefinitionsEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreTextualReferencesEqual_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual);
-
-
-void __RPC_STUB IIdentityAuthority_AreTextualReferencesEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_DoesDefinitionMatchReference_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches);
-
-
-void __RPC_STUB IIdentityAuthority_DoesDefinitionMatchReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_DoesTextualDefinitionMatchTextualReference_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches);
-
-
-void __RPC_STUB IIdentityAuthority_DoesTextualDefinitionMatchTextualReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_HashReference_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
-
-void __RPC_STUB IIdentityAuthority_HashReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_HashDefinition_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
-
-void __RPC_STUB IIdentityAuthority_HashDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_GenerateDefinitionKey_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszKeyForm);
-
-
-void __RPC_STUB IIdentityAuthority_GenerateDefinitionKey_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_GenerateReferenceKey_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszKeyForm);
-
-
-void __RPC_STUB IIdentityAuthority_GenerateReferenceKey_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_CreateDefinition_Proxy(
- IIdentityAuthority * This,
- /* [retval][out] */ IDefinitionIdentity **ppNewIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_CreateDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_CreateReference_Proxy(
- IIdentityAuthority * This,
- /* [retval][out] */ IReferenceIdentity **ppNewIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_CreateReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IIdentityAuthority_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAppIdAuthority_INTERFACE_DEFINED__
-#define __IAppIdAuthority_INTERFACE_DEFINED__
-
-/* interface IAppIdAuthority */
-/* [local][unique][uuid][object] */
-
-/* [v1_enum] */
-enum IAPPIDAUTHORITY_ARE_DEFINITIONS_EQUAL_FLAGS
- { IAPPIDAUTHORITY_ARE_DEFINITIONS_EQUAL_FLAG_IGNORE_VERSION = 0x1
- } ;
-/* [v1_enum] */
-enum IAPPIDAUTHORITY_ARE_REFERENCES_EQUAL_FLAGS
- { IAPPIDAUTHORITY_ARE_REFERENCES_EQUAL_FLAG_IGNORE_VERSION = 0x1
- } ;
-
-EXTERN_C const IID IID_IAppIdAuthority;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8c87810c-2541-4f75-b2d0-9af515488e23")
- IAppIdAuthority : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE TextToDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionAppId **ppIDefinitionAppId) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE TextToReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceAppId **ppIReferenceAppId) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DefinitionToText(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReferenceToText(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreDefinitionsEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDefinition1,
- /* [in] */ IDefinitionAppId *pDefinition2,
- /* [out] */ BOOL *pfAreEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreReferencesEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pReference1,
- /* [in] */ IReferenceAppId *pReference2,
- /* [out] */ BOOL *pfAreEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreTextualDefinitionsEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreTextualReferencesEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DoesDefinitionMatchReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DoesTextualDefinitionMatchTextualReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE HashReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE HashDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GenerateDefinitionKey(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GenerateReferenceKey(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateDefinition(
- /* [retval][out] */ IDefinitionAppId **ppNewIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateReference(
- /* [retval][out] */ IReferenceAppId **ppNewIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IAppIdAuthorityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IAppIdAuthority * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IAppIdAuthority * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IAppIdAuthority * This);
-
- HRESULT ( STDMETHODCALLTYPE *TextToDefinition )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionAppId **ppIDefinitionAppId);
-
- HRESULT ( STDMETHODCALLTYPE *TextToReference )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceAppId **ppIReferenceAppId);
-
- HRESULT ( STDMETHODCALLTYPE *DefinitionToText )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *ReferenceToText )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *AreDefinitionsEqual )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDefinition1,
- /* [in] */ IDefinitionAppId *pDefinition2,
- /* [out] */ BOOL *pfAreEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreReferencesEqual )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pReference1,
- /* [in] */ IReferenceAppId *pReference2,
- /* [out] */ BOOL *pfAreEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreTextualDefinitionsEqual )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreTextualReferencesEqual )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual);
-
- HRESULT ( STDMETHODCALLTYPE *DoesDefinitionMatchReference )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches);
-
- HRESULT ( STDMETHODCALLTYPE *DoesTextualDefinitionMatchTextualReference )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches);
-
- HRESULT ( STDMETHODCALLTYPE *HashReference )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
- HRESULT ( STDMETHODCALLTYPE *HashDefinition )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
- HRESULT ( STDMETHODCALLTYPE *GenerateDefinitionKey )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
- HRESULT ( STDMETHODCALLTYPE *GenerateReferenceKey )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
- HRESULT ( STDMETHODCALLTYPE *CreateDefinition )(
- IAppIdAuthority * This,
- /* [retval][out] */ IDefinitionAppId **ppNewIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *CreateReference )(
- IAppIdAuthority * This,
- /* [retval][out] */ IReferenceAppId **ppNewIdentity);
-
- END_INTERFACE
- } IAppIdAuthorityVtbl;
-
- interface IAppIdAuthority
- {
- CONST_VTBL struct IAppIdAuthorityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IAppIdAuthority_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IAppIdAuthority_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IAppIdAuthority_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IAppIdAuthority_TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionAppId) \
- (This)->lpVtbl -> TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionAppId)
-
-#define IAppIdAuthority_TextToReference(This,dwFlags,pszIdentity,ppIReferenceAppId) \
- (This)->lpVtbl -> TextToReference(This,dwFlags,pszIdentity,ppIReferenceAppId)
-
-#define IAppIdAuthority_DefinitionToText(This,dwFlags,pIDefinitionAppId,ppszFormattedIdentity) \
- (This)->lpVtbl -> DefinitionToText(This,dwFlags,pIDefinitionAppId,ppszFormattedIdentity)
-
-#define IAppIdAuthority_ReferenceToText(This,dwFlags,pIReferenceAppId,ppszFormattedIdentity) \
- (This)->lpVtbl -> ReferenceToText(This,dwFlags,pIReferenceAppId,ppszFormattedIdentity)
-
-#define IAppIdAuthority_AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfAreEqual) \
- (This)->lpVtbl -> AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfAreEqual)
-
-#define IAppIdAuthority_AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfAreEqual) \
- (This)->lpVtbl -> AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfAreEqual)
-
-#define IAppIdAuthority_AreTextualDefinitionsEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual) \
- (This)->lpVtbl -> AreTextualDefinitionsEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual)
-
-#define IAppIdAuthority_AreTextualReferencesEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual) \
- (This)->lpVtbl -> AreTextualReferencesEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual)
-
-#define IAppIdAuthority_DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches) \
- (This)->lpVtbl -> DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches)
-
-#define IAppIdAuthority_DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches) \
- (This)->lpVtbl -> DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches)
-
-#define IAppIdAuthority_HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey) \
- (This)->lpVtbl -> HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey)
-
-#define IAppIdAuthority_HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey) \
- (This)->lpVtbl -> HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey)
-
-#define IAppIdAuthority_GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm) \
- (This)->lpVtbl -> GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm)
-
-#define IAppIdAuthority_GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm) \
- (This)->lpVtbl -> GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm)
-
-#define IAppIdAuthority_CreateDefinition(This,ppNewIdentity) \
- (This)->lpVtbl -> CreateDefinition(This,ppNewIdentity)
-
-#define IAppIdAuthority_CreateReference(This,ppNewIdentity) \
- (This)->lpVtbl -> CreateReference(This,ppNewIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_TextToDefinition_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionAppId **ppIDefinitionAppId);
-
-
-void __RPC_STUB IAppIdAuthority_TextToDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_TextToReference_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceAppId **ppIReferenceAppId);
-
-
-void __RPC_STUB IAppIdAuthority_TextToReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_DefinitionToText_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId,
- /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszFormattedIdentity);
-
-
-void __RPC_STUB IAppIdAuthority_DefinitionToText_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_ReferenceToText_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceAppId,
- /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszFormattedIdentity);
-
-
-void __RPC_STUB IAppIdAuthority_ReferenceToText_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreDefinitionsEqual_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDefinition1,
- /* [in] */ IDefinitionAppId *pDefinition2,
- /* [out] */ BOOL *pfAreEqual);
-
-
-void __RPC_STUB IAppIdAuthority_AreDefinitionsEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreReferencesEqual_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pReference1,
- /* [in] */ IReferenceAppId *pReference2,
- /* [out] */ BOOL *pfAreEqual);
-
-
-void __RPC_STUB IAppIdAuthority_AreReferencesEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreTextualDefinitionsEqual_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual);
-
-
-void __RPC_STUB IAppIdAuthority_AreTextualDefinitionsEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreTextualReferencesEqual_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual);
-
-
-void __RPC_STUB IAppIdAuthority_AreTextualReferencesEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_DoesDefinitionMatchReference_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches);
-
-
-void __RPC_STUB IAppIdAuthority_DoesDefinitionMatchReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_DoesTextualDefinitionMatchTextualReference_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches);
-
-
-void __RPC_STUB IAppIdAuthority_DoesTextualDefinitionMatchTextualReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_HashReference_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
-
-void __RPC_STUB IAppIdAuthority_HashReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_HashDefinition_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
-
-void __RPC_STUB IAppIdAuthority_HashDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_GenerateDefinitionKey_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszKeyForm);
-
-
-void __RPC_STUB IAppIdAuthority_GenerateDefinitionKey_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_GenerateReferenceKey_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszKeyForm);
-
-
-void __RPC_STUB IAppIdAuthority_GenerateReferenceKey_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_CreateDefinition_Proxy(
- IAppIdAuthority * This,
- /* [retval][out] */ IDefinitionAppId **ppNewIdentity);
-
-
-void __RPC_STUB IAppIdAuthority_CreateDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_CreateReference_Proxy(
- IAppIdAuthority * This,
- /* [retval][out] */ IReferenceAppId **ppNewIdentity);
-
-
-void __RPC_STUB IAppIdAuthority_CreateReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IAppIdAuthority_INTERFACE_DEFINED__ */
-
-
-/* [local] */ HRESULT __stdcall GetAppIdAuthority(
- /* [out] */ IAppIdAuthority **ppIAppIdAuthority);
-
-/* [local] */ HRESULT __stdcall GetIdentityAuthority(
- /* [out] */ IIdentityAuthority **ppIIdentityAuthority);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/inc/isolationpriv.h b/src/inc/isolationpriv.h
deleted file mode 100644
index 7179724cf1..0000000000
--- a/src/inc/isolationpriv.h
+++ /dev/null
@@ -1,18263 +0,0 @@
-// 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.
-
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 6.00.0366 */
-/* Compiler settings for isolation.idl:
- Oicf, W1, Zp8, env=Win32 (32b run)
- protocol : dce , ms_ext, c_ext, robust
- error checks: allocation ref bounds_check enum stub_data
- VC __declspec() decoration level:
- __declspec(uuid()), __declspec(selectany), __declspec(novtable)
- DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING( )
-
-#pragma warning( disable: 4049 ) /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 475
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __isolation_h__
-#define __isolation_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */
-
-#ifndef __ISectionEntry_FWD_DEFINED__
-#define __ISectionEntry_FWD_DEFINED__
-typedef interface ISectionEntry ISectionEntry;
-#endif /* __ISectionEntry_FWD_DEFINED__ */
-
-
-#ifndef __ISection_FWD_DEFINED__
-#define __ISection_FWD_DEFINED__
-typedef interface ISection ISection;
-#endif /* __ISection_FWD_DEFINED__ */
-
-
-#ifndef __ICDF_FWD_DEFINED__
-#define __ICDF_FWD_DEFINED__
-typedef interface ICDF ICDF;
-#endif /* __ICDF_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithStringKey_FWD_DEFINED__
-#define __ISectionWithStringKey_FWD_DEFINED__
-typedef interface ISectionWithStringKey ISectionWithStringKey;
-#endif /* __ISectionWithStringKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithBlobKey_FWD_DEFINED__
-#define __ISectionWithBlobKey_FWD_DEFINED__
-typedef interface ISectionWithBlobKey ISectionWithBlobKey;
-#endif /* __ISectionWithBlobKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithGuidKey_FWD_DEFINED__
-#define __ISectionWithGuidKey_FWD_DEFINED__
-typedef interface ISectionWithGuidKey ISectionWithGuidKey;
-#endif /* __ISectionWithGuidKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithIntegerKey_FWD_DEFINED__
-#define __ISectionWithIntegerKey_FWD_DEFINED__
-typedef interface ISectionWithIntegerKey ISectionWithIntegerKey;
-#endif /* __ISectionWithIntegerKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithDefinitionIdentityKey_FWD_DEFINED__
-#define __ISectionWithDefinitionIdentityKey_FWD_DEFINED__
-typedef interface ISectionWithDefinitionIdentityKey ISectionWithDefinitionIdentityKey;
-#endif /* __ISectionWithDefinitionIdentityKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithReferenceIdentityKey_FWD_DEFINED__
-#define __ISectionWithReferenceIdentityKey_FWD_DEFINED__
-typedef interface ISectionWithReferenceIdentityKey ISectionWithReferenceIdentityKey;
-#endif /* __ISectionWithReferenceIdentityKey_FWD_DEFINED__ */
-
-
-#ifndef __ICMS_FWD_DEFINED__
-#define __ICMS_FWD_DEFINED__
-typedef interface ICMS ICMS;
-#endif /* __ICMS_FWD_DEFINED__ */
-
-
-#ifndef __IMuiResourceIdLookupMapEntry_FWD_DEFINED__
-#define __IMuiResourceIdLookupMapEntry_FWD_DEFINED__
-typedef interface IMuiResourceIdLookupMapEntry IMuiResourceIdLookupMapEntry;
-#endif /* __IMuiResourceIdLookupMapEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMuiResourceTypeIdStringEntry_FWD_DEFINED__
-#define __IMuiResourceTypeIdStringEntry_FWD_DEFINED__
-typedef interface IMuiResourceTypeIdStringEntry IMuiResourceTypeIdStringEntry;
-#endif /* __IMuiResourceTypeIdStringEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMuiResourceTypeIdIntEntry_FWD_DEFINED__
-#define __IMuiResourceTypeIdIntEntry_FWD_DEFINED__
-typedef interface IMuiResourceTypeIdIntEntry IMuiResourceTypeIdIntEntry;
-#endif /* __IMuiResourceTypeIdIntEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMuiResourceMapEntry_FWD_DEFINED__
-#define __IMuiResourceMapEntry_FWD_DEFINED__
-typedef interface IMuiResourceMapEntry IMuiResourceMapEntry;
-#endif /* __IMuiResourceMapEntry_FWD_DEFINED__ */
-
-
-#ifndef __IHashElementEntry_FWD_DEFINED__
-#define __IHashElementEntry_FWD_DEFINED__
-typedef interface IHashElementEntry IHashElementEntry;
-#endif /* __IHashElementEntry_FWD_DEFINED__ */
-
-
-#ifndef __IFileEntry_FWD_DEFINED__
-#define __IFileEntry_FWD_DEFINED__
-typedef interface IFileEntry IFileEntry;
-#endif /* __IFileEntry_FWD_DEFINED__ */
-
-
-#ifndef __IFileAssociationEntry_FWD_DEFINED__
-#define __IFileAssociationEntry_FWD_DEFINED__
-typedef interface IFileAssociationEntry IFileAssociationEntry;
-#endif /* __IFileAssociationEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICategoryMembershipDataEntry_FWD_DEFINED__
-#define __ICategoryMembershipDataEntry_FWD_DEFINED__
-typedef interface ICategoryMembershipDataEntry ICategoryMembershipDataEntry;
-#endif /* __ICategoryMembershipDataEntry_FWD_DEFINED__ */
-
-
-#ifndef __ISubcategoryMembershipEntry_FWD_DEFINED__
-#define __ISubcategoryMembershipEntry_FWD_DEFINED__
-typedef interface ISubcategoryMembershipEntry ISubcategoryMembershipEntry;
-#endif /* __ISubcategoryMembershipEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICategoryMembershipEntry_FWD_DEFINED__
-#define __ICategoryMembershipEntry_FWD_DEFINED__
-typedef interface ICategoryMembershipEntry ICategoryMembershipEntry;
-#endif /* __ICategoryMembershipEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICOMServerEntry_FWD_DEFINED__
-#define __ICOMServerEntry_FWD_DEFINED__
-typedef interface ICOMServerEntry ICOMServerEntry;
-#endif /* __ICOMServerEntry_FWD_DEFINED__ */
-
-
-#ifndef __IProgIdRedirectionEntry_FWD_DEFINED__
-#define __IProgIdRedirectionEntry_FWD_DEFINED__
-typedef interface IProgIdRedirectionEntry IProgIdRedirectionEntry;
-#endif /* __IProgIdRedirectionEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICLRSurrogateEntry_FWD_DEFINED__
-#define __ICLRSurrogateEntry_FWD_DEFINED__
-typedef interface ICLRSurrogateEntry ICLRSurrogateEntry;
-#endif /* __ICLRSurrogateEntry_FWD_DEFINED__ */
-
-
-#ifndef __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__
-#define __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__
-typedef interface IAssemblyReferenceDependentAssemblyEntry IAssemblyReferenceDependentAssemblyEntry;
-#endif /* __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__ */
-
-
-#ifndef __IAssemblyReferenceEntry_FWD_DEFINED__
-#define __IAssemblyReferenceEntry_FWD_DEFINED__
-typedef interface IAssemblyReferenceEntry IAssemblyReferenceEntry;
-#endif /* __IAssemblyReferenceEntry_FWD_DEFINED__ */
-
-
-#ifndef __IWindowClassEntry_FWD_DEFINED__
-#define __IWindowClassEntry_FWD_DEFINED__
-typedef interface IWindowClassEntry IWindowClassEntry;
-#endif /* __IWindowClassEntry_FWD_DEFINED__ */
-
-
-#ifndef __IResourceTableMappingEntry_FWD_DEFINED__
-#define __IResourceTableMappingEntry_FWD_DEFINED__
-typedef interface IResourceTableMappingEntry IResourceTableMappingEntry;
-#endif /* __IResourceTableMappingEntry_FWD_DEFINED__ */
-
-
-#ifndef __IEntryPointEntry_FWD_DEFINED__
-#define __IEntryPointEntry_FWD_DEFINED__
-typedef interface IEntryPointEntry IEntryPointEntry;
-#endif /* __IEntryPointEntry_FWD_DEFINED__ */
-
-
-#ifndef __IPermissionSetEntry_FWD_DEFINED__
-#define __IPermissionSetEntry_FWD_DEFINED__
-typedef interface IPermissionSetEntry IPermissionSetEntry;
-#endif /* __IPermissionSetEntry_FWD_DEFINED__ */
-
-
-#ifndef __IAssemblyRequestEntry_FWD_DEFINED__
-#define __IAssemblyRequestEntry_FWD_DEFINED__
-typedef interface IAssemblyRequestEntry IAssemblyRequestEntry;
-#endif /* __IAssemblyRequestEntry_FWD_DEFINED__ */
-
-
-#ifndef __IDescriptionMetadataEntry_FWD_DEFINED__
-#define __IDescriptionMetadataEntry_FWD_DEFINED__
-typedef interface IDescriptionMetadataEntry IDescriptionMetadataEntry;
-#endif /* __IDescriptionMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __IDeploymentMetadataEntry_FWD_DEFINED__
-#define __IDeploymentMetadataEntry_FWD_DEFINED__
-typedef interface IDeploymentMetadataEntry IDeploymentMetadataEntry;
-#endif /* __IDeploymentMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __IDependentOSMetadataEntry_FWD_DEFINED__
-#define __IDependentOSMetadataEntry_FWD_DEFINED__
-typedef interface IDependentOSMetadataEntry IDependentOSMetadataEntry;
-#endif /* __IDependentOSMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__
-#define __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__
-typedef interface ICompatibleFrameworksMetadataEntry ICompatibleFrameworksMetadataEntry;
-#endif /* __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMetadataSectionEntry_FWD_DEFINED__
-#define __IMetadataSectionEntry_FWD_DEFINED__
-typedef interface IMetadataSectionEntry IMetadataSectionEntry;
-#endif /* __IMetadataSectionEntry_FWD_DEFINED__ */
-
-
-#ifndef __IEventEntry_FWD_DEFINED__
-#define __IEventEntry_FWD_DEFINED__
-typedef interface IEventEntry IEventEntry;
-#endif /* __IEventEntry_FWD_DEFINED__ */
-
-
-#ifndef __IEventMapEntry_FWD_DEFINED__
-#define __IEventMapEntry_FWD_DEFINED__
-typedef interface IEventMapEntry IEventMapEntry;
-#endif /* __IEventMapEntry_FWD_DEFINED__ */
-
-
-#ifndef __IEventTagEntry_FWD_DEFINED__
-#define __IEventTagEntry_FWD_DEFINED__
-typedef interface IEventTagEntry IEventTagEntry;
-#endif /* __IEventTagEntry_FWD_DEFINED__ */
-
-
-#ifndef __IRegistryValueEntry_FWD_DEFINED__
-#define __IRegistryValueEntry_FWD_DEFINED__
-typedef interface IRegistryValueEntry IRegistryValueEntry;
-#endif /* __IRegistryValueEntry_FWD_DEFINED__ */
-
-
-#ifndef __IRegistryKeyEntry_FWD_DEFINED__
-#define __IRegistryKeyEntry_FWD_DEFINED__
-typedef interface IRegistryKeyEntry IRegistryKeyEntry;
-#endif /* __IRegistryKeyEntry_FWD_DEFINED__ */
-
-
-#ifndef __IDirectoryEntry_FWD_DEFINED__
-#define __IDirectoryEntry_FWD_DEFINED__
-typedef interface IDirectoryEntry IDirectoryEntry;
-#endif /* __IDirectoryEntry_FWD_DEFINED__ */
-
-
-#ifndef __ISecurityDescriptorReferenceEntry_FWD_DEFINED__
-#define __ISecurityDescriptorReferenceEntry_FWD_DEFINED__
-typedef interface ISecurityDescriptorReferenceEntry ISecurityDescriptorReferenceEntry;
-#endif /* __ISecurityDescriptorReferenceEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICounterSetEntry_FWD_DEFINED__
-#define __ICounterSetEntry_FWD_DEFINED__
-typedef interface ICounterSetEntry ICounterSetEntry;
-#endif /* __ICounterSetEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICounterEntry_FWD_DEFINED__
-#define __ICounterEntry_FWD_DEFINED__
-typedef interface ICounterEntry ICounterEntry;
-#endif /* __ICounterEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICompatibleFrameworkEntry_FWD_DEFINED__
-#define __ICompatibleFrameworkEntry_FWD_DEFINED__
-typedef interface ICompatibleFrameworkEntry ICompatibleFrameworkEntry;
-#endif /* __ICompatibleFrameworkEntry_FWD_DEFINED__ */
-
-
-#ifndef __IACS_FWD_DEFINED__
-#define __IACS_FWD_DEFINED__
-typedef interface IACS IACS;
-#endif /* __IACS_FWD_DEFINED__ */
-
-
-#ifndef __IAppIdMetadataEntry_FWD_DEFINED__
-#define __IAppIdMetadataEntry_FWD_DEFINED__
-typedef interface IAppIdMetadataEntry IAppIdMetadataEntry;
-#endif /* __IAppIdMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMemberComponentEntry_FWD_DEFINED__
-#define __IMemberComponentEntry_FWD_DEFINED__
-typedef interface IMemberComponentEntry IMemberComponentEntry;
-#endif /* __IMemberComponentEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMemberLookupEntry_FWD_DEFINED__
-#define __IMemberLookupEntry_FWD_DEFINED__
-typedef interface IMemberLookupEntry IMemberLookupEntry;
-#endif /* __IMemberLookupEntry_FWD_DEFINED__ */
-
-
-#ifndef __IStoreCoherencyEntry_FWD_DEFINED__
-#define __IStoreCoherencyEntry_FWD_DEFINED__
-typedef interface IStoreCoherencyEntry IStoreCoherencyEntry;
-#endif /* __IStoreCoherencyEntry_FWD_DEFINED__ */
-
-
-#ifndef __IReferenceIdentity_FWD_DEFINED__
-#define __IReferenceIdentity_FWD_DEFINED__
-typedef interface IReferenceIdentity IReferenceIdentity;
-#endif /* __IReferenceIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IDefinitionIdentity_FWD_DEFINED__
-#define __IDefinitionIdentity_FWD_DEFINED__
-typedef interface IDefinitionIdentity IDefinitionIdentity;
-#endif /* __IDefinitionIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
-#define __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
-typedef interface IEnumIDENTITY_ATTRIBUTE IEnumIDENTITY_ATTRIBUTE;
-#endif /* __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumDefinitionIdentity_FWD_DEFINED__
-#define __IEnumDefinitionIdentity_FWD_DEFINED__
-typedef interface IEnumDefinitionIdentity IEnumDefinitionIdentity;
-#endif /* __IEnumDefinitionIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IEnumReferenceIdentity_FWD_DEFINED__
-#define __IEnumReferenceIdentity_FWD_DEFINED__
-typedef interface IEnumReferenceIdentity IEnumReferenceIdentity;
-#endif /* __IEnumReferenceIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IDefinitionAppId_FWD_DEFINED__
-#define __IDefinitionAppId_FWD_DEFINED__
-typedef interface IDefinitionAppId IDefinitionAppId;
-#endif /* __IDefinitionAppId_FWD_DEFINED__ */
-
-
-#ifndef __IReferenceAppId_FWD_DEFINED__
-#define __IReferenceAppId_FWD_DEFINED__
-typedef interface IReferenceAppId IReferenceAppId;
-#endif /* __IReferenceAppId_FWD_DEFINED__ */
-
-
-#ifndef __IIdentityAuthority_FWD_DEFINED__
-#define __IIdentityAuthority_FWD_DEFINED__
-typedef interface IIdentityAuthority IIdentityAuthority;
-#endif /* __IIdentityAuthority_FWD_DEFINED__ */
-
-
-#ifndef __IAppIdAuthority_FWD_DEFINED__
-#define __IAppIdAuthority_FWD_DEFINED__
-typedef interface IAppIdAuthority IAppIdAuthority;
-#endif /* __IAppIdAuthority_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_FWD_DEFINED__
-#define __IEnumSTORE_CATEGORY_FWD_DEFINED__
-typedef interface IEnumSTORE_CATEGORY IEnumSTORE_CATEGORY;
-#endif /* __IEnumSTORE_CATEGORY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__
-#define __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__
-typedef interface IEnumSTORE_CATEGORY_SUBCATEGORY IEnumSTORE_CATEGORY_SUBCATEGORY;
-#endif /* __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__
-#define __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__
-typedef interface IEnumSTORE_CATEGORY_INSTANCE IEnumSTORE_CATEGORY_INSTANCE;
-#endif /* __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__ */
-
-
-#ifndef __IStore_FWD_DEFINED__
-#define __IStore_FWD_DEFINED__
-typedef interface IStore IStore;
-#endif /* __IStore_FWD_DEFINED__ */
-
-
-#ifndef __IMigrateStore_FWD_DEFINED__
-#define __IMigrateStore_FWD_DEFINED__
-typedef interface IMigrateStore IMigrateStore;
-#endif /* __IMigrateStore_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_DEPLOYMENT_METADATA_FWD_DEFINED__
-#define __IEnumSTORE_DEPLOYMENT_METADATA_FWD_DEFINED__
-typedef interface IEnumSTORE_DEPLOYMENT_METADATA IEnumSTORE_DEPLOYMENT_METADATA;
-#endif /* __IEnumSTORE_DEPLOYMENT_METADATA_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_FWD_DEFINED__
-#define __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_FWD_DEFINED__
-typedef interface IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY;
-#endif /* __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_FWD_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_FWD_DEFINED__
-typedef interface IEnumSTORE_ASSEMBLY IEnumSTORE_ASSEMBLY;
-#endif /* __IEnumSTORE_ASSEMBLY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__
-typedef interface IEnumSTORE_ASSEMBLY_FILE IEnumSTORE_ASSEMBLY_FILE;
-#endif /* __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__
-typedef interface IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
-#endif /* __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumCATEGORY_FWD_DEFINED__
-#define __IEnumCATEGORY_FWD_DEFINED__
-typedef interface IEnumCATEGORY IEnumCATEGORY;
-#endif /* __IEnumCATEGORY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumCATEGORY_SUBCATEGORY_FWD_DEFINED__
-#define __IEnumCATEGORY_SUBCATEGORY_FWD_DEFINED__
-typedef interface IEnumCATEGORY_SUBCATEGORY IEnumCATEGORY_SUBCATEGORY;
-#endif /* __IEnumCATEGORY_SUBCATEGORY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumCATEGORY_INSTANCE_FWD_DEFINED__
-#define __IEnumCATEGORY_INSTANCE_FWD_DEFINED__
-typedef interface IEnumCATEGORY_INSTANCE IEnumCATEGORY_INSTANCE;
-#endif /* __IEnumCATEGORY_INSTANCE_FWD_DEFINED__ */
-
-
-#ifndef __IManifestInformation_FWD_DEFINED__
-#define __IManifestInformation_FWD_DEFINED__
-typedef interface IManifestInformation IManifestInformation;
-#endif /* __IManifestInformation_FWD_DEFINED__ */
-
-
-#ifndef __IActContext_FWD_DEFINED__
-#define __IActContext_FWD_DEFINED__
-typedef interface IActContext IActContext;
-#endif /* __IActContext_FWD_DEFINED__ */
-
-
-#ifndef __IStateManager_FWD_DEFINED__
-#define __IStateManager_FWD_DEFINED__
-typedef interface IStateManager IStateManager;
-#endif /* __IStateManager_FWD_DEFINED__ */
-
-
-#ifndef __IManifestParseErrorCallback_FWD_DEFINED__
-#define __IManifestParseErrorCallback_FWD_DEFINED__
-typedef interface IManifestParseErrorCallback IManifestParseErrorCallback;
-#endif /* __IManifestParseErrorCallback_FWD_DEFINED__ */
-
-
-#ifndef __IMuiResourceIdLookupMapEntry_FWD_DEFINED__
-#define __IMuiResourceIdLookupMapEntry_FWD_DEFINED__
-typedef interface IMuiResourceIdLookupMapEntry IMuiResourceIdLookupMapEntry;
-#endif /* __IMuiResourceIdLookupMapEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMuiResourceTypeIdStringEntry_FWD_DEFINED__
-#define __IMuiResourceTypeIdStringEntry_FWD_DEFINED__
-typedef interface IMuiResourceTypeIdStringEntry IMuiResourceTypeIdStringEntry;
-#endif /* __IMuiResourceTypeIdStringEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMuiResourceTypeIdIntEntry_FWD_DEFINED__
-#define __IMuiResourceTypeIdIntEntry_FWD_DEFINED__
-typedef interface IMuiResourceTypeIdIntEntry IMuiResourceTypeIdIntEntry;
-#endif /* __IMuiResourceTypeIdIntEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMuiResourceMapEntry_FWD_DEFINED__
-#define __IMuiResourceMapEntry_FWD_DEFINED__
-typedef interface IMuiResourceMapEntry IMuiResourceMapEntry;
-#endif /* __IMuiResourceMapEntry_FWD_DEFINED__ */
-
-
-#ifndef __IHashElementEntry_FWD_DEFINED__
-#define __IHashElementEntry_FWD_DEFINED__
-typedef interface IHashElementEntry IHashElementEntry;
-#endif /* __IHashElementEntry_FWD_DEFINED__ */
-
-
-#ifndef __IFileEntry_FWD_DEFINED__
-#define __IFileEntry_FWD_DEFINED__
-typedef interface IFileEntry IFileEntry;
-#endif /* __IFileEntry_FWD_DEFINED__ */
-
-
-#ifndef __IFileAssociationEntry_FWD_DEFINED__
-#define __IFileAssociationEntry_FWD_DEFINED__
-typedef interface IFileAssociationEntry IFileAssociationEntry;
-#endif /* __IFileAssociationEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICategoryMembershipDataEntry_FWD_DEFINED__
-#define __ICategoryMembershipDataEntry_FWD_DEFINED__
-typedef interface ICategoryMembershipDataEntry ICategoryMembershipDataEntry;
-#endif /* __ICategoryMembershipDataEntry_FWD_DEFINED__ */
-
-
-#ifndef __ISubcategoryMembershipEntry_FWD_DEFINED__
-#define __ISubcategoryMembershipEntry_FWD_DEFINED__
-typedef interface ISubcategoryMembershipEntry ISubcategoryMembershipEntry;
-#endif /* __ISubcategoryMembershipEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICategoryMembershipEntry_FWD_DEFINED__
-#define __ICategoryMembershipEntry_FWD_DEFINED__
-typedef interface ICategoryMembershipEntry ICategoryMembershipEntry;
-#endif /* __ICategoryMembershipEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICOMServerEntry_FWD_DEFINED__
-#define __ICOMServerEntry_FWD_DEFINED__
-typedef interface ICOMServerEntry ICOMServerEntry;
-#endif /* __ICOMServerEntry_FWD_DEFINED__ */
-
-
-#ifndef __IProgIdRedirectionEntry_FWD_DEFINED__
-#define __IProgIdRedirectionEntry_FWD_DEFINED__
-typedef interface IProgIdRedirectionEntry IProgIdRedirectionEntry;
-#endif /* __IProgIdRedirectionEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICLRSurrogateEntry_FWD_DEFINED__
-#define __ICLRSurrogateEntry_FWD_DEFINED__
-typedef interface ICLRSurrogateEntry ICLRSurrogateEntry;
-#endif /* __ICLRSurrogateEntry_FWD_DEFINED__ */
-
-
-#ifndef __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__
-#define __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__
-typedef interface IAssemblyReferenceDependentAssemblyEntry IAssemblyReferenceDependentAssemblyEntry;
-#endif /* __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__ */
-
-
-#ifndef __IAssemblyReferenceEntry_FWD_DEFINED__
-#define __IAssemblyReferenceEntry_FWD_DEFINED__
-typedef interface IAssemblyReferenceEntry IAssemblyReferenceEntry;
-#endif /* __IAssemblyReferenceEntry_FWD_DEFINED__ */
-
-
-#ifndef __IWindowClassEntry_FWD_DEFINED__
-#define __IWindowClassEntry_FWD_DEFINED__
-typedef interface IWindowClassEntry IWindowClassEntry;
-#endif /* __IWindowClassEntry_FWD_DEFINED__ */
-
-
-#ifndef __IResourceTableMappingEntry_FWD_DEFINED__
-#define __IResourceTableMappingEntry_FWD_DEFINED__
-typedef interface IResourceTableMappingEntry IResourceTableMappingEntry;
-#endif /* __IResourceTableMappingEntry_FWD_DEFINED__ */
-
-
-#ifndef __IEntryPointEntry_FWD_DEFINED__
-#define __IEntryPointEntry_FWD_DEFINED__
-typedef interface IEntryPointEntry IEntryPointEntry;
-#endif /* __IEntryPointEntry_FWD_DEFINED__ */
-
-
-#ifndef __IPermissionSetEntry_FWD_DEFINED__
-#define __IPermissionSetEntry_FWD_DEFINED__
-typedef interface IPermissionSetEntry IPermissionSetEntry;
-#endif /* __IPermissionSetEntry_FWD_DEFINED__ */
-
-
-#ifndef __IAssemblyRequestEntry_FWD_DEFINED__
-#define __IAssemblyRequestEntry_FWD_DEFINED__
-typedef interface IAssemblyRequestEntry IAssemblyRequestEntry;
-#endif /* __IAssemblyRequestEntry_FWD_DEFINED__ */
-
-
-#ifndef __IDescriptionMetadataEntry_FWD_DEFINED__
-#define __IDescriptionMetadataEntry_FWD_DEFINED__
-typedef interface IDescriptionMetadataEntry IDescriptionMetadataEntry;
-#endif /* __IDescriptionMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __IDeploymentMetadataEntry_FWD_DEFINED__
-#define __IDeploymentMetadataEntry_FWD_DEFINED__
-typedef interface IDeploymentMetadataEntry IDeploymentMetadataEntry;
-#endif /* __IDeploymentMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __IDependentOSMetadataEntry_FWD_DEFINED__
-#define __IDependentOSMetadataEntry_FWD_DEFINED__
-typedef interface IDependentOSMetadataEntry IDependentOSMetadataEntry;
-#endif /* __IDependentOSMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__
-#define __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__
-typedef interface ICompatibleFrameworksMetadataEntry ICompatibleFrameworksMetadataEntry;
-#endif /* __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__ */
-
-
-#ifndef __IMetadataSectionEntry_FWD_DEFINED__
-#define __IMetadataSectionEntry_FWD_DEFINED__
-typedef interface IMetadataSectionEntry IMetadataSectionEntry;
-#endif /* __IMetadataSectionEntry_FWD_DEFINED__ */
-
-
-#ifndef __IEventEntry_FWD_DEFINED__
-#define __IEventEntry_FWD_DEFINED__
-typedef interface IEventEntry IEventEntry;
-#endif /* __IEventEntry_FWD_DEFINED__ */
-
-
-#ifndef __IEventMapEntry_FWD_DEFINED__
-#define __IEventMapEntry_FWD_DEFINED__
-typedef interface IEventMapEntry IEventMapEntry;
-#endif /* __IEventMapEntry_FWD_DEFINED__ */
-
-
-#ifndef __IEventTagEntry_FWD_DEFINED__
-#define __IEventTagEntry_FWD_DEFINED__
-typedef interface IEventTagEntry IEventTagEntry;
-#endif /* __IEventTagEntry_FWD_DEFINED__ */
-
-
-#ifndef __IRegistryValueEntry_FWD_DEFINED__
-#define __IRegistryValueEntry_FWD_DEFINED__
-typedef interface IRegistryValueEntry IRegistryValueEntry;
-#endif /* __IRegistryValueEntry_FWD_DEFINED__ */
-
-
-#ifndef __IRegistryKeyEntry_FWD_DEFINED__
-#define __IRegistryKeyEntry_FWD_DEFINED__
-typedef interface IRegistryKeyEntry IRegistryKeyEntry;
-#endif /* __IRegistryKeyEntry_FWD_DEFINED__ */
-
-
-#ifndef __IDirectoryEntry_FWD_DEFINED__
-#define __IDirectoryEntry_FWD_DEFINED__
-typedef interface IDirectoryEntry IDirectoryEntry;
-#endif /* __IDirectoryEntry_FWD_DEFINED__ */
-
-
-#ifndef __ISecurityDescriptorReferenceEntry_FWD_DEFINED__
-#define __ISecurityDescriptorReferenceEntry_FWD_DEFINED__
-typedef interface ISecurityDescriptorReferenceEntry ISecurityDescriptorReferenceEntry;
-#endif /* __ISecurityDescriptorReferenceEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICounterSetEntry_FWD_DEFINED__
-#define __ICounterSetEntry_FWD_DEFINED__
-typedef interface ICounterSetEntry ICounterSetEntry;
-#endif /* __ICounterSetEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICounterEntry_FWD_DEFINED__
-#define __ICounterEntry_FWD_DEFINED__
-typedef interface ICounterEntry ICounterEntry;
-#endif /* __ICounterEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICompatibleFrameworkEntry_FWD_DEFINED__
-#define __ICompatibleFrameworkEntry_FWD_DEFINED__
-typedef interface ICompatibleFrameworkEntry ICompatibleFrameworkEntry;
-#endif /* __ICompatibleFrameworkEntry_FWD_DEFINED__ */
-
-
-#ifndef __ICDF_FWD_DEFINED__
-#define __ICDF_FWD_DEFINED__
-typedef interface ICDF ICDF;
-#endif /* __ICDF_FWD_DEFINED__ */
-
-
-#ifndef __ISectionEntry_FWD_DEFINED__
-#define __ISectionEntry_FWD_DEFINED__
-typedef interface ISectionEntry ISectionEntry;
-#endif /* __ISectionEntry_FWD_DEFINED__ */
-
-
-#ifndef __ISection_FWD_DEFINED__
-#define __ISection_FWD_DEFINED__
-typedef interface ISection ISection;
-#endif /* __ISection_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithStringKey_FWD_DEFINED__
-#define __ISectionWithStringKey_FWD_DEFINED__
-typedef interface ISectionWithStringKey ISectionWithStringKey;
-#endif /* __ISectionWithStringKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithIntegerKey_FWD_DEFINED__
-#define __ISectionWithIntegerKey_FWD_DEFINED__
-typedef interface ISectionWithIntegerKey ISectionWithIntegerKey;
-#endif /* __ISectionWithIntegerKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithGuidKey_FWD_DEFINED__
-#define __ISectionWithGuidKey_FWD_DEFINED__
-typedef interface ISectionWithGuidKey ISectionWithGuidKey;
-#endif /* __ISectionWithGuidKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithBlobKey_FWD_DEFINED__
-#define __ISectionWithBlobKey_FWD_DEFINED__
-typedef interface ISectionWithBlobKey ISectionWithBlobKey;
-#endif /* __ISectionWithBlobKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithReferenceIdentityKey_FWD_DEFINED__
-#define __ISectionWithReferenceIdentityKey_FWD_DEFINED__
-typedef interface ISectionWithReferenceIdentityKey ISectionWithReferenceIdentityKey;
-#endif /* __ISectionWithReferenceIdentityKey_FWD_DEFINED__ */
-
-
-#ifndef __ISectionWithDefinitionIdentityKey_FWD_DEFINED__
-#define __ISectionWithDefinitionIdentityKey_FWD_DEFINED__
-typedef interface ISectionWithDefinitionIdentityKey ISectionWithDefinitionIdentityKey;
-#endif /* __ISectionWithDefinitionIdentityKey_FWD_DEFINED__ */
-
-
-#ifndef __IIdentityAuthority_FWD_DEFINED__
-#define __IIdentityAuthority_FWD_DEFINED__
-typedef interface IIdentityAuthority IIdentityAuthority;
-#endif /* __IIdentityAuthority_FWD_DEFINED__ */
-
-
-#ifndef __IAppIdAuthority_FWD_DEFINED__
-#define __IAppIdAuthority_FWD_DEFINED__
-typedef interface IAppIdAuthority IAppIdAuthority;
-#endif /* __IAppIdAuthority_FWD_DEFINED__ */
-
-
-#ifndef __IDefinitionIdentity_FWD_DEFINED__
-#define __IDefinitionIdentity_FWD_DEFINED__
-typedef interface IDefinitionIdentity IDefinitionIdentity;
-#endif /* __IDefinitionIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IReferenceIdentity_FWD_DEFINED__
-#define __IReferenceIdentity_FWD_DEFINED__
-typedef interface IReferenceIdentity IReferenceIdentity;
-#endif /* __IReferenceIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IDefinitionAppId_FWD_DEFINED__
-#define __IDefinitionAppId_FWD_DEFINED__
-typedef interface IDefinitionAppId IDefinitionAppId;
-#endif /* __IDefinitionAppId_FWD_DEFINED__ */
-
-
-#ifndef __IReferenceAppId_FWD_DEFINED__
-#define __IReferenceAppId_FWD_DEFINED__
-typedef interface IReferenceAppId IReferenceAppId;
-#endif /* __IReferenceAppId_FWD_DEFINED__ */
-
-
-#ifndef __IActContext_FWD_DEFINED__
-#define __IActContext_FWD_DEFINED__
-typedef interface IActContext IActContext;
-#endif /* __IActContext_FWD_DEFINED__ */
-
-
-#ifndef __IManifestParseErrorCallback_FWD_DEFINED__
-#define __IManifestParseErrorCallback_FWD_DEFINED__
-typedef interface IManifestParseErrorCallback IManifestParseErrorCallback;
-#endif /* __IManifestParseErrorCallback_FWD_DEFINED__ */
-
-
-#ifndef __IStore_FWD_DEFINED__
-#define __IStore_FWD_DEFINED__
-typedef interface IStore IStore;
-#endif /* __IStore_FWD_DEFINED__ */
-
-
-#ifndef __IMigrateStore_FWD_DEFINED__
-#define __IMigrateStore_FWD_DEFINED__
-typedef interface IMigrateStore IMigrateStore;
-#endif /* __IMigrateStore_FWD_DEFINED__ */
-
-
-#ifndef __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
-#define __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
-typedef interface IEnumIDENTITY_ATTRIBUTE IEnumIDENTITY_ATTRIBUTE;
-#endif /* __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_FWD_DEFINED__
-#define __IEnumSTORE_CATEGORY_FWD_DEFINED__
-typedef interface IEnumSTORE_CATEGORY IEnumSTORE_CATEGORY;
-#endif /* __IEnumSTORE_CATEGORY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__
-#define __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__
-typedef interface IEnumSTORE_CATEGORY_INSTANCE IEnumSTORE_CATEGORY_INSTANCE;
-#endif /* __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__
-#define __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__
-typedef interface IEnumSTORE_CATEGORY_SUBCATEGORY IEnumSTORE_CATEGORY_SUBCATEGORY;
-#endif /* __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_FWD_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_FWD_DEFINED__
-typedef interface IEnumSTORE_ASSEMBLY IEnumSTORE_ASSEMBLY;
-#endif /* __IEnumSTORE_ASSEMBLY_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__
-typedef interface IEnumSTORE_ASSEMBLY_FILE IEnumSTORE_ASSEMBLY_FILE;
-#endif /* __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__
-typedef interface IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
-#endif /* __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__ */
-
-
-#ifndef __IEnumDefinitionIdentity_FWD_DEFINED__
-#define __IEnumDefinitionIdentity_FWD_DEFINED__
-typedef interface IEnumDefinitionIdentity IEnumDefinitionIdentity;
-#endif /* __IEnumDefinitionIdentity_FWD_DEFINED__ */
-
-
-#ifndef __IEnumReferenceIdentity_FWD_DEFINED__
-#define __IEnumReferenceIdentity_FWD_DEFINED__
-typedef interface IEnumReferenceIdentity IEnumReferenceIdentity;
-#endif /* __IEnumReferenceIdentity_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "unknwn.h"
-#include "oaidl.h"
-#include "ocidl.h"
-#include "propidl.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-void * __RPC_USER MIDL_user_allocate(size_t);
-void __RPC_USER MIDL_user_free( void * );
-
-/* interface __MIDL_itf_isolation_0000 */
-/* [local] */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// {3B6DEF2E-5BB3-487f-B6C3-E888FF42A337}
-DEFINE_GUID(
- SXS_INSTALL_REFERENCE_SCHEME_CSUTIL,
- 0x3b6def2e,
- 0x5bb3,
- 0x487f,
- 0xb6, 0xc3, 0xe8, 0x88, 0xff, 0x42, 0xa3, 0x37);
-
-// {8cedc215-ac4b-488b-93c0-a50a49cb2fb8}
-DEFINE_GUID(
- SXS_INSTALL_REFERENCE_SCHEME_UNINSTALLKEY,
- 0x8cedc215,
- 0xac4b,
- 0x488b,
- 0x93, 0xc0, 0xa5, 0x0a, 0x49, 0xcb, 0x2f, 0xb8);
-
-// {b02f9d65-fb77-4f7a-afa5-b391309f11c9}
-DEFINE_GUID(
- SXS_INSTALL_REFERENCE_SCHEME_KEYFILE,
- 0xb02f9d65,
- 0xfb77,
- 0x4f7a,
- 0xaf, 0xa5, 0xb3, 0x91, 0x30, 0x9f, 0x11, 0xc9);
-
-// {2ec93463-b0c3-45e1-8364-327e96aea856}
-DEFINE_GUID(
- SXS_INSTALL_REFERENCE_SCHEME_OPAQUESTRING,
- 0x2ec93463,
- 0xb0c3,
- 0x45e1,
- 0x83, 0x64, 0x32, 0x7e, 0x96, 0xae, 0xa8, 0x56);
-
-// d16d444c-56d8-11d5-882d-0080c847b195
-DEFINE_GUID(
- SXS_INSTALL_REFERENCE_SCHEME_OSINSTALL,
- 0xd16d444c,
- 0x56d8,
- 0x11d5,
- 0x88, 0x2d, 0x00, 0x80, 0xc8, 0x47, 0xb1, 0x95);
-
-//
-// Guid for the -installed by sxsinstallassemblyw, who knows?-
-// 27dec61e-b43c-4ac8-88db-e209a8242d90
-//
-DEFINE_GUID(
- SXS_INSTALL_REFERENCE_SCHEME_SXS_INSTALL_ASSEMBLY,
- 0x27dec61e,
- 0xb43c,
- 0x4ac8,
- 0x88, 0xdb, 0xe2, 0x09, 0xa8, 0x24, 0x2d, 0x90);
-
-typedef struct _CULTURE_FALLBACK_LIST
- {
- SIZE_T nCultures;
- /* [size_is] */ const LPCWSTR *prgpszCultures;
- } CULTURE_FALLBACK_LIST;
-
-typedef struct _CULTURE_FALLBACK_LIST *PCULTURE_FALLBACK_LIST;
-
-typedef const CULTURE_FALLBACK_LIST *PCCULTURE_FALLBACK_LIST;
-
-typedef union _COMPONENT_VERSION
- {
- ULONGLONG Version64;
- struct __MIDL___MIDL_itf_isolation_0000_0001
- {
- ULONG BuildAndRevision;
- ULONG MajorAndMinor;
- } Version32;
- struct __MIDL___MIDL_itf_isolation_0000_0002
- {
- USHORT Revision;
- USHORT Build;
- USHORT Minor;
- USHORT Major;
- } Version16;
- } COMPONENT_VERSION;
-
-typedef union _COMPONENT_VERSION *PCOMPONENT_VERSION;
-
-typedef const COMPONENT_VERSION *PCCOMPONENT_VERSION;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0000_v0_0_s_ifspec;
-
-#ifndef __ISectionEntry_INTERFACE_DEFINED__
-#define __ISectionEntry_INTERFACE_DEFINED__
-
-/* interface ISectionEntry */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ISectionEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8861-c84a-11d7-850f-005cd062464f")
- ISectionEntry : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE GetField(
- /* [in] */ ULONG fieldId,
- /* [retval][out] */ PROPVARIANT *fieldValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetFieldName(
- /* [in] */ ULONG fieldId,
- /* [retval][out] */ LPWSTR *pszFieldName) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISectionEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISectionEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISectionEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISectionEntry * This);
-
- HRESULT ( STDMETHODCALLTYPE *GetField )(
- ISectionEntry * This,
- /* [in] */ ULONG fieldId,
- /* [retval][out] */ PROPVARIANT *fieldValue);
-
- HRESULT ( STDMETHODCALLTYPE *GetFieldName )(
- ISectionEntry * This,
- /* [in] */ ULONG fieldId,
- /* [retval][out] */ LPWSTR *pszFieldName);
-
- END_INTERFACE
- } ISectionEntryVtbl;
-
- interface ISectionEntry
- {
- CONST_VTBL struct ISectionEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISectionEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISectionEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISectionEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISectionEntry_GetField(This,fieldId,fieldValue) \
- (This)->lpVtbl -> GetField(This,fieldId,fieldValue)
-
-#define ISectionEntry_GetFieldName(This,fieldId,pszFieldName) \
- (This)->lpVtbl -> GetFieldName(This,fieldId,pszFieldName)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE ISectionEntry_GetField_Proxy(
- ISectionEntry * This,
- /* [in] */ ULONG fieldId,
- /* [retval][out] */ PROPVARIANT *fieldValue);
-
-
-void __RPC_STUB ISectionEntry_GetField_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE ISectionEntry_GetFieldName_Proxy(
- ISectionEntry * This,
- /* [in] */ ULONG fieldId,
- /* [retval][out] */ LPWSTR *pszFieldName);
-
-
-void __RPC_STUB ISectionEntry_GetFieldName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISectionEntry_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISection_INTERFACE_DEFINED__
-#define __ISection_INTERFACE_DEFINED__
-
-/* interface ISection */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ISection;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8862-c84a-11d7-850f-005cd062464f")
- ISection : public IUnknown
- {
- public:
- virtual /* [restricted][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum(
- /* [retval][out] */ IUnknown **ppunkSectionEntryEnum) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Count(
- /* [retval][out] */ ULONG *pdwSectionEntryCount) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SectionID(
- /* [retval][out] */ ULONG *pSectionId) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SectionName(
- /* [retval][out] */ LPWSTR *pszSectionName) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISectionVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISection * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISection * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISection * This);
-
- /* [restricted][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )(
- ISection * This,
- /* [retval][out] */ IUnknown **ppunkSectionEntryEnum);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )(
- ISection * This,
- /* [retval][out] */ ULONG *pdwSectionEntryCount);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SectionID )(
- ISection * This,
- /* [retval][out] */ ULONG *pSectionId);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SectionName )(
- ISection * This,
- /* [retval][out] */ LPWSTR *pszSectionName);
-
- END_INTERFACE
- } ISectionVtbl;
-
- interface ISection
- {
- CONST_VTBL struct ISectionVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISection_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISection_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISection_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISection_get__NewEnum(This,ppunkSectionEntryEnum) \
- (This)->lpVtbl -> get__NewEnum(This,ppunkSectionEntryEnum)
-
-#define ISection_get_Count(This,pdwSectionEntryCount) \
- (This)->lpVtbl -> get_Count(This,pdwSectionEntryCount)
-
-#define ISection_get_SectionID(This,pSectionId) \
- (This)->lpVtbl -> get_SectionID(This,pSectionId)
-
-#define ISection_get_SectionName(This,pszSectionName) \
- (This)->lpVtbl -> get_SectionName(This,pszSectionName)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [restricted][propget] */ HRESULT STDMETHODCALLTYPE ISection_get__NewEnum_Proxy(
- ISection * This,
- /* [retval][out] */ IUnknown **ppunkSectionEntryEnum);
-
-
-void __RPC_STUB ISection_get__NewEnum_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISection_get_Count_Proxy(
- ISection * This,
- /* [retval][out] */ ULONG *pdwSectionEntryCount);
-
-
-void __RPC_STUB ISection_get_Count_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISection_get_SectionID_Proxy(
- ISection * This,
- /* [retval][out] */ ULONG *pSectionId);
-
-
-void __RPC_STUB ISection_get_SectionID_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISection_get_SectionName_Proxy(
- ISection * This,
- /* [retval][out] */ LPWSTR *pszSectionName);
-
-
-void __RPC_STUB ISection_get_SectionName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISection_INTERFACE_DEFINED__ */
-
-
-#ifndef __ICDF_INTERFACE_DEFINED__
-#define __ICDF_INTERFACE_DEFINED__
-
-/* interface ICDF */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ICDF;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8860-c84a-11d7-850f-005cd062464f")
- ICDF : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE GetRootSection(
- /* [in] */ ULONG SectionID,
- /* [out] */ ISection **ppSection) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetRootSectionEntry(
- /* [in] */ ULONG SectionID,
- /* [out] */ ISectionEntry **ppSectionEntry) = 0;
-
- virtual /* [restricted][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum(
- /* [retval][out] */ IUnknown **ppunkEnum) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Count(
- /* [retval][out] */ ULONG *pdwCount) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Item(
- /* [in] */ ULONG SectionID,
- /* [retval][out] */ IUnknown **ppUnknown) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICDFVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICDF * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICDF * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICDF * This);
-
- HRESULT ( STDMETHODCALLTYPE *GetRootSection )(
- ICDF * This,
- /* [in] */ ULONG SectionID,
- /* [out] */ ISection **ppSection);
-
- HRESULT ( STDMETHODCALLTYPE *GetRootSectionEntry )(
- ICDF * This,
- /* [in] */ ULONG SectionID,
- /* [out] */ ISectionEntry **ppSectionEntry);
-
- /* [restricted][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )(
- ICDF * This,
- /* [retval][out] */ IUnknown **ppunkEnum);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )(
- ICDF * This,
- /* [retval][out] */ ULONG *pdwCount);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )(
- ICDF * This,
- /* [in] */ ULONG SectionID,
- /* [retval][out] */ IUnknown **ppUnknown);
-
- END_INTERFACE
- } ICDFVtbl;
-
- interface ICDF
- {
- CONST_VTBL struct ICDFVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICDF_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICDF_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICDF_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICDF_GetRootSection(This,SectionID,ppSection) \
- (This)->lpVtbl -> GetRootSection(This,SectionID,ppSection)
-
-#define ICDF_GetRootSectionEntry(This,SectionID,ppSectionEntry) \
- (This)->lpVtbl -> GetRootSectionEntry(This,SectionID,ppSectionEntry)
-
-#define ICDF_get__NewEnum(This,ppunkEnum) \
- (This)->lpVtbl -> get__NewEnum(This,ppunkEnum)
-
-#define ICDF_get_Count(This,pdwCount) \
- (This)->lpVtbl -> get_Count(This,pdwCount)
-
-#define ICDF_get_Item(This,SectionID,ppUnknown) \
- (This)->lpVtbl -> get_Item(This,SectionID,ppUnknown)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE ICDF_GetRootSection_Proxy(
- ICDF * This,
- /* [in] */ ULONG SectionID,
- /* [out] */ ISection **ppSection);
-
-
-void __RPC_STUB ICDF_GetRootSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE ICDF_GetRootSectionEntry_Proxy(
- ICDF * This,
- /* [in] */ ULONG SectionID,
- /* [out] */ ISectionEntry **ppSectionEntry);
-
-
-void __RPC_STUB ICDF_GetRootSectionEntry_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [restricted][propget] */ HRESULT STDMETHODCALLTYPE ICDF_get__NewEnum_Proxy(
- ICDF * This,
- /* [retval][out] */ IUnknown **ppunkEnum);
-
-
-void __RPC_STUB ICDF_get__NewEnum_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICDF_get_Count_Proxy(
- ICDF * This,
- /* [retval][out] */ ULONG *pdwCount);
-
-
-void __RPC_STUB ICDF_get_Count_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICDF_get_Item_Proxy(
- ICDF * This,
- /* [in] */ ULONG SectionID,
- /* [retval][out] */ IUnknown **ppUnknown);
-
-
-void __RPC_STUB ICDF_get_Item_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICDF_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISectionWithStringKey_INTERFACE_DEFINED__
-#define __ISectionWithStringKey_INTERFACE_DEFINED__
-
-/* interface ISectionWithStringKey */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ISectionWithStringKey;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8871-c84a-11d7-850f-005cd062464f")
- ISectionWithStringKey : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Lookup(
- /* [in] */ LPCWSTR wzStringKey,
- /* [out] */ IUnknown **ppUnknown) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsCaseInsensitive(
- /* [retval][out] */ VARIANT_BOOL *pbIsCaseInsentitive) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISectionWithStringKeyVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISectionWithStringKey * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISectionWithStringKey * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISectionWithStringKey * This);
-
- HRESULT ( STDMETHODCALLTYPE *Lookup )(
- ISectionWithStringKey * This,
- /* [in] */ LPCWSTR wzStringKey,
- /* [out] */ IUnknown **ppUnknown);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsCaseInsensitive )(
- ISectionWithStringKey * This,
- /* [retval][out] */ VARIANT_BOOL *pbIsCaseInsentitive);
-
- END_INTERFACE
- } ISectionWithStringKeyVtbl;
-
- interface ISectionWithStringKey
- {
- CONST_VTBL struct ISectionWithStringKeyVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISectionWithStringKey_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISectionWithStringKey_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISectionWithStringKey_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISectionWithStringKey_Lookup(This,wzStringKey,ppUnknown) \
- (This)->lpVtbl -> Lookup(This,wzStringKey,ppUnknown)
-
-#define ISectionWithStringKey_get_IsCaseInsensitive(This,pbIsCaseInsentitive) \
- (This)->lpVtbl -> get_IsCaseInsensitive(This,pbIsCaseInsentitive)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE ISectionWithStringKey_Lookup_Proxy(
- ISectionWithStringKey * This,
- /* [in] */ LPCWSTR wzStringKey,
- /* [out] */ IUnknown **ppUnknown);
-
-
-void __RPC_STUB ISectionWithStringKey_Lookup_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISectionWithStringKey_get_IsCaseInsensitive_Proxy(
- ISectionWithStringKey * This,
- /* [retval][out] */ VARIANT_BOOL *pbIsCaseInsentitive);
-
-
-void __RPC_STUB ISectionWithStringKey_get_IsCaseInsensitive_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISectionWithStringKey_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISectionWithBlobKey_INTERFACE_DEFINED__
-#define __ISectionWithBlobKey_INTERFACE_DEFINED__
-
-/* interface ISectionWithBlobKey */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ISectionWithBlobKey;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8872-c84a-11d7-850f-005cd062464f")
- ISectionWithBlobKey : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Lookup(
- /* [size_is][in] */ byte *pBlobKey,
- /* [in] */ ULONG ulBlobSize,
- /* [out] */ IUnknown **ppUnknown) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISectionWithBlobKeyVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISectionWithBlobKey * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISectionWithBlobKey * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISectionWithBlobKey * This);
-
- HRESULT ( STDMETHODCALLTYPE *Lookup )(
- ISectionWithBlobKey * This,
- /* [size_is][in] */ byte *pBlobKey,
- /* [in] */ ULONG ulBlobSize,
- /* [out] */ IUnknown **ppUnknown);
-
- END_INTERFACE
- } ISectionWithBlobKeyVtbl;
-
- interface ISectionWithBlobKey
- {
- CONST_VTBL struct ISectionWithBlobKeyVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISectionWithBlobKey_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISectionWithBlobKey_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISectionWithBlobKey_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISectionWithBlobKey_Lookup(This,pBlobKey,ulBlobSize,ppUnknown) \
- (This)->lpVtbl -> Lookup(This,pBlobKey,ulBlobSize,ppUnknown)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE ISectionWithBlobKey_Lookup_Proxy(
- ISectionWithBlobKey * This,
- /* [size_is][in] */ byte *pBlobKey,
- /* [in] */ ULONG ulBlobSize,
- /* [out] */ IUnknown **ppUnknown);
-
-
-void __RPC_STUB ISectionWithBlobKey_Lookup_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISectionWithBlobKey_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISectionWithGuidKey_INTERFACE_DEFINED__
-#define __ISectionWithGuidKey_INTERFACE_DEFINED__
-
-/* interface ISectionWithGuidKey */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ISectionWithGuidKey;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8873-c84a-11d7-850f-005cd062464f")
- ISectionWithGuidKey : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Lookup(
- /* [in] */ const GUID *pGuidKey,
- /* [out] */ IUnknown **ppUnknown) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISectionWithGuidKeyVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISectionWithGuidKey * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISectionWithGuidKey * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISectionWithGuidKey * This);
-
- HRESULT ( STDMETHODCALLTYPE *Lookup )(
- ISectionWithGuidKey * This,
- /* [in] */ const GUID *pGuidKey,
- /* [out] */ IUnknown **ppUnknown);
-
- END_INTERFACE
- } ISectionWithGuidKeyVtbl;
-
- interface ISectionWithGuidKey
- {
- CONST_VTBL struct ISectionWithGuidKeyVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISectionWithGuidKey_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISectionWithGuidKey_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISectionWithGuidKey_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISectionWithGuidKey_Lookup(This,pGuidKey,ppUnknown) \
- (This)->lpVtbl -> Lookup(This,pGuidKey,ppUnknown)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE ISectionWithGuidKey_Lookup_Proxy(
- ISectionWithGuidKey * This,
- /* [in] */ const GUID *pGuidKey,
- /* [out] */ IUnknown **ppUnknown);
-
-
-void __RPC_STUB ISectionWithGuidKey_Lookup_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISectionWithGuidKey_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISectionWithIntegerKey_INTERFACE_DEFINED__
-#define __ISectionWithIntegerKey_INTERFACE_DEFINED__
-
-/* interface ISectionWithIntegerKey */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ISectionWithIntegerKey;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8874-c84a-11d7-850f-005cd062464f")
- ISectionWithIntegerKey : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Lookup(
- /* [in] */ ULONG ulIntegerKey,
- /* [out] */ IUnknown **ppUnknown) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISectionWithIntegerKeyVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISectionWithIntegerKey * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISectionWithIntegerKey * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISectionWithIntegerKey * This);
-
- HRESULT ( STDMETHODCALLTYPE *Lookup )(
- ISectionWithIntegerKey * This,
- /* [in] */ ULONG ulIntegerKey,
- /* [out] */ IUnknown **ppUnknown);
-
- END_INTERFACE
- } ISectionWithIntegerKeyVtbl;
-
- interface ISectionWithIntegerKey
- {
- CONST_VTBL struct ISectionWithIntegerKeyVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISectionWithIntegerKey_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISectionWithIntegerKey_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISectionWithIntegerKey_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISectionWithIntegerKey_Lookup(This,ulIntegerKey,ppUnknown) \
- (This)->lpVtbl -> Lookup(This,ulIntegerKey,ppUnknown)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE ISectionWithIntegerKey_Lookup_Proxy(
- ISectionWithIntegerKey * This,
- /* [in] */ ULONG ulIntegerKey,
- /* [out] */ IUnknown **ppUnknown);
-
-
-void __RPC_STUB ISectionWithIntegerKey_Lookup_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISectionWithIntegerKey_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISectionWithDefinitionIdentityKey_INTERFACE_DEFINED__
-#define __ISectionWithDefinitionIdentityKey_INTERFACE_DEFINED__
-
-/* interface ISectionWithDefinitionIdentityKey */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ISectionWithDefinitionIdentityKey;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8875-c84a-11d7-850f-005cd062464f")
- ISectionWithDefinitionIdentityKey : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Lookup(
- /* [in] */ IDefinitionIdentity *pDefinitionIdentityKey,
- /* [out] */ IUnknown **ppUnknown) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISectionWithDefinitionIdentityKeyVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISectionWithDefinitionIdentityKey * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISectionWithDefinitionIdentityKey * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISectionWithDefinitionIdentityKey * This);
-
- HRESULT ( STDMETHODCALLTYPE *Lookup )(
- ISectionWithDefinitionIdentityKey * This,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentityKey,
- /* [out] */ IUnknown **ppUnknown);
-
- END_INTERFACE
- } ISectionWithDefinitionIdentityKeyVtbl;
-
- interface ISectionWithDefinitionIdentityKey
- {
- CONST_VTBL struct ISectionWithDefinitionIdentityKeyVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISectionWithDefinitionIdentityKey_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISectionWithDefinitionIdentityKey_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISectionWithDefinitionIdentityKey_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISectionWithDefinitionIdentityKey_Lookup(This,pDefinitionIdentityKey,ppUnknown) \
- (This)->lpVtbl -> Lookup(This,pDefinitionIdentityKey,ppUnknown)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE ISectionWithDefinitionIdentityKey_Lookup_Proxy(
- ISectionWithDefinitionIdentityKey * This,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentityKey,
- /* [out] */ IUnknown **ppUnknown);
-
-
-void __RPC_STUB ISectionWithDefinitionIdentityKey_Lookup_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISectionWithDefinitionIdentityKey_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISectionWithReferenceIdentityKey_INTERFACE_DEFINED__
-#define __ISectionWithReferenceIdentityKey_INTERFACE_DEFINED__
-
-/* interface ISectionWithReferenceIdentityKey */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ISectionWithReferenceIdentityKey;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("285a8876-c84a-11d7-850f-005cd062464f")
- ISectionWithReferenceIdentityKey : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Lookup(
- /* [in] */ IReferenceIdentity *pReferenceIdentityKey,
- /* [out] */ IUnknown **ppUnknown) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISectionWithReferenceIdentityKeyVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISectionWithReferenceIdentityKey * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISectionWithReferenceIdentityKey * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISectionWithReferenceIdentityKey * This);
-
- HRESULT ( STDMETHODCALLTYPE *Lookup )(
- ISectionWithReferenceIdentityKey * This,
- /* [in] */ IReferenceIdentity *pReferenceIdentityKey,
- /* [out] */ IUnknown **ppUnknown);
-
- END_INTERFACE
- } ISectionWithReferenceIdentityKeyVtbl;
-
- interface ISectionWithReferenceIdentityKey
- {
- CONST_VTBL struct ISectionWithReferenceIdentityKeyVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISectionWithReferenceIdentityKey_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISectionWithReferenceIdentityKey_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISectionWithReferenceIdentityKey_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISectionWithReferenceIdentityKey_Lookup(This,pReferenceIdentityKey,ppUnknown) \
- (This)->lpVtbl -> Lookup(This,pReferenceIdentityKey,ppUnknown)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE ISectionWithReferenceIdentityKey_Lookup_Proxy(
- ISectionWithReferenceIdentityKey * This,
- /* [in] */ IReferenceIdentity *pReferenceIdentityKey,
- /* [out] */ IUnknown **ppUnknown);
-
-
-void __RPC_STUB ISectionWithReferenceIdentityKey_Lookup_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISectionWithReferenceIdentityKey_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0278 */
-/* [local] */
-
-typedef
-enum _CMSSECTIONID
- { CMSSECTIONID_FILE_SECTION = 1,
- CMSSECTIONID_CATEGORY_INSTANCE_SECTION = 2,
- CMSSECTIONID_COM_REDIRECTION_SECTION = 3,
- CMSSECTIONID_PROGID_REDIRECTION_SECTION = 4,
- CMSSECTIONID_CLR_SURROGATE_SECTION = 5,
- CMSSECTIONID_ASSEMBLY_REFERENCE_SECTION = 6,
- CMSSECTIONID_WINDOW_CLASS_SECTION = 8,
- CMSSECTIONID_STRING_SECTION = 9,
- CMSSECTIONID_ENTRYPOINT_SECTION = 10,
- CMSSECTIONID_PERMISSION_SET_SECTION = 11,
- CMSSECTIONENTRYID_METADATA = 12,
- CMSSECTIONID_ASSEMBLY_REQUEST_SECTION = 13,
- CMSSECTIONID_REGISTRY_KEY_SECTION = 16,
- CMSSECTIONID_DIRECTORY_SECTION = 17,
- CMSSECTIONID_FILE_ASSOCIATION_SECTION = 18,
- CMSSECTIONID_COMPATIBLE_FRAMEWORKS_SECTION = 19,
- CMSSECTIONID_EVENT_SECTION = 101,
- CMSSECTIONID_EVENT_MAP_SECTION = 102,
- CMSSECTIONID_EVENT_TAG_SECTION = 103,
- CMSSECTIONID_COUNTERSET_SECTION = 110,
- CMSSECTIONID_COUNTER_SECTION = 111
- } CMSSECTIONID;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-enum __MIDL___MIDL_itf_isolation_0278_0001
- { CMS_ASSEMBLY_DEPLOYMENT_FLAG_BEFORE_APPLICATION_STARTUP = 4,
- CMS_ASSEMBLY_DEPLOYMENT_FLAG_RUN_AFTER_INSTALL = 16,
- CMS_ASSEMBLY_DEPLOYMENT_FLAG_INSTALL = 32,
- CMS_ASSEMBLY_DEPLOYMENT_FLAG_TRUST_URL_PARAMETERS = 64,
- CMS_ASSEMBLY_DEPLOYMENT_FLAG_DISALLOW_URL_ACTIVATION = 128,
- CMS_ASSEMBLY_DEPLOYMENT_FLAG_MAP_FILE_EXTENSIONS = 256,
- CMS_ASSEMBLY_DEPLOYMENT_FLAG_CREATE_DESKTOP_SHORTCUT = 512
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0002
- { CMS_ASSEMBLY_REFERENCE_FLAG_OPTIONAL = 1,
- CMS_ASSEMBLY_REFERENCE_FLAG_VISIBLE = 2,
- CMS_ASSEMBLY_REFERENCE_FLAG_FOLLOW = 4,
- CMS_ASSEMBLY_REFERENCE_FLAG_IS_PLATFORM = 8,
- CMS_ASSEMBLY_REFERENCE_FLAG_CULTURE_WILDCARDED = 16,
- CMS_ASSEMBLY_REFERENCE_FLAG_PROCESSOR_ARCHITECTURE_WILDCARDED = 32,
- CMS_ASSEMBLY_REFERENCE_FLAG_PREREQUISITE = 128
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0003
- { CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_OPTIONAL = 1,
- CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_VISIBLE = 2,
- CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_PREREQUISITE = 4,
- CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_RESOURCE_FALLBACK_CULTURE_INTERNAL = 8,
- CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_INSTALL = 16,
- CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_ALLOW_DELAYED_BINDING = 32
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0004
- { CMS_FILE_FLAG_OPTIONAL = 1
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0005
- { CMS_ENTRY_POINT_FLAG_HOST_IN_BROWSER = 1,
- CMS_ENTRY_POINT_FLAG_CUSTOMHOSTSPECIFIED = 2,
- CMS_ENTRY_POINT_FLAG_CUSTOMUX = 4
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0006
- { CMS_COM_SERVER_FLAG_IS_CLR_CLASS = 1
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0007
- { CMS_REGISTRY_KEY_FLAG_OWNER = 1,
- CMS_REGISTRY_KEY_FLAG_LEAF_IN_MANIFEST = 2
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0008
- { CMS_REGISTRY_VALUE_FLAG_OWNER = 1
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0009
- { CMS_DIRECTORY_FLAG_OWNER = 1
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0010
- { CMS_MANIFEST_FLAG_ASSEMBLY = 1,
- CMS_MANIFEST_FLAG_CATEGORY = 2,
- CMS_MANIFEST_FLAG_FEATURE = 3,
- CMS_MANIFEST_FLAG_APPLICATION = 4,
- CMS_MANIFEST_FLAG_USEMANIFESTFORTRUST = 8
- } ;
-
-enum __MIDL___MIDL_itf_isolation_0278_0011
- { CMS_USAGE_PATTERN_SCOPE_APPLICATION = 1,
- CMS_USAGE_PATTERN_SCOPE_PROCESS = 2,
- CMS_USAGE_PATTERN_SCOPE_MACHINE = 3,
- CMS_USAGE_PATTERN_SCOPE_MASK = 7
- } ;
-typedef
-enum _CMS_SCHEMA_VERSION
- { CMS_SCHEMA_VERSION_V1 = 1,
- CMS_SCHEMA_VERSION_V2 = 2
- } CMS_SCHEMA_VERSION;
-
-typedef enum _CMS_SCHEMA_VERSION *PCMS_SCHEMA_VERSION;
-
-typedef const CMS_SCHEMA_VERSION *PCCMS_SCHEMA_VERSION;
-
-typedef
-enum _CMS_FILE_HASH_ALGORITHM
- { CMS_FILE_HASH_ALGORITHM_SHA1 = 1,
- CMS_FILE_HASH_ALGORITHM_SHA256 = 2,
- CMS_FILE_HASH_ALGORITHM_SHA384 = 3,
- CMS_FILE_HASH_ALGORITHM_SHA512 = 4,
- CMS_FILE_HASH_ALGORITHM_MD5 = 5,
- CMS_FILE_HASH_ALGORITHM_MD4 = 6,
- CMS_FILE_HASH_ALGORITHM_MD2 = 7
- } CMS_FILE_HASH_ALGORITHM;
-
-typedef enum _CMS_FILE_HASH_ALGORITHM *PCMS_FILE_HASH_ALGORITHM;
-
-typedef const CMS_FILE_HASH_ALGORITHM *PCCMS_FILE_HASH_ALGORITHM;
-
-typedef
-enum _CMS_TIME_UNIT_TYPE
- { CMS_TIME_UNIT_TYPE_HOURS = 1,
- CMS_TIME_UNIT_TYPE_DAYS = 2,
- CMS_TIME_UNIT_TYPE_WEEKS = 3,
- CMS_TIME_UNIT_TYPE_MONTHS = 4
- } CMS_TIME_UNIT_TYPE;
-
-typedef enum _CMS_TIME_UNIT_TYPE *PCMS_TIME_UNIT_TYPE;
-
-typedef const CMS_TIME_UNIT_TYPE *PCCMS_TIME_UNIT_TYPE;
-
-typedef
-enum _CMS_REGISTRY_VALUE_TYPE
- { CMS_REGISTRY_VALUE_TYPE_NONE = 0,
- CMS_REGISTRY_VALUE_TYPE_SZ = 1,
- CMS_REGISTRY_VALUE_TYPE_EXPAND_SZ = 2,
- CMS_REGISTRY_VALUE_TYPE_MULTI_SZ = 3,
- CMS_REGISTRY_VALUE_TYPE_BINARY = 4,
- CMS_REGISTRY_VALUE_TYPE_DWORD = 5,
- CMS_REGISTRY_VALUE_TYPE_DWORD_LITTLE_ENDIAN = 6,
- CMS_REGISTRY_VALUE_TYPE_DWORD_BIG_ENDIAN = 7,
- CMS_REGISTRY_VALUE_TYPE_LINK = 8,
- CMS_REGISTRY_VALUE_TYPE_RESOURCE_LIST = 9,
- CMS_REGISTRY_VALUE_TYPE_FULL_RESOURCE_DESCRIPTOR = 10,
- CMS_REGISTRY_VALUE_TYPE_RESOURCE_REQUIREMENTS_LIST = 11,
- CMS_REGISTRY_VALUE_TYPE_QWORD = 12,
- CMS_REGISTRY_VALUE_TYPE_QWORD_LITTLE_ENDIAN = 13
- } CMS_REGISTRY_VALUE_TYPE;
-
-typedef enum _CMS_REGISTRY_VALUE_TYPE *PCMS_REGISTRY_VALUE_TYPE;
-
-typedef const CMS_REGISTRY_VALUE_TYPE *PCCMS_REGISTRY_VALUE_TYPE;
-
-typedef
-enum _CMS_REGISTRY_VALUE_HINT
- { CMS_REGISTRY_VALUE_HINT_REPLACE = 1,
- CMS_REGISTRY_VALUE_HINT_APPEND = 2,
- CMS_REGISTRY_VALUE_HINT_PREPEND = 3
- } CMS_REGISTRY_VALUE_HINT;
-
-typedef enum _CMS_REGISTRY_VALUE_HINT *PCMS_REGISTRY_VALUE_HINT;
-
-typedef const CMS_REGISTRY_VALUE_HINT *PCCMS_REGISTRY_VALUE_HINT;
-
-typedef
-enum _CMS_SYSTEM_PROTECTION
- { CMS_SYSTEM_PROTECTION_READ_ONLY_IGNORE_WRITES = 1,
- CMS_SYSTEM_PROTECTION_READ_ONLY_FAIL_WRITES = 2,
- CMS_SYSTEM_PROTECTION_OS_ONLY_IGNORE_WRITES = 3,
- CMS_SYSTEM_PROTECTION_OS_ONLY_FAIL_WRITES = 4,
- CMS_SYSTEM_PROTECTION_TRANSACTED = 5,
- CMS_SYSTEM_PROTECTION_APPLICATION_VIRTUALIZED = 6,
- CMS_SYSTEM_PROTECTION_USER_VIRTUALIZED = 7,
- CMS_SYSTEM_PROTECTION_APPLICATION_AND_USER_VIRTUALIZED = 8,
- CMS_SYSTEM_PROTECTION_INHERIT = 9,
- CMS_SYSTEM_PROTECTION_NOT_PROTECTED = 10
- } CMS_SYSTEM_PROTECTION;
-
-typedef enum _CMS_SYSTEM_PROTECTION *PCMS_SYSTEM_PROTECTION;
-
-typedef const CMS_SYSTEM_PROTECTION *PCCMS_SYSTEM_PROTECTION;
-
-typedef
-enum _CMS_FILE_WRITABLE_TYPE
- { CMS_FILE_WRITABLE_TYPE_NOT_WRITABLE = 1,
- CMS_FILE_WRITABLE_TYPE_APPLICATION_DATA = 2
- } CMS_FILE_WRITABLE_TYPE;
-
-typedef enum _CMS_FILE_WRITABLE_TYPE *PCMS_FILE_WRITABLE_TYPE;
-
-typedef const CMS_FILE_WRITABLE_TYPE *PCCMS_FILE_WRITABLE_TYPE;
-
-typedef
-enum _CMS_HASH_TRANSFORM
- { CMS_HASH_TRANSFORM_IDENTITY = 1,
- CMS_HASH_TRANSFORM_MANIFESTINVARIANT = 2
- } CMS_HASH_TRANSFORM;
-
-typedef enum _CMS_HASH_TRANSFORM *PCMS_HASH_TRANSFORM;
-
-typedef const CMS_HASH_TRANSFORM *PCCMS_HASH_TRANSFORM;
-
-typedef
-enum _CMS_HASH_DIGESTMETHOD
- { CMS_HASH_DIGESTMETHOD_SHA1 = 1,
- CMS_HASH_DIGESTMETHOD_SHA256 = 2,
- CMS_HASH_DIGESTMETHOD_SHA384 = 3,
- CMS_HASH_DIGESTMETHOD_SHA512 = 4
- } CMS_HASH_DIGESTMETHOD;
-
-typedef enum _CMS_HASH_DIGESTMETHOD *PCMS_HASH_DIGESTMETHOD;
-
-typedef const CMS_HASH_DIGESTMETHOD *PCCMS_HASH_DIGESTMETHOD;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0278_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0278_v0_0_s_ifspec;
-
-#ifndef __ICMS_INTERFACE_DEFINED__
-#define __ICMS_INTERFACE_DEFINED__
-
-/* interface ICMS */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_ICMS;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("a504e5b0-8ccf-4cb4-9902-c9d1b9abd033")
- ICMS : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0015) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileSection(
- /* [retval][out] */ ISection **__MIDL_0016) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CategoryMembershipSection(
- /* [retval][out] */ ISection **__MIDL_0017) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_COMRedirectionSection(
- /* [retval][out] */ ISection **__MIDL_0018) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProgIdRedirectionSection(
- /* [retval][out] */ ISection **__MIDL_0019) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CLRSurrogateSection(
- /* [retval][out] */ ISection **__MIDL_0020) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AssemblyReferenceSection(
- /* [retval][out] */ ISection **__MIDL_0021) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_WindowClassSection(
- /* [retval][out] */ ISection **__MIDL_0022) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StringSection(
- /* [retval][out] */ ISection **__MIDL_0023) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EntryPointSection(
- /* [retval][out] */ ISection **__MIDL_0024) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PermissionSetSection(
- /* [retval][out] */ ISection **__MIDL_0025) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MetadataSectionEntry(
- /* [retval][out] */ ISectionEntry **__MIDL_0026) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AssemblyRequestSection(
- /* [retval][out] */ ISection **__MIDL_0027) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RegistryKeySection(
- /* [retval][out] */ ISection **__MIDL_0028) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DirectorySection(
- /* [retval][out] */ ISection **__MIDL_0029) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileAssociationSection(
- /* [retval][out] */ ISection **__MIDL_0030) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CompatibleFrameworksSection(
- /* [retval][out] */ ISection **__MIDL_0031) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventSection(
- /* [retval][out] */ ISection **__MIDL_0032) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventMapSection(
- /* [retval][out] */ ISection **__MIDL_0033) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventTagSection(
- /* [retval][out] */ ISection **__MIDL_0034) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterSetSection(
- /* [retval][out] */ ISection **__MIDL_0035) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterSection(
- /* [retval][out] */ ISection **__MIDL_0036) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICMSVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICMS * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICMS * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICMS * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
- ICMS * This,
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0015);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0016);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CategoryMembershipSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0017);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_COMRedirectionSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0018);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProgIdRedirectionSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0019);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CLRSurrogateSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0020);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AssemblyReferenceSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0021);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_WindowClassSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0022);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StringSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0023);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EntryPointSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0024);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PermissionSetSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0025);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MetadataSectionEntry )(
- ICMS * This,
- /* [retval][out] */ ISectionEntry **__MIDL_0026);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AssemblyRequestSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0027);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RegistryKeySection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0028);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DirectorySection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0029);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileAssociationSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0030);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CompatibleFrameworksSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0031);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0032);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventMapSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0033);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventTagSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0034);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterSetSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0035);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterSection )(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0036);
-
- END_INTERFACE
- } ICMSVtbl;
-
- interface ICMS
- {
- CONST_VTBL struct ICMSVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICMS_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICMS_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICMS_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICMS_get_Identity(This,__MIDL_0015) \
- (This)->lpVtbl -> get_Identity(This,__MIDL_0015)
-
-#define ICMS_get_FileSection(This,__MIDL_0016) \
- (This)->lpVtbl -> get_FileSection(This,__MIDL_0016)
-
-#define ICMS_get_CategoryMembershipSection(This,__MIDL_0017) \
- (This)->lpVtbl -> get_CategoryMembershipSection(This,__MIDL_0017)
-
-#define ICMS_get_COMRedirectionSection(This,__MIDL_0018) \
- (This)->lpVtbl -> get_COMRedirectionSection(This,__MIDL_0018)
-
-#define ICMS_get_ProgIdRedirectionSection(This,__MIDL_0019) \
- (This)->lpVtbl -> get_ProgIdRedirectionSection(This,__MIDL_0019)
-
-#define ICMS_get_CLRSurrogateSection(This,__MIDL_0020) \
- (This)->lpVtbl -> get_CLRSurrogateSection(This,__MIDL_0020)
-
-#define ICMS_get_AssemblyReferenceSection(This,__MIDL_0021) \
- (This)->lpVtbl -> get_AssemblyReferenceSection(This,__MIDL_0021)
-
-#define ICMS_get_WindowClassSection(This,__MIDL_0022) \
- (This)->lpVtbl -> get_WindowClassSection(This,__MIDL_0022)
-
-#define ICMS_get_StringSection(This,__MIDL_0023) \
- (This)->lpVtbl -> get_StringSection(This,__MIDL_0023)
-
-#define ICMS_get_EntryPointSection(This,__MIDL_0024) \
- (This)->lpVtbl -> get_EntryPointSection(This,__MIDL_0024)
-
-#define ICMS_get_PermissionSetSection(This,__MIDL_0025) \
- (This)->lpVtbl -> get_PermissionSetSection(This,__MIDL_0025)
-
-#define ICMS_get_MetadataSectionEntry(This,__MIDL_0026) \
- (This)->lpVtbl -> get_MetadataSectionEntry(This,__MIDL_0026)
-
-#define ICMS_get_AssemblyRequestSection(This,__MIDL_0027) \
- (This)->lpVtbl -> get_AssemblyRequestSection(This,__MIDL_0027)
-
-#define ICMS_get_RegistryKeySection(This,__MIDL_0028) \
- (This)->lpVtbl -> get_RegistryKeySection(This,__MIDL_0028)
-
-#define ICMS_get_DirectorySection(This,__MIDL_0029) \
- (This)->lpVtbl -> get_DirectorySection(This,__MIDL_0029)
-
-#define ICMS_get_FileAssociationSection(This,__MIDL_0030) \
- (This)->lpVtbl -> get_FileAssociationSection(This,__MIDL_0030)
-
-#define ICMS_get_CompatibleFrameworksSection(This,__MIDL_0031) \
- (This)->lpVtbl -> get_CompatibleFrameworksSection(This,__MIDL_0031)
-
-#define ICMS_get_EventSection(This,__MIDL_0032) \
- (This)->lpVtbl -> get_EventSection(This,__MIDL_0032)
-
-#define ICMS_get_EventMapSection(This,__MIDL_0033) \
- (This)->lpVtbl -> get_EventMapSection(This,__MIDL_0033)
-
-#define ICMS_get_EventTagSection(This,__MIDL_0034) \
- (This)->lpVtbl -> get_EventTagSection(This,__MIDL_0034)
-
-#define ICMS_get_CounterSetSection(This,__MIDL_0035) \
- (This)->lpVtbl -> get_CounterSetSection(This,__MIDL_0035)
-
-#define ICMS_get_CounterSection(This,__MIDL_0036) \
- (This)->lpVtbl -> get_CounterSection(This,__MIDL_0036)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_Identity_Proxy(
- ICMS * This,
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0015);
-
-
-void __RPC_STUB ICMS_get_Identity_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_FileSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0016);
-
-
-void __RPC_STUB ICMS_get_FileSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CategoryMembershipSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0017);
-
-
-void __RPC_STUB ICMS_get_CategoryMembershipSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_COMRedirectionSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0018);
-
-
-void __RPC_STUB ICMS_get_COMRedirectionSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_ProgIdRedirectionSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0019);
-
-
-void __RPC_STUB ICMS_get_ProgIdRedirectionSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CLRSurrogateSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0020);
-
-
-void __RPC_STUB ICMS_get_CLRSurrogateSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_AssemblyReferenceSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0021);
-
-
-void __RPC_STUB ICMS_get_AssemblyReferenceSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_WindowClassSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0022);
-
-
-void __RPC_STUB ICMS_get_WindowClassSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_StringSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0023);
-
-
-void __RPC_STUB ICMS_get_StringSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_EntryPointSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0024);
-
-
-void __RPC_STUB ICMS_get_EntryPointSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_PermissionSetSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0025);
-
-
-void __RPC_STUB ICMS_get_PermissionSetSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_MetadataSectionEntry_Proxy(
- ICMS * This,
- /* [retval][out] */ ISectionEntry **__MIDL_0026);
-
-
-void __RPC_STUB ICMS_get_MetadataSectionEntry_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_AssemblyRequestSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0027);
-
-
-void __RPC_STUB ICMS_get_AssemblyRequestSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_RegistryKeySection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0028);
-
-
-void __RPC_STUB ICMS_get_RegistryKeySection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_DirectorySection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0029);
-
-
-void __RPC_STUB ICMS_get_DirectorySection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_FileAssociationSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0030);
-
-
-void __RPC_STUB ICMS_get_FileAssociationSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CompatibleFrameworksSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0031);
-
-
-void __RPC_STUB ICMS_get_CompatibleFrameworksSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_EventSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0032);
-
-
-void __RPC_STUB ICMS_get_EventSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_EventMapSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0033);
-
-
-void __RPC_STUB ICMS_get_EventMapSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_EventTagSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0034);
-
-
-void __RPC_STUB ICMS_get_EventTagSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CounterSetSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0035);
-
-
-void __RPC_STUB ICMS_get_CounterSetSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CounterSection_Proxy(
- ICMS * This,
- /* [retval][out] */ ISection **__MIDL_0036);
-
-
-void __RPC_STUB ICMS_get_CounterSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICMS_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0280 */
-/* [local] */
-
-typedef struct _MuiResourceIdLookupMapEntry
- {
- ULONG Count;
- } MuiResourceIdLookupMapEntry;
-
-typedef
-enum _MuiResourceIdLookupMapEntryFieldId
- { MuiResourceIdLookupMap_Count = 0
- } MuiResourceIdLookupMapEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0280_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0280_v0_0_s_ifspec;
-
-#ifndef __IMuiResourceIdLookupMapEntry_INTERFACE_DEFINED__
-#define __IMuiResourceIdLookupMapEntry_INTERFACE_DEFINED__
-
-/* interface IMuiResourceIdLookupMapEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IMuiResourceIdLookupMapEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("24abe1f7-a396-4a03-9adf-1d5b86a5569f")
- IMuiResourceIdLookupMapEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ MuiResourceIdLookupMapEntry **__MIDL_0037) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Count(
- /* [retval][out] */ ULONG *__MIDL_0038) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IMuiResourceIdLookupMapEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IMuiResourceIdLookupMapEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IMuiResourceIdLookupMapEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IMuiResourceIdLookupMapEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IMuiResourceIdLookupMapEntry * This,
- /* [retval][out] */ MuiResourceIdLookupMapEntry **__MIDL_0037);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )(
- IMuiResourceIdLookupMapEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0038);
-
- END_INTERFACE
- } IMuiResourceIdLookupMapEntryVtbl;
-
- interface IMuiResourceIdLookupMapEntry
- {
- CONST_VTBL struct IMuiResourceIdLookupMapEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IMuiResourceIdLookupMapEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IMuiResourceIdLookupMapEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IMuiResourceIdLookupMapEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IMuiResourceIdLookupMapEntry_get_AllData(This,__MIDL_0037) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0037)
-
-#define IMuiResourceIdLookupMapEntry_get_Count(This,__MIDL_0038) \
- (This)->lpVtbl -> get_Count(This,__MIDL_0038)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceIdLookupMapEntry_get_AllData_Proxy(
- IMuiResourceIdLookupMapEntry * This,
- /* [retval][out] */ MuiResourceIdLookupMapEntry **__MIDL_0037);
-
-
-void __RPC_STUB IMuiResourceIdLookupMapEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceIdLookupMapEntry_get_Count_Proxy(
- IMuiResourceIdLookupMapEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0038);
-
-
-void __RPC_STUB IMuiResourceIdLookupMapEntry_get_Count_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IMuiResourceIdLookupMapEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0281 */
-/* [local] */
-
-typedef struct _MuiResourceTypeIdStringEntry
- {
- /* [size_is] */ BYTE *StringIds;
- ULONG StringIdsSize;
- /* [size_is] */ BYTE *IntegerIds;
- ULONG IntegerIdsSize;
- } MuiResourceTypeIdStringEntry;
-
-typedef
-enum _MuiResourceTypeIdStringEntryFieldId
- { MuiResourceTypeIdString_StringIds = 0,
- MuiResourceTypeIdString_StringIdsSize = MuiResourceTypeIdString_StringIds + 1,
- MuiResourceTypeIdString_IntegerIds = MuiResourceTypeIdString_StringIdsSize + 1,
- MuiResourceTypeIdString_IntegerIdsSize = MuiResourceTypeIdString_IntegerIds + 1
- } MuiResourceTypeIdStringEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0281_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0281_v0_0_s_ifspec;
-
-#ifndef __IMuiResourceTypeIdStringEntry_INTERFACE_DEFINED__
-#define __IMuiResourceTypeIdStringEntry_INTERFACE_DEFINED__
-
-/* interface IMuiResourceTypeIdStringEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IMuiResourceTypeIdStringEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("11df5cad-c183-479b-9a44-3842b71639ce")
- IMuiResourceTypeIdStringEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ MuiResourceTypeIdStringEntry **__MIDL_0039) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StringIds(
- /* [retval][out] */ IStream **__MIDL_0040) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IntegerIds(
- /* [retval][out] */ IStream **__MIDL_0041) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IMuiResourceTypeIdStringEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IMuiResourceTypeIdStringEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IMuiResourceTypeIdStringEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IMuiResourceTypeIdStringEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IMuiResourceTypeIdStringEntry * This,
- /* [retval][out] */ MuiResourceTypeIdStringEntry **__MIDL_0039);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StringIds )(
- IMuiResourceTypeIdStringEntry * This,
- /* [retval][out] */ IStream **__MIDL_0040);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IntegerIds )(
- IMuiResourceTypeIdStringEntry * This,
- /* [retval][out] */ IStream **__MIDL_0041);
-
- END_INTERFACE
- } IMuiResourceTypeIdStringEntryVtbl;
-
- interface IMuiResourceTypeIdStringEntry
- {
- CONST_VTBL struct IMuiResourceTypeIdStringEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IMuiResourceTypeIdStringEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IMuiResourceTypeIdStringEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IMuiResourceTypeIdStringEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IMuiResourceTypeIdStringEntry_get_AllData(This,__MIDL_0039) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0039)
-
-#define IMuiResourceTypeIdStringEntry_get_StringIds(This,__MIDL_0040) \
- (This)->lpVtbl -> get_StringIds(This,__MIDL_0040)
-
-#define IMuiResourceTypeIdStringEntry_get_IntegerIds(This,__MIDL_0041) \
- (This)->lpVtbl -> get_IntegerIds(This,__MIDL_0041)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdStringEntry_get_AllData_Proxy(
- IMuiResourceTypeIdStringEntry * This,
- /* [retval][out] */ MuiResourceTypeIdStringEntry **__MIDL_0039);
-
-
-void __RPC_STUB IMuiResourceTypeIdStringEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdStringEntry_get_StringIds_Proxy(
- IMuiResourceTypeIdStringEntry * This,
- /* [retval][out] */ IStream **__MIDL_0040);
-
-
-void __RPC_STUB IMuiResourceTypeIdStringEntry_get_StringIds_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdStringEntry_get_IntegerIds_Proxy(
- IMuiResourceTypeIdStringEntry * This,
- /* [retval][out] */ IStream **__MIDL_0041);
-
-
-void __RPC_STUB IMuiResourceTypeIdStringEntry_get_IntegerIds_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IMuiResourceTypeIdStringEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0282 */
-/* [local] */
-
-typedef struct _MuiResourceTypeIdIntEntry
- {
- /* [size_is] */ BYTE *StringIds;
- ULONG StringIdsSize;
- /* [size_is] */ BYTE *IntegerIds;
- ULONG IntegerIdsSize;
- } MuiResourceTypeIdIntEntry;
-
-typedef
-enum _MuiResourceTypeIdIntEntryFieldId
- { MuiResourceTypeIdInt_StringIds = 0,
- MuiResourceTypeIdInt_StringIdsSize = MuiResourceTypeIdInt_StringIds + 1,
- MuiResourceTypeIdInt_IntegerIds = MuiResourceTypeIdInt_StringIdsSize + 1,
- MuiResourceTypeIdInt_IntegerIdsSize = MuiResourceTypeIdInt_IntegerIds + 1
- } MuiResourceTypeIdIntEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0282_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0282_v0_0_s_ifspec;
-
-#ifndef __IMuiResourceTypeIdIntEntry_INTERFACE_DEFINED__
-#define __IMuiResourceTypeIdIntEntry_INTERFACE_DEFINED__
-
-/* interface IMuiResourceTypeIdIntEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IMuiResourceTypeIdIntEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("55b2dec1-d0f6-4bf4-91b1-30f73ad8e4df")
- IMuiResourceTypeIdIntEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ MuiResourceTypeIdIntEntry **__MIDL_0042) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StringIds(
- /* [retval][out] */ IStream **__MIDL_0043) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IntegerIds(
- /* [retval][out] */ IStream **__MIDL_0044) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IMuiResourceTypeIdIntEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IMuiResourceTypeIdIntEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IMuiResourceTypeIdIntEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IMuiResourceTypeIdIntEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IMuiResourceTypeIdIntEntry * This,
- /* [retval][out] */ MuiResourceTypeIdIntEntry **__MIDL_0042);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StringIds )(
- IMuiResourceTypeIdIntEntry * This,
- /* [retval][out] */ IStream **__MIDL_0043);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IntegerIds )(
- IMuiResourceTypeIdIntEntry * This,
- /* [retval][out] */ IStream **__MIDL_0044);
-
- END_INTERFACE
- } IMuiResourceTypeIdIntEntryVtbl;
-
- interface IMuiResourceTypeIdIntEntry
- {
- CONST_VTBL struct IMuiResourceTypeIdIntEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IMuiResourceTypeIdIntEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IMuiResourceTypeIdIntEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IMuiResourceTypeIdIntEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IMuiResourceTypeIdIntEntry_get_AllData(This,__MIDL_0042) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0042)
-
-#define IMuiResourceTypeIdIntEntry_get_StringIds(This,__MIDL_0043) \
- (This)->lpVtbl -> get_StringIds(This,__MIDL_0043)
-
-#define IMuiResourceTypeIdIntEntry_get_IntegerIds(This,__MIDL_0044) \
- (This)->lpVtbl -> get_IntegerIds(This,__MIDL_0044)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdIntEntry_get_AllData_Proxy(
- IMuiResourceTypeIdIntEntry * This,
- /* [retval][out] */ MuiResourceTypeIdIntEntry **__MIDL_0042);
-
-
-void __RPC_STUB IMuiResourceTypeIdIntEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdIntEntry_get_StringIds_Proxy(
- IMuiResourceTypeIdIntEntry * This,
- /* [retval][out] */ IStream **__MIDL_0043);
-
-
-void __RPC_STUB IMuiResourceTypeIdIntEntry_get_StringIds_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdIntEntry_get_IntegerIds_Proxy(
- IMuiResourceTypeIdIntEntry * This,
- /* [retval][out] */ IStream **__MIDL_0044);
-
-
-void __RPC_STUB IMuiResourceTypeIdIntEntry_get_IntegerIds_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IMuiResourceTypeIdIntEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0283 */
-/* [local] */
-
-typedef struct _MuiResourceMapEntry
- {
- /* [size_is] */ BYTE *ResourceTypeIdInt;
- ULONG ResourceTypeIdIntSize;
- /* [size_is] */ BYTE *ResourceTypeIdString;
- ULONG ResourceTypeIdStringSize;
- } MuiResourceMapEntry;
-
-typedef
-enum _MuiResourceMapEntryFieldId
- { MuiResourceMap_ResourceTypeIdInt = 0,
- MuiResourceMap_ResourceTypeIdIntSize = MuiResourceMap_ResourceTypeIdInt + 1,
- MuiResourceMap_ResourceTypeIdString = MuiResourceMap_ResourceTypeIdIntSize + 1,
- MuiResourceMap_ResourceTypeIdStringSize = MuiResourceMap_ResourceTypeIdString + 1
- } MuiResourceMapEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0283_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0283_v0_0_s_ifspec;
-
-#ifndef __IMuiResourceMapEntry_INTERFACE_DEFINED__
-#define __IMuiResourceMapEntry_INTERFACE_DEFINED__
-
-/* interface IMuiResourceMapEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IMuiResourceMapEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("397927f5-10f2-4ecb-bfe1-3c264212a193")
- IMuiResourceMapEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ MuiResourceMapEntry **__MIDL_0045) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceTypeIdInt(
- /* [retval][out] */ IStream **__MIDL_0046) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceTypeIdString(
- /* [retval][out] */ IStream **__MIDL_0047) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IMuiResourceMapEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IMuiResourceMapEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IMuiResourceMapEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IMuiResourceMapEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IMuiResourceMapEntry * This,
- /* [retval][out] */ MuiResourceMapEntry **__MIDL_0045);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceTypeIdInt )(
- IMuiResourceMapEntry * This,
- /* [retval][out] */ IStream **__MIDL_0046);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceTypeIdString )(
- IMuiResourceMapEntry * This,
- /* [retval][out] */ IStream **__MIDL_0047);
-
- END_INTERFACE
- } IMuiResourceMapEntryVtbl;
-
- interface IMuiResourceMapEntry
- {
- CONST_VTBL struct IMuiResourceMapEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IMuiResourceMapEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IMuiResourceMapEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IMuiResourceMapEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IMuiResourceMapEntry_get_AllData(This,__MIDL_0045) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0045)
-
-#define IMuiResourceMapEntry_get_ResourceTypeIdInt(This,__MIDL_0046) \
- (This)->lpVtbl -> get_ResourceTypeIdInt(This,__MIDL_0046)
-
-#define IMuiResourceMapEntry_get_ResourceTypeIdString(This,__MIDL_0047) \
- (This)->lpVtbl -> get_ResourceTypeIdString(This,__MIDL_0047)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceMapEntry_get_AllData_Proxy(
- IMuiResourceMapEntry * This,
- /* [retval][out] */ MuiResourceMapEntry **__MIDL_0045);
-
-
-void __RPC_STUB IMuiResourceMapEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceMapEntry_get_ResourceTypeIdInt_Proxy(
- IMuiResourceMapEntry * This,
- /* [retval][out] */ IStream **__MIDL_0046);
-
-
-void __RPC_STUB IMuiResourceMapEntry_get_ResourceTypeIdInt_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceMapEntry_get_ResourceTypeIdString_Proxy(
- IMuiResourceMapEntry * This,
- /* [retval][out] */ IStream **__MIDL_0047);
-
-
-void __RPC_STUB IMuiResourceMapEntry_get_ResourceTypeIdString_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IMuiResourceMapEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0284 */
-/* [local] */
-
-typedef struct _HashElementEntry
- {
- ULONG index;
- UCHAR Transform;
- /* [size_is] */ BYTE *TransformMetadata;
- ULONG TransformMetadataSize;
- UCHAR DigestMethod;
- /* [size_is] */ BYTE *DigestValue;
- ULONG DigestValueSize;
- LPCWSTR Xml;
- } HashElementEntry;
-
-typedef
-enum _HashElementEntryFieldId
- { HashElement_Transform = 0,
- HashElement_TransformMetadata = HashElement_Transform + 1,
- HashElement_TransformMetadataSize = HashElement_TransformMetadata + 1,
- HashElement_DigestMethod = HashElement_TransformMetadataSize + 1,
- HashElement_DigestValue = HashElement_DigestMethod + 1,
- HashElement_DigestValueSize = HashElement_DigestValue + 1,
- HashElement_Xml = HashElement_DigestValueSize + 1
- } HashElementEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0284_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0284_v0_0_s_ifspec;
-
-#ifndef __IHashElementEntry_INTERFACE_DEFINED__
-#define __IHashElementEntry_INTERFACE_DEFINED__
-
-/* interface IHashElementEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IHashElementEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("9D46FB70-7B54-4f4f-9331-BA9E87833FF5")
- IHashElementEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ HashElementEntry **__MIDL_0048) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_index(
- /* [retval][out] */ ULONG *__MIDL_0049) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Transform(
- /* [retval][out] */ UCHAR *__MIDL_0050) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TransformMetadata(
- /* [retval][out] */ IStream **__MIDL_0051) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DigestMethod(
- /* [retval][out] */ UCHAR *__MIDL_0052) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DigestValue(
- /* [retval][out] */ IStream **__MIDL_0053) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Xml(
- /* [retval][out] */ LPCWSTR *__MIDL_0054) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IHashElementEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IHashElementEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IHashElementEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IHashElementEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IHashElementEntry * This,
- /* [retval][out] */ HashElementEntry **__MIDL_0048);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_index )(
- IHashElementEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0049);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Transform )(
- IHashElementEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0050);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TransformMetadata )(
- IHashElementEntry * This,
- /* [retval][out] */ IStream **__MIDL_0051);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DigestMethod )(
- IHashElementEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0052);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DigestValue )(
- IHashElementEntry * This,
- /* [retval][out] */ IStream **__MIDL_0053);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )(
- IHashElementEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0054);
-
- END_INTERFACE
- } IHashElementEntryVtbl;
-
- interface IHashElementEntry
- {
- CONST_VTBL struct IHashElementEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IHashElementEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IHashElementEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IHashElementEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IHashElementEntry_get_AllData(This,__MIDL_0048) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0048)
-
-#define IHashElementEntry_get_index(This,__MIDL_0049) \
- (This)->lpVtbl -> get_index(This,__MIDL_0049)
-
-#define IHashElementEntry_get_Transform(This,__MIDL_0050) \
- (This)->lpVtbl -> get_Transform(This,__MIDL_0050)
-
-#define IHashElementEntry_get_TransformMetadata(This,__MIDL_0051) \
- (This)->lpVtbl -> get_TransformMetadata(This,__MIDL_0051)
-
-#define IHashElementEntry_get_DigestMethod(This,__MIDL_0052) \
- (This)->lpVtbl -> get_DigestMethod(This,__MIDL_0052)
-
-#define IHashElementEntry_get_DigestValue(This,__MIDL_0053) \
- (This)->lpVtbl -> get_DigestValue(This,__MIDL_0053)
-
-#define IHashElementEntry_get_Xml(This,__MIDL_0054) \
- (This)->lpVtbl -> get_Xml(This,__MIDL_0054)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_AllData_Proxy(
- IHashElementEntry * This,
- /* [retval][out] */ HashElementEntry **__MIDL_0048);
-
-
-void __RPC_STUB IHashElementEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_index_Proxy(
- IHashElementEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0049);
-
-
-void __RPC_STUB IHashElementEntry_get_index_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_Transform_Proxy(
- IHashElementEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0050);
-
-
-void __RPC_STUB IHashElementEntry_get_Transform_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_TransformMetadata_Proxy(
- IHashElementEntry * This,
- /* [retval][out] */ IStream **__MIDL_0051);
-
-
-void __RPC_STUB IHashElementEntry_get_TransformMetadata_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_DigestMethod_Proxy(
- IHashElementEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0052);
-
-
-void __RPC_STUB IHashElementEntry_get_DigestMethod_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_DigestValue_Proxy(
- IHashElementEntry * This,
- /* [retval][out] */ IStream **__MIDL_0053);
-
-
-void __RPC_STUB IHashElementEntry_get_DigestValue_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_Xml_Proxy(
- IHashElementEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0054);
-
-
-void __RPC_STUB IHashElementEntry_get_Xml_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IHashElementEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0285 */
-/* [local] */
-
-typedef struct _FileEntry
- {
- LPCWSTR Name;
- ULONG HashAlgorithm;
- LPCWSTR LoadFrom;
- LPCWSTR SourcePath;
- LPCWSTR ImportPath;
- LPCWSTR SourceName;
- LPCWSTR Location;
- /* [size_is] */ BYTE *HashValue;
- ULONG HashValueSize;
- ULONGLONG Size;
- LPCWSTR Group;
- ULONG Flags;
- MuiResourceMapEntry MuiMapping;
- ULONG WritableType;
- ISection *HashElements;
- } FileEntry;
-
-typedef
-enum _FileEntryFieldId
- { File_HashAlgorithm = 0,
- File_LoadFrom = File_HashAlgorithm + 1,
- File_SourcePath = File_LoadFrom + 1,
- File_ImportPath = File_SourcePath + 1,
- File_SourceName = File_ImportPath + 1,
- File_Location = File_SourceName + 1,
- File_HashValue = File_Location + 1,
- File_HashValueSize = File_HashValue + 1,
- File_Size = File_HashValueSize + 1,
- File_Group = File_Size + 1,
- File_Flags = File_Group + 1,
- File_MuiMapping = File_Flags + 1,
- File_WritableType = File_MuiMapping + 1,
- File_HashElements = File_WritableType + 1
- } FileEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0285_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0285_v0_0_s_ifspec;
-
-#ifndef __IFileEntry_INTERFACE_DEFINED__
-#define __IFileEntry_INTERFACE_DEFINED__
-
-/* interface IFileEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IFileEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("A2A55FAD-349B-469b-BF12-ADC33D14A937")
- IFileEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ FileEntry **__MIDL_0055) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
- /* [retval][out] */ LPCWSTR *__MIDL_0056) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashAlgorithm(
- /* [retval][out] */ ULONG *__MIDL_0057) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LoadFrom(
- /* [retval][out] */ LPCWSTR *__MIDL_0058) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourcePath(
- /* [retval][out] */ LPCWSTR *__MIDL_0059) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ImportPath(
- /* [retval][out] */ LPCWSTR *__MIDL_0060) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourceName(
- /* [retval][out] */ LPCWSTR *__MIDL_0061) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Location(
- /* [retval][out] */ LPCWSTR *__MIDL_0062) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashValue(
- /* [retval][out] */ IStream **__MIDL_0063) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
- /* [retval][out] */ ULONGLONG *__MIDL_0064) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Group(
- /* [retval][out] */ LPCWSTR *__MIDL_0065) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
- /* [retval][out] */ ULONG *__MIDL_0066) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MuiMapping(
- /* [retval][out] */ IMuiResourceMapEntry **__MIDL_0067) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_WritableType(
- /* [retval][out] */ ULONG *__MIDL_0068) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashElements(
- /* [retval][out] */ ISection **HashElement) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IFileEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IFileEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IFileEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IFileEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IFileEntry * This,
- /* [retval][out] */ FileEntry **__MIDL_0055);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0056);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashAlgorithm )(
- IFileEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0057);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LoadFrom )(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0058);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SourcePath )(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0059);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ImportPath )(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0060);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SourceName )(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0061);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Location )(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0062);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashValue )(
- IFileEntry * This,
- /* [retval][out] */ IStream **__MIDL_0063);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
- IFileEntry * This,
- /* [retval][out] */ ULONGLONG *__MIDL_0064);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Group )(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0065);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
- IFileEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0066);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MuiMapping )(
- IFileEntry * This,
- /* [retval][out] */ IMuiResourceMapEntry **__MIDL_0067);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_WritableType )(
- IFileEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0068);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashElements )(
- IFileEntry * This,
- /* [retval][out] */ ISection **HashElement);
-
- END_INTERFACE
- } IFileEntryVtbl;
-
- interface IFileEntry
- {
- CONST_VTBL struct IFileEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IFileEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IFileEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IFileEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IFileEntry_get_AllData(This,__MIDL_0055) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0055)
-
-#define IFileEntry_get_Name(This,__MIDL_0056) \
- (This)->lpVtbl -> get_Name(This,__MIDL_0056)
-
-#define IFileEntry_get_HashAlgorithm(This,__MIDL_0057) \
- (This)->lpVtbl -> get_HashAlgorithm(This,__MIDL_0057)
-
-#define IFileEntry_get_LoadFrom(This,__MIDL_0058) \
- (This)->lpVtbl -> get_LoadFrom(This,__MIDL_0058)
-
-#define IFileEntry_get_SourcePath(This,__MIDL_0059) \
- (This)->lpVtbl -> get_SourcePath(This,__MIDL_0059)
-
-#define IFileEntry_get_ImportPath(This,__MIDL_0060) \
- (This)->lpVtbl -> get_ImportPath(This,__MIDL_0060)
-
-#define IFileEntry_get_SourceName(This,__MIDL_0061) \
- (This)->lpVtbl -> get_SourceName(This,__MIDL_0061)
-
-#define IFileEntry_get_Location(This,__MIDL_0062) \
- (This)->lpVtbl -> get_Location(This,__MIDL_0062)
-
-#define IFileEntry_get_HashValue(This,__MIDL_0063) \
- (This)->lpVtbl -> get_HashValue(This,__MIDL_0063)
-
-#define IFileEntry_get_Size(This,__MIDL_0064) \
- (This)->lpVtbl -> get_Size(This,__MIDL_0064)
-
-#define IFileEntry_get_Group(This,__MIDL_0065) \
- (This)->lpVtbl -> get_Group(This,__MIDL_0065)
-
-#define IFileEntry_get_Flags(This,__MIDL_0066) \
- (This)->lpVtbl -> get_Flags(This,__MIDL_0066)
-
-#define IFileEntry_get_MuiMapping(This,__MIDL_0067) \
- (This)->lpVtbl -> get_MuiMapping(This,__MIDL_0067)
-
-#define IFileEntry_get_WritableType(This,__MIDL_0068) \
- (This)->lpVtbl -> get_WritableType(This,__MIDL_0068)
-
-#define IFileEntry_get_HashElements(This,HashElement) \
- (This)->lpVtbl -> get_HashElements(This,HashElement)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_AllData_Proxy(
- IFileEntry * This,
- /* [retval][out] */ FileEntry **__MIDL_0055);
-
-
-void __RPC_STUB IFileEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Name_Proxy(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0056);
-
-
-void __RPC_STUB IFileEntry_get_Name_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_HashAlgorithm_Proxy(
- IFileEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0057);
-
-
-void __RPC_STUB IFileEntry_get_HashAlgorithm_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_LoadFrom_Proxy(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0058);
-
-
-void __RPC_STUB IFileEntry_get_LoadFrom_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_SourcePath_Proxy(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0059);
-
-
-void __RPC_STUB IFileEntry_get_SourcePath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_ImportPath_Proxy(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0060);
-
-
-void __RPC_STUB IFileEntry_get_ImportPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_SourceName_Proxy(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0061);
-
-
-void __RPC_STUB IFileEntry_get_SourceName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Location_Proxy(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0062);
-
-
-void __RPC_STUB IFileEntry_get_Location_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_HashValue_Proxy(
- IFileEntry * This,
- /* [retval][out] */ IStream **__MIDL_0063);
-
-
-void __RPC_STUB IFileEntry_get_HashValue_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Size_Proxy(
- IFileEntry * This,
- /* [retval][out] */ ULONGLONG *__MIDL_0064);
-
-
-void __RPC_STUB IFileEntry_get_Size_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Group_Proxy(
- IFileEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0065);
-
-
-void __RPC_STUB IFileEntry_get_Group_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Flags_Proxy(
- IFileEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0066);
-
-
-void __RPC_STUB IFileEntry_get_Flags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_MuiMapping_Proxy(
- IFileEntry * This,
- /* [retval][out] */ IMuiResourceMapEntry **__MIDL_0067);
-
-
-void __RPC_STUB IFileEntry_get_MuiMapping_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_WritableType_Proxy(
- IFileEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0068);
-
-
-void __RPC_STUB IFileEntry_get_WritableType_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_HashElements_Proxy(
- IFileEntry * This,
- /* [retval][out] */ ISection **HashElement);
-
-
-void __RPC_STUB IFileEntry_get_HashElements_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IFileEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0286 */
-/* [local] */
-
-typedef struct _FileAssociationEntry
- {
- LPCWSTR Extension;
- LPCWSTR Description;
- LPCWSTR ProgID;
- LPCWSTR DefaultIcon;
- LPCWSTR Parameter;
- } FileAssociationEntry;
-
-typedef
-enum _FileAssociationEntryFieldId
- { FileAssociation_Description = 0,
- FileAssociation_ProgID = FileAssociation_Description + 1,
- FileAssociation_DefaultIcon = FileAssociation_ProgID + 1,
- FileAssociation_Parameter = FileAssociation_DefaultIcon + 1
- } FileAssociationEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0286_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0286_v0_0_s_ifspec;
-
-#ifndef __IFileAssociationEntry_INTERFACE_DEFINED__
-#define __IFileAssociationEntry_INTERFACE_DEFINED__
-
-/* interface IFileAssociationEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IFileAssociationEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("0C66F299-E08E-48c5-9264-7CCBEB4D5CBB")
- IFileAssociationEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ FileAssociationEntry **__MIDL_0069) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Extension(
- /* [retval][out] */ LPCWSTR *__MIDL_0070) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
- /* [retval][out] */ LPCWSTR *__MIDL_0071) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProgID(
- /* [retval][out] */ LPCWSTR *__MIDL_0072) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DefaultIcon(
- /* [retval][out] */ LPCWSTR *__MIDL_0073) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Parameter(
- /* [retval][out] */ LPCWSTR *__MIDL_0074) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IFileAssociationEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IFileAssociationEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IFileAssociationEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IFileAssociationEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IFileAssociationEntry * This,
- /* [retval][out] */ FileAssociationEntry **__MIDL_0069);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Extension )(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0070);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0071);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProgID )(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0072);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DefaultIcon )(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0073);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Parameter )(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0074);
-
- END_INTERFACE
- } IFileAssociationEntryVtbl;
-
- interface IFileAssociationEntry
- {
- CONST_VTBL struct IFileAssociationEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IFileAssociationEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IFileAssociationEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IFileAssociationEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IFileAssociationEntry_get_AllData(This,__MIDL_0069) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0069)
-
-#define IFileAssociationEntry_get_Extension(This,__MIDL_0070) \
- (This)->lpVtbl -> get_Extension(This,__MIDL_0070)
-
-#define IFileAssociationEntry_get_Description(This,__MIDL_0071) \
- (This)->lpVtbl -> get_Description(This,__MIDL_0071)
-
-#define IFileAssociationEntry_get_ProgID(This,__MIDL_0072) \
- (This)->lpVtbl -> get_ProgID(This,__MIDL_0072)
-
-#define IFileAssociationEntry_get_DefaultIcon(This,__MIDL_0073) \
- (This)->lpVtbl -> get_DefaultIcon(This,__MIDL_0073)
-
-#define IFileAssociationEntry_get_Parameter(This,__MIDL_0074) \
- (This)->lpVtbl -> get_Parameter(This,__MIDL_0074)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_AllData_Proxy(
- IFileAssociationEntry * This,
- /* [retval][out] */ FileAssociationEntry **__MIDL_0069);
-
-
-void __RPC_STUB IFileAssociationEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_Extension_Proxy(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0070);
-
-
-void __RPC_STUB IFileAssociationEntry_get_Extension_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_Description_Proxy(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0071);
-
-
-void __RPC_STUB IFileAssociationEntry_get_Description_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_ProgID_Proxy(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0072);
-
-
-void __RPC_STUB IFileAssociationEntry_get_ProgID_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_DefaultIcon_Proxy(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0073);
-
-
-void __RPC_STUB IFileAssociationEntry_get_DefaultIcon_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_Parameter_Proxy(
- IFileAssociationEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0074);
-
-
-void __RPC_STUB IFileAssociationEntry_get_Parameter_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IFileAssociationEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0287 */
-/* [local] */
-
-typedef struct _CategoryMembershipDataEntry
- {
- ULONG index;
- LPCWSTR Xml;
- LPCWSTR Description;
- } CategoryMembershipDataEntry;
-
-typedef
-enum _CategoryMembershipDataEntryFieldId
- { CategoryMembershipData_Xml = 0,
- CategoryMembershipData_Description = CategoryMembershipData_Xml + 1
- } CategoryMembershipDataEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0287_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0287_v0_0_s_ifspec;
-
-#ifndef __ICategoryMembershipDataEntry_INTERFACE_DEFINED__
-#define __ICategoryMembershipDataEntry_INTERFACE_DEFINED__
-
-/* interface ICategoryMembershipDataEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ICategoryMembershipDataEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("DA0C3B27-6B6B-4b80-A8F8-6CE14F4BC0A4")
- ICategoryMembershipDataEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ CategoryMembershipDataEntry **__MIDL_0075) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_index(
- /* [retval][out] */ ULONG *__MIDL_0076) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Xml(
- /* [retval][out] */ LPCWSTR *__MIDL_0077) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
- /* [retval][out] */ LPCWSTR *__MIDL_0078) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICategoryMembershipDataEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICategoryMembershipDataEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICategoryMembershipDataEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICategoryMembershipDataEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ICategoryMembershipDataEntry * This,
- /* [retval][out] */ CategoryMembershipDataEntry **__MIDL_0075);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_index )(
- ICategoryMembershipDataEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0076);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )(
- ICategoryMembershipDataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0077);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
- ICategoryMembershipDataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0078);
-
- END_INTERFACE
- } ICategoryMembershipDataEntryVtbl;
-
- interface ICategoryMembershipDataEntry
- {
- CONST_VTBL struct ICategoryMembershipDataEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICategoryMembershipDataEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICategoryMembershipDataEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICategoryMembershipDataEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICategoryMembershipDataEntry_get_AllData(This,__MIDL_0075) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0075)
-
-#define ICategoryMembershipDataEntry_get_index(This,__MIDL_0076) \
- (This)->lpVtbl -> get_index(This,__MIDL_0076)
-
-#define ICategoryMembershipDataEntry_get_Xml(This,__MIDL_0077) \
- (This)->lpVtbl -> get_Xml(This,__MIDL_0077)
-
-#define ICategoryMembershipDataEntry_get_Description(This,__MIDL_0078) \
- (This)->lpVtbl -> get_Description(This,__MIDL_0078)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipDataEntry_get_AllData_Proxy(
- ICategoryMembershipDataEntry * This,
- /* [retval][out] */ CategoryMembershipDataEntry **__MIDL_0075);
-
-
-void __RPC_STUB ICategoryMembershipDataEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipDataEntry_get_index_Proxy(
- ICategoryMembershipDataEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0076);
-
-
-void __RPC_STUB ICategoryMembershipDataEntry_get_index_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipDataEntry_get_Xml_Proxy(
- ICategoryMembershipDataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0077);
-
-
-void __RPC_STUB ICategoryMembershipDataEntry_get_Xml_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipDataEntry_get_Description_Proxy(
- ICategoryMembershipDataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0078);
-
-
-void __RPC_STUB ICategoryMembershipDataEntry_get_Description_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICategoryMembershipDataEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0288 */
-/* [local] */
-
-typedef struct _SubcategoryMembershipEntry
- {
- LPCWSTR Subcategory;
- ISection *CategoryMembershipData;
- } SubcategoryMembershipEntry;
-
-typedef
-enum _SubcategoryMembershipEntryFieldId
- { SubcategoryMembership_CategoryMembershipData = 0
- } SubcategoryMembershipEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0288_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0288_v0_0_s_ifspec;
-
-#ifndef __ISubcategoryMembershipEntry_INTERFACE_DEFINED__
-#define __ISubcategoryMembershipEntry_INTERFACE_DEFINED__
-
-/* interface ISubcategoryMembershipEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ISubcategoryMembershipEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("5A7A54D7-5AD5-418e-AB7A-CF823A8D48D0")
- ISubcategoryMembershipEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ SubcategoryMembershipEntry **__MIDL_0079) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Subcategory(
- /* [retval][out] */ LPCWSTR *__MIDL_0080) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CategoryMembershipData(
- /* [retval][out] */ ISection **CategoryMembershipData) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISubcategoryMembershipEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISubcategoryMembershipEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISubcategoryMembershipEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISubcategoryMembershipEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ISubcategoryMembershipEntry * This,
- /* [retval][out] */ SubcategoryMembershipEntry **__MIDL_0079);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Subcategory )(
- ISubcategoryMembershipEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0080);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CategoryMembershipData )(
- ISubcategoryMembershipEntry * This,
- /* [retval][out] */ ISection **CategoryMembershipData);
-
- END_INTERFACE
- } ISubcategoryMembershipEntryVtbl;
-
- interface ISubcategoryMembershipEntry
- {
- CONST_VTBL struct ISubcategoryMembershipEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISubcategoryMembershipEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISubcategoryMembershipEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISubcategoryMembershipEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISubcategoryMembershipEntry_get_AllData(This,__MIDL_0079) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0079)
-
-#define ISubcategoryMembershipEntry_get_Subcategory(This,__MIDL_0080) \
- (This)->lpVtbl -> get_Subcategory(This,__MIDL_0080)
-
-#define ISubcategoryMembershipEntry_get_CategoryMembershipData(This,CategoryMembershipData) \
- (This)->lpVtbl -> get_CategoryMembershipData(This,CategoryMembershipData)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISubcategoryMembershipEntry_get_AllData_Proxy(
- ISubcategoryMembershipEntry * This,
- /* [retval][out] */ SubcategoryMembershipEntry **__MIDL_0079);
-
-
-void __RPC_STUB ISubcategoryMembershipEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISubcategoryMembershipEntry_get_Subcategory_Proxy(
- ISubcategoryMembershipEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0080);
-
-
-void __RPC_STUB ISubcategoryMembershipEntry_get_Subcategory_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISubcategoryMembershipEntry_get_CategoryMembershipData_Proxy(
- ISubcategoryMembershipEntry * This,
- /* [retval][out] */ ISection **CategoryMembershipData);
-
-
-void __RPC_STUB ISubcategoryMembershipEntry_get_CategoryMembershipData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISubcategoryMembershipEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0289 */
-/* [local] */
-
-typedef struct _CategoryMembershipEntry
- {
- IDefinitionIdentity *Identity;
- ISection *SubcategoryMembership;
- } CategoryMembershipEntry;
-
-typedef
-enum _CategoryMembershipEntryFieldId
- { CategoryMembership_SubcategoryMembership = 0
- } CategoryMembershipEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0289_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0289_v0_0_s_ifspec;
-
-#ifndef __ICategoryMembershipEntry_INTERFACE_DEFINED__
-#define __ICategoryMembershipEntry_INTERFACE_DEFINED__
-
-/* interface ICategoryMembershipEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ICategoryMembershipEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("97FDCA77-B6F2-4718-A1EB-29D0AECE9C03")
- ICategoryMembershipEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ CategoryMembershipEntry **__MIDL_0081) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0082) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubcategoryMembership(
- /* [retval][out] */ ISection **SubcategoryMembership) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICategoryMembershipEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICategoryMembershipEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICategoryMembershipEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICategoryMembershipEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ICategoryMembershipEntry * This,
- /* [retval][out] */ CategoryMembershipEntry **__MIDL_0081);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
- ICategoryMembershipEntry * This,
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0082);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubcategoryMembership )(
- ICategoryMembershipEntry * This,
- /* [retval][out] */ ISection **SubcategoryMembership);
-
- END_INTERFACE
- } ICategoryMembershipEntryVtbl;
-
- interface ICategoryMembershipEntry
- {
- CONST_VTBL struct ICategoryMembershipEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICategoryMembershipEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICategoryMembershipEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICategoryMembershipEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICategoryMembershipEntry_get_AllData(This,__MIDL_0081) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0081)
-
-#define ICategoryMembershipEntry_get_Identity(This,__MIDL_0082) \
- (This)->lpVtbl -> get_Identity(This,__MIDL_0082)
-
-#define ICategoryMembershipEntry_get_SubcategoryMembership(This,SubcategoryMembership) \
- (This)->lpVtbl -> get_SubcategoryMembership(This,SubcategoryMembership)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipEntry_get_AllData_Proxy(
- ICategoryMembershipEntry * This,
- /* [retval][out] */ CategoryMembershipEntry **__MIDL_0081);
-
-
-void __RPC_STUB ICategoryMembershipEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipEntry_get_Identity_Proxy(
- ICategoryMembershipEntry * This,
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0082);
-
-
-void __RPC_STUB ICategoryMembershipEntry_get_Identity_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipEntry_get_SubcategoryMembership_Proxy(
- ICategoryMembershipEntry * This,
- /* [retval][out] */ ISection **SubcategoryMembership);
-
-
-void __RPC_STUB ICategoryMembershipEntry_get_SubcategoryMembership_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICategoryMembershipEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0290 */
-/* [local] */
-
-typedef struct _COMServerEntry
- {
- GUID Clsid;
- ULONG Flags;
- GUID ConfiguredGuid;
- GUID ImplementedClsid;
- GUID TypeLibrary;
- ULONG ThreadingModel;
- LPCWSTR RuntimeVersion;
- LPCWSTR HostFile;
- } COMServerEntry;
-
-typedef
-enum _COMServerEntryFieldId
- { COMServer_Flags = 0,
- COMServer_ConfiguredGuid = COMServer_Flags + 1,
- COMServer_ImplementedClsid = COMServer_ConfiguredGuid + 1,
- COMServer_TypeLibrary = COMServer_ImplementedClsid + 1,
- COMServer_ThreadingModel = COMServer_TypeLibrary + 1,
- COMServer_RuntimeVersion = COMServer_ThreadingModel + 1,
- COMServer_HostFile = COMServer_RuntimeVersion + 1
- } COMServerEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0290_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0290_v0_0_s_ifspec;
-
-#ifndef __ICOMServerEntry_INTERFACE_DEFINED__
-#define __ICOMServerEntry_INTERFACE_DEFINED__
-
-/* interface ICOMServerEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ICOMServerEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("3903B11B-FBE8-477c-825F-DB828B5FD174")
- ICOMServerEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ COMServerEntry **__MIDL_0083) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Clsid(
- /* [retval][out] */ GUID *__MIDL_0084) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
- /* [retval][out] */ ULONG *__MIDL_0085) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ConfiguredGuid(
- /* [retval][out] */ GUID *__MIDL_0086) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ImplementedClsid(
- /* [retval][out] */ GUID *__MIDL_0087) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TypeLibrary(
- /* [retval][out] */ GUID *__MIDL_0088) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ThreadingModel(
- /* [retval][out] */ ULONG *__MIDL_0089) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RuntimeVersion(
- /* [retval][out] */ LPCWSTR *__MIDL_0090) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HostFile(
- /* [retval][out] */ LPCWSTR *__MIDL_0091) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICOMServerEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICOMServerEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICOMServerEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICOMServerEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ICOMServerEntry * This,
- /* [retval][out] */ COMServerEntry **__MIDL_0083);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Clsid )(
- ICOMServerEntry * This,
- /* [retval][out] */ GUID *__MIDL_0084);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
- ICOMServerEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0085);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ConfiguredGuid )(
- ICOMServerEntry * This,
- /* [retval][out] */ GUID *__MIDL_0086);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ImplementedClsid )(
- ICOMServerEntry * This,
- /* [retval][out] */ GUID *__MIDL_0087);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TypeLibrary )(
- ICOMServerEntry * This,
- /* [retval][out] */ GUID *__MIDL_0088);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ThreadingModel )(
- ICOMServerEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0089);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RuntimeVersion )(
- ICOMServerEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0090);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HostFile )(
- ICOMServerEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0091);
-
- END_INTERFACE
- } ICOMServerEntryVtbl;
-
- interface ICOMServerEntry
- {
- CONST_VTBL struct ICOMServerEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICOMServerEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICOMServerEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICOMServerEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICOMServerEntry_get_AllData(This,__MIDL_0083) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0083)
-
-#define ICOMServerEntry_get_Clsid(This,__MIDL_0084) \
- (This)->lpVtbl -> get_Clsid(This,__MIDL_0084)
-
-#define ICOMServerEntry_get_Flags(This,__MIDL_0085) \
- (This)->lpVtbl -> get_Flags(This,__MIDL_0085)
-
-#define ICOMServerEntry_get_ConfiguredGuid(This,__MIDL_0086) \
- (This)->lpVtbl -> get_ConfiguredGuid(This,__MIDL_0086)
-
-#define ICOMServerEntry_get_ImplementedClsid(This,__MIDL_0087) \
- (This)->lpVtbl -> get_ImplementedClsid(This,__MIDL_0087)
-
-#define ICOMServerEntry_get_TypeLibrary(This,__MIDL_0088) \
- (This)->lpVtbl -> get_TypeLibrary(This,__MIDL_0088)
-
-#define ICOMServerEntry_get_ThreadingModel(This,__MIDL_0089) \
- (This)->lpVtbl -> get_ThreadingModel(This,__MIDL_0089)
-
-#define ICOMServerEntry_get_RuntimeVersion(This,__MIDL_0090) \
- (This)->lpVtbl -> get_RuntimeVersion(This,__MIDL_0090)
-
-#define ICOMServerEntry_get_HostFile(This,__MIDL_0091) \
- (This)->lpVtbl -> get_HostFile(This,__MIDL_0091)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_AllData_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ COMServerEntry **__MIDL_0083);
-
-
-void __RPC_STUB ICOMServerEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_Clsid_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ GUID *__MIDL_0084);
-
-
-void __RPC_STUB ICOMServerEntry_get_Clsid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_Flags_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0085);
-
-
-void __RPC_STUB ICOMServerEntry_get_Flags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_ConfiguredGuid_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ GUID *__MIDL_0086);
-
-
-void __RPC_STUB ICOMServerEntry_get_ConfiguredGuid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_ImplementedClsid_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ GUID *__MIDL_0087);
-
-
-void __RPC_STUB ICOMServerEntry_get_ImplementedClsid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_TypeLibrary_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ GUID *__MIDL_0088);
-
-
-void __RPC_STUB ICOMServerEntry_get_TypeLibrary_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_ThreadingModel_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0089);
-
-
-void __RPC_STUB ICOMServerEntry_get_ThreadingModel_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_RuntimeVersion_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0090);
-
-
-void __RPC_STUB ICOMServerEntry_get_RuntimeVersion_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_HostFile_Proxy(
- ICOMServerEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0091);
-
-
-void __RPC_STUB ICOMServerEntry_get_HostFile_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICOMServerEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0291 */
-/* [local] */
-
-typedef struct _ProgIdRedirectionEntry
- {
- LPCWSTR ProgId;
- GUID RedirectedGuid;
- } ProgIdRedirectionEntry;
-
-typedef
-enum _ProgIdRedirectionEntryFieldId
- { ProgIdRedirection_RedirectedGuid = 0
- } ProgIdRedirectionEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0291_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0291_v0_0_s_ifspec;
-
-#ifndef __IProgIdRedirectionEntry_INTERFACE_DEFINED__
-#define __IProgIdRedirectionEntry_INTERFACE_DEFINED__
-
-/* interface IProgIdRedirectionEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IProgIdRedirectionEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("54F198EC-A63A-45ea-A984-452F68D9B35B")
- IProgIdRedirectionEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ ProgIdRedirectionEntry **__MIDL_0092) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProgId(
- /* [retval][out] */ LPCWSTR *__MIDL_0093) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RedirectedGuid(
- /* [retval][out] */ GUID *__MIDL_0094) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IProgIdRedirectionEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IProgIdRedirectionEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IProgIdRedirectionEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IProgIdRedirectionEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IProgIdRedirectionEntry * This,
- /* [retval][out] */ ProgIdRedirectionEntry **__MIDL_0092);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProgId )(
- IProgIdRedirectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0093);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RedirectedGuid )(
- IProgIdRedirectionEntry * This,
- /* [retval][out] */ GUID *__MIDL_0094);
-
- END_INTERFACE
- } IProgIdRedirectionEntryVtbl;
-
- interface IProgIdRedirectionEntry
- {
- CONST_VTBL struct IProgIdRedirectionEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IProgIdRedirectionEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IProgIdRedirectionEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IProgIdRedirectionEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IProgIdRedirectionEntry_get_AllData(This,__MIDL_0092) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0092)
-
-#define IProgIdRedirectionEntry_get_ProgId(This,__MIDL_0093) \
- (This)->lpVtbl -> get_ProgId(This,__MIDL_0093)
-
-#define IProgIdRedirectionEntry_get_RedirectedGuid(This,__MIDL_0094) \
- (This)->lpVtbl -> get_RedirectedGuid(This,__MIDL_0094)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IProgIdRedirectionEntry_get_AllData_Proxy(
- IProgIdRedirectionEntry * This,
- /* [retval][out] */ ProgIdRedirectionEntry **__MIDL_0092);
-
-
-void __RPC_STUB IProgIdRedirectionEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IProgIdRedirectionEntry_get_ProgId_Proxy(
- IProgIdRedirectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0093);
-
-
-void __RPC_STUB IProgIdRedirectionEntry_get_ProgId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IProgIdRedirectionEntry_get_RedirectedGuid_Proxy(
- IProgIdRedirectionEntry * This,
- /* [retval][out] */ GUID *__MIDL_0094);
-
-
-void __RPC_STUB IProgIdRedirectionEntry_get_RedirectedGuid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IProgIdRedirectionEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0292 */
-/* [local] */
-
-typedef struct _CLRSurrogateEntry
- {
- GUID Clsid;
- LPCWSTR RuntimeVersion;
- LPCWSTR ClassName;
- } CLRSurrogateEntry;
-
-typedef
-enum _CLRSurrogateEntryFieldId
- { CLRSurrogate_RuntimeVersion = 0,
- CLRSurrogate_ClassName = CLRSurrogate_RuntimeVersion + 1
- } CLRSurrogateEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0292_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0292_v0_0_s_ifspec;
-
-#ifndef __ICLRSurrogateEntry_INTERFACE_DEFINED__
-#define __ICLRSurrogateEntry_INTERFACE_DEFINED__
-
-/* interface ICLRSurrogateEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ICLRSurrogateEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("1E0422A1-F0D2-44ae-914B-8A2DECCFD22B")
- ICLRSurrogateEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ CLRSurrogateEntry **__MIDL_0095) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Clsid(
- /* [retval][out] */ GUID *__MIDL_0096) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RuntimeVersion(
- /* [retval][out] */ LPCWSTR *__MIDL_0097) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ClassName(
- /* [retval][out] */ LPCWSTR *__MIDL_0098) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICLRSurrogateEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICLRSurrogateEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICLRSurrogateEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICLRSurrogateEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ICLRSurrogateEntry * This,
- /* [retval][out] */ CLRSurrogateEntry **__MIDL_0095);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Clsid )(
- ICLRSurrogateEntry * This,
- /* [retval][out] */ GUID *__MIDL_0096);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RuntimeVersion )(
- ICLRSurrogateEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0097);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClassName )(
- ICLRSurrogateEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0098);
-
- END_INTERFACE
- } ICLRSurrogateEntryVtbl;
-
- interface ICLRSurrogateEntry
- {
- CONST_VTBL struct ICLRSurrogateEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICLRSurrogateEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICLRSurrogateEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICLRSurrogateEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICLRSurrogateEntry_get_AllData(This,__MIDL_0095) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0095)
-
-#define ICLRSurrogateEntry_get_Clsid(This,__MIDL_0096) \
- (This)->lpVtbl -> get_Clsid(This,__MIDL_0096)
-
-#define ICLRSurrogateEntry_get_RuntimeVersion(This,__MIDL_0097) \
- (This)->lpVtbl -> get_RuntimeVersion(This,__MIDL_0097)
-
-#define ICLRSurrogateEntry_get_ClassName(This,__MIDL_0098) \
- (This)->lpVtbl -> get_ClassName(This,__MIDL_0098)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICLRSurrogateEntry_get_AllData_Proxy(
- ICLRSurrogateEntry * This,
- /* [retval][out] */ CLRSurrogateEntry **__MIDL_0095);
-
-
-void __RPC_STUB ICLRSurrogateEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICLRSurrogateEntry_get_Clsid_Proxy(
- ICLRSurrogateEntry * This,
- /* [retval][out] */ GUID *__MIDL_0096);
-
-
-void __RPC_STUB ICLRSurrogateEntry_get_Clsid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICLRSurrogateEntry_get_RuntimeVersion_Proxy(
- ICLRSurrogateEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0097);
-
-
-void __RPC_STUB ICLRSurrogateEntry_get_RuntimeVersion_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICLRSurrogateEntry_get_ClassName_Proxy(
- ICLRSurrogateEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0098);
-
-
-void __RPC_STUB ICLRSurrogateEntry_get_ClassName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICLRSurrogateEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0293 */
-/* [local] */
-
-typedef struct _AssemblyReferenceDependentAssemblyEntry
- {
- LPCWSTR Group;
- LPCWSTR Codebase;
- ULONGLONG Size;
- /* [size_is] */ BYTE *HashValue;
- ULONG HashValueSize;
- ULONG HashAlgorithm;
- ULONG Flags;
- LPCWSTR ResourceFallbackCulture;
- LPCWSTR Description;
- LPCWSTR SupportUrl;
- ISection *HashElements;
- } AssemblyReferenceDependentAssemblyEntry;
-
-typedef
-enum _AssemblyReferenceDependentAssemblyEntryFieldId
- { AssemblyReferenceDependentAssembly_Group = 0,
- AssemblyReferenceDependentAssembly_Codebase = AssemblyReferenceDependentAssembly_Group + 1,
- AssemblyReferenceDependentAssembly_Size = AssemblyReferenceDependentAssembly_Codebase + 1,
- AssemblyReferenceDependentAssembly_HashValue = AssemblyReferenceDependentAssembly_Size + 1,
- AssemblyReferenceDependentAssembly_HashValueSize = AssemblyReferenceDependentAssembly_HashValue + 1,
- AssemblyReferenceDependentAssembly_HashAlgorithm = AssemblyReferenceDependentAssembly_HashValueSize + 1,
- AssemblyReferenceDependentAssembly_Flags = AssemblyReferenceDependentAssembly_HashAlgorithm + 1,
- AssemblyReferenceDependentAssembly_ResourceFallbackCulture = AssemblyReferenceDependentAssembly_Flags + 1,
- AssemblyReferenceDependentAssembly_Description = AssemblyReferenceDependentAssembly_ResourceFallbackCulture + 1,
- AssemblyReferenceDependentAssembly_SupportUrl = AssemblyReferenceDependentAssembly_Description + 1,
- AssemblyReferenceDependentAssembly_HashElements = AssemblyReferenceDependentAssembly_SupportUrl + 1
- } AssemblyReferenceDependentAssemblyEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0293_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0293_v0_0_s_ifspec;
-
-#ifndef __IAssemblyReferenceDependentAssemblyEntry_INTERFACE_DEFINED__
-#define __IAssemblyReferenceDependentAssemblyEntry_INTERFACE_DEFINED__
-
-/* interface IAssemblyReferenceDependentAssemblyEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IAssemblyReferenceDependentAssemblyEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("C31FF59E-CD25-47b8-9EF3-CF4433EB97CC")
- IAssemblyReferenceDependentAssemblyEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ AssemblyReferenceDependentAssemblyEntry **__MIDL_0099) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Group(
- /* [retval][out] */ LPCWSTR *__MIDL_0100) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
- /* [retval][out] */ LPCWSTR *__MIDL_0101) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
- /* [retval][out] */ ULONGLONG *__MIDL_0102) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashValue(
- /* [retval][out] */ IStream **__MIDL_0103) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashAlgorithm(
- /* [retval][out] */ ULONG *__MIDL_0104) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
- /* [retval][out] */ ULONG *__MIDL_0105) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceFallbackCulture(
- /* [retval][out] */ LPCWSTR *__MIDL_0106) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
- /* [retval][out] */ LPCWSTR *__MIDL_0107) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportUrl(
- /* [retval][out] */ LPCWSTR *__MIDL_0108) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashElements(
- /* [retval][out] */ ISection **HashElement) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IAssemblyReferenceDependentAssemblyEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IAssemblyReferenceDependentAssemblyEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IAssemblyReferenceDependentAssemblyEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ AssemblyReferenceDependentAssemblyEntry **__MIDL_0099);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Group )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0100);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0101);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ ULONGLONG *__MIDL_0102);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashValue )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ IStream **__MIDL_0103);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashAlgorithm )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0104);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0105);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceFallbackCulture )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0106);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0107);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportUrl )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0108);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashElements )(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ ISection **HashElement);
-
- END_INTERFACE
- } IAssemblyReferenceDependentAssemblyEntryVtbl;
-
- interface IAssemblyReferenceDependentAssemblyEntry
- {
- CONST_VTBL struct IAssemblyReferenceDependentAssemblyEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IAssemblyReferenceDependentAssemblyEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IAssemblyReferenceDependentAssemblyEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IAssemblyReferenceDependentAssemblyEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_AllData(This,__MIDL_0099) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0099)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_Group(This,__MIDL_0100) \
- (This)->lpVtbl -> get_Group(This,__MIDL_0100)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_Codebase(This,__MIDL_0101) \
- (This)->lpVtbl -> get_Codebase(This,__MIDL_0101)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_Size(This,__MIDL_0102) \
- (This)->lpVtbl -> get_Size(This,__MIDL_0102)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_HashValue(This,__MIDL_0103) \
- (This)->lpVtbl -> get_HashValue(This,__MIDL_0103)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_HashAlgorithm(This,__MIDL_0104) \
- (This)->lpVtbl -> get_HashAlgorithm(This,__MIDL_0104)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_Flags(This,__MIDL_0105) \
- (This)->lpVtbl -> get_Flags(This,__MIDL_0105)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_ResourceFallbackCulture(This,__MIDL_0106) \
- (This)->lpVtbl -> get_ResourceFallbackCulture(This,__MIDL_0106)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_Description(This,__MIDL_0107) \
- (This)->lpVtbl -> get_Description(This,__MIDL_0107)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_SupportUrl(This,__MIDL_0108) \
- (This)->lpVtbl -> get_SupportUrl(This,__MIDL_0108)
-
-#define IAssemblyReferenceDependentAssemblyEntry_get_HashElements(This,HashElement) \
- (This)->lpVtbl -> get_HashElements(This,HashElement)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_AllData_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ AssemblyReferenceDependentAssemblyEntry **__MIDL_0099);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Group_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0100);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Group_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Codebase_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0101);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Size_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ ULONGLONG *__MIDL_0102);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Size_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_HashValue_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ IStream **__MIDL_0103);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_HashValue_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_HashAlgorithm_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0104);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_HashAlgorithm_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Flags_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0105);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Flags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_ResourceFallbackCulture_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0106);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_ResourceFallbackCulture_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Description_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0107);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Description_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_SupportUrl_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0108);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_SupportUrl_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_HashElements_Proxy(
- IAssemblyReferenceDependentAssemblyEntry * This,
- /* [retval][out] */ ISection **HashElement);
-
-
-void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_HashElements_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IAssemblyReferenceDependentAssemblyEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0294 */
-/* [local] */
-
-typedef struct _AssemblyReferenceEntry
- {
- IReferenceIdentity *ReferenceIdentity;
- ULONG Flags;
- AssemblyReferenceDependentAssemblyEntry DependentAssembly;
- } AssemblyReferenceEntry;
-
-typedef
-enum _AssemblyReferenceEntryFieldId
- { AssemblyReference_Flags = 0,
- AssemblyReference_DependentAssembly = AssemblyReference_Flags + 1
- } AssemblyReferenceEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0294_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0294_v0_0_s_ifspec;
-
-#ifndef __IAssemblyReferenceEntry_INTERFACE_DEFINED__
-#define __IAssemblyReferenceEntry_INTERFACE_DEFINED__
-
-/* interface IAssemblyReferenceEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IAssemblyReferenceEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("FD47B733-AFBC-45e4-B7C2-BBEB1D9F766C")
- IAssemblyReferenceEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ AssemblyReferenceEntry **__MIDL_0109) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ReferenceIdentity(
- /* [retval][out] */ IReferenceIdentity **__MIDL_0110) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
- /* [retval][out] */ ULONG *__MIDL_0111) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DependentAssembly(
- /* [retval][out] */ IAssemblyReferenceDependentAssemblyEntry **__MIDL_0112) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IAssemblyReferenceEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IAssemblyReferenceEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IAssemblyReferenceEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IAssemblyReferenceEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IAssemblyReferenceEntry * This,
- /* [retval][out] */ AssemblyReferenceEntry **__MIDL_0109);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ReferenceIdentity )(
- IAssemblyReferenceEntry * This,
- /* [retval][out] */ IReferenceIdentity **__MIDL_0110);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
- IAssemblyReferenceEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0111);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DependentAssembly )(
- IAssemblyReferenceEntry * This,
- /* [retval][out] */ IAssemblyReferenceDependentAssemblyEntry **__MIDL_0112);
-
- END_INTERFACE
- } IAssemblyReferenceEntryVtbl;
-
- interface IAssemblyReferenceEntry
- {
- CONST_VTBL struct IAssemblyReferenceEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IAssemblyReferenceEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IAssemblyReferenceEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IAssemblyReferenceEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IAssemblyReferenceEntry_get_AllData(This,__MIDL_0109) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0109)
-
-#define IAssemblyReferenceEntry_get_ReferenceIdentity(This,__MIDL_0110) \
- (This)->lpVtbl -> get_ReferenceIdentity(This,__MIDL_0110)
-
-#define IAssemblyReferenceEntry_get_Flags(This,__MIDL_0111) \
- (This)->lpVtbl -> get_Flags(This,__MIDL_0111)
-
-#define IAssemblyReferenceEntry_get_DependentAssembly(This,__MIDL_0112) \
- (This)->lpVtbl -> get_DependentAssembly(This,__MIDL_0112)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceEntry_get_AllData_Proxy(
- IAssemblyReferenceEntry * This,
- /* [retval][out] */ AssemblyReferenceEntry **__MIDL_0109);
-
-
-void __RPC_STUB IAssemblyReferenceEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceEntry_get_ReferenceIdentity_Proxy(
- IAssemblyReferenceEntry * This,
- /* [retval][out] */ IReferenceIdentity **__MIDL_0110);
-
-
-void __RPC_STUB IAssemblyReferenceEntry_get_ReferenceIdentity_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceEntry_get_Flags_Proxy(
- IAssemblyReferenceEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0111);
-
-
-void __RPC_STUB IAssemblyReferenceEntry_get_Flags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceEntry_get_DependentAssembly_Proxy(
- IAssemblyReferenceEntry * This,
- /* [retval][out] */ IAssemblyReferenceDependentAssemblyEntry **__MIDL_0112);
-
-
-void __RPC_STUB IAssemblyReferenceEntry_get_DependentAssembly_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IAssemblyReferenceEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0295 */
-/* [local] */
-
-typedef struct _WindowClassEntry
- {
- LPCWSTR ClassName;
- LPCWSTR HostDll;
- BOOLEAN fVersioned;
- } WindowClassEntry;
-
-typedef
-enum _WindowClassEntryFieldId
- { WindowClass_HostDll = 0,
- WindowClass_fVersioned = WindowClass_HostDll + 1
- } WindowClassEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0295_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0295_v0_0_s_ifspec;
-
-#ifndef __IWindowClassEntry_INTERFACE_DEFINED__
-#define __IWindowClassEntry_INTERFACE_DEFINED__
-
-/* interface IWindowClassEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IWindowClassEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8AD3FC86-AFD3-477a-8FD5-146C291195BA")
- IWindowClassEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ WindowClassEntry **__MIDL_0113) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ClassName(
- /* [retval][out] */ LPCWSTR *__MIDL_0114) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HostDll(
- /* [retval][out] */ LPCWSTR *__MIDL_0115) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_fVersioned(
- /* [retval][out] */ BOOLEAN *__MIDL_0116) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IWindowClassEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IWindowClassEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IWindowClassEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IWindowClassEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IWindowClassEntry * This,
- /* [retval][out] */ WindowClassEntry **__MIDL_0113);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClassName )(
- IWindowClassEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0114);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HostDll )(
- IWindowClassEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0115);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_fVersioned )(
- IWindowClassEntry * This,
- /* [retval][out] */ BOOLEAN *__MIDL_0116);
-
- END_INTERFACE
- } IWindowClassEntryVtbl;
-
- interface IWindowClassEntry
- {
- CONST_VTBL struct IWindowClassEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IWindowClassEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IWindowClassEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IWindowClassEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IWindowClassEntry_get_AllData(This,__MIDL_0113) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0113)
-
-#define IWindowClassEntry_get_ClassName(This,__MIDL_0114) \
- (This)->lpVtbl -> get_ClassName(This,__MIDL_0114)
-
-#define IWindowClassEntry_get_HostDll(This,__MIDL_0115) \
- (This)->lpVtbl -> get_HostDll(This,__MIDL_0115)
-
-#define IWindowClassEntry_get_fVersioned(This,__MIDL_0116) \
- (This)->lpVtbl -> get_fVersioned(This,__MIDL_0116)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IWindowClassEntry_get_AllData_Proxy(
- IWindowClassEntry * This,
- /* [retval][out] */ WindowClassEntry **__MIDL_0113);
-
-
-void __RPC_STUB IWindowClassEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IWindowClassEntry_get_ClassName_Proxy(
- IWindowClassEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0114);
-
-
-void __RPC_STUB IWindowClassEntry_get_ClassName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IWindowClassEntry_get_HostDll_Proxy(
- IWindowClassEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0115);
-
-
-void __RPC_STUB IWindowClassEntry_get_HostDll_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IWindowClassEntry_get_fVersioned_Proxy(
- IWindowClassEntry * This,
- /* [retval][out] */ BOOLEAN *__MIDL_0116);
-
-
-void __RPC_STUB IWindowClassEntry_get_fVersioned_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IWindowClassEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0296 */
-/* [local] */
-
-typedef struct _ResourceTableMappingEntry
- {
- LPCWSTR id;
- LPCWSTR FinalStringMapped;
- } ResourceTableMappingEntry;
-
-typedef
-enum _ResourceTableMappingEntryFieldId
- { ResourceTableMapping_FinalStringMapped = 0
- } ResourceTableMappingEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0296_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0296_v0_0_s_ifspec;
-
-#ifndef __IResourceTableMappingEntry_INTERFACE_DEFINED__
-#define __IResourceTableMappingEntry_INTERFACE_DEFINED__
-
-/* interface IResourceTableMappingEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IResourceTableMappingEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("70A4ECEE-B195-4c59-85BF-44B6ACA83F07")
- IResourceTableMappingEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ ResourceTableMappingEntry **__MIDL_0117) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_id(
- /* [retval][out] */ LPCWSTR *__MIDL_0118) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FinalStringMapped(
- /* [retval][out] */ LPCWSTR *__MIDL_0119) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IResourceTableMappingEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IResourceTableMappingEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IResourceTableMappingEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IResourceTableMappingEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IResourceTableMappingEntry * This,
- /* [retval][out] */ ResourceTableMappingEntry **__MIDL_0117);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_id )(
- IResourceTableMappingEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0118);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FinalStringMapped )(
- IResourceTableMappingEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0119);
-
- END_INTERFACE
- } IResourceTableMappingEntryVtbl;
-
- interface IResourceTableMappingEntry
- {
- CONST_VTBL struct IResourceTableMappingEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IResourceTableMappingEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IResourceTableMappingEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IResourceTableMappingEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IResourceTableMappingEntry_get_AllData(This,__MIDL_0117) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0117)
-
-#define IResourceTableMappingEntry_get_id(This,__MIDL_0118) \
- (This)->lpVtbl -> get_id(This,__MIDL_0118)
-
-#define IResourceTableMappingEntry_get_FinalStringMapped(This,__MIDL_0119) \
- (This)->lpVtbl -> get_FinalStringMapped(This,__MIDL_0119)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IResourceTableMappingEntry_get_AllData_Proxy(
- IResourceTableMappingEntry * This,
- /* [retval][out] */ ResourceTableMappingEntry **__MIDL_0117);
-
-
-void __RPC_STUB IResourceTableMappingEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IResourceTableMappingEntry_get_id_Proxy(
- IResourceTableMappingEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0118);
-
-
-void __RPC_STUB IResourceTableMappingEntry_get_id_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IResourceTableMappingEntry_get_FinalStringMapped_Proxy(
- IResourceTableMappingEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0119);
-
-
-void __RPC_STUB IResourceTableMappingEntry_get_FinalStringMapped_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IResourceTableMappingEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0297 */
-/* [local] */
-
-typedef struct _EntryPointEntry
- {
- LPCWSTR Name;
- LPCWSTR CommandLine_File;
- LPCWSTR CommandLine_Parameters;
- IReferenceIdentity *Identity;
- ULONG Flags;
- } EntryPointEntry;
-
-typedef
-enum _EntryPointEntryFieldId
- { EntryPoint_CommandLine_File = 0,
- EntryPoint_CommandLine_Parameters = EntryPoint_CommandLine_File + 1,
- EntryPoint_Identity = EntryPoint_CommandLine_Parameters + 1,
- EntryPoint_Flags = EntryPoint_Identity + 1
- } EntryPointEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0297_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0297_v0_0_s_ifspec;
-
-#ifndef __IEntryPointEntry_INTERFACE_DEFINED__
-#define __IEntryPointEntry_INTERFACE_DEFINED__
-
-/* interface IEntryPointEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IEntryPointEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("1583EFE9-832F-4d08-B041-CAC5ACEDB948")
- IEntryPointEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ EntryPointEntry **__MIDL_0120) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
- /* [retval][out] */ LPCWSTR *__MIDL_0121) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CommandLine_File(
- /* [retval][out] */ LPCWSTR *__MIDL_0122) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CommandLine_Parameters(
- /* [retval][out] */ LPCWSTR *__MIDL_0123) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
- /* [retval][out] */ IReferenceIdentity **__MIDL_0124) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
- /* [retval][out] */ ULONG *__MIDL_0125) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEntryPointEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEntryPointEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEntryPointEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEntryPointEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IEntryPointEntry * This,
- /* [retval][out] */ EntryPointEntry **__MIDL_0120);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
- IEntryPointEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0121);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CommandLine_File )(
- IEntryPointEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0122);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CommandLine_Parameters )(
- IEntryPointEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0123);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
- IEntryPointEntry * This,
- /* [retval][out] */ IReferenceIdentity **__MIDL_0124);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
- IEntryPointEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0125);
-
- END_INTERFACE
- } IEntryPointEntryVtbl;
-
- interface IEntryPointEntry
- {
- CONST_VTBL struct IEntryPointEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEntryPointEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEntryPointEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEntryPointEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEntryPointEntry_get_AllData(This,__MIDL_0120) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0120)
-
-#define IEntryPointEntry_get_Name(This,__MIDL_0121) \
- (This)->lpVtbl -> get_Name(This,__MIDL_0121)
-
-#define IEntryPointEntry_get_CommandLine_File(This,__MIDL_0122) \
- (This)->lpVtbl -> get_CommandLine_File(This,__MIDL_0122)
-
-#define IEntryPointEntry_get_CommandLine_Parameters(This,__MIDL_0123) \
- (This)->lpVtbl -> get_CommandLine_Parameters(This,__MIDL_0123)
-
-#define IEntryPointEntry_get_Identity(This,__MIDL_0124) \
- (This)->lpVtbl -> get_Identity(This,__MIDL_0124)
-
-#define IEntryPointEntry_get_Flags(This,__MIDL_0125) \
- (This)->lpVtbl -> get_Flags(This,__MIDL_0125)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_AllData_Proxy(
- IEntryPointEntry * This,
- /* [retval][out] */ EntryPointEntry **__MIDL_0120);
-
-
-void __RPC_STUB IEntryPointEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_Name_Proxy(
- IEntryPointEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0121);
-
-
-void __RPC_STUB IEntryPointEntry_get_Name_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_CommandLine_File_Proxy(
- IEntryPointEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0122);
-
-
-void __RPC_STUB IEntryPointEntry_get_CommandLine_File_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_CommandLine_Parameters_Proxy(
- IEntryPointEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0123);
-
-
-void __RPC_STUB IEntryPointEntry_get_CommandLine_Parameters_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_Identity_Proxy(
- IEntryPointEntry * This,
- /* [retval][out] */ IReferenceIdentity **__MIDL_0124);
-
-
-void __RPC_STUB IEntryPointEntry_get_Identity_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_Flags_Proxy(
- IEntryPointEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0125);
-
-
-void __RPC_STUB IEntryPointEntry_get_Flags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEntryPointEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0298 */
-/* [local] */
-
-typedef struct _PermissionSetEntry
- {
- LPCWSTR Id;
- LPCWSTR XmlSegment;
- } PermissionSetEntry;
-
-typedef
-enum _PermissionSetEntryFieldId
- { PermissionSet_XmlSegment = 0
- } PermissionSetEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0298_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0298_v0_0_s_ifspec;
-
-#ifndef __IPermissionSetEntry_INTERFACE_DEFINED__
-#define __IPermissionSetEntry_INTERFACE_DEFINED__
-
-/* interface IPermissionSetEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IPermissionSetEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("EBE5A1ED-FEBC-42c4-A9E1-E087C6E36635")
- IPermissionSetEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ PermissionSetEntry **__MIDL_0126) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Id(
- /* [retval][out] */ LPCWSTR *__MIDL_0127) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_XmlSegment(
- /* [retval][out] */ LPCWSTR *__MIDL_0128) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IPermissionSetEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IPermissionSetEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IPermissionSetEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IPermissionSetEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IPermissionSetEntry * This,
- /* [retval][out] */ PermissionSetEntry **__MIDL_0126);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )(
- IPermissionSetEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0127);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_XmlSegment )(
- IPermissionSetEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0128);
-
- END_INTERFACE
- } IPermissionSetEntryVtbl;
-
- interface IPermissionSetEntry
- {
- CONST_VTBL struct IPermissionSetEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IPermissionSetEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IPermissionSetEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IPermissionSetEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IPermissionSetEntry_get_AllData(This,__MIDL_0126) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0126)
-
-#define IPermissionSetEntry_get_Id(This,__MIDL_0127) \
- (This)->lpVtbl -> get_Id(This,__MIDL_0127)
-
-#define IPermissionSetEntry_get_XmlSegment(This,__MIDL_0128) \
- (This)->lpVtbl -> get_XmlSegment(This,__MIDL_0128)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IPermissionSetEntry_get_AllData_Proxy(
- IPermissionSetEntry * This,
- /* [retval][out] */ PermissionSetEntry **__MIDL_0126);
-
-
-void __RPC_STUB IPermissionSetEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IPermissionSetEntry_get_Id_Proxy(
- IPermissionSetEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0127);
-
-
-void __RPC_STUB IPermissionSetEntry_get_Id_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IPermissionSetEntry_get_XmlSegment_Proxy(
- IPermissionSetEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0128);
-
-
-void __RPC_STUB IPermissionSetEntry_get_XmlSegment_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IPermissionSetEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0299 */
-/* [local] */
-
-typedef struct _AssemblyRequestEntry
- {
- LPCWSTR Name;
- LPCWSTR permissionSetID;
- } AssemblyRequestEntry;
-
-typedef
-enum _AssemblyRequestEntryFieldId
- { AssemblyRequest_permissionSetID = 0
- } AssemblyRequestEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0299_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0299_v0_0_s_ifspec;
-
-#ifndef __IAssemblyRequestEntry_INTERFACE_DEFINED__
-#define __IAssemblyRequestEntry_INTERFACE_DEFINED__
-
-/* interface IAssemblyRequestEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IAssemblyRequestEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("2474ECB4-8EFD-4410-9F31-B3E7C4A07731")
- IAssemblyRequestEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ AssemblyRequestEntry **__MIDL_0129) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
- /* [retval][out] */ LPCWSTR *__MIDL_0130) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_permissionSetID(
- /* [retval][out] */ LPCWSTR *__MIDL_0131) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IAssemblyRequestEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IAssemblyRequestEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IAssemblyRequestEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IAssemblyRequestEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IAssemblyRequestEntry * This,
- /* [retval][out] */ AssemblyRequestEntry **__MIDL_0129);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
- IAssemblyRequestEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0130);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_permissionSetID )(
- IAssemblyRequestEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0131);
-
- END_INTERFACE
- } IAssemblyRequestEntryVtbl;
-
- interface IAssemblyRequestEntry
- {
- CONST_VTBL struct IAssemblyRequestEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IAssemblyRequestEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IAssemblyRequestEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IAssemblyRequestEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IAssemblyRequestEntry_get_AllData(This,__MIDL_0129) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0129)
-
-#define IAssemblyRequestEntry_get_Name(This,__MIDL_0130) \
- (This)->lpVtbl -> get_Name(This,__MIDL_0130)
-
-#define IAssemblyRequestEntry_get_permissionSetID(This,__MIDL_0131) \
- (This)->lpVtbl -> get_permissionSetID(This,__MIDL_0131)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyRequestEntry_get_AllData_Proxy(
- IAssemblyRequestEntry * This,
- /* [retval][out] */ AssemblyRequestEntry **__MIDL_0129);
-
-
-void __RPC_STUB IAssemblyRequestEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyRequestEntry_get_Name_Proxy(
- IAssemblyRequestEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0130);
-
-
-void __RPC_STUB IAssemblyRequestEntry_get_Name_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyRequestEntry_get_permissionSetID_Proxy(
- IAssemblyRequestEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0131);
-
-
-void __RPC_STUB IAssemblyRequestEntry_get_permissionSetID_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IAssemblyRequestEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0300 */
-/* [local] */
-
-typedef struct _DescriptionMetadataEntry
- {
- LPCWSTR Publisher;
- LPCWSTR Product;
- LPCWSTR SupportUrl;
- LPCWSTR IconFile;
- LPCWSTR ErrorReportUrl;
- LPCWSTR SuiteName;
- } DescriptionMetadataEntry;
-
-typedef
-enum _DescriptionMetadataEntryFieldId
- { DescriptionMetadata_Publisher = 0,
- DescriptionMetadata_Product = DescriptionMetadata_Publisher + 1,
- DescriptionMetadata_SupportUrl = DescriptionMetadata_Product + 1,
- DescriptionMetadata_IconFile = DescriptionMetadata_SupportUrl + 1,
- DescriptionMetadata_ErrorReportUrl = DescriptionMetadata_IconFile + 1,
- DescriptionMetadata_SuiteName = DescriptionMetadata_ErrorReportUrl + 1
- } DescriptionMetadataEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0300_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0300_v0_0_s_ifspec;
-
-#ifndef __IDescriptionMetadataEntry_INTERFACE_DEFINED__
-#define __IDescriptionMetadataEntry_INTERFACE_DEFINED__
-
-/* interface IDescriptionMetadataEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IDescriptionMetadataEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("CB73147E-5FC2-4c31-B4E6-58D13DBE1A08")
- IDescriptionMetadataEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ DescriptionMetadataEntry **__MIDL_0132) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Publisher(
- /* [retval][out] */ LPCWSTR *__MIDL_0133) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Product(
- /* [retval][out] */ LPCWSTR *__MIDL_0134) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportUrl(
- /* [retval][out] */ LPCWSTR *__MIDL_0135) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IconFile(
- /* [retval][out] */ LPCWSTR *__MIDL_0136) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ErrorReportUrl(
- /* [retval][out] */ LPCWSTR *__MIDL_0137) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SuiteName(
- /* [retval][out] */ LPCWSTR *__MIDL_0138) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IDescriptionMetadataEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IDescriptionMetadataEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IDescriptionMetadataEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IDescriptionMetadataEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ DescriptionMetadataEntry **__MIDL_0132);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Publisher )(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0133);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Product )(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0134);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportUrl )(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0135);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IconFile )(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0136);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ErrorReportUrl )(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0137);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SuiteName )(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0138);
-
- END_INTERFACE
- } IDescriptionMetadataEntryVtbl;
-
- interface IDescriptionMetadataEntry
- {
- CONST_VTBL struct IDescriptionMetadataEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IDescriptionMetadataEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IDescriptionMetadataEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IDescriptionMetadataEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IDescriptionMetadataEntry_get_AllData(This,__MIDL_0132) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0132)
-
-#define IDescriptionMetadataEntry_get_Publisher(This,__MIDL_0133) \
- (This)->lpVtbl -> get_Publisher(This,__MIDL_0133)
-
-#define IDescriptionMetadataEntry_get_Product(This,__MIDL_0134) \
- (This)->lpVtbl -> get_Product(This,__MIDL_0134)
-
-#define IDescriptionMetadataEntry_get_SupportUrl(This,__MIDL_0135) \
- (This)->lpVtbl -> get_SupportUrl(This,__MIDL_0135)
-
-#define IDescriptionMetadataEntry_get_IconFile(This,__MIDL_0136) \
- (This)->lpVtbl -> get_IconFile(This,__MIDL_0136)
-
-#define IDescriptionMetadataEntry_get_ErrorReportUrl(This,__MIDL_0137) \
- (This)->lpVtbl -> get_ErrorReportUrl(This,__MIDL_0137)
-
-#define IDescriptionMetadataEntry_get_SuiteName(This,__MIDL_0138) \
- (This)->lpVtbl -> get_SuiteName(This,__MIDL_0138)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_AllData_Proxy(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ DescriptionMetadataEntry **__MIDL_0132);
-
-
-void __RPC_STUB IDescriptionMetadataEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_Publisher_Proxy(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0133);
-
-
-void __RPC_STUB IDescriptionMetadataEntry_get_Publisher_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_Product_Proxy(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0134);
-
-
-void __RPC_STUB IDescriptionMetadataEntry_get_Product_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_SupportUrl_Proxy(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0135);
-
-
-void __RPC_STUB IDescriptionMetadataEntry_get_SupportUrl_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_IconFile_Proxy(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0136);
-
-
-void __RPC_STUB IDescriptionMetadataEntry_get_IconFile_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_ErrorReportUrl_Proxy(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0137);
-
-
-void __RPC_STUB IDescriptionMetadataEntry_get_ErrorReportUrl_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_SuiteName_Proxy(
- IDescriptionMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0138);
-
-
-void __RPC_STUB IDescriptionMetadataEntry_get_SuiteName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IDescriptionMetadataEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0301 */
-/* [local] */
-
-typedef struct _DeploymentMetadataEntry
- {
- LPCWSTR DeploymentProviderCodebase;
- LPCWSTR MinimumRequiredVersion;
- USHORT MaximumAge;
- UCHAR MaximumAge_Unit;
- ULONG DeploymentFlags;
- } DeploymentMetadataEntry;
-
-typedef
-enum _DeploymentMetadataEntryFieldId
- { DeploymentMetadata_DeploymentProviderCodebase = 0,
- DeploymentMetadata_MinimumRequiredVersion = DeploymentMetadata_DeploymentProviderCodebase + 1,
- DeploymentMetadata_MaximumAge = DeploymentMetadata_MinimumRequiredVersion + 1,
- DeploymentMetadata_MaximumAge_Unit = DeploymentMetadata_MaximumAge + 1,
- DeploymentMetadata_DeploymentFlags = DeploymentMetadata_MaximumAge_Unit + 1
- } DeploymentMetadataEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0301_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0301_v0_0_s_ifspec;
-
-#ifndef __IDeploymentMetadataEntry_INTERFACE_DEFINED__
-#define __IDeploymentMetadataEntry_INTERFACE_DEFINED__
-
-/* interface IDeploymentMetadataEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IDeploymentMetadataEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("CFA3F59F-334D-46bf-A5A5-5D11BB2D7EBC")
- IDeploymentMetadataEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ DeploymentMetadataEntry **__MIDL_0139) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DeploymentProviderCodebase(
- /* [retval][out] */ LPCWSTR *__MIDL_0140) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MinimumRequiredVersion(
- /* [retval][out] */ LPCWSTR *__MIDL_0141) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MaximumAge(
- /* [retval][out] */ USHORT *__MIDL_0142) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MaximumAge_Unit(
- /* [retval][out] */ UCHAR *__MIDL_0143) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DeploymentFlags(
- /* [retval][out] */ ULONG *__MIDL_0144) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IDeploymentMetadataEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IDeploymentMetadataEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IDeploymentMetadataEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IDeploymentMetadataEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ DeploymentMetadataEntry **__MIDL_0139);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeploymentProviderCodebase )(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0140);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinimumRequiredVersion )(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0141);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaximumAge )(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ USHORT *__MIDL_0142);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaximumAge_Unit )(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0143);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeploymentFlags )(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0144);
-
- END_INTERFACE
- } IDeploymentMetadataEntryVtbl;
-
- interface IDeploymentMetadataEntry
- {
- CONST_VTBL struct IDeploymentMetadataEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IDeploymentMetadataEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IDeploymentMetadataEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IDeploymentMetadataEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IDeploymentMetadataEntry_get_AllData(This,__MIDL_0139) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0139)
-
-#define IDeploymentMetadataEntry_get_DeploymentProviderCodebase(This,__MIDL_0140) \
- (This)->lpVtbl -> get_DeploymentProviderCodebase(This,__MIDL_0140)
-
-#define IDeploymentMetadataEntry_get_MinimumRequiredVersion(This,__MIDL_0141) \
- (This)->lpVtbl -> get_MinimumRequiredVersion(This,__MIDL_0141)
-
-#define IDeploymentMetadataEntry_get_MaximumAge(This,__MIDL_0142) \
- (This)->lpVtbl -> get_MaximumAge(This,__MIDL_0142)
-
-#define IDeploymentMetadataEntry_get_MaximumAge_Unit(This,__MIDL_0143) \
- (This)->lpVtbl -> get_MaximumAge_Unit(This,__MIDL_0143)
-
-#define IDeploymentMetadataEntry_get_DeploymentFlags(This,__MIDL_0144) \
- (This)->lpVtbl -> get_DeploymentFlags(This,__MIDL_0144)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_AllData_Proxy(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ DeploymentMetadataEntry **__MIDL_0139);
-
-
-void __RPC_STUB IDeploymentMetadataEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_DeploymentProviderCodebase_Proxy(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0140);
-
-
-void __RPC_STUB IDeploymentMetadataEntry_get_DeploymentProviderCodebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_MinimumRequiredVersion_Proxy(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0141);
-
-
-void __RPC_STUB IDeploymentMetadataEntry_get_MinimumRequiredVersion_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_MaximumAge_Proxy(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ USHORT *__MIDL_0142);
-
-
-void __RPC_STUB IDeploymentMetadataEntry_get_MaximumAge_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_MaximumAge_Unit_Proxy(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0143);
-
-
-void __RPC_STUB IDeploymentMetadataEntry_get_MaximumAge_Unit_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_DeploymentFlags_Proxy(
- IDeploymentMetadataEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0144);
-
-
-void __RPC_STUB IDeploymentMetadataEntry_get_DeploymentFlags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IDeploymentMetadataEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0302 */
-/* [local] */
-
-typedef struct _DependentOSMetadataEntry
- {
- LPCWSTR SupportUrl;
- LPCWSTR Description;
- USHORT MajorVersion;
- USHORT MinorVersion;
- USHORT BuildNumber;
- UCHAR ServicePackMajor;
- UCHAR ServicePackMinor;
- } DependentOSMetadataEntry;
-
-typedef
-enum _DependentOSMetadataEntryFieldId
- { DependentOSMetadata_SupportUrl = 0,
- DependentOSMetadata_Description = DependentOSMetadata_SupportUrl + 1,
- DependentOSMetadata_MajorVersion = DependentOSMetadata_Description + 1,
- DependentOSMetadata_MinorVersion = DependentOSMetadata_MajorVersion + 1,
- DependentOSMetadata_BuildNumber = DependentOSMetadata_MinorVersion + 1,
- DependentOSMetadata_ServicePackMajor = DependentOSMetadata_BuildNumber + 1,
- DependentOSMetadata_ServicePackMinor = DependentOSMetadata_ServicePackMajor + 1
- } DependentOSMetadataEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0302_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0302_v0_0_s_ifspec;
-
-#ifndef __IDependentOSMetadataEntry_INTERFACE_DEFINED__
-#define __IDependentOSMetadataEntry_INTERFACE_DEFINED__
-
-/* interface IDependentOSMetadataEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IDependentOSMetadataEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("CF168CF4-4E8F-4d92-9D2A-60E5CA21CF85")
- IDependentOSMetadataEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ DependentOSMetadataEntry **__MIDL_0145) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportUrl(
- /* [retval][out] */ LPCWSTR *__MIDL_0146) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
- /* [retval][out] */ LPCWSTR *__MIDL_0147) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MajorVersion(
- /* [retval][out] */ USHORT *__MIDL_0148) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MinorVersion(
- /* [retval][out] */ USHORT *__MIDL_0149) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildNumber(
- /* [retval][out] */ USHORT *__MIDL_0150) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ServicePackMajor(
- /* [retval][out] */ UCHAR *__MIDL_0151) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ServicePackMinor(
- /* [retval][out] */ UCHAR *__MIDL_0152) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IDependentOSMetadataEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IDependentOSMetadataEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IDependentOSMetadataEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IDependentOSMetadataEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ DependentOSMetadataEntry **__MIDL_0145);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportUrl )(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0146);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0147);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MajorVersion )(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ USHORT *__MIDL_0148);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinorVersion )(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ USHORT *__MIDL_0149);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildNumber )(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ USHORT *__MIDL_0150);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ServicePackMajor )(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0151);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ServicePackMinor )(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0152);
-
- END_INTERFACE
- } IDependentOSMetadataEntryVtbl;
-
- interface IDependentOSMetadataEntry
- {
- CONST_VTBL struct IDependentOSMetadataEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IDependentOSMetadataEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IDependentOSMetadataEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IDependentOSMetadataEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IDependentOSMetadataEntry_get_AllData(This,__MIDL_0145) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0145)
-
-#define IDependentOSMetadataEntry_get_SupportUrl(This,__MIDL_0146) \
- (This)->lpVtbl -> get_SupportUrl(This,__MIDL_0146)
-
-#define IDependentOSMetadataEntry_get_Description(This,__MIDL_0147) \
- (This)->lpVtbl -> get_Description(This,__MIDL_0147)
-
-#define IDependentOSMetadataEntry_get_MajorVersion(This,__MIDL_0148) \
- (This)->lpVtbl -> get_MajorVersion(This,__MIDL_0148)
-
-#define IDependentOSMetadataEntry_get_MinorVersion(This,__MIDL_0149) \
- (This)->lpVtbl -> get_MinorVersion(This,__MIDL_0149)
-
-#define IDependentOSMetadataEntry_get_BuildNumber(This,__MIDL_0150) \
- (This)->lpVtbl -> get_BuildNumber(This,__MIDL_0150)
-
-#define IDependentOSMetadataEntry_get_ServicePackMajor(This,__MIDL_0151) \
- (This)->lpVtbl -> get_ServicePackMajor(This,__MIDL_0151)
-
-#define IDependentOSMetadataEntry_get_ServicePackMinor(This,__MIDL_0152) \
- (This)->lpVtbl -> get_ServicePackMinor(This,__MIDL_0152)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_AllData_Proxy(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ DependentOSMetadataEntry **__MIDL_0145);
-
-
-void __RPC_STUB IDependentOSMetadataEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_SupportUrl_Proxy(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0146);
-
-
-void __RPC_STUB IDependentOSMetadataEntry_get_SupportUrl_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_Description_Proxy(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0147);
-
-
-void __RPC_STUB IDependentOSMetadataEntry_get_Description_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_MajorVersion_Proxy(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ USHORT *__MIDL_0148);
-
-
-void __RPC_STUB IDependentOSMetadataEntry_get_MajorVersion_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_MinorVersion_Proxy(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ USHORT *__MIDL_0149);
-
-
-void __RPC_STUB IDependentOSMetadataEntry_get_MinorVersion_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_BuildNumber_Proxy(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ USHORT *__MIDL_0150);
-
-
-void __RPC_STUB IDependentOSMetadataEntry_get_BuildNumber_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_ServicePackMajor_Proxy(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0151);
-
-
-void __RPC_STUB IDependentOSMetadataEntry_get_ServicePackMajor_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_ServicePackMinor_Proxy(
- IDependentOSMetadataEntry * This,
- /* [retval][out] */ UCHAR *__MIDL_0152);
-
-
-void __RPC_STUB IDependentOSMetadataEntry_get_ServicePackMinor_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IDependentOSMetadataEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0303 */
-/* [local] */
-
-typedef struct _CompatibleFrameworksMetadataEntry
- {
- LPCWSTR SupportUrl;
- } CompatibleFrameworksMetadataEntry;
-
-typedef
-enum _CompatibleFrameworksMetadataEntryFieldId
- { CompatibleFrameworksMetadata_SupportUrl = 0
- } CompatibleFrameworksMetadataEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0303_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0303_v0_0_s_ifspec;
-
-#ifndef __ICompatibleFrameworksMetadataEntry_INTERFACE_DEFINED__
-#define __ICompatibleFrameworksMetadataEntry_INTERFACE_DEFINED__
-
-/* interface ICompatibleFrameworksMetadataEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ICompatibleFrameworksMetadataEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("4A33D662-2210-463A-BE9F-FBDF1AA554E3")
- ICompatibleFrameworksMetadataEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ CompatibleFrameworksMetadataEntry **__MIDL_0153) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportUrl(
- /* [retval][out] */ LPCWSTR *__MIDL_0154) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICompatibleFrameworksMetadataEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICompatibleFrameworksMetadataEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICompatibleFrameworksMetadataEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICompatibleFrameworksMetadataEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ICompatibleFrameworksMetadataEntry * This,
- /* [retval][out] */ CompatibleFrameworksMetadataEntry **__MIDL_0153);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportUrl )(
- ICompatibleFrameworksMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0154);
-
- END_INTERFACE
- } ICompatibleFrameworksMetadataEntryVtbl;
-
- interface ICompatibleFrameworksMetadataEntry
- {
- CONST_VTBL struct ICompatibleFrameworksMetadataEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICompatibleFrameworksMetadataEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICompatibleFrameworksMetadataEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICompatibleFrameworksMetadataEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICompatibleFrameworksMetadataEntry_get_AllData(This,__MIDL_0153) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0153)
-
-#define ICompatibleFrameworksMetadataEntry_get_SupportUrl(This,__MIDL_0154) \
- (This)->lpVtbl -> get_SupportUrl(This,__MIDL_0154)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworksMetadataEntry_get_AllData_Proxy(
- ICompatibleFrameworksMetadataEntry * This,
- /* [retval][out] */ CompatibleFrameworksMetadataEntry **__MIDL_0153);
-
-
-void __RPC_STUB ICompatibleFrameworksMetadataEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworksMetadataEntry_get_SupportUrl_Proxy(
- ICompatibleFrameworksMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0154);
-
-
-void __RPC_STUB ICompatibleFrameworksMetadataEntry_get_SupportUrl_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICompatibleFrameworksMetadataEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0304 */
-/* [local] */
-
-typedef struct _MetadataSectionEntry
- {
- ULONG SchemaVersion;
- ULONG ManifestFlags;
- ULONG UsagePatterns;
- IDefinitionIdentity *CdfIdentity;
- LPCWSTR LocalPath;
- ULONG HashAlgorithm;
- /* [size_is] */ BYTE *ManifestHash;
- ULONG ManifestHashSize;
- LPCWSTR ContentType;
- LPCWSTR RuntimeImageVersion;
- /* [size_is] */ BYTE *MvidValue;
- ULONG MvidValueSize;
- DescriptionMetadataEntry DescriptionData;
- DeploymentMetadataEntry DeploymentData;
- DependentOSMetadataEntry DependentOSData;
- LPCWSTR defaultPermissionSetID;
- LPCWSTR RequestedExecutionLevel;
- BOOLEAN RequestedExecutionLevelUIAccess;
- IReferenceIdentity *ResourceTypeResourcesDependency;
- IReferenceIdentity *ResourceTypeManifestResourcesDependency;
- LPCWSTR KeyInfoElement;
- CompatibleFrameworksMetadataEntry CompatibleFrameworksData;
- } MetadataSectionEntry;
-
-typedef
-enum _MetadataSectionEntryFieldId
- { MetadataSection_SchemaVersion = 0,
- MetadataSection_ManifestFlags = MetadataSection_SchemaVersion + 1,
- MetadataSection_UsagePatterns = MetadataSection_ManifestFlags + 1,
- MetadataSection_CdfIdentity = MetadataSection_UsagePatterns + 1,
- MetadataSection_LocalPath = MetadataSection_CdfIdentity + 1,
- MetadataSection_HashAlgorithm = MetadataSection_LocalPath + 1,
- MetadataSection_ManifestHash = MetadataSection_HashAlgorithm + 1,
- MetadataSection_ManifestHashSize = MetadataSection_ManifestHash + 1,
- MetadataSection_ContentType = MetadataSection_ManifestHashSize + 1,
- MetadataSection_RuntimeImageVersion = MetadataSection_ContentType + 1,
- MetadataSection_MvidValue = MetadataSection_RuntimeImageVersion + 1,
- MetadataSection_MvidValueSize = MetadataSection_MvidValue + 1,
- MetadataSection_DescriptionData = MetadataSection_MvidValueSize + 1,
- MetadataSection_DeploymentData = MetadataSection_DescriptionData + 1,
- MetadataSection_DependentOSData = MetadataSection_DeploymentData + 1,
- MetadataSection_defaultPermissionSetID = MetadataSection_DependentOSData + 1,
- MetadataSection_RequestedExecutionLevel = MetadataSection_defaultPermissionSetID + 1,
- MetadataSection_RequestedExecutionLevelUIAccess = MetadataSection_RequestedExecutionLevel + 1,
- MetadataSection_ResourceTypeResourcesDependency = MetadataSection_RequestedExecutionLevelUIAccess + 1,
- MetadataSection_ResourceTypeManifestResourcesDependency = MetadataSection_ResourceTypeResourcesDependency + 1,
- MetadataSection_KeyInfoElement = MetadataSection_ResourceTypeManifestResourcesDependency + 1,
- MetadataSection_CompatibleFrameworksData = MetadataSection_KeyInfoElement + 1
- } MetadataSectionEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0304_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0304_v0_0_s_ifspec;
-
-#ifndef __IMetadataSectionEntry_INTERFACE_DEFINED__
-#define __IMetadataSectionEntry_INTERFACE_DEFINED__
-
-/* interface IMetadataSectionEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IMetadataSectionEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("AB1ED79F-943E-407d-A80B-0744E3A95B28")
- IMetadataSectionEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ MetadataSectionEntry **__MIDL_0155) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SchemaVersion(
- /* [retval][out] */ ULONG *__MIDL_0156) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ManifestFlags(
- /* [retval][out] */ ULONG *__MIDL_0157) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UsagePatterns(
- /* [retval][out] */ ULONG *__MIDL_0158) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CdfIdentity(
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0159) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LocalPath(
- /* [retval][out] */ LPCWSTR *__MIDL_0160) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashAlgorithm(
- /* [retval][out] */ ULONG *__MIDL_0161) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ManifestHash(
- /* [retval][out] */ IStream **__MIDL_0162) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ContentType(
- /* [retval][out] */ LPCWSTR *__MIDL_0163) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RuntimeImageVersion(
- /* [retval][out] */ LPCWSTR *__MIDL_0164) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MvidValue(
- /* [retval][out] */ IStream **__MIDL_0165) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DescriptionData(
- /* [retval][out] */ IDescriptionMetadataEntry **__MIDL_0166) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DeploymentData(
- /* [retval][out] */ IDeploymentMetadataEntry **__MIDL_0167) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DependentOSData(
- /* [retval][out] */ IDependentOSMetadataEntry **__MIDL_0168) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_defaultPermissionSetID(
- /* [retval][out] */ LPCWSTR *__MIDL_0169) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RequestedExecutionLevel(
- /* [retval][out] */ LPCWSTR *__MIDL_0170) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RequestedExecutionLevelUIAccess(
- /* [retval][out] */ BOOLEAN *__MIDL_0171) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceTypeResourcesDependency(
- /* [retval][out] */ IReferenceIdentity **__MIDL_0172) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceTypeManifestResourcesDependency(
- /* [retval][out] */ IReferenceIdentity **__MIDL_0173) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KeyInfoElement(
- /* [retval][out] */ LPCWSTR *__MIDL_0174) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CompatibleFrameworksData(
- /* [retval][out] */ ICompatibleFrameworksMetadataEntry **__MIDL_0175) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IMetadataSectionEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IMetadataSectionEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IMetadataSectionEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IMetadataSectionEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ MetadataSectionEntry **__MIDL_0155);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SchemaVersion )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0156);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ManifestFlags )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0157);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UsagePatterns )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0158);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CdfIdentity )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0159);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LocalPath )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0160);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashAlgorithm )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0161);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ManifestHash )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IStream **__MIDL_0162);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ContentType )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0163);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RuntimeImageVersion )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0164);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MvidValue )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IStream **__MIDL_0165);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DescriptionData )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IDescriptionMetadataEntry **__MIDL_0166);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeploymentData )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IDeploymentMetadataEntry **__MIDL_0167);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DependentOSData )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IDependentOSMetadataEntry **__MIDL_0168);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_defaultPermissionSetID )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0169);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequestedExecutionLevel )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0170);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequestedExecutionLevelUIAccess )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ BOOLEAN *__MIDL_0171);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceTypeResourcesDependency )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IReferenceIdentity **__MIDL_0172);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceTypeManifestResourcesDependency )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IReferenceIdentity **__MIDL_0173);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KeyInfoElement )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0174);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CompatibleFrameworksData )(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ICompatibleFrameworksMetadataEntry **__MIDL_0175);
-
- END_INTERFACE
- } IMetadataSectionEntryVtbl;
-
- interface IMetadataSectionEntry
- {
- CONST_VTBL struct IMetadataSectionEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IMetadataSectionEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IMetadataSectionEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IMetadataSectionEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IMetadataSectionEntry_get_AllData(This,__MIDL_0155) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0155)
-
-#define IMetadataSectionEntry_get_SchemaVersion(This,__MIDL_0156) \
- (This)->lpVtbl -> get_SchemaVersion(This,__MIDL_0156)
-
-#define IMetadataSectionEntry_get_ManifestFlags(This,__MIDL_0157) \
- (This)->lpVtbl -> get_ManifestFlags(This,__MIDL_0157)
-
-#define IMetadataSectionEntry_get_UsagePatterns(This,__MIDL_0158) \
- (This)->lpVtbl -> get_UsagePatterns(This,__MIDL_0158)
-
-#define IMetadataSectionEntry_get_CdfIdentity(This,__MIDL_0159) \
- (This)->lpVtbl -> get_CdfIdentity(This,__MIDL_0159)
-
-#define IMetadataSectionEntry_get_LocalPath(This,__MIDL_0160) \
- (This)->lpVtbl -> get_LocalPath(This,__MIDL_0160)
-
-#define IMetadataSectionEntry_get_HashAlgorithm(This,__MIDL_0161) \
- (This)->lpVtbl -> get_HashAlgorithm(This,__MIDL_0161)
-
-#define IMetadataSectionEntry_get_ManifestHash(This,__MIDL_0162) \
- (This)->lpVtbl -> get_ManifestHash(This,__MIDL_0162)
-
-#define IMetadataSectionEntry_get_ContentType(This,__MIDL_0163) \
- (This)->lpVtbl -> get_ContentType(This,__MIDL_0163)
-
-#define IMetadataSectionEntry_get_RuntimeImageVersion(This,__MIDL_0164) \
- (This)->lpVtbl -> get_RuntimeImageVersion(This,__MIDL_0164)
-
-#define IMetadataSectionEntry_get_MvidValue(This,__MIDL_0165) \
- (This)->lpVtbl -> get_MvidValue(This,__MIDL_0165)
-
-#define IMetadataSectionEntry_get_DescriptionData(This,__MIDL_0166) \
- (This)->lpVtbl -> get_DescriptionData(This,__MIDL_0166)
-
-#define IMetadataSectionEntry_get_DeploymentData(This,__MIDL_0167) \
- (This)->lpVtbl -> get_DeploymentData(This,__MIDL_0167)
-
-#define IMetadataSectionEntry_get_DependentOSData(This,__MIDL_0168) \
- (This)->lpVtbl -> get_DependentOSData(This,__MIDL_0168)
-
-#define IMetadataSectionEntry_get_defaultPermissionSetID(This,__MIDL_0169) \
- (This)->lpVtbl -> get_defaultPermissionSetID(This,__MIDL_0169)
-
-#define IMetadataSectionEntry_get_RequestedExecutionLevel(This,__MIDL_0170) \
- (This)->lpVtbl -> get_RequestedExecutionLevel(This,__MIDL_0170)
-
-#define IMetadataSectionEntry_get_RequestedExecutionLevelUIAccess(This,__MIDL_0171) \
- (This)->lpVtbl -> get_RequestedExecutionLevelUIAccess(This,__MIDL_0171)
-
-#define IMetadataSectionEntry_get_ResourceTypeResourcesDependency(This,__MIDL_0172) \
- (This)->lpVtbl -> get_ResourceTypeResourcesDependency(This,__MIDL_0172)
-
-#define IMetadataSectionEntry_get_ResourceTypeManifestResourcesDependency(This,__MIDL_0173) \
- (This)->lpVtbl -> get_ResourceTypeManifestResourcesDependency(This,__MIDL_0173)
-
-#define IMetadataSectionEntry_get_KeyInfoElement(This,__MIDL_0174) \
- (This)->lpVtbl -> get_KeyInfoElement(This,__MIDL_0174)
-
-#define IMetadataSectionEntry_get_CompatibleFrameworksData(This,__MIDL_0175) \
- (This)->lpVtbl -> get_CompatibleFrameworksData(This,__MIDL_0175)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_AllData_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ MetadataSectionEntry **__MIDL_0155);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_SchemaVersion_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0156);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_SchemaVersion_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ManifestFlags_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0157);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_ManifestFlags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_UsagePatterns_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0158);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_UsagePatterns_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_CdfIdentity_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0159);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_CdfIdentity_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_LocalPath_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0160);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_LocalPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_HashAlgorithm_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0161);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_HashAlgorithm_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ManifestHash_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IStream **__MIDL_0162);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_ManifestHash_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ContentType_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0163);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_ContentType_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_RuntimeImageVersion_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0164);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_RuntimeImageVersion_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_MvidValue_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IStream **__MIDL_0165);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_MvidValue_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_DescriptionData_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IDescriptionMetadataEntry **__MIDL_0166);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_DescriptionData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_DeploymentData_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IDeploymentMetadataEntry **__MIDL_0167);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_DeploymentData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_DependentOSData_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IDependentOSMetadataEntry **__MIDL_0168);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_DependentOSData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_defaultPermissionSetID_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0169);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_defaultPermissionSetID_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_RequestedExecutionLevel_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0170);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_RequestedExecutionLevel_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_RequestedExecutionLevelUIAccess_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ BOOLEAN *__MIDL_0171);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_RequestedExecutionLevelUIAccess_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ResourceTypeResourcesDependency_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IReferenceIdentity **__MIDL_0172);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_ResourceTypeResourcesDependency_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ResourceTypeManifestResourcesDependency_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ IReferenceIdentity **__MIDL_0173);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_ResourceTypeManifestResourcesDependency_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_KeyInfoElement_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0174);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_KeyInfoElement_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_CompatibleFrameworksData_Proxy(
- IMetadataSectionEntry * This,
- /* [retval][out] */ ICompatibleFrameworksMetadataEntry **__MIDL_0175);
-
-
-void __RPC_STUB IMetadataSectionEntry_get_CompatibleFrameworksData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IMetadataSectionEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0305 */
-/* [local] */
-
-typedef struct _EventEntry
- {
- ULONG EventID;
- ULONG Level;
- ULONG Version;
- GUID Guid;
- LPCWSTR SubTypeName;
- ULONG SubTypeValue;
- LPCWSTR DisplayName;
- ULONG EventNameMicrodomIndex;
- } EventEntry;
-
-typedef
-enum _EventEntryFieldId
- { Event_Level = 0,
- Event_Version = Event_Level + 1,
- Event_Guid = Event_Version + 1,
- Event_SubTypeName = Event_Guid + 1,
- Event_SubTypeValue = Event_SubTypeName + 1,
- Event_DisplayName = Event_SubTypeValue + 1,
- Event_EventNameMicrodomIndex = Event_DisplayName + 1
- } EventEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0305_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0305_v0_0_s_ifspec;
-
-#ifndef __IEventEntry_INTERFACE_DEFINED__
-#define __IEventEntry_INTERFACE_DEFINED__
-
-/* interface IEventEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IEventEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8AD3FC86-AFD3-477a-8FD5-146C291195BB")
- IEventEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ EventEntry **__MIDL_0176) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventID(
- /* [retval][out] */ ULONG *__MIDL_0177) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Level(
- /* [retval][out] */ ULONG *__MIDL_0178) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Version(
- /* [retval][out] */ ULONG *__MIDL_0179) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Guid(
- /* [retval][out] */ GUID *__MIDL_0180) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubTypeName(
- /* [retval][out] */ LPCWSTR *__MIDL_0181) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubTypeValue(
- /* [retval][out] */ ULONG *__MIDL_0182) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DisplayName(
- /* [retval][out] */ LPCWSTR *__MIDL_0183) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventNameMicrodomIndex(
- /* [retval][out] */ ULONG *__MIDL_0184) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEventEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEventEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEventEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEventEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IEventEntry * This,
- /* [retval][out] */ EventEntry **__MIDL_0176);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventID )(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0177);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Level )(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0178);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Version )(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0179);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Guid )(
- IEventEntry * This,
- /* [retval][out] */ GUID *__MIDL_0180);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubTypeName )(
- IEventEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0181);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubTypeValue )(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0182);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayName )(
- IEventEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0183);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventNameMicrodomIndex )(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0184);
-
- END_INTERFACE
- } IEventEntryVtbl;
-
- interface IEventEntry
- {
- CONST_VTBL struct IEventEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEventEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEventEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEventEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEventEntry_get_AllData(This,__MIDL_0176) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0176)
-
-#define IEventEntry_get_EventID(This,__MIDL_0177) \
- (This)->lpVtbl -> get_EventID(This,__MIDL_0177)
-
-#define IEventEntry_get_Level(This,__MIDL_0178) \
- (This)->lpVtbl -> get_Level(This,__MIDL_0178)
-
-#define IEventEntry_get_Version(This,__MIDL_0179) \
- (This)->lpVtbl -> get_Version(This,__MIDL_0179)
-
-#define IEventEntry_get_Guid(This,__MIDL_0180) \
- (This)->lpVtbl -> get_Guid(This,__MIDL_0180)
-
-#define IEventEntry_get_SubTypeName(This,__MIDL_0181) \
- (This)->lpVtbl -> get_SubTypeName(This,__MIDL_0181)
-
-#define IEventEntry_get_SubTypeValue(This,__MIDL_0182) \
- (This)->lpVtbl -> get_SubTypeValue(This,__MIDL_0182)
-
-#define IEventEntry_get_DisplayName(This,__MIDL_0183) \
- (This)->lpVtbl -> get_DisplayName(This,__MIDL_0183)
-
-#define IEventEntry_get_EventNameMicrodomIndex(This,__MIDL_0184) \
- (This)->lpVtbl -> get_EventNameMicrodomIndex(This,__MIDL_0184)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_AllData_Proxy(
- IEventEntry * This,
- /* [retval][out] */ EventEntry **__MIDL_0176);
-
-
-void __RPC_STUB IEventEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_EventID_Proxy(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0177);
-
-
-void __RPC_STUB IEventEntry_get_EventID_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_Level_Proxy(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0178);
-
-
-void __RPC_STUB IEventEntry_get_Level_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_Version_Proxy(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0179);
-
-
-void __RPC_STUB IEventEntry_get_Version_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_Guid_Proxy(
- IEventEntry * This,
- /* [retval][out] */ GUID *__MIDL_0180);
-
-
-void __RPC_STUB IEventEntry_get_Guid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_SubTypeName_Proxy(
- IEventEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0181);
-
-
-void __RPC_STUB IEventEntry_get_SubTypeName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_SubTypeValue_Proxy(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0182);
-
-
-void __RPC_STUB IEventEntry_get_SubTypeValue_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_DisplayName_Proxy(
- IEventEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0183);
-
-
-void __RPC_STUB IEventEntry_get_DisplayName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_EventNameMicrodomIndex_Proxy(
- IEventEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0184);
-
-
-void __RPC_STUB IEventEntry_get_EventNameMicrodomIndex_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEventEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0306 */
-/* [local] */
-
-typedef struct _EventMapEntry
- {
- LPCWSTR MapName;
- LPCWSTR Name;
- ULONG Value;
- BOOLEAN IsValueMap;
- } EventMapEntry;
-
-typedef
-enum _EventMapEntryFieldId
- { EventMap_Name = 0,
- EventMap_Value = EventMap_Name + 1,
- EventMap_IsValueMap = EventMap_Value + 1
- } EventMapEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0306_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0306_v0_0_s_ifspec;
-
-#ifndef __IEventMapEntry_INTERFACE_DEFINED__
-#define __IEventMapEntry_INTERFACE_DEFINED__
-
-/* interface IEventMapEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IEventMapEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8AD3FC86-AFD3-477a-8FD5-146C291195BC")
- IEventMapEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ EventMapEntry **__MIDL_0185) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MapName(
- /* [retval][out] */ LPCWSTR *__MIDL_0186) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
- /* [retval][out] */ LPCWSTR *__MIDL_0187) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Value(
- /* [retval][out] */ ULONG *__MIDL_0188) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsValueMap(
- /* [retval][out] */ BOOLEAN *__MIDL_0189) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEventMapEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEventMapEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEventMapEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEventMapEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IEventMapEntry * This,
- /* [retval][out] */ EventMapEntry **__MIDL_0185);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MapName )(
- IEventMapEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0186);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
- IEventMapEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0187);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Value )(
- IEventMapEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0188);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsValueMap )(
- IEventMapEntry * This,
- /* [retval][out] */ BOOLEAN *__MIDL_0189);
-
- END_INTERFACE
- } IEventMapEntryVtbl;
-
- interface IEventMapEntry
- {
- CONST_VTBL struct IEventMapEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEventMapEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEventMapEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEventMapEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEventMapEntry_get_AllData(This,__MIDL_0185) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0185)
-
-#define IEventMapEntry_get_MapName(This,__MIDL_0186) \
- (This)->lpVtbl -> get_MapName(This,__MIDL_0186)
-
-#define IEventMapEntry_get_Name(This,__MIDL_0187) \
- (This)->lpVtbl -> get_Name(This,__MIDL_0187)
-
-#define IEventMapEntry_get_Value(This,__MIDL_0188) \
- (This)->lpVtbl -> get_Value(This,__MIDL_0188)
-
-#define IEventMapEntry_get_IsValueMap(This,__MIDL_0189) \
- (This)->lpVtbl -> get_IsValueMap(This,__MIDL_0189)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_AllData_Proxy(
- IEventMapEntry * This,
- /* [retval][out] */ EventMapEntry **__MIDL_0185);
-
-
-void __RPC_STUB IEventMapEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_MapName_Proxy(
- IEventMapEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0186);
-
-
-void __RPC_STUB IEventMapEntry_get_MapName_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_Name_Proxy(
- IEventMapEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0187);
-
-
-void __RPC_STUB IEventMapEntry_get_Name_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_Value_Proxy(
- IEventMapEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0188);
-
-
-void __RPC_STUB IEventMapEntry_get_Value_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_IsValueMap_Proxy(
- IEventMapEntry * This,
- /* [retval][out] */ BOOLEAN *__MIDL_0189);
-
-
-void __RPC_STUB IEventMapEntry_get_IsValueMap_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEventMapEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0307 */
-/* [local] */
-
-typedef struct _EventTagEntry
- {
- LPCWSTR TagData;
- ULONG EventID;
- } EventTagEntry;
-
-typedef
-enum _EventTagEntryFieldId
- { EventTag_EventID = 0
- } EventTagEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0307_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0307_v0_0_s_ifspec;
-
-#ifndef __IEventTagEntry_INTERFACE_DEFINED__
-#define __IEventTagEntry_INTERFACE_DEFINED__
-
-/* interface IEventTagEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IEventTagEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8AD3FC86-AFD3-477a-8FD5-146C291195BD")
- IEventTagEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ EventTagEntry **__MIDL_0190) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TagData(
- /* [retval][out] */ LPCWSTR *__MIDL_0191) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventID(
- /* [retval][out] */ ULONG *__MIDL_0192) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEventTagEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEventTagEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEventTagEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEventTagEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IEventTagEntry * This,
- /* [retval][out] */ EventTagEntry **__MIDL_0190);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TagData )(
- IEventTagEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0191);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventID )(
- IEventTagEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0192);
-
- END_INTERFACE
- } IEventTagEntryVtbl;
-
- interface IEventTagEntry
- {
- CONST_VTBL struct IEventTagEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEventTagEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEventTagEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEventTagEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEventTagEntry_get_AllData(This,__MIDL_0190) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0190)
-
-#define IEventTagEntry_get_TagData(This,__MIDL_0191) \
- (This)->lpVtbl -> get_TagData(This,__MIDL_0191)
-
-#define IEventTagEntry_get_EventID(This,__MIDL_0192) \
- (This)->lpVtbl -> get_EventID(This,__MIDL_0192)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventTagEntry_get_AllData_Proxy(
- IEventTagEntry * This,
- /* [retval][out] */ EventTagEntry **__MIDL_0190);
-
-
-void __RPC_STUB IEventTagEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventTagEntry_get_TagData_Proxy(
- IEventTagEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0191);
-
-
-void __RPC_STUB IEventTagEntry_get_TagData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IEventTagEntry_get_EventID_Proxy(
- IEventTagEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0192);
-
-
-void __RPC_STUB IEventTagEntry_get_EventID_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEventTagEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0308 */
-/* [local] */
-
-typedef struct _RegistryValueEntry
- {
- ULONG Flags;
- ULONG OperationHint;
- ULONG Type;
- LPCWSTR Value;
- LPCWSTR BuildFilter;
- } RegistryValueEntry;
-
-typedef
-enum _RegistryValueEntryFieldId
- { RegistryValue_Flags = 0,
- RegistryValue_OperationHint = RegistryValue_Flags + 1,
- RegistryValue_Type = RegistryValue_OperationHint + 1,
- RegistryValue_Value = RegistryValue_Type + 1,
- RegistryValue_BuildFilter = RegistryValue_Value + 1
- } RegistryValueEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0308_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0308_v0_0_s_ifspec;
-
-#ifndef __IRegistryValueEntry_INTERFACE_DEFINED__
-#define __IRegistryValueEntry_INTERFACE_DEFINED__
-
-/* interface IRegistryValueEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IRegistryValueEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("49e1fe8d-ebb8-4593-8c4e-3e14c845b142")
- IRegistryValueEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ RegistryValueEntry **__MIDL_0193) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
- /* [retval][out] */ ULONG *__MIDL_0194) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_OperationHint(
- /* [retval][out] */ ULONG *__MIDL_0195) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Type(
- /* [retval][out] */ ULONG *__MIDL_0196) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Value(
- /* [retval][out] */ LPCWSTR *__MIDL_0197) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildFilter(
- /* [retval][out] */ LPCWSTR *__MIDL_0198) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IRegistryValueEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IRegistryValueEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IRegistryValueEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IRegistryValueEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IRegistryValueEntry * This,
- /* [retval][out] */ RegistryValueEntry **__MIDL_0193);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
- IRegistryValueEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0194);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OperationHint )(
- IRegistryValueEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0195);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Type )(
- IRegistryValueEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0196);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Value )(
- IRegistryValueEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0197);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildFilter )(
- IRegistryValueEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0198);
-
- END_INTERFACE
- } IRegistryValueEntryVtbl;
-
- interface IRegistryValueEntry
- {
- CONST_VTBL struct IRegistryValueEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IRegistryValueEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IRegistryValueEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IRegistryValueEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IRegistryValueEntry_get_AllData(This,__MIDL_0193) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0193)
-
-#define IRegistryValueEntry_get_Flags(This,__MIDL_0194) \
- (This)->lpVtbl -> get_Flags(This,__MIDL_0194)
-
-#define IRegistryValueEntry_get_OperationHint(This,__MIDL_0195) \
- (This)->lpVtbl -> get_OperationHint(This,__MIDL_0195)
-
-#define IRegistryValueEntry_get_Type(This,__MIDL_0196) \
- (This)->lpVtbl -> get_Type(This,__MIDL_0196)
-
-#define IRegistryValueEntry_get_Value(This,__MIDL_0197) \
- (This)->lpVtbl -> get_Value(This,__MIDL_0197)
-
-#define IRegistryValueEntry_get_BuildFilter(This,__MIDL_0198) \
- (This)->lpVtbl -> get_BuildFilter(This,__MIDL_0198)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_AllData_Proxy(
- IRegistryValueEntry * This,
- /* [retval][out] */ RegistryValueEntry **__MIDL_0193);
-
-
-void __RPC_STUB IRegistryValueEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_Flags_Proxy(
- IRegistryValueEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0194);
-
-
-void __RPC_STUB IRegistryValueEntry_get_Flags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_OperationHint_Proxy(
- IRegistryValueEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0195);
-
-
-void __RPC_STUB IRegistryValueEntry_get_OperationHint_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_Type_Proxy(
- IRegistryValueEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0196);
-
-
-void __RPC_STUB IRegistryValueEntry_get_Type_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_Value_Proxy(
- IRegistryValueEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0197);
-
-
-void __RPC_STUB IRegistryValueEntry_get_Value_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_BuildFilter_Proxy(
- IRegistryValueEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0198);
-
-
-void __RPC_STUB IRegistryValueEntry_get_BuildFilter_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IRegistryValueEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0309 */
-/* [local] */
-
-typedef struct _RegistryKeyEntry
- {
- ULONG Flags;
- ULONG Protection;
- LPCWSTR BuildFilter;
- /* [size_is] */ BYTE *SecurityDescriptor;
- ULONG SecurityDescriptorSize;
- /* [size_is] */ BYTE *Values;
- ULONG ValuesSize;
- /* [size_is] */ BYTE *Keys;
- ULONG KeysSize;
- } RegistryKeyEntry;
-
-typedef
-enum _RegistryKeyEntryFieldId
- { RegistryKey_Flags = 0,
- RegistryKey_Protection = RegistryKey_Flags + 1,
- RegistryKey_BuildFilter = RegistryKey_Protection + 1,
- RegistryKey_SecurityDescriptor = RegistryKey_BuildFilter + 1,
- RegistryKey_SecurityDescriptorSize = RegistryKey_SecurityDescriptor + 1,
- RegistryKey_Values = RegistryKey_SecurityDescriptorSize + 1,
- RegistryKey_ValuesSize = RegistryKey_Values + 1,
- RegistryKey_Keys = RegistryKey_ValuesSize + 1,
- RegistryKey_KeysSize = RegistryKey_Keys + 1
- } RegistryKeyEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0309_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0309_v0_0_s_ifspec;
-
-#ifndef __IRegistryKeyEntry_INTERFACE_DEFINED__
-#define __IRegistryKeyEntry_INTERFACE_DEFINED__
-
-/* interface IRegistryKeyEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IRegistryKeyEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("186685d1-6673-48c3-bc83-95859bb591df")
- IRegistryKeyEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ RegistryKeyEntry **__MIDL_0199) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
- /* [retval][out] */ ULONG *__MIDL_0200) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Protection(
- /* [retval][out] */ ULONG *__MIDL_0201) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildFilter(
- /* [retval][out] */ LPCWSTR *__MIDL_0202) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SecurityDescriptor(
- /* [retval][out] */ IStream **__MIDL_0203) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Values(
- /* [retval][out] */ IStream **__MIDL_0204) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Keys(
- /* [retval][out] */ IStream **__MIDL_0205) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IRegistryKeyEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IRegistryKeyEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IRegistryKeyEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IRegistryKeyEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IRegistryKeyEntry * This,
- /* [retval][out] */ RegistryKeyEntry **__MIDL_0199);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
- IRegistryKeyEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0200);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Protection )(
- IRegistryKeyEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0201);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildFilter )(
- IRegistryKeyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0202);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SecurityDescriptor )(
- IRegistryKeyEntry * This,
- /* [retval][out] */ IStream **__MIDL_0203);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Values )(
- IRegistryKeyEntry * This,
- /* [retval][out] */ IStream **__MIDL_0204);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Keys )(
- IRegistryKeyEntry * This,
- /* [retval][out] */ IStream **__MIDL_0205);
-
- END_INTERFACE
- } IRegistryKeyEntryVtbl;
-
- interface IRegistryKeyEntry
- {
- CONST_VTBL struct IRegistryKeyEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IRegistryKeyEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IRegistryKeyEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IRegistryKeyEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IRegistryKeyEntry_get_AllData(This,__MIDL_0199) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0199)
-
-#define IRegistryKeyEntry_get_Flags(This,__MIDL_0200) \
- (This)->lpVtbl -> get_Flags(This,__MIDL_0200)
-
-#define IRegistryKeyEntry_get_Protection(This,__MIDL_0201) \
- (This)->lpVtbl -> get_Protection(This,__MIDL_0201)
-
-#define IRegistryKeyEntry_get_BuildFilter(This,__MIDL_0202) \
- (This)->lpVtbl -> get_BuildFilter(This,__MIDL_0202)
-
-#define IRegistryKeyEntry_get_SecurityDescriptor(This,__MIDL_0203) \
- (This)->lpVtbl -> get_SecurityDescriptor(This,__MIDL_0203)
-
-#define IRegistryKeyEntry_get_Values(This,__MIDL_0204) \
- (This)->lpVtbl -> get_Values(This,__MIDL_0204)
-
-#define IRegistryKeyEntry_get_Keys(This,__MIDL_0205) \
- (This)->lpVtbl -> get_Keys(This,__MIDL_0205)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_AllData_Proxy(
- IRegistryKeyEntry * This,
- /* [retval][out] */ RegistryKeyEntry **__MIDL_0199);
-
-
-void __RPC_STUB IRegistryKeyEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_Flags_Proxy(
- IRegistryKeyEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0200);
-
-
-void __RPC_STUB IRegistryKeyEntry_get_Flags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_Protection_Proxy(
- IRegistryKeyEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0201);
-
-
-void __RPC_STUB IRegistryKeyEntry_get_Protection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_BuildFilter_Proxy(
- IRegistryKeyEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0202);
-
-
-void __RPC_STUB IRegistryKeyEntry_get_BuildFilter_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_SecurityDescriptor_Proxy(
- IRegistryKeyEntry * This,
- /* [retval][out] */ IStream **__MIDL_0203);
-
-
-void __RPC_STUB IRegistryKeyEntry_get_SecurityDescriptor_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_Values_Proxy(
- IRegistryKeyEntry * This,
- /* [retval][out] */ IStream **__MIDL_0204);
-
-
-void __RPC_STUB IRegistryKeyEntry_get_Values_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_Keys_Proxy(
- IRegistryKeyEntry * This,
- /* [retval][out] */ IStream **__MIDL_0205);
-
-
-void __RPC_STUB IRegistryKeyEntry_get_Keys_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IRegistryKeyEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0310 */
-/* [local] */
-
-typedef struct _DirectoryEntry
- {
- ULONG Flags;
- ULONG Protection;
- LPCWSTR BuildFilter;
- /* [size_is] */ BYTE *SecurityDescriptor;
- ULONG SecurityDescriptorSize;
- } DirectoryEntry;
-
-typedef
-enum _DirectoryEntryFieldId
- { Directory_Flags = 0,
- Directory_Protection = Directory_Flags + 1,
- Directory_BuildFilter = Directory_Protection + 1,
- Directory_SecurityDescriptor = Directory_BuildFilter + 1,
- Directory_SecurityDescriptorSize = Directory_SecurityDescriptor + 1
- } DirectoryEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0310_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0310_v0_0_s_ifspec;
-
-#ifndef __IDirectoryEntry_INTERFACE_DEFINED__
-#define __IDirectoryEntry_INTERFACE_DEFINED__
-
-/* interface IDirectoryEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IDirectoryEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("9f27c750-7dfb-46a1-a673-52e53e2337a9")
- IDirectoryEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ DirectoryEntry **__MIDL_0206) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
- /* [retval][out] */ ULONG *__MIDL_0207) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Protection(
- /* [retval][out] */ ULONG *__MIDL_0208) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildFilter(
- /* [retval][out] */ LPCWSTR *__MIDL_0209) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SecurityDescriptor(
- /* [retval][out] */ IStream **__MIDL_0210) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IDirectoryEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IDirectoryEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IDirectoryEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IDirectoryEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IDirectoryEntry * This,
- /* [retval][out] */ DirectoryEntry **__MIDL_0206);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
- IDirectoryEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0207);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Protection )(
- IDirectoryEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0208);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildFilter )(
- IDirectoryEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0209);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SecurityDescriptor )(
- IDirectoryEntry * This,
- /* [retval][out] */ IStream **__MIDL_0210);
-
- END_INTERFACE
- } IDirectoryEntryVtbl;
-
- interface IDirectoryEntry
- {
- CONST_VTBL struct IDirectoryEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IDirectoryEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IDirectoryEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IDirectoryEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IDirectoryEntry_get_AllData(This,__MIDL_0206) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0206)
-
-#define IDirectoryEntry_get_Flags(This,__MIDL_0207) \
- (This)->lpVtbl -> get_Flags(This,__MIDL_0207)
-
-#define IDirectoryEntry_get_Protection(This,__MIDL_0208) \
- (This)->lpVtbl -> get_Protection(This,__MIDL_0208)
-
-#define IDirectoryEntry_get_BuildFilter(This,__MIDL_0209) \
- (This)->lpVtbl -> get_BuildFilter(This,__MIDL_0209)
-
-#define IDirectoryEntry_get_SecurityDescriptor(This,__MIDL_0210) \
- (This)->lpVtbl -> get_SecurityDescriptor(This,__MIDL_0210)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_AllData_Proxy(
- IDirectoryEntry * This,
- /* [retval][out] */ DirectoryEntry **__MIDL_0206);
-
-
-void __RPC_STUB IDirectoryEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_Flags_Proxy(
- IDirectoryEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0207);
-
-
-void __RPC_STUB IDirectoryEntry_get_Flags_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_Protection_Proxy(
- IDirectoryEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0208);
-
-
-void __RPC_STUB IDirectoryEntry_get_Protection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_BuildFilter_Proxy(
- IDirectoryEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0209);
-
-
-void __RPC_STUB IDirectoryEntry_get_BuildFilter_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_SecurityDescriptor_Proxy(
- IDirectoryEntry * This,
- /* [retval][out] */ IStream **__MIDL_0210);
-
-
-void __RPC_STUB IDirectoryEntry_get_SecurityDescriptor_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IDirectoryEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0311 */
-/* [local] */
-
-typedef struct _SecurityDescriptorReferenceEntry
- {
- LPCWSTR Name;
- LPCWSTR BuildFilter;
- } SecurityDescriptorReferenceEntry;
-
-typedef
-enum _SecurityDescriptorReferenceEntryFieldId
- { SecurityDescriptorReference_Name = 0,
- SecurityDescriptorReference_BuildFilter = SecurityDescriptorReference_Name + 1
- } SecurityDescriptorReferenceEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0311_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0311_v0_0_s_ifspec;
-
-#ifndef __ISecurityDescriptorReferenceEntry_INTERFACE_DEFINED__
-#define __ISecurityDescriptorReferenceEntry_INTERFACE_DEFINED__
-
-/* interface ISecurityDescriptorReferenceEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ISecurityDescriptorReferenceEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("a75b74e9-2c00-4ebb-b3f9-62a670aaa07e")
- ISecurityDescriptorReferenceEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ SecurityDescriptorReferenceEntry **__MIDL_0211) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
- /* [retval][out] */ LPCWSTR *__MIDL_0212) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildFilter(
- /* [retval][out] */ LPCWSTR *__MIDL_0213) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ISecurityDescriptorReferenceEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ISecurityDescriptorReferenceEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ISecurityDescriptorReferenceEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ISecurityDescriptorReferenceEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ISecurityDescriptorReferenceEntry * This,
- /* [retval][out] */ SecurityDescriptorReferenceEntry **__MIDL_0211);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
- ISecurityDescriptorReferenceEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0212);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildFilter )(
- ISecurityDescriptorReferenceEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0213);
-
- END_INTERFACE
- } ISecurityDescriptorReferenceEntryVtbl;
-
- interface ISecurityDescriptorReferenceEntry
- {
- CONST_VTBL struct ISecurityDescriptorReferenceEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ISecurityDescriptorReferenceEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ISecurityDescriptorReferenceEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ISecurityDescriptorReferenceEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ISecurityDescriptorReferenceEntry_get_AllData(This,__MIDL_0211) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0211)
-
-#define ISecurityDescriptorReferenceEntry_get_Name(This,__MIDL_0212) \
- (This)->lpVtbl -> get_Name(This,__MIDL_0212)
-
-#define ISecurityDescriptorReferenceEntry_get_BuildFilter(This,__MIDL_0213) \
- (This)->lpVtbl -> get_BuildFilter(This,__MIDL_0213)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISecurityDescriptorReferenceEntry_get_AllData_Proxy(
- ISecurityDescriptorReferenceEntry * This,
- /* [retval][out] */ SecurityDescriptorReferenceEntry **__MIDL_0211);
-
-
-void __RPC_STUB ISecurityDescriptorReferenceEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISecurityDescriptorReferenceEntry_get_Name_Proxy(
- ISecurityDescriptorReferenceEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0212);
-
-
-void __RPC_STUB ISecurityDescriptorReferenceEntry_get_Name_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ISecurityDescriptorReferenceEntry_get_BuildFilter_Proxy(
- ISecurityDescriptorReferenceEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0213);
-
-
-void __RPC_STUB ISecurityDescriptorReferenceEntry_get_BuildFilter_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ISecurityDescriptorReferenceEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0312 */
-/* [local] */
-
-typedef struct _CounterSetEntry
- {
- GUID CounterSetGuid;
- GUID ProviderGuid;
- LPCWSTR Name;
- LPCWSTR Description;
- BOOLEAN InstanceType;
- } CounterSetEntry;
-
-typedef
-enum _CounterSetEntryFieldId
- { CounterSet_ProviderGuid = 0,
- CounterSet_Name = CounterSet_ProviderGuid + 1,
- CounterSet_Description = CounterSet_Name + 1,
- CounterSet_InstanceType = CounterSet_Description + 1
- } CounterSetEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0312_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0312_v0_0_s_ifspec;
-
-#ifndef __ICounterSetEntry_INTERFACE_DEFINED__
-#define __ICounterSetEntry_INTERFACE_DEFINED__
-
-/* interface ICounterSetEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ICounterSetEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8CD3FC85-AFD3-477a-8FD5-146C291195BB")
- ICounterSetEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ CounterSetEntry **__MIDL_0214) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterSetGuid(
- /* [retval][out] */ GUID *__MIDL_0215) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProviderGuid(
- /* [retval][out] */ GUID *__MIDL_0216) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
- /* [retval][out] */ LPCWSTR *__MIDL_0217) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
- /* [retval][out] */ LPCWSTR *__MIDL_0218) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InstanceType(
- /* [retval][out] */ BOOLEAN *__MIDL_0219) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICounterSetEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICounterSetEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICounterSetEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICounterSetEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ICounterSetEntry * This,
- /* [retval][out] */ CounterSetEntry **__MIDL_0214);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterSetGuid )(
- ICounterSetEntry * This,
- /* [retval][out] */ GUID *__MIDL_0215);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProviderGuid )(
- ICounterSetEntry * This,
- /* [retval][out] */ GUID *__MIDL_0216);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
- ICounterSetEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0217);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
- ICounterSetEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0218);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InstanceType )(
- ICounterSetEntry * This,
- /* [retval][out] */ BOOLEAN *__MIDL_0219);
-
- END_INTERFACE
- } ICounterSetEntryVtbl;
-
- interface ICounterSetEntry
- {
- CONST_VTBL struct ICounterSetEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICounterSetEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICounterSetEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICounterSetEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICounterSetEntry_get_AllData(This,__MIDL_0214) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0214)
-
-#define ICounterSetEntry_get_CounterSetGuid(This,__MIDL_0215) \
- (This)->lpVtbl -> get_CounterSetGuid(This,__MIDL_0215)
-
-#define ICounterSetEntry_get_ProviderGuid(This,__MIDL_0216) \
- (This)->lpVtbl -> get_ProviderGuid(This,__MIDL_0216)
-
-#define ICounterSetEntry_get_Name(This,__MIDL_0217) \
- (This)->lpVtbl -> get_Name(This,__MIDL_0217)
-
-#define ICounterSetEntry_get_Description(This,__MIDL_0218) \
- (This)->lpVtbl -> get_Description(This,__MIDL_0218)
-
-#define ICounterSetEntry_get_InstanceType(This,__MIDL_0219) \
- (This)->lpVtbl -> get_InstanceType(This,__MIDL_0219)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_AllData_Proxy(
- ICounterSetEntry * This,
- /* [retval][out] */ CounterSetEntry **__MIDL_0214);
-
-
-void __RPC_STUB ICounterSetEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_CounterSetGuid_Proxy(
- ICounterSetEntry * This,
- /* [retval][out] */ GUID *__MIDL_0215);
-
-
-void __RPC_STUB ICounterSetEntry_get_CounterSetGuid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_ProviderGuid_Proxy(
- ICounterSetEntry * This,
- /* [retval][out] */ GUID *__MIDL_0216);
-
-
-void __RPC_STUB ICounterSetEntry_get_ProviderGuid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_Name_Proxy(
- ICounterSetEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0217);
-
-
-void __RPC_STUB ICounterSetEntry_get_Name_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_Description_Proxy(
- ICounterSetEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0218);
-
-
-void __RPC_STUB ICounterSetEntry_get_Description_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_InstanceType_Proxy(
- ICounterSetEntry * This,
- /* [retval][out] */ BOOLEAN *__MIDL_0219);
-
-
-void __RPC_STUB ICounterSetEntry_get_InstanceType_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICounterSetEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0313 */
-/* [local] */
-
-typedef struct _CounterEntry
- {
- GUID CounterSetGuid;
- ULONG CounterId;
- LPCWSTR Name;
- LPCWSTR Description;
- ULONG CounterType;
- ULONGLONG Attributes;
- ULONG BaseId;
- ULONG DefaultScale;
- } CounterEntry;
-
-typedef
-enum _CounterEntryFieldId
- { Counter_CounterId = 0,
- Counter_Name = Counter_CounterId + 1,
- Counter_Description = Counter_Name + 1,
- Counter_CounterType = Counter_Description + 1,
- Counter_Attributes = Counter_CounterType + 1,
- Counter_BaseId = Counter_Attributes + 1,
- Counter_DefaultScale = Counter_BaseId + 1
- } CounterEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0313_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0313_v0_0_s_ifspec;
-
-#ifndef __ICounterEntry_INTERFACE_DEFINED__
-#define __ICounterEntry_INTERFACE_DEFINED__
-
-/* interface ICounterEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ICounterEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8CD3FC86-AFD3-477a-8FD5-146C291195BB")
- ICounterEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ CounterEntry **__MIDL_0220) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterSetGuid(
- /* [retval][out] */ GUID *__MIDL_0221) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterId(
- /* [retval][out] */ ULONG *__MIDL_0222) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
- /* [retval][out] */ LPCWSTR *__MIDL_0223) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
- /* [retval][out] */ LPCWSTR *__MIDL_0224) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterType(
- /* [retval][out] */ ULONG *__MIDL_0225) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Attributes(
- /* [retval][out] */ ULONGLONG *__MIDL_0226) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BaseId(
- /* [retval][out] */ ULONG *__MIDL_0227) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DefaultScale(
- /* [retval][out] */ ULONG *__MIDL_0228) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICounterEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICounterEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICounterEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICounterEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ICounterEntry * This,
- /* [retval][out] */ CounterEntry **__MIDL_0220);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterSetGuid )(
- ICounterEntry * This,
- /* [retval][out] */ GUID *__MIDL_0221);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterId )(
- ICounterEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0222);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
- ICounterEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0223);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
- ICounterEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0224);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterType )(
- ICounterEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0225);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Attributes )(
- ICounterEntry * This,
- /* [retval][out] */ ULONGLONG *__MIDL_0226);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BaseId )(
- ICounterEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0227);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DefaultScale )(
- ICounterEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0228);
-
- END_INTERFACE
- } ICounterEntryVtbl;
-
- interface ICounterEntry
- {
- CONST_VTBL struct ICounterEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICounterEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICounterEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICounterEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICounterEntry_get_AllData(This,__MIDL_0220) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0220)
-
-#define ICounterEntry_get_CounterSetGuid(This,__MIDL_0221) \
- (This)->lpVtbl -> get_CounterSetGuid(This,__MIDL_0221)
-
-#define ICounterEntry_get_CounterId(This,__MIDL_0222) \
- (This)->lpVtbl -> get_CounterId(This,__MIDL_0222)
-
-#define ICounterEntry_get_Name(This,__MIDL_0223) \
- (This)->lpVtbl -> get_Name(This,__MIDL_0223)
-
-#define ICounterEntry_get_Description(This,__MIDL_0224) \
- (This)->lpVtbl -> get_Description(This,__MIDL_0224)
-
-#define ICounterEntry_get_CounterType(This,__MIDL_0225) \
- (This)->lpVtbl -> get_CounterType(This,__MIDL_0225)
-
-#define ICounterEntry_get_Attributes(This,__MIDL_0226) \
- (This)->lpVtbl -> get_Attributes(This,__MIDL_0226)
-
-#define ICounterEntry_get_BaseId(This,__MIDL_0227) \
- (This)->lpVtbl -> get_BaseId(This,__MIDL_0227)
-
-#define ICounterEntry_get_DefaultScale(This,__MIDL_0228) \
- (This)->lpVtbl -> get_DefaultScale(This,__MIDL_0228)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_AllData_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ CounterEntry **__MIDL_0220);
-
-
-void __RPC_STUB ICounterEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_CounterSetGuid_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ GUID *__MIDL_0221);
-
-
-void __RPC_STUB ICounterEntry_get_CounterSetGuid_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_CounterId_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0222);
-
-
-void __RPC_STUB ICounterEntry_get_CounterId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_Name_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0223);
-
-
-void __RPC_STUB ICounterEntry_get_Name_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_Description_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0224);
-
-
-void __RPC_STUB ICounterEntry_get_Description_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_CounterType_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0225);
-
-
-void __RPC_STUB ICounterEntry_get_CounterType_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_Attributes_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ ULONGLONG *__MIDL_0226);
-
-
-void __RPC_STUB ICounterEntry_get_Attributes_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_BaseId_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0227);
-
-
-void __RPC_STUB ICounterEntry_get_BaseId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_DefaultScale_Proxy(
- ICounterEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0228);
-
-
-void __RPC_STUB ICounterEntry_get_DefaultScale_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICounterEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0314 */
-/* [local] */
-
-typedef struct _CompatibleFrameworkEntry
- {
- ULONG index;
- LPCWSTR TargetVersion;
- LPCWSTR Profile;
- LPCWSTR SupportedRuntime;
- } CompatibleFrameworkEntry;
-
-typedef
-enum _CompatibleFrameworkEntryFieldId
- { CompatibleFramework_TargetVersion = 0,
- CompatibleFramework_Profile = CompatibleFramework_TargetVersion + 1,
- CompatibleFramework_SupportedRuntime = CompatibleFramework_Profile + 1
- } CompatibleFrameworkEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0314_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0314_v0_0_s_ifspec;
-
-#ifndef __ICompatibleFrameworkEntry_INTERFACE_DEFINED__
-#define __ICompatibleFrameworkEntry_INTERFACE_DEFINED__
-
-/* interface ICompatibleFrameworkEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_ICompatibleFrameworkEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("C98BFE2A-62C9-40AD-ADCE-A9037BE2BE6C")
- ICompatibleFrameworkEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ CompatibleFrameworkEntry **__MIDL_0229) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_index(
- /* [retval][out] */ ULONG *__MIDL_0230) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TargetVersion(
- /* [retval][out] */ LPCWSTR *__MIDL_0231) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Profile(
- /* [retval][out] */ LPCWSTR *__MIDL_0232) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportedRuntime(
- /* [retval][out] */ LPCWSTR *__MIDL_0233) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct ICompatibleFrameworkEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- ICompatibleFrameworkEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- ICompatibleFrameworkEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- ICompatibleFrameworkEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ CompatibleFrameworkEntry **__MIDL_0229);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_index )(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0230);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TargetVersion )(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0231);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Profile )(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0232);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportedRuntime )(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0233);
-
- END_INTERFACE
- } ICompatibleFrameworkEntryVtbl;
-
- interface ICompatibleFrameworkEntry
- {
- CONST_VTBL struct ICompatibleFrameworkEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define ICompatibleFrameworkEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define ICompatibleFrameworkEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define ICompatibleFrameworkEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define ICompatibleFrameworkEntry_get_AllData(This,__MIDL_0229) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0229)
-
-#define ICompatibleFrameworkEntry_get_index(This,__MIDL_0230) \
- (This)->lpVtbl -> get_index(This,__MIDL_0230)
-
-#define ICompatibleFrameworkEntry_get_TargetVersion(This,__MIDL_0231) \
- (This)->lpVtbl -> get_TargetVersion(This,__MIDL_0231)
-
-#define ICompatibleFrameworkEntry_get_Profile(This,__MIDL_0232) \
- (This)->lpVtbl -> get_Profile(This,__MIDL_0232)
-
-#define ICompatibleFrameworkEntry_get_SupportedRuntime(This,__MIDL_0233) \
- (This)->lpVtbl -> get_SupportedRuntime(This,__MIDL_0233)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_AllData_Proxy(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ CompatibleFrameworkEntry **__MIDL_0229);
-
-
-void __RPC_STUB ICompatibleFrameworkEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_index_Proxy(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0230);
-
-
-void __RPC_STUB ICompatibleFrameworkEntry_get_index_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_TargetVersion_Proxy(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0231);
-
-
-void __RPC_STUB ICompatibleFrameworkEntry_get_TargetVersion_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_Profile_Proxy(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0232);
-
-
-void __RPC_STUB ICompatibleFrameworkEntry_get_Profile_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_SupportedRuntime_Proxy(
- ICompatibleFrameworkEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0233);
-
-
-void __RPC_STUB ICompatibleFrameworkEntry_get_SupportedRuntime_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __ICompatibleFrameworkEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0315 */
-/* [local] */
-
-HRESULT FreeMuiResourceIdLookupMapEntry(
- /* [in] */ MuiResourceIdLookupMapEntry *__MIDL_0234);
-
-HRESULT FreeMuiResourceTypeIdStringEntry(
- /* [in] */ MuiResourceTypeIdStringEntry *__MIDL_0235);
-
-HRESULT FreeMuiResourceTypeIdIntEntry(
- /* [in] */ MuiResourceTypeIdIntEntry *__MIDL_0236);
-
-HRESULT FreeMuiResourceMapEntry(
- /* [in] */ MuiResourceMapEntry *__MIDL_0237);
-
-HRESULT FreeHashElementEntry(
- /* [in] */ HashElementEntry *__MIDL_0238);
-
-HRESULT FreeFileEntry(
- /* [in] */ FileEntry *__MIDL_0239);
-
-HRESULT FreeFileAssociationEntry(
- /* [in] */ FileAssociationEntry *__MIDL_0240);
-
-HRESULT FreeCategoryMembershipDataEntry(
- /* [in] */ CategoryMembershipDataEntry *__MIDL_0241);
-
-HRESULT FreeSubcategoryMembershipEntry(
- /* [in] */ SubcategoryMembershipEntry *__MIDL_0242);
-
-HRESULT FreeCategoryMembershipEntry(
- /* [in] */ CategoryMembershipEntry *__MIDL_0243);
-
-HRESULT FreeCOMServerEntry(
- /* [in] */ COMServerEntry *__MIDL_0244);
-
-HRESULT FreeProgIdRedirectionEntry(
- /* [in] */ ProgIdRedirectionEntry *__MIDL_0245);
-
-HRESULT FreeCLRSurrogateEntry(
- /* [in] */ CLRSurrogateEntry *__MIDL_0246);
-
-HRESULT FreeAssemblyReferenceDependentAssemblyEntry(
- /* [in] */ AssemblyReferenceDependentAssemblyEntry *__MIDL_0247);
-
-HRESULT FreeAssemblyReferenceEntry(
- /* [in] */ AssemblyReferenceEntry *__MIDL_0248);
-
-HRESULT FreeWindowClassEntry(
- /* [in] */ WindowClassEntry *__MIDL_0249);
-
-HRESULT FreeResourceTableMappingEntry(
- /* [in] */ ResourceTableMappingEntry *__MIDL_0250);
-
-HRESULT FreeEntryPointEntry(
- /* [in] */ EntryPointEntry *__MIDL_0251);
-
-HRESULT FreePermissionSetEntry(
- /* [in] */ PermissionSetEntry *__MIDL_0252);
-
-HRESULT FreeAssemblyRequestEntry(
- /* [in] */ AssemblyRequestEntry *__MIDL_0253);
-
-HRESULT FreeDescriptionMetadataEntry(
- /* [in] */ DescriptionMetadataEntry *__MIDL_0254);
-
-HRESULT FreeDeploymentMetadataEntry(
- /* [in] */ DeploymentMetadataEntry *__MIDL_0255);
-
-HRESULT FreeDependentOSMetadataEntry(
- /* [in] */ DependentOSMetadataEntry *__MIDL_0256);
-
-HRESULT FreeCompatibleFrameworksMetadataEntry(
- /* [in] */ CompatibleFrameworksMetadataEntry *__MIDL_0257);
-
-HRESULT FreeMetadataSectionEntry(
- /* [in] */ MetadataSectionEntry *__MIDL_0258);
-
-HRESULT FreeEventEntry(
- /* [in] */ EventEntry *__MIDL_0259);
-
-HRESULT FreeEventMapEntry(
- /* [in] */ EventMapEntry *__MIDL_0260);
-
-HRESULT FreeEventTagEntry(
- /* [in] */ EventTagEntry *__MIDL_0261);
-
-HRESULT FreeRegistryValueEntry(
- /* [in] */ RegistryValueEntry *__MIDL_0262);
-
-HRESULT FreeRegistryKeyEntry(
- /* [in] */ RegistryKeyEntry *__MIDL_0263);
-
-HRESULT FreeDirectoryEntry(
- /* [in] */ DirectoryEntry *__MIDL_0264);
-
-HRESULT FreeSecurityDescriptorReferenceEntry(
- /* [in] */ SecurityDescriptorReferenceEntry *__MIDL_0265);
-
-HRESULT FreeCounterSetEntry(
- /* [in] */ CounterSetEntry *__MIDL_0266);
-
-HRESULT FreeCounterEntry(
- /* [in] */ CounterEntry *__MIDL_0267);
-
-HRESULT FreeCompatibleFrameworkEntry(
- /* [in] */ CompatibleFrameworkEntry *__MIDL_0268);
-
-typedef
-enum _ACSSECTIONID
- { ACSSECTIONID_COMPONENTS_SECTION = 1,
- ACSSECTIONID_MEMBER_LOOKUP_SECTION = 2,
- ACSSECTIONID_METADATA_SECTION = 3,
- ACSSECTIONID_STORE_COHERENCY_SECTION = 4
- } ACSSECTIONID;
-
-
-
-
-
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0315_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0315_v0_0_s_ifspec;
-
-#ifndef __IACS_INTERFACE_DEFINED__
-#define __IACS_INTERFACE_DEFINED__
-
-/* interface IACS */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IACS;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("323f59af-4ab7-45a7-9e95-630cdfacef9c")
- IACS : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
- /* [retval][out] */ IDefinitionAppId **__MIDL_0269) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ComponentsSection(
- /* [retval][out] */ ISection **__MIDL_0270) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MemberLookupSection(
- /* [retval][out] */ ISection **__MIDL_0271) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MetadataSection(
- /* [retval][out] */ ISection **__MIDL_0272) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StoreCoherencySection(
- /* [retval][out] */ ISection **__MIDL_0273) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IACSVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IACS * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IACS * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IACS * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
- IACS * This,
- /* [retval][out] */ IDefinitionAppId **__MIDL_0269);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ComponentsSection )(
- IACS * This,
- /* [retval][out] */ ISection **__MIDL_0270);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MemberLookupSection )(
- IACS * This,
- /* [retval][out] */ ISection **__MIDL_0271);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MetadataSection )(
- IACS * This,
- /* [retval][out] */ ISection **__MIDL_0272);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StoreCoherencySection )(
- IACS * This,
- /* [retval][out] */ ISection **__MIDL_0273);
-
- END_INTERFACE
- } IACSVtbl;
-
- interface IACS
- {
- CONST_VTBL struct IACSVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IACS_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IACS_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IACS_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IACS_get_Identity(This,__MIDL_0269) \
- (This)->lpVtbl -> get_Identity(This,__MIDL_0269)
-
-#define IACS_get_ComponentsSection(This,__MIDL_0270) \
- (This)->lpVtbl -> get_ComponentsSection(This,__MIDL_0270)
-
-#define IACS_get_MemberLookupSection(This,__MIDL_0271) \
- (This)->lpVtbl -> get_MemberLookupSection(This,__MIDL_0271)
-
-#define IACS_get_MetadataSection(This,__MIDL_0272) \
- (This)->lpVtbl -> get_MetadataSection(This,__MIDL_0272)
-
-#define IACS_get_StoreCoherencySection(This,__MIDL_0273) \
- (This)->lpVtbl -> get_StoreCoherencySection(This,__MIDL_0273)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_Identity_Proxy(
- IACS * This,
- /* [retval][out] */ IDefinitionAppId **__MIDL_0269);
-
-
-void __RPC_STUB IACS_get_Identity_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_ComponentsSection_Proxy(
- IACS * This,
- /* [retval][out] */ ISection **__MIDL_0270);
-
-
-void __RPC_STUB IACS_get_ComponentsSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_MemberLookupSection_Proxy(
- IACS * This,
- /* [retval][out] */ ISection **__MIDL_0271);
-
-
-void __RPC_STUB IACS_get_MemberLookupSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_MetadataSection_Proxy(
- IACS * This,
- /* [retval][out] */ ISection **__MIDL_0272);
-
-
-void __RPC_STUB IACS_get_MetadataSection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_StoreCoherencySection_Proxy(
- IACS * This,
- /* [retval][out] */ ISection **__MIDL_0273);
-
-
-void __RPC_STUB IACS_get_StoreCoherencySection_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IACS_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0317 */
-/* [local] */
-
-typedef struct _AppIdMetadataEntry
- {
- ULONG AppIdLength;
- ULONG ComponentCount;
- LPCWSTR SourceURL;
- LPCWSTR LocalInstanceUniquifier;
- } AppIdMetadataEntry;
-
-typedef
-enum _AppIdMetadataEntryFieldId
- { AppIdMetadata_AppIdLength = 0,
- AppIdMetadata_ComponentCount = AppIdMetadata_AppIdLength + 1,
- AppIdMetadata_SourceURL = AppIdMetadata_ComponentCount + 1,
- AppIdMetadata_LocalInstanceUniquifier = AppIdMetadata_SourceURL + 1
- } AppIdMetadataEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0317_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0317_v0_0_s_ifspec;
-
-#ifndef __IAppIdMetadataEntry_INTERFACE_DEFINED__
-#define __IAppIdMetadataEntry_INTERFACE_DEFINED__
-
-/* interface IAppIdMetadataEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IAppIdMetadataEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("c75f426f-cb59-4246-88ca-b4dcd969dd6e")
- IAppIdMetadataEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ AppIdMetadataEntry **__MIDL_0274) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AppIdLength(
- /* [retval][out] */ ULONG *__MIDL_0275) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ComponentCount(
- /* [retval][out] */ ULONG *__MIDL_0276) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourceURL(
- /* [retval][out] */ LPCWSTR *__MIDL_0277) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LocalInstanceUniquifier(
- /* [retval][out] */ LPCWSTR *__MIDL_0278) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IAppIdMetadataEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IAppIdMetadataEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IAppIdMetadataEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IAppIdMetadataEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ AppIdMetadataEntry **__MIDL_0274);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AppIdLength )(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0275);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ComponentCount )(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0276);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SourceURL )(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0277);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LocalInstanceUniquifier )(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0278);
-
- END_INTERFACE
- } IAppIdMetadataEntryVtbl;
-
- interface IAppIdMetadataEntry
- {
- CONST_VTBL struct IAppIdMetadataEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IAppIdMetadataEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IAppIdMetadataEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IAppIdMetadataEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IAppIdMetadataEntry_get_AllData(This,__MIDL_0274) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0274)
-
-#define IAppIdMetadataEntry_get_AppIdLength(This,__MIDL_0275) \
- (This)->lpVtbl -> get_AppIdLength(This,__MIDL_0275)
-
-#define IAppIdMetadataEntry_get_ComponentCount(This,__MIDL_0276) \
- (This)->lpVtbl -> get_ComponentCount(This,__MIDL_0276)
-
-#define IAppIdMetadataEntry_get_SourceURL(This,__MIDL_0277) \
- (This)->lpVtbl -> get_SourceURL(This,__MIDL_0277)
-
-#define IAppIdMetadataEntry_get_LocalInstanceUniquifier(This,__MIDL_0278) \
- (This)->lpVtbl -> get_LocalInstanceUniquifier(This,__MIDL_0278)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_AllData_Proxy(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ AppIdMetadataEntry **__MIDL_0274);
-
-
-void __RPC_STUB IAppIdMetadataEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_AppIdLength_Proxy(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0275);
-
-
-void __RPC_STUB IAppIdMetadataEntry_get_AppIdLength_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_ComponentCount_Proxy(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0276);
-
-
-void __RPC_STUB IAppIdMetadataEntry_get_ComponentCount_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_SourceURL_Proxy(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0277);
-
-
-void __RPC_STUB IAppIdMetadataEntry_get_SourceURL_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_LocalInstanceUniquifier_Proxy(
- IAppIdMetadataEntry * This,
- /* [retval][out] */ LPCWSTR *__MIDL_0278);
-
-
-void __RPC_STUB IAppIdMetadataEntry_get_LocalInstanceUniquifier_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IAppIdMetadataEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0318 */
-/* [local] */
-
-typedef struct _MemberComponentEntry
- {
- IDefinitionIdentity *Identity;
- GUID StoreId;
- } MemberComponentEntry;
-
-typedef
-enum _MemberComponentEntryFieldId
- { MemberComponent_Identity = 0,
- MemberComponent_StoreId = MemberComponent_Identity + 1
- } MemberComponentEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0318_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0318_v0_0_s_ifspec;
-
-#ifndef __IMemberComponentEntry_INTERFACE_DEFINED__
-#define __IMemberComponentEntry_INTERFACE_DEFINED__
-
-/* interface IMemberComponentEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IMemberComponentEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8f83f8cc-46a4-4347-8578-966a38e4221e")
- IMemberComponentEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ MemberComponentEntry **__MIDL_0279) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0280) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StoreId(
- /* [retval][out] */ GUID *__MIDL_0281) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IMemberComponentEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IMemberComponentEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IMemberComponentEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IMemberComponentEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IMemberComponentEntry * This,
- /* [retval][out] */ MemberComponentEntry **__MIDL_0279);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
- IMemberComponentEntry * This,
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0280);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StoreId )(
- IMemberComponentEntry * This,
- /* [retval][out] */ GUID *__MIDL_0281);
-
- END_INTERFACE
- } IMemberComponentEntryVtbl;
-
- interface IMemberComponentEntry
- {
- CONST_VTBL struct IMemberComponentEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IMemberComponentEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IMemberComponentEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IMemberComponentEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IMemberComponentEntry_get_AllData(This,__MIDL_0279) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0279)
-
-#define IMemberComponentEntry_get_Identity(This,__MIDL_0280) \
- (This)->lpVtbl -> get_Identity(This,__MIDL_0280)
-
-#define IMemberComponentEntry_get_StoreId(This,__MIDL_0281) \
- (This)->lpVtbl -> get_StoreId(This,__MIDL_0281)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberComponentEntry_get_AllData_Proxy(
- IMemberComponentEntry * This,
- /* [retval][out] */ MemberComponentEntry **__MIDL_0279);
-
-
-void __RPC_STUB IMemberComponentEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberComponentEntry_get_Identity_Proxy(
- IMemberComponentEntry * This,
- /* [retval][out] */ IDefinitionIdentity **__MIDL_0280);
-
-
-void __RPC_STUB IMemberComponentEntry_get_Identity_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberComponentEntry_get_StoreId_Proxy(
- IMemberComponentEntry * This,
- /* [retval][out] */ GUID *__MIDL_0281);
-
-
-void __RPC_STUB IMemberComponentEntry_get_StoreId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IMemberComponentEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0319 */
-/* [local] */
-
-typedef struct _MemberLookupEntry
- {
- ULONG Index;
- } MemberLookupEntry;
-
-typedef
-enum _MemberLookupEntryFieldId
- { MemberLookup_Index = 0
- } MemberLookupEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0319_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0319_v0_0_s_ifspec;
-
-#ifndef __IMemberLookupEntry_INTERFACE_DEFINED__
-#define __IMemberLookupEntry_INTERFACE_DEFINED__
-
-/* interface IMemberLookupEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IMemberLookupEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("6C128A08-8598-41ce-8CD0-9D58DEFFA50B")
- IMemberLookupEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ MemberLookupEntry **__MIDL_0282) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Index(
- /* [retval][out] */ ULONG *__MIDL_0283) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IMemberLookupEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IMemberLookupEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IMemberLookupEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IMemberLookupEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IMemberLookupEntry * This,
- /* [retval][out] */ MemberLookupEntry **__MIDL_0282);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )(
- IMemberLookupEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0283);
-
- END_INTERFACE
- } IMemberLookupEntryVtbl;
-
- interface IMemberLookupEntry
- {
- CONST_VTBL struct IMemberLookupEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IMemberLookupEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IMemberLookupEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IMemberLookupEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IMemberLookupEntry_get_AllData(This,__MIDL_0282) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0282)
-
-#define IMemberLookupEntry_get_Index(This,__MIDL_0283) \
- (This)->lpVtbl -> get_Index(This,__MIDL_0283)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberLookupEntry_get_AllData_Proxy(
- IMemberLookupEntry * This,
- /* [retval][out] */ MemberLookupEntry **__MIDL_0282);
-
-
-void __RPC_STUB IMemberLookupEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberLookupEntry_get_Index_Proxy(
- IMemberLookupEntry * This,
- /* [retval][out] */ ULONG *__MIDL_0283);
-
-
-void __RPC_STUB IMemberLookupEntry_get_Index_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IMemberLookupEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0320 */
-/* [local] */
-
-typedef struct _StoreCoherencyEntry
- {
- ULONGLONG CoherencyId;
- } StoreCoherencyEntry;
-
-typedef
-enum _StoreCoherencyEntryFieldId
- { StoreCoherency_CoherencyId = 0
- } StoreCoherencyEntryFieldId;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0320_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0320_v0_0_s_ifspec;
-
-#ifndef __IStoreCoherencyEntry_INTERFACE_DEFINED__
-#define __IStoreCoherencyEntry_INTERFACE_DEFINED__
-
-/* interface IStoreCoherencyEntry */
-/* [uuid][unique][object][local] */
-
-
-EXTERN_C const IID IID_IStoreCoherencyEntry;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("87E02E32-9979-4023-A135-FA033E84B037")
- IStoreCoherencyEntry : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
- /* [retval][out] */ StoreCoherencyEntry **__MIDL_0284) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CoherencyId(
- /* [retval][out] */ ULONGLONG *__MIDL_0285) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IStoreCoherencyEntryVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IStoreCoherencyEntry * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IStoreCoherencyEntry * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IStoreCoherencyEntry * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
- IStoreCoherencyEntry * This,
- /* [retval][out] */ StoreCoherencyEntry **__MIDL_0284);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CoherencyId )(
- IStoreCoherencyEntry * This,
- /* [retval][out] */ ULONGLONG *__MIDL_0285);
-
- END_INTERFACE
- } IStoreCoherencyEntryVtbl;
-
- interface IStoreCoherencyEntry
- {
- CONST_VTBL struct IStoreCoherencyEntryVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IStoreCoherencyEntry_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IStoreCoherencyEntry_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IStoreCoherencyEntry_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IStoreCoherencyEntry_get_AllData(This,__MIDL_0284) \
- (This)->lpVtbl -> get_AllData(This,__MIDL_0284)
-
-#define IStoreCoherencyEntry_get_CoherencyId(This,__MIDL_0285) \
- (This)->lpVtbl -> get_CoherencyId(This,__MIDL_0285)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IStoreCoherencyEntry_get_AllData_Proxy(
- IStoreCoherencyEntry * This,
- /* [retval][out] */ StoreCoherencyEntry **__MIDL_0284);
-
-
-void __RPC_STUB IStoreCoherencyEntry_get_AllData_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IStoreCoherencyEntry_get_CoherencyId_Proxy(
- IStoreCoherencyEntry * This,
- /* [retval][out] */ ULONGLONG *__MIDL_0285);
-
-
-void __RPC_STUB IStoreCoherencyEntry_get_CoherencyId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IStoreCoherencyEntry_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0321 */
-/* [local] */
-
-HRESULT FreeAppIdMetadataEntry(
- /* [in] */ AppIdMetadataEntry *__MIDL_0286);
-
-HRESULT FreeMemberComponentEntry(
- /* [in] */ MemberComponentEntry *__MIDL_0287);
-
-HRESULT FreeMemberLookupEntry(
- /* [in] */ MemberLookupEntry *__MIDL_0288);
-
-HRESULT FreeStoreCoherencyEntry(
- /* [in] */ StoreCoherencyEntry *__MIDL_0289);
-
-typedef struct _IDENTITY_ATTRIBUTE
- {
- LPCWSTR pszNamespace;
- LPCWSTR pszName;
- LPCWSTR pszValue;
- } IDENTITY_ATTRIBUTE;
-
-typedef struct _IDENTITY_ATTRIBUTE *PIDENTITY_ATTRIBUTE;
-
-typedef const IDENTITY_ATTRIBUTE *PCIDENTITY_ATTRIBUTE;
-
-/* [v1_enum] */
-enum _STORE_ASSEMBLY_STATUS_FLAGS
- { STORE_ASSEMBLY_STATUS_MANIFEST_ONLY = 0x1,
- STORE_ASSEMBLY_STATUS_PAYLOAD_RESIDENT = 0x2,
- STORE_ASSEMBLY_STATUS_PARTIAL_INSTALL = 0x4
- } ;
-typedef struct _STORE_ASSEMBLY
- {
- DWORD dwStatus;
- IDefinitionIdentity *pIDefinitionIdentity;
- LPCWSTR pszManifestPath;
- ULONGLONG ullAssemblySize;
- ULONGLONG ullChangeId;
- } STORE_ASSEMBLY;
-
-typedef struct _STORE_ASSEMBLY *PSTORE_ASSEMBLY;
-
-typedef const STORE_ASSEMBLY *PCSTORE_ASSEMBLY;
-
-/* [v1_enum] */
-enum _STORE_ASSEMBLY_FILE_STATUS_FLAGS
- { STORE_ASSEMBLY_FILE_STATUS_FLAG_PRESENT = 0x1
- } ;
-typedef struct _STORE_ASSEMBLY_FILE
- {
- DWORD cbSize;
- DWORD dwFlags;
- LPCWSTR pszFileName;
- DWORD dwFileStatusFlags;
- } STORE_ASSEMBLY_FILE;
-
-typedef struct _STORE_ASSEMBLY_FILE *PSTORE_ASSEMBLY_FILE;
-
-typedef const STORE_ASSEMBLY_FILE *PCSTORE_ASSEMBLY_FILE;
-
-typedef struct _STORE_ASSEMBLY_INSTALLATION_REFERENCE
- {
- DWORD cbSize;
- DWORD dwFlags;
- GUID guidScheme;
- LPCWSTR pszIdentifier;
- LPCWSTR pszNonCanonicalData;
- } STORE_ASSEMBLY_INSTALLATION_REFERENCE;
-
-typedef struct _STORE_ASSEMBLY_INSTALLATION_REFERENCE *PSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
-
-typedef const STORE_ASSEMBLY_INSTALLATION_REFERENCE *PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
-
-typedef struct _STORE_CATEGORY
- {
- IDefinitionIdentity *pIDefinitionIdentity;
- } STORE_CATEGORY;
-
-typedef struct _STORE_CATEGORY *PSTORE_CATEGORY;
-
-typedef const STORE_CATEGORY *PCSTORE_CATEGORY;
-
-typedef struct _STORE_CATEGORY_SUBCATEGORY
- {
- LPCWSTR pszSubcategory;
- } STORE_CATEGORY_SUBCATEGORY;
-
-typedef struct _STORE_CATEGORY_SUBCATEGORY *PSTORE_CATEGORY_SUBCATEGORY;
-
-typedef const STORE_CATEGORY_SUBCATEGORY *PCSTORE_CATEGORY_SUBCATEGORY;
-
-typedef struct _STORE_CATEGORY_INSTANCE
- {
- IDefinitionAppId *pIDefinitionAppId_Application;
- LPCWSTR pszXMLSnippet;
- } STORE_CATEGORY_INSTANCE;
-
-typedef struct _STORE_CATEGORY_INSTANCE *PSTORE_CATEGORY_INSTANCE;
-
-typedef const STORE_CATEGORY_INSTANCE *PCSTORE_CATEGORY_INSTANCE;
-
-typedef struct _CATEGORY
- {
- IDefinitionIdentity *pIDefinitionIdentity;
- } CATEGORY;
-
-typedef struct _CATEGORY *PCATEGORY;
-
-typedef const CATEGORY *PCCATEGORY;
-
-typedef struct _CATEGORY_SUBCATEGORY
- {
- LPCWSTR pszSubcategory;
- } CATEGORY_SUBCATEGORY;
-
-typedef struct _CATEGORY_SUBCATEGORY *PCATEGORY_SUBCATEGORY;
-
-typedef const CATEGORY_SUBCATEGORY *PCCATEGORY_SUBCATEGORY;
-
-typedef struct _CATEGORY_INSTANCE
- {
- IDefinitionAppId *pIDefinitionAppId_Application;
- LPCWSTR pszXMLSnippet;
- } CATEGORY_INSTANCE;
-
-typedef struct _CATEGORY_INSTANCE *PCATEGORY_INSTANCE;
-
-typedef const CATEGORY_INSTANCE *PCCATEGORY_INSTANCE;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST
- {
- DWORD dwSize;
- DWORD dwFlags;
- ULONG nProcessorArchitectures;
- /* [size_is] */ const USHORT *prgusProcessorArchitectures;
- } CREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST *PCREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST;
-
-typedef const CREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST *PCCREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST;
-
-typedef /* [v1_enum] */
-enum _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE
- { CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE_INVALID = 0,
- CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE_SYSTEM_STORE = 1,
- CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE_USER_STORE = 2,
- CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE_PRIVATE_STORE = 3
- } CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE;
-
-typedef /* [v1_enum] */ enum _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE *PCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE;
-
-typedef const CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE *PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE
- {
- DWORD dwSize;
- DWORD dwFlags;
- CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE iType;
- IStore *pIStore;
- PVOID pvReservedMustBeZero;
- } CREATE_APP_CONTEXT_DATA_CUSTOM_STORE;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE *PCREATE_APP_CONTEXT_DATA_CUSTOM_STORE;
-
-typedef const CREATE_APP_CONTEXT_DATA_CUSTOM_STORE *PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST
- {
- DWORD dwSize;
- DWORD dwFlags;
- ULONG Count;
- /* [size_is] */ const PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE *prgpStores;
- } CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST *PCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST;
-
-typedef const CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST *PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST;
-
-typedef /* [v1_enum] */
-enum _CREATE_APP_CONTEXT_DATA_SOURCE_TYPES
- { CREATE_APP_CONTEXT_DATA_SOURCE_TYPE_APP_DEFINITION = 1,
- CREATE_APP_CONTEXT_DATA_SOURCE_TYPE_APP_REFERENCE = 2
- } CREATE_APP_CONTEXT_DATA_SOURCE_TYPES;
-
-typedef /* [v1_enum] */ enum _CREATE_APP_CONTEXT_DATA_SOURCE_TYPES *PCREATE_APP_CONTEXT_DATA_SOURCE_TYPES;
-
-typedef const CREATE_APP_CONTEXT_DATA_SOURCE_TYPES *PCCREATE_APP_CONTEXT_DATA_SOURCE_TYPES;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION
- {
- DWORD dwSize;
- DWORD dwFlags;
- IDefinitionAppId *pIDefinitionAppId;
- } CREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION *PCREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION;
-
-typedef const CREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION *PCCREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE
- {
- DWORD dwSize;
- DWORD dwFlags;
- IReferenceAppId *pIReferenceAppId;
- } CREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE *PCREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE;
-
-typedef const CREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE *PCCREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE;
-
-typedef /* [switch_type] */ union _CREATE_APP_CONTEXT_DATA_SOURCE_UNION
- {
- /* [case()] */ PCCREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION AppDefinition;
- /* [case()] */ PCCREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE AppReference;
- } CREATE_APP_CONTEXT_DATA_SOURCE_UNION;
-
-typedef /* [switch_type] */ union _CREATE_APP_CONTEXT_DATA_SOURCE_UNION *PCREATE_APP_CONTEXT_DATA_SOURCE_UNION;
-
-typedef const CREATE_APP_CONTEXT_DATA_SOURCE_UNION *PCCREATE_APP_CONTEXT_DATA_SOURCE_UNION;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE
- {
- DWORD dwSize;
- DWORD dwFlags;
- CREATE_APP_CONTEXT_DATA_SOURCE_TYPES iSourceType;
- /* [switch_is] */ CREATE_APP_CONTEXT_DATA_SOURCE_UNION Data;
- } CREATE_APP_CONTEXT_DATA_SOURCE;
-
-typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE *PCREATE_APP_CONTEXT_DATA_SOURCE;
-
-typedef const CREATE_APP_CONTEXT_DATA_SOURCE *PCCREATE_APP_CONTEXT_DATA_SOURCE;
-
-/* [v1_enum] */
-enum _CREATE_APP_CONTEXT_DATA_FLAGS
- { CREATE_APP_CONTEXT_DATA_FLAG_CUSTOM_STORE_LIST_VALID = 0x1,
- CREATE_APP_CONTEXT_DATA_FLAG_CULTURE_FALLBACK_LIST_VALID = 0x2,
- CREATE_APP_CONTEXT_DATA_FLAG_PROCESSOR_ARCHITECTURE_FALLBACK_LIST_VALID = 0x4,
- CREATE_APP_CONTEXT_DATA_FLAG_PROCESSOR_ARCHITECTURE_VALID = 0x8,
- CREATE_APP_CONTEXT_DATA_FLAG_SOURCE_VALID = 0x10,
- CREATE_APP_CONTEXT_DATA_FLAG_IGNORE_VISIBILITY_FLAGS = 0x100000
- } ;
-typedef struct _CREATE_APP_CONTEXT_DATA
- {
- DWORD dwSize;
- DWORD dwFlags;
- PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST pCustomStoreList;
- PCCULTURE_FALLBACK_LIST pCultureFallbackList;
- PCCREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST pProcessorArchitectureFallbackList;
- PCCREATE_APP_CONTEXT_DATA_SOURCE pSource;
- USHORT usProcessorArchitecture;
- } CREATE_APP_CONTEXT_DATA;
-
-typedef struct _CREATE_APP_CONTEXT_DATA *PCREATE_APP_CONTEXT_DATA;
-
-typedef const CREATE_APP_CONTEXT_DATA *PCCREATE_APP_CONTEXT_DATA;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0321_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0321_v0_0_s_ifspec;
-
-#ifndef __IReferenceIdentity_INTERFACE_DEFINED__
-#define __IReferenceIdentity_INTERFACE_DEFINED__
-
-/* interface IReferenceIdentity */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IReferenceIdentity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("6eaf5ace-7917-4f3c-b129-e046a9704766")
- IReferenceIdentity : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE GetAttribute(
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetAttribute(
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAttributes(
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
- /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IReferenceIdentityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IReferenceIdentity * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IReferenceIdentity * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IReferenceIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *GetAttribute )(
- IReferenceIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue);
-
- HRESULT ( STDMETHODCALLTYPE *SetAttribute )(
- IReferenceIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAttributes )(
- IReferenceIdentity * This,
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IReferenceIdentity * This,
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
- /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity);
-
- END_INTERFACE
- } IReferenceIdentityVtbl;
-
- interface IReferenceIdentity
- {
- CONST_VTBL struct IReferenceIdentityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IReferenceIdentity_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IReferenceIdentity_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IReferenceIdentity_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IReferenceIdentity_GetAttribute(This,pszNamespace,pszName,ppszValue) \
- (This)->lpVtbl -> GetAttribute(This,pszNamespace,pszName,ppszValue)
-
-#define IReferenceIdentity_SetAttribute(This,pszNamespace,pszName,pszValue) \
- (This)->lpVtbl -> SetAttribute(This,pszNamespace,pszName,pszValue)
-
-#define IReferenceIdentity_EnumAttributes(This,ppIEnumIDENTITY_ATTRIBUTE) \
- (This)->lpVtbl -> EnumAttributes(This,ppIEnumIDENTITY_ATTRIBUTE)
-
-#define IReferenceIdentity_Clone(This,cDeltas,rgDeltas,ppIReferenceIdentity) \
- (This)->lpVtbl -> Clone(This,cDeltas,rgDeltas,ppIReferenceIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IReferenceIdentity_GetAttribute_Proxy(
- IReferenceIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue);
-
-
-void __RPC_STUB IReferenceIdentity_GetAttribute_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IReferenceIdentity_SetAttribute_Proxy(
- IReferenceIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue);
-
-
-void __RPC_STUB IReferenceIdentity_SetAttribute_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IReferenceIdentity_EnumAttributes_Proxy(
- IReferenceIdentity * This,
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
-
-
-void __RPC_STUB IReferenceIdentity_EnumAttributes_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IReferenceIdentity_Clone_Proxy(
- IReferenceIdentity * This,
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
- /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity);
-
-
-void __RPC_STUB IReferenceIdentity_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IReferenceIdentity_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDefinitionIdentity_INTERFACE_DEFINED__
-#define __IDefinitionIdentity_INTERFACE_DEFINED__
-
-/* interface IDefinitionIdentity */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IDefinitionIdentity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("587bf538-4d90-4a3c-9ef1-58a200a8a9e7")
- IDefinitionIdentity : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE GetAttribute(
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetAttribute(
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAttributes(
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
- /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IDefinitionIdentityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IDefinitionIdentity * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IDefinitionIdentity * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IDefinitionIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *GetAttribute )(
- IDefinitionIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue);
-
- HRESULT ( STDMETHODCALLTYPE *SetAttribute )(
- IDefinitionIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAttributes )(
- IDefinitionIdentity * This,
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IDefinitionIdentity * This,
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
- /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity);
-
- END_INTERFACE
- } IDefinitionIdentityVtbl;
-
- interface IDefinitionIdentity
- {
- CONST_VTBL struct IDefinitionIdentityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IDefinitionIdentity_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IDefinitionIdentity_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IDefinitionIdentity_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IDefinitionIdentity_GetAttribute(This,pszNamespace,pszName,ppszValue) \
- (This)->lpVtbl -> GetAttribute(This,pszNamespace,pszName,ppszValue)
-
-#define IDefinitionIdentity_SetAttribute(This,pszNamespace,pszName,pszValue) \
- (This)->lpVtbl -> SetAttribute(This,pszNamespace,pszName,pszValue)
-
-#define IDefinitionIdentity_EnumAttributes(This,ppIEAIA) \
- (This)->lpVtbl -> EnumAttributes(This,ppIEAIA)
-
-#define IDefinitionIdentity_Clone(This,cDeltas,prgDeltas,ppIDefinitionIdentity) \
- (This)->lpVtbl -> Clone(This,cDeltas,prgDeltas,ppIDefinitionIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionIdentity_GetAttribute_Proxy(
- IDefinitionIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [retval][out] */ LPWSTR *ppszValue);
-
-
-void __RPC_STUB IDefinitionIdentity_GetAttribute_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionIdentity_SetAttribute_Proxy(
- IDefinitionIdentity * This,
- /* [unique][in] */ LPCWSTR pszNamespace,
- /* [in] */ LPCWSTR pszName,
- /* [unique][in] */ LPCWSTR pszValue);
-
-
-void __RPC_STUB IDefinitionIdentity_SetAttribute_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionIdentity_EnumAttributes_Proxy(
- IDefinitionIdentity * This,
- /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA);
-
-
-void __RPC_STUB IDefinitionIdentity_EnumAttributes_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionIdentity_Clone_Proxy(
- IDefinitionIdentity * This,
- /* [in] */ SIZE_T cDeltas,
- /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
- /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity);
-
-
-void __RPC_STUB IDefinitionIdentity_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IDefinitionIdentity_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0323 */
-/* [local] */
-
-typedef struct _IDENTITY_ATTRIBUTE_BLOB
- {
- DWORD ofsNamespace;
- DWORD ofsName;
- DWORD ofsValue;
- } IDENTITY_ATTRIBUTE_BLOB;
-
-typedef struct _IDENTITY_ATTRIBUTE_BLOB *PIDENTITY_ATTRIBUTE_BLOB;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0323_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0323_v0_0_s_ifspec;
-
-#ifndef __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__
-#define __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__
-
-/* interface IEnumIDENTITY_ATTRIBUTE */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumIDENTITY_ATTRIBUTE;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("9cdaae75-246e-4b00-a26d-b9aec137a3eb")
- IEnumIDENTITY_ATTRIBUTE : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
- /* [optional][out] */ ULONG *pceltWritten) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CurrentIntoBuffer(
- /* [in] */ SIZE_T cbAvailable,
- /* [length_is][size_is][out][in] */ BYTE pbData[ ],
- /* [out] */ SIZE_T *pcbUsed) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumIDENTITY_ATTRIBUTEVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumIDENTITY_ATTRIBUTE * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumIDENTITY_ATTRIBUTE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
- /* [optional][out] */ ULONG *pceltWritten);
-
- HRESULT ( STDMETHODCALLTYPE *CurrentIntoBuffer )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ SIZE_T cbAvailable,
- /* [length_is][size_is][out][in] */ BYTE pbData[ ],
- /* [out] */ SIZE_T *pcbUsed);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumIDENTITY_ATTRIBUTE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
-
- END_INTERFACE
- } IEnumIDENTITY_ATTRIBUTEVtbl;
-
- interface IEnumIDENTITY_ATTRIBUTE
- {
- CONST_VTBL struct IEnumIDENTITY_ATTRIBUTEVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumIDENTITY_ATTRIBUTE_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumIDENTITY_ATTRIBUTE_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumIDENTITY_ATTRIBUTE_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumIDENTITY_ATTRIBUTE_Next(This,celt,rgAttributes,pceltWritten) \
- (This)->lpVtbl -> Next(This,celt,rgAttributes,pceltWritten)
-
-#define IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer(This,cbAvailable,pbData,pcbUsed) \
- (This)->lpVtbl -> CurrentIntoBuffer(This,cbAvailable,pbData,pcbUsed)
-
-#define IEnumIDENTITY_ATTRIBUTE_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumIDENTITY_ATTRIBUTE_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumIDENTITY_ATTRIBUTE_Clone(This,ppIEnumIDENTITY_ATTRIBUTE) \
- (This)->lpVtbl -> Clone(This,ppIEnumIDENTITY_ATTRIBUTE)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Next_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
- /* [optional][out] */ ULONG *pceltWritten);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ SIZE_T cbAvailable,
- /* [length_is][size_is][out][in] */ BYTE pbData[ ],
- /* [out] */ SIZE_T *pcbUsed);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Skip_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Reset_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Clone_Proxy(
- IEnumIDENTITY_ATTRIBUTE * This,
- /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
-
-
-void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumDefinitionIdentity_INTERFACE_DEFINED__
-#define __IEnumDefinitionIdentity_INTERFACE_DEFINED__
-
-/* interface IEnumDefinitionIdentity */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumDefinitionIdentity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("f3549d9c-fc73-4793-9c00-1cd204254c0c")
- IEnumDefinitionIdentity : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [out] */ ULONG *pceltWritten) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumDefinitionIdentityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumDefinitionIdentity * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumDefinitionIdentity * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumDefinitionIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumDefinitionIdentity * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [out] */ ULONG *pceltWritten);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumDefinitionIdentity * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumDefinitionIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumDefinitionIdentity * This,
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
-
- END_INTERFACE
- } IEnumDefinitionIdentityVtbl;
-
- interface IEnumDefinitionIdentity
- {
- CONST_VTBL struct IEnumDefinitionIdentityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumDefinitionIdentity_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumDefinitionIdentity_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumDefinitionIdentity_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumDefinitionIdentity_Next(This,celt,rgpIDefinitionIdentity,pceltWritten) \
- (This)->lpVtbl -> Next(This,celt,rgpIDefinitionIdentity,pceltWritten)
-
-#define IEnumDefinitionIdentity_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumDefinitionIdentity_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumDefinitionIdentity_Clone(This,ppIEnumDefinitionIdentity) \
- (This)->lpVtbl -> Clone(This,ppIEnumDefinitionIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Next_Proxy(
- IEnumDefinitionIdentity * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [out] */ ULONG *pceltWritten);
-
-
-void __RPC_STUB IEnumDefinitionIdentity_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Skip_Proxy(
- IEnumDefinitionIdentity * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumDefinitionIdentity_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Reset_Proxy(
- IEnumDefinitionIdentity * This);
-
-
-void __RPC_STUB IEnumDefinitionIdentity_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Clone_Proxy(
- IEnumDefinitionIdentity * This,
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
-
-
-void __RPC_STUB IEnumDefinitionIdentity_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumDefinitionIdentity_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumReferenceIdentity_INTERFACE_DEFINED__
-#define __IEnumReferenceIdentity_INTERFACE_DEFINED__
-
-/* interface IEnumReferenceIdentity */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumReferenceIdentity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("b30352cf-23da-4577-9b3f-b4e6573be53b")
- IEnumReferenceIdentity : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
- /* [out] */ ULONG *pceltWritten) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- IEnumReferenceIdentity **ppIEnumReferenceIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumReferenceIdentityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumReferenceIdentity * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumReferenceIdentity * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumReferenceIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumReferenceIdentity * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
- /* [out] */ ULONG *pceltWritten);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumReferenceIdentity * This,
- ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumReferenceIdentity * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumReferenceIdentity * This,
- IEnumReferenceIdentity **ppIEnumReferenceIdentity);
-
- END_INTERFACE
- } IEnumReferenceIdentityVtbl;
-
- interface IEnumReferenceIdentity
- {
- CONST_VTBL struct IEnumReferenceIdentityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumReferenceIdentity_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumReferenceIdentity_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumReferenceIdentity_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumReferenceIdentity_Next(This,celt,prgpIReferenceIdentity,pceltWritten) \
- (This)->lpVtbl -> Next(This,celt,prgpIReferenceIdentity,pceltWritten)
-
-#define IEnumReferenceIdentity_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumReferenceIdentity_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumReferenceIdentity_Clone(This,ppIEnumReferenceIdentity) \
- (This)->lpVtbl -> Clone(This,ppIEnumReferenceIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Next_Proxy(
- IEnumReferenceIdentity * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
- /* [out] */ ULONG *pceltWritten);
-
-
-void __RPC_STUB IEnumReferenceIdentity_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Skip_Proxy(
- IEnumReferenceIdentity * This,
- ULONG celt);
-
-
-void __RPC_STUB IEnumReferenceIdentity_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Reset_Proxy(
- IEnumReferenceIdentity * This);
-
-
-void __RPC_STUB IEnumReferenceIdentity_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Clone_Proxy(
- IEnumReferenceIdentity * This,
- IEnumReferenceIdentity **ppIEnumReferenceIdentity);
-
-
-void __RPC_STUB IEnumReferenceIdentity_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumReferenceIdentity_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDefinitionAppId_INTERFACE_DEFINED__
-#define __IDefinitionAppId_INTERFACE_DEFINED__
-
-/* interface IDefinitionAppId */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IDefinitionAppId;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("d91e12d8-98ed-47fa-9936-39421283d59b")
- IDefinitionAppId : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubscriptionId(
- /* [retval][out] */ LPWSTR *ppszSubscription) = 0;
-
- virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubscriptionId(
- /* [in] */ LPCWSTR pszSubscription) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
- /* [retval][out] */ LPWSTR *ppszCodebase) = 0;
-
- virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Codebase(
- /* [in] */ LPCWSTR pszCodebase) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAppPath(
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetAppPath(
- /* [in] */ ULONG cIDefinitionIdentity,
- /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IDefinitionAppIdVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IDefinitionAppId * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IDefinitionAppId * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IDefinitionAppId * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriptionId )(
- IDefinitionAppId * This,
- /* [retval][out] */ LPWSTR *ppszSubscription);
-
- /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubscriptionId )(
- IDefinitionAppId * This,
- /* [in] */ LPCWSTR pszSubscription);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
- IDefinitionAppId * This,
- /* [retval][out] */ LPWSTR *ppszCodebase);
-
- /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Codebase )(
- IDefinitionAppId * This,
- /* [in] */ LPCWSTR pszCodebase);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAppPath )(
- IDefinitionAppId * This,
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *SetAppPath )(
- IDefinitionAppId * This,
- /* [in] */ ULONG cIDefinitionIdentity,
- /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]);
-
- END_INTERFACE
- } IDefinitionAppIdVtbl;
-
- interface IDefinitionAppId
- {
- CONST_VTBL struct IDefinitionAppIdVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IDefinitionAppId_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IDefinitionAppId_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IDefinitionAppId_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IDefinitionAppId_get_SubscriptionId(This,ppszSubscription) \
- (This)->lpVtbl -> get_SubscriptionId(This,ppszSubscription)
-
-#define IDefinitionAppId_put_SubscriptionId(This,pszSubscription) \
- (This)->lpVtbl -> put_SubscriptionId(This,pszSubscription)
-
-#define IDefinitionAppId_get_Codebase(This,ppszCodebase) \
- (This)->lpVtbl -> get_Codebase(This,ppszCodebase)
-
-#define IDefinitionAppId_put_Codebase(This,pszCodebase) \
- (This)->lpVtbl -> put_Codebase(This,pszCodebase)
-
-#define IDefinitionAppId_EnumAppPath(This,ppIEnumDefinitionIdentity) \
- (This)->lpVtbl -> EnumAppPath(This,ppIEnumDefinitionIdentity)
-
-#define IDefinitionAppId_SetAppPath(This,cIDefinitionIdentity,rgIDefinitionIdentity) \
- (This)->lpVtbl -> SetAppPath(This,cIDefinitionIdentity,rgIDefinitionIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_get_SubscriptionId_Proxy(
- IDefinitionAppId * This,
- /* [retval][out] */ LPWSTR *ppszSubscription);
-
-
-void __RPC_STUB IDefinitionAppId_get_SubscriptionId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propput] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_put_SubscriptionId_Proxy(
- IDefinitionAppId * This,
- /* [in] */ LPCWSTR pszSubscription);
-
-
-void __RPC_STUB IDefinitionAppId_put_SubscriptionId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_get_Codebase_Proxy(
- IDefinitionAppId * This,
- /* [retval][out] */ LPWSTR *ppszCodebase);
-
-
-void __RPC_STUB IDefinitionAppId_get_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propput] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_put_Codebase_Proxy(
- IDefinitionAppId * This,
- /* [in] */ LPCWSTR pszCodebase);
-
-
-void __RPC_STUB IDefinitionAppId_put_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionAppId_EnumAppPath_Proxy(
- IDefinitionAppId * This,
- /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
-
-
-void __RPC_STUB IDefinitionAppId_EnumAppPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IDefinitionAppId_SetAppPath_Proxy(
- IDefinitionAppId * This,
- /* [in] */ ULONG cIDefinitionIdentity,
- /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]);
-
-
-void __RPC_STUB IDefinitionAppId_SetAppPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IDefinitionAppId_INTERFACE_DEFINED__ */
-
-
-#ifndef __IReferenceAppId_INTERFACE_DEFINED__
-#define __IReferenceAppId_INTERFACE_DEFINED__
-
-/* interface IReferenceAppId */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IReferenceAppId;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("054f0bef-9e45-4363-8f5a-2f8e142d9a3b")
- IReferenceAppId : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubscriptionId(
- /* [retval][out] */ LPWSTR *ppszSubscription) = 0;
-
- virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubscriptionId(
- /* [in] */ LPCWSTR pszSubscription) = 0;
-
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
- /* [retval][out] */ LPWSTR *ppszCodebase) = 0;
-
- virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Codebase(
- /* [in] */ LPCWSTR pszCodebase) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAppPath(
- /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IReferenceAppIdVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IReferenceAppId * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IReferenceAppId * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IReferenceAppId * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriptionId )(
- IReferenceAppId * This,
- /* [retval][out] */ LPWSTR *ppszSubscription);
-
- /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubscriptionId )(
- IReferenceAppId * This,
- /* [in] */ LPCWSTR pszSubscription);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
- IReferenceAppId * This,
- /* [retval][out] */ LPWSTR *ppszCodebase);
-
- /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Codebase )(
- IReferenceAppId * This,
- /* [in] */ LPCWSTR pszCodebase);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAppPath )(
- IReferenceAppId * This,
- /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId);
-
- END_INTERFACE
- } IReferenceAppIdVtbl;
-
- interface IReferenceAppId
- {
- CONST_VTBL struct IReferenceAppIdVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IReferenceAppId_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IReferenceAppId_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IReferenceAppId_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IReferenceAppId_get_SubscriptionId(This,ppszSubscription) \
- (This)->lpVtbl -> get_SubscriptionId(This,ppszSubscription)
-
-#define IReferenceAppId_put_SubscriptionId(This,pszSubscription) \
- (This)->lpVtbl -> put_SubscriptionId(This,pszSubscription)
-
-#define IReferenceAppId_get_Codebase(This,ppszCodebase) \
- (This)->lpVtbl -> get_Codebase(This,ppszCodebase)
-
-#define IReferenceAppId_put_Codebase(This,pszCodebase) \
- (This)->lpVtbl -> put_Codebase(This,pszCodebase)
-
-#define IReferenceAppId_EnumAppPath(This,ppIReferenceAppId) \
- (This)->lpVtbl -> EnumAppPath(This,ppIReferenceAppId)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_get_SubscriptionId_Proxy(
- IReferenceAppId * This,
- /* [retval][out] */ LPWSTR *ppszSubscription);
-
-
-void __RPC_STUB IReferenceAppId_get_SubscriptionId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propput] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_put_SubscriptionId_Proxy(
- IReferenceAppId * This,
- /* [in] */ LPCWSTR pszSubscription);
-
-
-void __RPC_STUB IReferenceAppId_put_SubscriptionId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_get_Codebase_Proxy(
- IReferenceAppId * This,
- /* [retval][out] */ LPWSTR *ppszCodebase);
-
-
-void __RPC_STUB IReferenceAppId_get_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-/* [propput] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_put_Codebase_Proxy(
- IReferenceAppId * This,
- /* [in] */ LPCWSTR pszCodebase);
-
-
-void __RPC_STUB IReferenceAppId_put_Codebase_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IReferenceAppId_EnumAppPath_Proxy(
- IReferenceAppId * This,
- /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId);
-
-
-void __RPC_STUB IReferenceAppId_EnumAppPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IReferenceAppId_INTERFACE_DEFINED__ */
-
-
-#ifndef __IIdentityAuthority_INTERFACE_DEFINED__
-#define __IIdentityAuthority_INTERFACE_DEFINED__
-
-/* interface IIdentityAuthority */
-/* [local][unique][uuid][object] */
-
-/* [v1_enum] */
-enum _TEXT_TO_DEFINITION_IDENTITY_FLAGS
- { TEXT_TO_DEFINITION_IDENTITY_FLAG_ALLOW_UNKNOWN_ATTRIBUTES_IN_NULL_NAMESPACE = 0x1
- } ;
-/* [v1_enum] */
-enum _TEXT_TO_REFERENCE_IDENTITY_FLAGS
- { TEXT_TO_REFERENCE_IDENTITY_FLAG_ALLOW_UNKNOWN_ATTRIBUTES_IN_NULL_NAMESPACE = 0x1
- } ;
-/* [v1_enum] */
-enum _DEFINITION_IDENTITY_TO_TEXT_FLAGS
- { DEFINITION_IDENTITY_TO_TEXT_FLAG_CANONICAL = 0x1
- } ;
-/* [v1_enum] */
-enum _REFERENCE_IDENTITY_TO_TEXT_FLAGS
- { REFERENCE_IDENTITY_TO_TEXT_FLAG_CANONICAL = 0x1
- } ;
-/* [v1_enum] */
-enum _IIDENTITYAUTHORITY_DOES_DEFINITION_MATCH_REFERENCE_FLAGS
- { IIDENTITYAUTHORITY_DOES_DEFINITION_MATCH_REFERENCE_FLAG_EXACT_MATCH_REQUIRED = 0x1
- } ;
-/* [v1_enum] */
-enum _IIDENTITYAUTHORITY_DOES_TEXTUAL_DEFINITION_MATCH_TEXTUAL_REFERENCE_FLAGS
- { IIDENTITYAUTHORITY_DOES_TEXTUAL_DEFINITION_MATCH_TEXTUAL_REFERENCE_FLAG_EXACT_MATCH_REQUIRED = 0x1
- } ;
-
-EXTERN_C const IID IID_IIdentityAuthority;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("261a6983-c35d-4d0d-aa5b-7867259e77bc")
- IIdentityAuthority : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE TextToDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE TextToReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceIdentity **ppIReferenceIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DefinitionToText(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DefinitionToTextBuffer(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReferenceToText(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReferenceToTextBuffer(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreDefinitionsEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinition1,
- /* [in] */ IDefinitionIdentity *pDefinition2,
- /* [out] */ BOOL *pfEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreReferencesEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pReference1,
- /* [in] */ IReferenceIdentity *pReference2,
- /* [out] */ BOOL *pfEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreTextualDefinitionsEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreTextualReferencesEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DoesDefinitionMatchReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DoesTextualDefinitionMatchTextualReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE HashReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE HashDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GenerateDefinitionKey(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GenerateReferenceKey(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateDefinition(
- /* [retval][out] */ IDefinitionIdentity **ppNewIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateReference(
- /* [retval][out] */ IReferenceIdentity **ppNewIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IIdentityAuthorityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IIdentityAuthority * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IIdentityAuthority * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IIdentityAuthority * This);
-
- HRESULT ( STDMETHODCALLTYPE *TextToDefinition )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *TextToReference )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceIdentity **ppIReferenceIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *DefinitionToText )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *DefinitionToTextBuffer )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired);
-
- HRESULT ( STDMETHODCALLTYPE *ReferenceToText )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *ReferenceToTextBuffer )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired);
-
- HRESULT ( STDMETHODCALLTYPE *AreDefinitionsEqual )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinition1,
- /* [in] */ IDefinitionIdentity *pDefinition2,
- /* [out] */ BOOL *pfEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreReferencesEqual )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pReference1,
- /* [in] */ IReferenceIdentity *pReference2,
- /* [out] */ BOOL *pfEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreTextualDefinitionsEqual )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreTextualReferencesEqual )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual);
-
- HRESULT ( STDMETHODCALLTYPE *DoesDefinitionMatchReference )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches);
-
- HRESULT ( STDMETHODCALLTYPE *DoesTextualDefinitionMatchTextualReference )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches);
-
- HRESULT ( STDMETHODCALLTYPE *HashReference )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
- HRESULT ( STDMETHODCALLTYPE *HashDefinition )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
- HRESULT ( STDMETHODCALLTYPE *GenerateDefinitionKey )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
- HRESULT ( STDMETHODCALLTYPE *GenerateReferenceKey )(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
- HRESULT ( STDMETHODCALLTYPE *CreateDefinition )(
- IIdentityAuthority * This,
- /* [retval][out] */ IDefinitionIdentity **ppNewIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *CreateReference )(
- IIdentityAuthority * This,
- /* [retval][out] */ IReferenceIdentity **ppNewIdentity);
-
- END_INTERFACE
- } IIdentityAuthorityVtbl;
-
- interface IIdentityAuthority
- {
- CONST_VTBL struct IIdentityAuthorityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IIdentityAuthority_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IIdentityAuthority_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IIdentityAuthority_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IIdentityAuthority_TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionIdentity) \
- (This)->lpVtbl -> TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionIdentity)
-
-#define IIdentityAuthority_TextToReference(This,dwFlags,pszIdentity,ppIReferenceIdentity) \
- (This)->lpVtbl -> TextToReference(This,dwFlags,pszIdentity,ppIReferenceIdentity)
-
-#define IIdentityAuthority_DefinitionToText(This,dwFlags,pIDefinitionIdentity,ppszFormattedIdentity) \
- (This)->lpVtbl -> DefinitionToText(This,dwFlags,pIDefinitionIdentity,ppszFormattedIdentity)
-
-#define IIdentityAuthority_DefinitionToTextBuffer(This,dwFlags,pIDefinitionIdentity,cchBufferSize,wchBuffer,pcchBufferRequired) \
- (This)->lpVtbl -> DefinitionToTextBuffer(This,dwFlags,pIDefinitionIdentity,cchBufferSize,wchBuffer,pcchBufferRequired)
-
-#define IIdentityAuthority_ReferenceToText(This,dwFlags,pIReferenceIdentity,ppszFormattedIdentity) \
- (This)->lpVtbl -> ReferenceToText(This,dwFlags,pIReferenceIdentity,ppszFormattedIdentity)
-
-#define IIdentityAuthority_ReferenceToTextBuffer(This,dwFlags,pIReferenceIdentity,cchBufferSize,wchBuffer,pcchBufferRequired) \
- (This)->lpVtbl -> ReferenceToTextBuffer(This,dwFlags,pIReferenceIdentity,cchBufferSize,wchBuffer,pcchBufferRequired)
-
-#define IIdentityAuthority_AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfEqual) \
- (This)->lpVtbl -> AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfEqual)
-
-#define IIdentityAuthority_AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfEqual) \
- (This)->lpVtbl -> AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfEqual)
-
-#define IIdentityAuthority_AreTextualDefinitionsEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual) \
- (This)->lpVtbl -> AreTextualDefinitionsEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual)
-
-#define IIdentityAuthority_AreTextualReferencesEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual) \
- (This)->lpVtbl -> AreTextualReferencesEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual)
-
-#define IIdentityAuthority_DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches) \
- (This)->lpVtbl -> DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches)
-
-#define IIdentityAuthority_DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches) \
- (This)->lpVtbl -> DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches)
-
-#define IIdentityAuthority_HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey) \
- (This)->lpVtbl -> HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey)
-
-#define IIdentityAuthority_HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey) \
- (This)->lpVtbl -> HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey)
-
-#define IIdentityAuthority_GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm) \
- (This)->lpVtbl -> GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm)
-
-#define IIdentityAuthority_GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm) \
- (This)->lpVtbl -> GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm)
-
-#define IIdentityAuthority_CreateDefinition(This,ppNewIdentity) \
- (This)->lpVtbl -> CreateDefinition(This,ppNewIdentity)
-
-#define IIdentityAuthority_CreateReference(This,ppNewIdentity) \
- (This)->lpVtbl -> CreateReference(This,ppNewIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_TextToDefinition_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_TextToDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_TextToReference_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceIdentity **ppIReferenceIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_TextToReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_DefinitionToText_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_DefinitionToText_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_DefinitionToTextBuffer_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired);
-
-
-void __RPC_STUB IIdentityAuthority_DefinitionToTextBuffer_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_ReferenceToText_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_ReferenceToText_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_ReferenceToTextBuffer_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cchBufferSize,
- /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
- /* [out] */ ULONG *pcchBufferRequired);
-
-
-void __RPC_STUB IIdentityAuthority_ReferenceToTextBuffer_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreDefinitionsEqual_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinition1,
- /* [in] */ IDefinitionIdentity *pDefinition2,
- /* [out] */ BOOL *pfEqual);
-
-
-void __RPC_STUB IIdentityAuthority_AreDefinitionsEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreReferencesEqual_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pReference1,
- /* [in] */ IReferenceIdentity *pReference2,
- /* [out] */ BOOL *pfEqual);
-
-
-void __RPC_STUB IIdentityAuthority_AreReferencesEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreTextualDefinitionsEqual_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual);
-
-
-void __RPC_STUB IIdentityAuthority_AreTextualDefinitionsEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreTextualReferencesEqual_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentityLeft,
- /* [in] */ LPCWSTR pszIdentityRight,
- /* [out] */ BOOL *pfEqual);
-
-
-void __RPC_STUB IIdentityAuthority_AreTextualReferencesEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_DoesDefinitionMatchReference_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches);
-
-
-void __RPC_STUB IIdentityAuthority_DoesDefinitionMatchReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_DoesTextualDefinitionMatchTextualReference_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches);
-
-
-void __RPC_STUB IIdentityAuthority_DoesTextualDefinitionMatchTextualReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_HashReference_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
-
-void __RPC_STUB IIdentityAuthority_HashReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_HashDefinition_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
-
-void __RPC_STUB IIdentityAuthority_HashDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_GenerateDefinitionKey_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
-
-void __RPC_STUB IIdentityAuthority_GenerateDefinitionKey_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_GenerateReferenceKey_Proxy(
- IIdentityAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
-
-void __RPC_STUB IIdentityAuthority_GenerateReferenceKey_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_CreateDefinition_Proxy(
- IIdentityAuthority * This,
- /* [retval][out] */ IDefinitionIdentity **ppNewIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_CreateDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IIdentityAuthority_CreateReference_Proxy(
- IIdentityAuthority * This,
- /* [retval][out] */ IReferenceIdentity **ppNewIdentity);
-
-
-void __RPC_STUB IIdentityAuthority_CreateReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IIdentityAuthority_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAppIdAuthority_INTERFACE_DEFINED__
-#define __IAppIdAuthority_INTERFACE_DEFINED__
-
-/* interface IAppIdAuthority */
-/* [local][unique][uuid][object] */
-
-/* [v1_enum] */
-enum IAPPIDAUTHORITY_ARE_DEFINITIONS_EQUAL_FLAGS
- { IAPPIDAUTHORITY_ARE_DEFINITIONS_EQUAL_FLAG_IGNORE_VERSION = 0x1
- } ;
-/* [v1_enum] */
-enum IAPPIDAUTHORITY_ARE_REFERENCES_EQUAL_FLAGS
- { IAPPIDAUTHORITY_ARE_REFERENCES_EQUAL_FLAG_IGNORE_VERSION = 0x1
- } ;
-
-EXTERN_C const IID IID_IAppIdAuthority;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8c87810c-2541-4f75-b2d0-9af515488e23")
- IAppIdAuthority : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE TextToDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionAppId **ppIDefinitionAppId) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE TextToReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceAppId **ppIReferenceAppId) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DefinitionToText(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReferenceToText(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreDefinitionsEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDefinition1,
- /* [in] */ IDefinitionAppId *pDefinition2,
- /* [out] */ BOOL *pfAreEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreReferencesEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pReference1,
- /* [in] */ IReferenceAppId *pReference2,
- /* [out] */ BOOL *pfAreEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreTextualDefinitionsEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AreTextualReferencesEqual(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DoesDefinitionMatchReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE DoesTextualDefinitionMatchTextualReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE HashReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE HashDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GenerateDefinitionKey(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GenerateReferenceKey(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateDefinition(
- /* [retval][out] */ IDefinitionAppId **ppNewIdentity) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateReference(
- /* [retval][out] */ IReferenceAppId **ppNewIdentity) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IAppIdAuthorityVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IAppIdAuthority * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IAppIdAuthority * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IAppIdAuthority * This);
-
- HRESULT ( STDMETHODCALLTYPE *TextToDefinition )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionAppId **ppIDefinitionAppId);
-
- HRESULT ( STDMETHODCALLTYPE *TextToReference )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceAppId **ppIReferenceAppId);
-
- HRESULT ( STDMETHODCALLTYPE *DefinitionToText )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *ReferenceToText )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *AreDefinitionsEqual )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDefinition1,
- /* [in] */ IDefinitionAppId *pDefinition2,
- /* [out] */ BOOL *pfAreEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreReferencesEqual )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pReference1,
- /* [in] */ IReferenceAppId *pReference2,
- /* [out] */ BOOL *pfAreEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreTextualDefinitionsEqual )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual);
-
- HRESULT ( STDMETHODCALLTYPE *AreTextualReferencesEqual )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual);
-
- HRESULT ( STDMETHODCALLTYPE *DoesDefinitionMatchReference )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches);
-
- HRESULT ( STDMETHODCALLTYPE *DoesTextualDefinitionMatchTextualReference )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches);
-
- HRESULT ( STDMETHODCALLTYPE *HashReference )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
- HRESULT ( STDMETHODCALLTYPE *HashDefinition )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
- HRESULT ( STDMETHODCALLTYPE *GenerateDefinitionKey )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
- HRESULT ( STDMETHODCALLTYPE *GenerateReferenceKey )(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
- HRESULT ( STDMETHODCALLTYPE *CreateDefinition )(
- IAppIdAuthority * This,
- /* [retval][out] */ IDefinitionAppId **ppNewIdentity);
-
- HRESULT ( STDMETHODCALLTYPE *CreateReference )(
- IAppIdAuthority * This,
- /* [retval][out] */ IReferenceAppId **ppNewIdentity);
-
- END_INTERFACE
- } IAppIdAuthorityVtbl;
-
- interface IAppIdAuthority
- {
- CONST_VTBL struct IAppIdAuthorityVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IAppIdAuthority_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IAppIdAuthority_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IAppIdAuthority_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IAppIdAuthority_TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionAppId) \
- (This)->lpVtbl -> TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionAppId)
-
-#define IAppIdAuthority_TextToReference(This,dwFlags,pszIdentity,ppIReferenceAppId) \
- (This)->lpVtbl -> TextToReference(This,dwFlags,pszIdentity,ppIReferenceAppId)
-
-#define IAppIdAuthority_DefinitionToText(This,dwFlags,pIDefinitionAppId,ppszFormattedIdentity) \
- (This)->lpVtbl -> DefinitionToText(This,dwFlags,pIDefinitionAppId,ppszFormattedIdentity)
-
-#define IAppIdAuthority_ReferenceToText(This,dwFlags,pIReferenceAppId,ppszFormattedIdentity) \
- (This)->lpVtbl -> ReferenceToText(This,dwFlags,pIReferenceAppId,ppszFormattedIdentity)
-
-#define IAppIdAuthority_AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfAreEqual) \
- (This)->lpVtbl -> AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfAreEqual)
-
-#define IAppIdAuthority_AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfAreEqual) \
- (This)->lpVtbl -> AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfAreEqual)
-
-#define IAppIdAuthority_AreTextualDefinitionsEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual) \
- (This)->lpVtbl -> AreTextualDefinitionsEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual)
-
-#define IAppIdAuthority_AreTextualReferencesEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual) \
- (This)->lpVtbl -> AreTextualReferencesEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual)
-
-#define IAppIdAuthority_DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches) \
- (This)->lpVtbl -> DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches)
-
-#define IAppIdAuthority_DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches) \
- (This)->lpVtbl -> DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches)
-
-#define IAppIdAuthority_HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey) \
- (This)->lpVtbl -> HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey)
-
-#define IAppIdAuthority_HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey) \
- (This)->lpVtbl -> HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey)
-
-#define IAppIdAuthority_GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm) \
- (This)->lpVtbl -> GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm)
-
-#define IAppIdAuthority_GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm) \
- (This)->lpVtbl -> GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm)
-
-#define IAppIdAuthority_CreateDefinition(This,ppNewIdentity) \
- (This)->lpVtbl -> CreateDefinition(This,ppNewIdentity)
-
-#define IAppIdAuthority_CreateReference(This,ppNewIdentity) \
- (This)->lpVtbl -> CreateReference(This,ppNewIdentity)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_TextToDefinition_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IDefinitionAppId **ppIDefinitionAppId);
-
-
-void __RPC_STUB IAppIdAuthority_TextToDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_TextToReference_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszIdentity,
- /* [out] */ IReferenceAppId **ppIReferenceAppId);
-
-
-void __RPC_STUB IAppIdAuthority_TextToReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_DefinitionToText_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
-
-void __RPC_STUB IAppIdAuthority_DefinitionToText_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_ReferenceToText_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceAppId,
- /* [out] */ LPWSTR *ppszFormattedIdentity);
-
-
-void __RPC_STUB IAppIdAuthority_ReferenceToText_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreDefinitionsEqual_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDefinition1,
- /* [in] */ IDefinitionAppId *pDefinition2,
- /* [out] */ BOOL *pfAreEqual);
-
-
-void __RPC_STUB IAppIdAuthority_AreDefinitionsEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreReferencesEqual_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pReference1,
- /* [in] */ IReferenceAppId *pReference2,
- /* [out] */ BOOL *pfAreEqual);
-
-
-void __RPC_STUB IAppIdAuthority_AreReferencesEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreTextualDefinitionsEqual_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual);
-
-
-void __RPC_STUB IAppIdAuthority_AreTextualDefinitionsEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreTextualReferencesEqual_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszAppIdLeft,
- /* [in] */ LPCWSTR pszAppIdRight,
- /* [out] */ BOOL *pfAreEqual);
-
-
-void __RPC_STUB IAppIdAuthority_AreTextualReferencesEqual_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_DoesDefinitionMatchReference_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ BOOL *pfMatches);
-
-
-void __RPC_STUB IAppIdAuthority_DoesDefinitionMatchReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_DoesTextualDefinitionMatchTextualReference_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ LPCWSTR pszDefinition,
- /* [in] */ LPCWSTR pszReference,
- /* [out] */ BOOL *pfMatches);
-
-
-void __RPC_STUB IAppIdAuthority_DoesTextualDefinitionMatchTextualReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_HashReference_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
-
-void __RPC_STUB IAppIdAuthority_HashReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_HashDefinition_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ ULONGLONG *pullPseudoKey);
-
-
-void __RPC_STUB IAppIdAuthority_HashDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_GenerateDefinitionKey_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
-
-void __RPC_STUB IAppIdAuthority_GenerateDefinitionKey_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_GenerateReferenceKey_Proxy(
- IAppIdAuthority * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceAppId *pIReferenceIdentity,
- /* [out] */ LPWSTR *ppszKeyForm);
-
-
-void __RPC_STUB IAppIdAuthority_GenerateReferenceKey_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_CreateDefinition_Proxy(
- IAppIdAuthority * This,
- /* [retval][out] */ IDefinitionAppId **ppNewIdentity);
-
-
-void __RPC_STUB IAppIdAuthority_CreateDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IAppIdAuthority_CreateReference_Proxy(
- IAppIdAuthority * This,
- /* [retval][out] */ IReferenceAppId **ppNewIdentity);
-
-
-void __RPC_STUB IAppIdAuthority_CreateReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IAppIdAuthority_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_INTERFACE_DEFINED__
-#define __IEnumSTORE_CATEGORY_INTERFACE_DEFINED__
-
-/* interface IEnumSTORE_CATEGORY */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumSTORE_CATEGORY;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("b840a2f5-a497-4a6d-9038-cd3ec2fbd222")
- IEnumSTORE_CATEGORY : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_CATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG ulElements) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumSTORE_CATEGORY **ppIEnumSTORE_CATEGORY) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumSTORE_CATEGORYVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumSTORE_CATEGORY * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumSTORE_CATEGORY * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumSTORE_CATEGORY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumSTORE_CATEGORY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_CATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumSTORE_CATEGORY * This,
- /* [in] */ ULONG ulElements);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumSTORE_CATEGORY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumSTORE_CATEGORY * This,
- /* [out] */ IEnumSTORE_CATEGORY **ppIEnumSTORE_CATEGORY);
-
- END_INTERFACE
- } IEnumSTORE_CATEGORYVtbl;
-
- interface IEnumSTORE_CATEGORY
- {
- CONST_VTBL struct IEnumSTORE_CATEGORYVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTORE_CATEGORY_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumSTORE_CATEGORY_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumSTORE_CATEGORY_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumSTORE_CATEGORY_Next(This,celt,rgElements,pulFetched) \
- (This)->lpVtbl -> Next(This,celt,rgElements,pulFetched)
-
-#define IEnumSTORE_CATEGORY_Skip(This,ulElements) \
- (This)->lpVtbl -> Skip(This,ulElements)
-
-#define IEnumSTORE_CATEGORY_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumSTORE_CATEGORY_Clone(This,ppIEnumSTORE_CATEGORY) \
- (This)->lpVtbl -> Clone(This,ppIEnumSTORE_CATEGORY)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_Next_Proxy(
- IEnumSTORE_CATEGORY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_CATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_Skip_Proxy(
- IEnumSTORE_CATEGORY * This,
- /* [in] */ ULONG ulElements);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_Reset_Proxy(
- IEnumSTORE_CATEGORY * This);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_Clone_Proxy(
- IEnumSTORE_CATEGORY * This,
- /* [out] */ IEnumSTORE_CATEGORY **ppIEnumSTORE_CATEGORY);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumSTORE_CATEGORY_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_SUBCATEGORY_INTERFACE_DEFINED__
-#define __IEnumSTORE_CATEGORY_SUBCATEGORY_INTERFACE_DEFINED__
-
-/* interface IEnumSTORE_CATEGORY_SUBCATEGORY */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumSTORE_CATEGORY_SUBCATEGORY;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("19be1967-b2fc-4dc1-9627-f3cb6305d2a7")
- IEnumSTORE_CATEGORY_SUBCATEGORY : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_CATEGORY_SUBCATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG ulElements) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumSTORE_CATEGORY_SUBCATEGORY **ppIEnumSTORE_CATEGORY_SUBCATEGORY) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumSTORE_CATEGORY_SUBCATEGORYVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_CATEGORY_SUBCATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This,
- /* [in] */ ULONG ulElements);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This,
- /* [out] */ IEnumSTORE_CATEGORY_SUBCATEGORY **ppIEnumSTORE_CATEGORY_SUBCATEGORY);
-
- END_INTERFACE
- } IEnumSTORE_CATEGORY_SUBCATEGORYVtbl;
-
- interface IEnumSTORE_CATEGORY_SUBCATEGORY
- {
- CONST_VTBL struct IEnumSTORE_CATEGORY_SUBCATEGORYVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTORE_CATEGORY_SUBCATEGORY_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumSTORE_CATEGORY_SUBCATEGORY_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumSTORE_CATEGORY_SUBCATEGORY_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumSTORE_CATEGORY_SUBCATEGORY_Next(This,celt,rgElements,pulFetched) \
- (This)->lpVtbl -> Next(This,celt,rgElements,pulFetched)
-
-#define IEnumSTORE_CATEGORY_SUBCATEGORY_Skip(This,ulElements) \
- (This)->lpVtbl -> Skip(This,ulElements)
-
-#define IEnumSTORE_CATEGORY_SUBCATEGORY_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumSTORE_CATEGORY_SUBCATEGORY_Clone(This,ppIEnumSTORE_CATEGORY_SUBCATEGORY) \
- (This)->lpVtbl -> Clone(This,ppIEnumSTORE_CATEGORY_SUBCATEGORY)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_SUBCATEGORY_Next_Proxy(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_CATEGORY_SUBCATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_SUBCATEGORY_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_SUBCATEGORY_Skip_Proxy(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This,
- /* [in] */ ULONG ulElements);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_SUBCATEGORY_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_SUBCATEGORY_Reset_Proxy(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_SUBCATEGORY_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_SUBCATEGORY_Clone_Proxy(
- IEnumSTORE_CATEGORY_SUBCATEGORY * This,
- /* [out] */ IEnumSTORE_CATEGORY_SUBCATEGORY **ppIEnumSTORE_CATEGORY_SUBCATEGORY);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_SUBCATEGORY_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumSTORE_CATEGORY_SUBCATEGORY_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_CATEGORY_INSTANCE_INTERFACE_DEFINED__
-#define __IEnumSTORE_CATEGORY_INSTANCE_INTERFACE_DEFINED__
-
-/* interface IEnumSTORE_CATEGORY_INSTANCE */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumSTORE_CATEGORY_INSTANCE;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("5ba7cb30-8508-4114-8c77-262fcda4fadb")
- IEnumSTORE_CATEGORY_INSTANCE : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG ulElements,
- /* [length_is][size_is][out] */ STORE_CATEGORY_INSTANCE rgInstances[ ],
- /* [out] */ ULONG *pulFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG ulElements) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumSTORE_CATEGORY_INSTANCE **ppIEnumSTORE_CATEGORY_INSTANCE) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumSTORE_CATEGORY_INSTANCEVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumSTORE_CATEGORY_INSTANCE * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumSTORE_CATEGORY_INSTANCE * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumSTORE_CATEGORY_INSTANCE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumSTORE_CATEGORY_INSTANCE * This,
- /* [in] */ ULONG ulElements,
- /* [length_is][size_is][out] */ STORE_CATEGORY_INSTANCE rgInstances[ ],
- /* [out] */ ULONG *pulFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumSTORE_CATEGORY_INSTANCE * This,
- /* [in] */ ULONG ulElements);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumSTORE_CATEGORY_INSTANCE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumSTORE_CATEGORY_INSTANCE * This,
- /* [out] */ IEnumSTORE_CATEGORY_INSTANCE **ppIEnumSTORE_CATEGORY_INSTANCE);
-
- END_INTERFACE
- } IEnumSTORE_CATEGORY_INSTANCEVtbl;
-
- interface IEnumSTORE_CATEGORY_INSTANCE
- {
- CONST_VTBL struct IEnumSTORE_CATEGORY_INSTANCEVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTORE_CATEGORY_INSTANCE_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumSTORE_CATEGORY_INSTANCE_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumSTORE_CATEGORY_INSTANCE_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumSTORE_CATEGORY_INSTANCE_Next(This,ulElements,rgInstances,pulFetched) \
- (This)->lpVtbl -> Next(This,ulElements,rgInstances,pulFetched)
-
-#define IEnumSTORE_CATEGORY_INSTANCE_Skip(This,ulElements) \
- (This)->lpVtbl -> Skip(This,ulElements)
-
-#define IEnumSTORE_CATEGORY_INSTANCE_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumSTORE_CATEGORY_INSTANCE_Clone(This,ppIEnumSTORE_CATEGORY_INSTANCE) \
- (This)->lpVtbl -> Clone(This,ppIEnumSTORE_CATEGORY_INSTANCE)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_INSTANCE_Next_Proxy(
- IEnumSTORE_CATEGORY_INSTANCE * This,
- /* [in] */ ULONG ulElements,
- /* [length_is][size_is][out] */ STORE_CATEGORY_INSTANCE rgInstances[ ],
- /* [out] */ ULONG *pulFetched);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_INSTANCE_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_INSTANCE_Skip_Proxy(
- IEnumSTORE_CATEGORY_INSTANCE * This,
- /* [in] */ ULONG ulElements);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_INSTANCE_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_INSTANCE_Reset_Proxy(
- IEnumSTORE_CATEGORY_INSTANCE * This);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_INSTANCE_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_INSTANCE_Clone_Proxy(
- IEnumSTORE_CATEGORY_INSTANCE * This,
- /* [out] */ IEnumSTORE_CATEGORY_INSTANCE **ppIEnumSTORE_CATEGORY_INSTANCE);
-
-
-void __RPC_STUB IEnumSTORE_CATEGORY_INSTANCE_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumSTORE_CATEGORY_INSTANCE_INTERFACE_DEFINED__ */
-
-
-#ifndef __IStore_INTERFACE_DEFINED__
-#define __IStore_INTERFACE_DEFINED__
-
-/* interface IStore */
-/* [local][unique][uuid][object] */
-
-typedef struct _STORE_SET_CANONICALIZATION_CONTEXT
- {
- DWORD cbSize;
- DWORD dwFlags;
- LPCWSTR pszBaseAddressesFilePath;
- LPCWSTR pszExportsFilePath;
- } STORE_SET_CANONICALIZATION_CONTEXT;
-
-typedef struct _STORE_SET_CANONICALIZATION_CONTEXT *PSTORE_SET_CANONICALIZATION_CONTEXT;
-
-typedef const STORE_SET_CANONICALIZATION_CONTEXT *PCSTORE_SET_CANONICALIZATION_CONTEXT;
-
-typedef struct _STORE_STAGE_COMPONENT
- {
- DWORD cbSize;
- DWORD dwFlags;
- IDefinitionAppId *pIApplicationIdentity;
- IDefinitionIdentity *pIComponentIdentity;
- LPCWSTR pszManifestSourcePath;
- } STORE_STAGE_COMPONENT;
-
-typedef struct _STORE_STAGE_COMPONENT *PSTORE_STAGE_COMPONENT;
-
-typedef const STORE_STAGE_COMPONENT *PCSTORE_STAGE_COMPONENT;
-
-/* [v1_enum] */
-enum _STORE_STAGE_COMPONENT_DISPOSITIONS
- { ISTORE_STAGE_COMPONENT_DISPOSITION_INSTALLED = 0x1,
- ISTORE_STAGE_COMPONENT_DISPOSITION_REFRESHED_BITS = 0x2,
- ISTORE_STAGE_COMPONENT_DISPOSITION_ALREADY_INSTALLED = 0x3
- } ;
-typedef struct _STORE_STAGE_COMPONENT_FILE
- {
- DWORD cbSize;
- DWORD dwFlags;
- IDefinitionAppId *pApplication;
- IDefinitionIdentity *pMemberComponent;
- LPCWSTR pszComponentRelativePath;
- LPCWSTR pszSourceFileName;
- } STORE_STAGE_COMPONENT_FILE;
-
-typedef struct _STORE_STAGE_COMPONENT_FILE *PSTORE_STAGE_COMPONENT_FILE;
-
-typedef const STORE_STAGE_COMPONENT_FILE *PCSTORE_STAGE_COMPONENT_FILE;
-
-/* [v1_enum] */
-enum _STORE_STAGE_COMPONENT_FILE_DISPOSITIONS
- { ISTORE_STAGE_COMPONENT_FILE_DISPOSITION_INSTALLED = 0x1,
- ISTORE_STAGE_COMPONENT_FILE_DISPOSITION_REFRESHED_BITS = 0x2,
- ISTORE_STAGE_COMPONENT_FILE_DISPOSITION_ALREADY_INSTALLED = 0x3
- } ;
-/* [v1_enum] */
-enum _STORE_PIN_DEPLOYMENT_FLAGS
- { STORE_PIN_DEPLOYMENT_FLAG_NEVER_EXPIRES = 0x1
- } ;
-typedef struct _STORE_PIN_DEPLOYMENT
- {
- DWORD cbSize;
- DWORD dwFlags;
- IDefinitionAppId *pIApplicationIdentity;
- ULONGLONG ExpirationTime;
- PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReferenceTrack;
- } STORE_PIN_DEPLOYMENT;
-
-typedef struct _STORE_PIN_DEPLOYMENT *PSTORE_PIN_DEPLOYMENT;
-
-typedef const STORE_PIN_DEPLOYMENT *PCSTORE_PIN_DEPLOYMENT;
-
-/* [v1_enum] */
-enum _STORE_PIN_DEPLOYMENT_DISPOSITIONS
- { ISTORE_PIN_DEPLOYMENT_DISPOSITION_PINNED = 0x1
- } ;
-typedef struct _STORE_UNPIN_DEPLOYMENT
- {
- DWORD cbSize;
- DWORD dwFlags;
- IDefinitionAppId *pIApplicationIdentity;
- PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReferenceTrack;
- } STORE_UNPIN_DEPLOYMENT;
-
-typedef struct _STORE_UNPIN_DEPLOYMENT *PSTORE_UNPIN_DEPLOYMENT;
-
-typedef const STORE_UNPIN_DEPLOYMENT *PCSTORE_UNPIN_DEPLOYMENT;
-
-/* [v1_enum] */
-enum _STORE_UNPIN_DEPLOYMENT_DISPOSITIONS
- { ISTORE_UNPIN_DEPLOYMENT_DISPOSITION_REMOVED = 0x1
- } ;
-/* [v1_enum] */
-enum _STORE_INSTALL_DEPLOYMENT_FLAGS
- { STORE_INSTALL_DEPLOYMENT_FLAG_UNINSTALL_OTHERS = 0x1
- } ;
-typedef struct _STORE_INSTALL_DEPLOYMENT
- {
- DWORD cbSize;
- DWORD dwFlags;
- IDefinitionAppId *pIApplicationIdentity;
- PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReferenceTrack;
- } STORE_INSTALL_DEPLOYMENT;
-
-typedef struct _STORE_INSTALL_DEPLOYMENT *PSTORE_INSTALL_DEPLOYMENT;
-
-typedef const STORE_INSTALL_DEPLOYMENT *PCSTORE_INSTALL_DEPLOYMENT;
-
-/* [v1_enum] */
-enum _STORE_INSTALL_DEPLOYMENT_DISPOSITIONS
- { ISTORE_INSTALL_DEPLOYMENT_DISPOSITION_ALREADY_INSTALLED = 0x1,
- ISTORE_INSTALL_DEPLOYMENT_DISPOSITION_INSTALLED = 0x2
- } ;
-typedef struct _STORE_UNINSTALL_DEPLOYMENT
- {
- DWORD cbSize;
- DWORD dwFlags;
- IDefinitionAppId *pIApplicationIdentity;
- PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReferenceTrack;
- } STORE_UNINSTALL_DEPLOYMENT;
-
-typedef struct _STORE_UNINSTALL_DEPLOYMENT *PSTORE_UNINSTALL_DEPLOYMENT;
-
-typedef const STORE_UNINSTALL_DEPLOYMENT *PCSTORE_UNINSTALL_DEPLOYMENT;
-
-/* [v1_enum] */
-enum _STORE_UNINSTALL_DEPLOYMENT_DISPOSITIONS
- { ISTORE_UNINSTALL_DEPLOYMENT_DISPOSITION_NOT_EXIST = 0x1,
- ISTORE_UNINSTALL_DEPLOYMENT_DISPOSITION_UNINSTALLED = 0x2
- } ;
-typedef struct _STORE_SET_DEPLOYMENT_METADATA_PROPERTY
- {
- GUID guidPropertySet;
- LPCWSTR pszName;
- SIZE_T nValueSize;
- /* [length_is][size_is] */ const BYTE *prgbValue;
- } STORE_SET_DEPLOYMENT_METADATA_PROPERTY;
-
-typedef struct _STORE_SET_DEPLOYMENT_METADATA_PROPERTY *PSTORE_SET_DEPLOYMENT_METADATA_PROPERTY;
-
-typedef const STORE_SET_DEPLOYMENT_METADATA_PROPERTY *PCSTORE_SET_DEPLOYMENT_METADATA_PROPERTY;
-
-typedef struct _STORE_SET_DEPLOYMENT_METADATA
- {
- DWORD cbSize;
- DWORD dwFlags;
- IDefinitionAppId *pDeploymentIdentity;
- PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE InstallReference;
- SIZE_T cPropertiesToTest;
- /* [length_is][size_is] */ const STORE_SET_DEPLOYMENT_METADATA_PROPERTY *rgPropertiesToTest;
- SIZE_T cPropertiesToSet;
- /* [length_is][size_is] */ const STORE_SET_DEPLOYMENT_METADATA_PROPERTY *rgPropertiesToSet;
- } STORE_SET_DEPLOYMENT_METADATA;
-
-typedef struct _STORE_SET_DEPLOYMENT_METADATA *PSTORE_SET_DEPLOYMENT_METADATA;
-
-typedef const STORE_SET_DEPLOYMENT_METADATA *PCSTORE_SET_DEPLOYMENT_METADATA;
-
-/* [v1_enum] */
-enum _STORE_SET_DEPLOYMENT_METADATA_DISPOSITIONS
- { ISTORE_SET_DEPLOYMENT_METADATA_DISPOSITION_SET = 0x2
- } ;
-/* [v1_enum] */
-enum _STORE_SCAVENGE_FLAGS
- { STORE_SCAVENGE_FLAG_DEEP_CLEAN = 0,
- STORE_SCAVENGE_FLAG_LIGHT_ONLY = 0x1,
- STORE_SCAVENGE_FLAG_LIMIT_SIZE = 0x2,
- STORE_SCAVENGE_FLAG_LIMIT_TIME = 0x4,
- STORE_SCAVENGE_FLAG_LIMIT_COUNT = 0x8
- } ;
-typedef struct _STORE_SCAVENGE
- {
- DWORD cbSize;
- DWORD dwFlags;
- ULONGLONG SizeReclaimationLimit;
- ULONGLONG RuntimeLimit;
- DWORD ComponentCountLimit;
- } STORE_SCAVENGE;
-
-typedef struct _STORE_SCAVENGE *PSTORE_SCAVENGE;
-
-typedef const STORE_SCAVENGE *PCSTORE_SCAVENGE;
-
-/* [v1_enum] */
-enum _STORE_SCAVENGE_DISPOSITIONS
- { ISTORE_SCAVENGE_DISPOSITION_SCAVENGED = 0x1
- } ;
-typedef /* [public][public][public][public][public][v1_enum] */
-enum __MIDL_IStore_0001
- { STORE_TXN_OP_INVALID = 0,
- STORE_TXN_OP_SET_CANONICALIZATION_CONTEXT = 14,
- STORE_TXN_OP_STAGE_COMPONENT = 20,
- STORE_TXN_OP_PIN_DEPLOYMENT = 21,
- STORE_TXN_OP_UNPIN_DEPLOYMENT = 22,
- STORE_TXN_OP_STAGE_COMPONENT_FILE = 23,
- STORE_TXN_OP_INSTALL_DEPLOYMENT = 24,
- STORE_TXN_OP_UNINSTALL_DEPLOYMENT = 25,
- STORE_TXN_OP_SET_DEPLOYMENT_METADATA = 26,
- STORE_TXN_OP_SCAVENGE = 27
- } STORE_TXN_OP_TYPE;
-
-typedef /* [switch_type] */ union _STORE_TXN_OPERATION_DATA
- {
- /* [case()] */ PCSTORE_SET_CANONICALIZATION_CONTEXT SetCanonicalizationContext;
- /* [case()] */ PCSTORE_STAGE_COMPONENT StageComponent;
- /* [case()] */ PCSTORE_STAGE_COMPONENT_FILE StageComponentFile;
- /* [case()] */ PCSTORE_PIN_DEPLOYMENT PinDeployment;
- /* [case()] */ PCSTORE_UNPIN_DEPLOYMENT UnpinDeployment;
- /* [case()] */ PCSTORE_INSTALL_DEPLOYMENT InstallDeployment;
- /* [case()] */ PCSTORE_UNINSTALL_DEPLOYMENT UninstallDeployment;
- /* [case()] */ PCSTORE_SET_DEPLOYMENT_METADATA SetDeploymentMetadata;
- /* [case()] */ PCSTORE_SCAVENGE Scavenge;
- } STORE_TXN_OPERATION_DATA;
-
-typedef /* [switch_type] */ union _STORE_TXN_OPERATION_DATA *PSTORE_TXN_OPERATION_DATA;
-
-C_ASSERT(sizeof(STORE_TXN_OPERATION_DATA) == sizeof(PVOID));
-typedef struct _STORE_TXN_OPERATION
- {
- STORE_TXN_OP_TYPE Operation;
- /* [switch_is] */ STORE_TXN_OPERATION_DATA Data;
- } STORE_TXN_OPERATION;
-
-typedef struct _STORE_TXN_OPERATION *PSTORE_TXN_OPERATION;
-
-typedef const STORE_TXN_OPERATION *PCSTORE_TXN_OPERATION;
-
-/* [v1_enum] */
-enum _ISTORE_BIND_REFERENCE_TO_ASSEMBLY_FLAGS
- { ISTORE_BIND_REFERENCE_TO_ASSEMBLY_FLAG_FORCE_LIBRARY_SEMANTICS = 0x1
- } ;
-/* [v1_enum] */
-enum _ISTORE_BIND_DEFINITIONS_DISPOSITIONS
- { ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_UNDEFINED = 0,
- ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_UNTOUCHED = 1,
- ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_RESOLVED = 2,
- ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_UNRESOLVED = 3,
- ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_MASK = 0xffff,
- ISTORE_BIND_DEFINITIONS_DISPOSITION_FLAG_POLICY_WAS_APPLIED = 0x10000
- } ;
-/* [v1_enum] */
-enum _ISTORE_BINDING_RESULT_DISPOSITION_STATES
- { ISTORE_BINDING_RESULT_DISPOSITION_STATE_UNDEFINED = 0,
- ISTORE_BINDING_RESULT_DISPOSITION_STATE_UNTOUCHED = 1,
- ISTORE_BINDING_RESULT_DISPOSITION_STATE_RESOLVED = 2,
- ISTORE_BINDING_RESULT_DISPOSITION_STATE_UNRESOLVED = 3,
- ISTORE_BINDING_RESULT_DISPOSITION_STATE_MASK = 0xffff,
- ISTORE_BINDING_RESULT_DISPOSITION_FLAG_POLICY_WAS_APPLIED = 0x10000
- } ;
-typedef struct _ISTORE_BINDING_RESULT
- {
- DWORD dwFlags;
- ULONG ulDisposition;
- COMPONENT_VERSION cvVersion;
- GUID guidCacheCoherencyGuid;
- PVOID pvReserved;
- } ISTORE_BINDING_RESULT;
-
-typedef struct _ISTORE_BINDING_RESULT *PISTORE_BINDING_RESULT;
-
-typedef const ISTORE_BINDING_RESULT *PCISTORE_BINDING_RESULT;
-
-/* [v1_enum] */
-enum _ISTORE_ENUM_ASSEMBLIES_FLAGS
- { ISTORE_ENUM_ASSEMBLIES_FLAG_LIMIT_TO_VISIBLE_ONLY = 0x1,
- ISTORE_ENUM_ASSEMBLIES_FLAG_MATCH_SERVICING = 0x2,
- ISTORE_ENUM_ASSEMBLIES_FLAG_FORCE_LIBRARY_SEMANTICS = 0x4
- } ;
-/* [v1_enum] */
-enum _ISTORE_ENUM_FILES_FLAGS
- { ISTORE_ENUM_FILES_FLAG_INCLUDE_INSTALLED_FILES = 0x1,
- ISTORE_ENUM_FILES_FLAG_INCLUDE_MISSING_FILES = 0x2
- } ;
-/* [v1_enum] */
-enum _ISTORE_ENUM_PRIVATE_FILES_FLAGS
- { ISTORE_ENUM_PRIVATE_FILES_FLAG_INCLUDE_INSTALLED_FILES = 0x1,
- ISTORE_ENUM_PRIVATE_FILES_FLAG_INCLUDE_MISSING_FILES = 0x2
- } ;
-/* [v1_enum] */
-enum _ISTORE_ENUM_INSTALLER_DEPLOYMENT_METADATA
- { ISTORE_ENUM_INSTALLER_DEPLOYMENT_METADATA_INCLUDE_FAMILIES = 0x1,
- ISTORE_ENUM_INSTALLER_DEPLOYMENT_METADATA_INCLUDE_SPECIFICS = 0x2
- } ;
-
-EXTERN_C const IID IID_IStore;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("a5c62f6d-5e3e-4cd9-b345-6b281d7a1d1e")
- IStore : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Transact(
- /* [in] */ SIZE_T cOperation,
- /* [size_is][in] */ const STORE_TXN_OPERATION rgOperations[ ],
- /* [size_is][out] */ ULONG rgDispositions[ ],
- /* [size_is][out] */ HRESULT rgResults[ ]) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE BindReferenceToAssembly(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cDeploymentsToIgnore,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppAssembly) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CalculateDelimiterOfDeploymentsBasedOnQuota(
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cDeployments,
- /* [length_is][in] */ IDefinitionAppId *rgpIDefinitionAppId_Deployments[ ],
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ ULONGLONG ulonglongQuote,
- /* [out] */ SIZE_T *Delimiter,
- /* [out] */ ULONGLONG *SizeSharedWithExternalDeployment,
- /* [out] */ ULONGLONG *SizeConsumedByInputDeploymentArray) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE BindDefinitions(
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T DefinitionCount,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [in] */ ULONG cDeploymentsToIgnore,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
- /* [size_is][out] */ ISTORE_BINDING_RESULT rgBindingResults[ ]) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetAssemblyInformation(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppManifest) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumAssemblies(
- /* [in] */ DWORD dwFlags,
- /* [unique][in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumFiles(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumInstallationReferences(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResults) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE LockAssemblyPath(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [out] */ LPVOID *ppvCookie,
- /* [out] */ LPWSTR *ppszPayloadRoot) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReleaseAssemblyPath(
- /* [in] */ LPVOID pvCookie) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE QueryChangeID(
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [out] */ ULONGLONG *pullChangeId) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumCategories(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumSubcategories(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pCategoryId,
- /* [in] */ LPCWSTR pszSubcategoryPathPattern,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumCategoryInstances(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pCategoryId,
- /* [in] */ LPCWSTR pszSubcategoryPath,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppUnknown) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetDeploymentProperty(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDeploymentInPackage,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE InstallReference,
- /* [in] */ REFCLSID PropertySet,
- /* [in] */ LPCWSTR pcwszPropertyName,
- /* [retval][out] */ BLOB *PropertyValue) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE LockApplicationPath(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIdentity,
- /* [out] */ LPVOID *ppvCookie,
- /* [out] */ LPWSTR *ppszPayloadRoot) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReleaseApplicationPath(
- /* [in] */ LPVOID Cookie) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumPrivateFiles(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pApplicationId,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumInstallerDeploymentMetadata(
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ IReferenceAppId *pDeploymentFilter,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumInstallerDeploymentMetadataProperties(
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ IDefinitionAppId *pAppidDeployment,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IStoreVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IStore * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IStore * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IStore * This);
-
- HRESULT ( STDMETHODCALLTYPE *Transact )(
- IStore * This,
- /* [in] */ SIZE_T cOperation,
- /* [size_is][in] */ const STORE_TXN_OPERATION rgOperations[ ],
- /* [size_is][out] */ ULONG rgDispositions[ ],
- /* [size_is][out] */ HRESULT rgResults[ ]);
-
- HRESULT ( STDMETHODCALLTYPE *BindReferenceToAssembly )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cDeploymentsToIgnore,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppAssembly);
-
- HRESULT ( STDMETHODCALLTYPE *CalculateDelimiterOfDeploymentsBasedOnQuota )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cDeployments,
- /* [length_is][in] */ IDefinitionAppId *rgpIDefinitionAppId_Deployments[ ],
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ ULONGLONG ulonglongQuote,
- /* [out] */ SIZE_T *Delimiter,
- /* [out] */ ULONGLONG *SizeSharedWithExternalDeployment,
- /* [out] */ ULONGLONG *SizeConsumedByInputDeploymentArray);
-
- HRESULT ( STDMETHODCALLTYPE *BindDefinitions )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T DefinitionCount,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [in] */ ULONG cDeploymentsToIgnore,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
- /* [size_is][out] */ ISTORE_BINDING_RESULT rgBindingResults[ ]);
-
- HRESULT ( STDMETHODCALLTYPE *GetAssemblyInformation )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppManifest);
-
- HRESULT ( STDMETHODCALLTYPE *EnumAssemblies )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [unique][in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
- HRESULT ( STDMETHODCALLTYPE *EnumFiles )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
- HRESULT ( STDMETHODCALLTYPE *EnumInstallationReferences )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResults);
-
- HRESULT ( STDMETHODCALLTYPE *LockAssemblyPath )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [out] */ LPVOID *ppvCookie,
- /* [out] */ LPWSTR *ppszPayloadRoot);
-
- HRESULT ( STDMETHODCALLTYPE *ReleaseAssemblyPath )(
- IStore * This,
- /* [in] */ LPVOID pvCookie);
-
- HRESULT ( STDMETHODCALLTYPE *QueryChangeID )(
- IStore * This,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [out] */ ULONGLONG *pullChangeId);
-
- HRESULT ( STDMETHODCALLTYPE *EnumCategories )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
- HRESULT ( STDMETHODCALLTYPE *EnumSubcategories )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pCategoryId,
- /* [in] */ LPCWSTR pszSubcategoryPathPattern,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
- HRESULT ( STDMETHODCALLTYPE *EnumCategoryInstances )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pCategoryId,
- /* [in] */ LPCWSTR pszSubcategoryPath,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppUnknown);
-
- HRESULT ( STDMETHODCALLTYPE *GetDeploymentProperty )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDeploymentInPackage,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE InstallReference,
- /* [in] */ REFCLSID PropertySet,
- /* [in] */ LPCWSTR pcwszPropertyName,
- /* [retval][out] */ BLOB *PropertyValue);
-
- HRESULT ( STDMETHODCALLTYPE *LockApplicationPath )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIdentity,
- /* [out] */ LPVOID *ppvCookie,
- /* [out] */ LPWSTR *ppszPayloadRoot);
-
- HRESULT ( STDMETHODCALLTYPE *ReleaseApplicationPath )(
- IStore * This,
- /* [in] */ LPVOID Cookie);
-
- HRESULT ( STDMETHODCALLTYPE *EnumPrivateFiles )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pApplicationId,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
- HRESULT ( STDMETHODCALLTYPE *EnumInstallerDeploymentMetadata )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ IReferenceAppId *pDeploymentFilter,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
- HRESULT ( STDMETHODCALLTYPE *EnumInstallerDeploymentMetadataProperties )(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ IDefinitionAppId *pAppidDeployment,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
- END_INTERFACE
- } IStoreVtbl;
-
- interface IStore
- {
- CONST_VTBL struct IStoreVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IStore_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IStore_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IStore_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IStore_Transact(This,cOperation,rgOperations,rgDispositions,rgResults) \
- (This)->lpVtbl -> Transact(This,cOperation,rgOperations,rgDispositions,rgResults)
-
-#define IStore_BindReferenceToAssembly(This,dwFlags,pIReferenceIdentity,cDeploymentsToIgnore,rgpIDefinitionIdentity_DeploymentsToIgnore,riid,ppAssembly) \
- (This)->lpVtbl -> BindReferenceToAssembly(This,dwFlags,pIReferenceIdentity,cDeploymentsToIgnore,rgpIDefinitionIdentity_DeploymentsToIgnore,riid,ppAssembly)
-
-#define IStore_CalculateDelimiterOfDeploymentsBasedOnQuota(This,dwFlags,cDeployments,rgpIDefinitionAppId_Deployments,pReference,ulonglongQuote,Delimiter,SizeSharedWithExternalDeployment,SizeConsumedByInputDeploymentArray) \
- (This)->lpVtbl -> CalculateDelimiterOfDeploymentsBasedOnQuota(This,dwFlags,cDeployments,rgpIDefinitionAppId_Deployments,pReference,ulonglongQuote,Delimiter,SizeSharedWithExternalDeployment,SizeConsumedByInputDeploymentArray)
-
-#define IStore_BindDefinitions(This,dwFlags,DefinitionCount,rgpIDefinitionIdentity,cDeploymentsToIgnore,rgpIDefinitionIdentity_DeploymentsToIgnore,rgBindingResults) \
- (This)->lpVtbl -> BindDefinitions(This,dwFlags,DefinitionCount,rgpIDefinitionIdentity,cDeploymentsToIgnore,rgpIDefinitionIdentity_DeploymentsToIgnore,rgBindingResults)
-
-#define IStore_GetAssemblyInformation(This,dwFlags,pIDefinitionIdentity,riid,ppManifest) \
- (This)->lpVtbl -> GetAssemblyInformation(This,dwFlags,pIDefinitionIdentity,riid,ppManifest)
-
-#define IStore_EnumAssemblies(This,dwFlags,pIReferenceIdentity_ToMatch,riid,ppQueryResult) \
- (This)->lpVtbl -> EnumAssemblies(This,dwFlags,pIReferenceIdentity_ToMatch,riid,ppQueryResult)
-
-#define IStore_EnumFiles(This,dwFlags,pDefinitionIdentity,riid,ppQueryResult) \
- (This)->lpVtbl -> EnumFiles(This,dwFlags,pDefinitionIdentity,riid,ppQueryResult)
-
-#define IStore_EnumInstallationReferences(This,dwFlags,pDefinitionIdentity,riid,ppQueryResults) \
- (This)->lpVtbl -> EnumInstallationReferences(This,dwFlags,pDefinitionIdentity,riid,ppQueryResults)
-
-#define IStore_LockAssemblyPath(This,dwFlags,pDefinitionIdentity,ppvCookie,ppszPayloadRoot) \
- (This)->lpVtbl -> LockAssemblyPath(This,dwFlags,pDefinitionIdentity,ppvCookie,ppszPayloadRoot)
-
-#define IStore_ReleaseAssemblyPath(This,pvCookie) \
- (This)->lpVtbl -> ReleaseAssemblyPath(This,pvCookie)
-
-#define IStore_QueryChangeID(This,pDefinitionIdentity,pullChangeId) \
- (This)->lpVtbl -> QueryChangeID(This,pDefinitionIdentity,pullChangeId)
-
-#define IStore_EnumCategories(This,dwFlags,pIReferenceIdentity_ToMatch,riid,ppIUnknown) \
- (This)->lpVtbl -> EnumCategories(This,dwFlags,pIReferenceIdentity_ToMatch,riid,ppIUnknown)
-
-#define IStore_EnumSubcategories(This,dwFlags,pCategoryId,pszSubcategoryPathPattern,riid,ppIUnknown) \
- (This)->lpVtbl -> EnumSubcategories(This,dwFlags,pCategoryId,pszSubcategoryPathPattern,riid,ppIUnknown)
-
-#define IStore_EnumCategoryInstances(This,dwFlags,pCategoryId,pszSubcategoryPath,riid,ppUnknown) \
- (This)->lpVtbl -> EnumCategoryInstances(This,dwFlags,pCategoryId,pszSubcategoryPath,riid,ppUnknown)
-
-#define IStore_GetDeploymentProperty(This,dwFlags,pDeploymentInPackage,InstallReference,PropertySet,pcwszPropertyName,PropertyValue) \
- (This)->lpVtbl -> GetDeploymentProperty(This,dwFlags,pDeploymentInPackage,InstallReference,PropertySet,pcwszPropertyName,PropertyValue)
-
-#define IStore_LockApplicationPath(This,dwFlags,pIdentity,ppvCookie,ppszPayloadRoot) \
- (This)->lpVtbl -> LockApplicationPath(This,dwFlags,pIdentity,ppvCookie,ppszPayloadRoot)
-
-#define IStore_ReleaseApplicationPath(This,Cookie) \
- (This)->lpVtbl -> ReleaseApplicationPath(This,Cookie)
-
-#define IStore_EnumPrivateFiles(This,dwFlags,pApplicationId,pDefinitionIdentity,riid,ppQueryResult) \
- (This)->lpVtbl -> EnumPrivateFiles(This,dwFlags,pApplicationId,pDefinitionIdentity,riid,ppQueryResult)
-
-#define IStore_EnumInstallerDeploymentMetadata(This,dwFlags,pReference,pDeploymentFilter,riid,ppQueryResult) \
- (This)->lpVtbl -> EnumInstallerDeploymentMetadata(This,dwFlags,pReference,pDeploymentFilter,riid,ppQueryResult)
-
-#define IStore_EnumInstallerDeploymentMetadataProperties(This,dwFlags,pReference,pAppidDeployment,riid,ppQueryResult) \
- (This)->lpVtbl -> EnumInstallerDeploymentMetadataProperties(This,dwFlags,pReference,pAppidDeployment,riid,ppQueryResult)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IStore_Transact_Proxy(
- IStore * This,
- /* [in] */ SIZE_T cOperation,
- /* [size_is][in] */ const STORE_TXN_OPERATION rgOperations[ ],
- /* [size_is][out] */ ULONG rgDispositions[ ],
- /* [size_is][out] */ HRESULT rgResults[ ]);
-
-
-void __RPC_STUB IStore_Transact_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_BindReferenceToAssembly_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity,
- /* [in] */ ULONG cDeploymentsToIgnore,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppAssembly);
-
-
-void __RPC_STUB IStore_BindReferenceToAssembly_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_CalculateDelimiterOfDeploymentsBasedOnQuota_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cDeployments,
- /* [length_is][in] */ IDefinitionAppId *rgpIDefinitionAppId_Deployments[ ],
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ ULONGLONG ulonglongQuote,
- /* [out] */ SIZE_T *Delimiter,
- /* [out] */ ULONGLONG *SizeSharedWithExternalDeployment,
- /* [out] */ ULONGLONG *SizeConsumedByInputDeploymentArray);
-
-
-void __RPC_STUB IStore_CalculateDelimiterOfDeploymentsBasedOnQuota_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_BindDefinitions_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T DefinitionCount,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
- /* [in] */ ULONG cDeploymentsToIgnore,
- /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
- /* [size_is][out] */ ISTORE_BINDING_RESULT rgBindingResults[ ]);
-
-
-void __RPC_STUB IStore_BindDefinitions_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_GetAssemblyInformation_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppManifest);
-
-
-void __RPC_STUB IStore_GetAssemblyInformation_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumAssemblies_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [unique][in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
-
-void __RPC_STUB IStore_EnumAssemblies_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumFiles_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
-
-void __RPC_STUB IStore_EnumFiles_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumInstallationReferences_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResults);
-
-
-void __RPC_STUB IStore_EnumInstallationReferences_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_LockAssemblyPath_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [out] */ LPVOID *ppvCookie,
- /* [out] */ LPWSTR *ppszPayloadRoot);
-
-
-void __RPC_STUB IStore_LockAssemblyPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_ReleaseAssemblyPath_Proxy(
- IStore * This,
- /* [in] */ LPVOID pvCookie);
-
-
-void __RPC_STUB IStore_ReleaseAssemblyPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_QueryChangeID_Proxy(
- IStore * This,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [out] */ ULONGLONG *pullChangeId);
-
-
-void __RPC_STUB IStore_QueryChangeID_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumCategories_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
-
-void __RPC_STUB IStore_EnumCategories_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumSubcategories_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pCategoryId,
- /* [in] */ LPCWSTR pszSubcategoryPathPattern,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
-
-void __RPC_STUB IStore_EnumSubcategories_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumCategoryInstances_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pCategoryId,
- /* [in] */ LPCWSTR pszSubcategoryPath,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppUnknown);
-
-
-void __RPC_STUB IStore_EnumCategoryInstances_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_GetDeploymentProperty_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pDeploymentInPackage,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE InstallReference,
- /* [in] */ REFCLSID PropertySet,
- /* [in] */ LPCWSTR pcwszPropertyName,
- /* [retval][out] */ BLOB *PropertyValue);
-
-
-void __RPC_STUB IStore_GetDeploymentProperty_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_LockApplicationPath_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIdentity,
- /* [out] */ LPVOID *ppvCookie,
- /* [out] */ LPWSTR *ppszPayloadRoot);
-
-
-void __RPC_STUB IStore_LockApplicationPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_ReleaseApplicationPath_Proxy(
- IStore * This,
- /* [in] */ LPVOID Cookie);
-
-
-void __RPC_STUB IStore_ReleaseApplicationPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumPrivateFiles_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pApplicationId,
- /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
-
-void __RPC_STUB IStore_EnumPrivateFiles_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumInstallerDeploymentMetadata_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ IReferenceAppId *pDeploymentFilter,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
-
-void __RPC_STUB IStore_EnumInstallerDeploymentMetadata_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStore_EnumInstallerDeploymentMetadataProperties_Proxy(
- IStore * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
- /* [in] */ IDefinitionAppId *pAppidDeployment,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppQueryResult);
-
-
-void __RPC_STUB IStore_EnumInstallerDeploymentMetadataProperties_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IStore_INTERFACE_DEFINED__ */
-
-
-#ifndef __IMigrateStore_INTERFACE_DEFINED__
-#define __IMigrateStore_INTERFACE_DEFINED__
-
-/* interface IMigrateStore */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IMigrateStore;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("a5c6a738-fc6a-4204-b4db-b8629b67e655")
- IMigrateStore : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Migrate(
- /* [in] */ LPVOID pvReserved) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IMigrateStoreVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IMigrateStore * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IMigrateStore * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IMigrateStore * This);
-
- HRESULT ( STDMETHODCALLTYPE *Migrate )(
- IMigrateStore * This,
- /* [in] */ LPVOID pvReserved);
-
- END_INTERFACE
- } IMigrateStoreVtbl;
-
- interface IMigrateStore
- {
- CONST_VTBL struct IMigrateStoreVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IMigrateStore_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IMigrateStore_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IMigrateStore_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IMigrateStore_Migrate(This,pvReserved) \
- (This)->lpVtbl -> Migrate(This,pvReserved)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IMigrateStore_Migrate_Proxy(
- IMigrateStore * This,
- /* [in] */ LPVOID pvReserved);
-
-
-void __RPC_STUB IMigrateStore_Migrate_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IMigrateStore_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_DEPLOYMENT_METADATA_INTERFACE_DEFINED__
-#define __IEnumSTORE_DEPLOYMENT_METADATA_INTERFACE_DEFINED__
-
-/* interface IEnumSTORE_DEPLOYMENT_METADATA */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumSTORE_DEPLOYMENT_METADATA;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("f9fd4090-93db-45c0-af87-624940f19cff")
- IEnumSTORE_DEPLOYMENT_METADATA : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionAppId *AppIds[ ],
- /* [optional][out] */ ULONG *pceltFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA **ppEnum) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumSTORE_DEPLOYMENT_METADATAVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumSTORE_DEPLOYMENT_METADATA * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumSTORE_DEPLOYMENT_METADATA * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumSTORE_DEPLOYMENT_METADATA * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumSTORE_DEPLOYMENT_METADATA * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionAppId *AppIds[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumSTORE_DEPLOYMENT_METADATA * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumSTORE_DEPLOYMENT_METADATA * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumSTORE_DEPLOYMENT_METADATA * This,
- /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA **ppEnum);
-
- END_INTERFACE
- } IEnumSTORE_DEPLOYMENT_METADATAVtbl;
-
- interface IEnumSTORE_DEPLOYMENT_METADATA
- {
- CONST_VTBL struct IEnumSTORE_DEPLOYMENT_METADATAVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_Next(This,celt,AppIds,pceltFetched) \
- (This)->lpVtbl -> Next(This,celt,AppIds,pceltFetched)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_Clone(This,ppEnum) \
- (This)->lpVtbl -> Clone(This,ppEnum)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_Next_Proxy(
- IEnumSTORE_DEPLOYMENT_METADATA * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ IDefinitionAppId *AppIds[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
-
-void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_Skip_Proxy(
- IEnumSTORE_DEPLOYMENT_METADATA * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_Reset_Proxy(
- IEnumSTORE_DEPLOYMENT_METADATA * This);
-
-
-void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_Clone_Proxy(
- IEnumSTORE_DEPLOYMENT_METADATA * This,
- /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA **ppEnum);
-
-
-void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumSTORE_DEPLOYMENT_METADATA_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_INTERFACE_DEFINED__
-#define __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_INTERFACE_DEFINED__
-
-/* interface IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY */
-/* [local][unique][uuid][object] */
-
-typedef struct _STORE_DEPLOYMENT_METADATA_PROPERTY
- {
- GUID guidPropertySet;
- LPCWSTR pszName;
- SIZE_T cbValue;
- /* [length_is][size_is] */ const BYTE *prgbValue;
- } STORE_DEPLOYMENT_METADATA_PROPERTY;
-
-typedef struct _STORE_DEPLOYMENT_METADATA_PROPERTY *PSTORE_DEPLOYMENT_METADATA_PROPERTY;
-
-
-EXTERN_C const IID IID_IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("5fa4f590-a416-4b22-ac79-7c3f0d31f303")
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_DEPLOYMENT_METADATA_PROPERTY AppIds[ ],
- /* [optional][out] */ ULONG *pceltFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY **ppEnum) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumSTORE_DEPLOYMENT_METADATA_PROPERTYVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_DEPLOYMENT_METADATA_PROPERTY AppIds[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
- /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY **ppEnum);
-
- END_INTERFACE
- } IEnumSTORE_DEPLOYMENT_METADATA_PROPERTYVtbl;
-
- interface IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY
- {
- CONST_VTBL struct IEnumSTORE_DEPLOYMENT_METADATA_PROPERTYVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Next(This,celt,AppIds,pceltFetched) \
- (This)->lpVtbl -> Next(This,celt,AppIds,pceltFetched)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Clone(This,ppEnum) \
- (This)->lpVtbl -> Clone(This,ppEnum)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Next_Proxy(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_DEPLOYMENT_METADATA_PROPERTY AppIds[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
-
-void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Skip_Proxy(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Reset_Proxy(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This);
-
-
-void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Clone_Proxy(
- IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
- /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY **ppEnum);
-
-
-void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_INTERFACE_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_INTERFACE_DEFINED__
-
-/* interface IEnumSTORE_ASSEMBLY */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumSTORE_ASSEMBLY;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("a5c637bf-6eaa-4e5f-b535-55299657e33e")
- IEnumSTORE_ASSEMBLY : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumSTORE_ASSEMBLY **ppEnum) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumSTORE_ASSEMBLYVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumSTORE_ASSEMBLY * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumSTORE_ASSEMBLY * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumSTORE_ASSEMBLY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumSTORE_ASSEMBLY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumSTORE_ASSEMBLY * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumSTORE_ASSEMBLY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumSTORE_ASSEMBLY * This,
- /* [out] */ IEnumSTORE_ASSEMBLY **ppEnum);
-
- END_INTERFACE
- } IEnumSTORE_ASSEMBLYVtbl;
-
- interface IEnumSTORE_ASSEMBLY
- {
- CONST_VTBL struct IEnumSTORE_ASSEMBLYVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTORE_ASSEMBLY_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumSTORE_ASSEMBLY_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumSTORE_ASSEMBLY_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumSTORE_ASSEMBLY_Next(This,celt,rgelt,pceltFetched) \
- (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched)
-
-#define IEnumSTORE_ASSEMBLY_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumSTORE_ASSEMBLY_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumSTORE_ASSEMBLY_Clone(This,ppEnum) \
- (This)->lpVtbl -> Clone(This,ppEnum)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_Next_Proxy(
- IEnumSTORE_ASSEMBLY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_Skip_Proxy(
- IEnumSTORE_ASSEMBLY * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_Reset_Proxy(
- IEnumSTORE_ASSEMBLY * This);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_Clone_Proxy(
- IEnumSTORE_ASSEMBLY * This,
- /* [out] */ IEnumSTORE_ASSEMBLY **ppEnum);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumSTORE_ASSEMBLY_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_FILE_INTERFACE_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_FILE_INTERFACE_DEFINED__
-
-/* interface IEnumSTORE_ASSEMBLY_FILE */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumSTORE_ASSEMBLY_FILE;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("a5c6aaa3-03e4-478d-b9f5-2e45908d5e4f")
- IEnumSTORE_ASSEMBLY_FILE : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY_FILE rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumSTORE_ASSEMBLY_FILE **ppEnum) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumSTORE_ASSEMBLY_FILEVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumSTORE_ASSEMBLY_FILE * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumSTORE_ASSEMBLY_FILE * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumSTORE_ASSEMBLY_FILE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumSTORE_ASSEMBLY_FILE * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY_FILE rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumSTORE_ASSEMBLY_FILE * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumSTORE_ASSEMBLY_FILE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumSTORE_ASSEMBLY_FILE * This,
- /* [out] */ IEnumSTORE_ASSEMBLY_FILE **ppEnum);
-
- END_INTERFACE
- } IEnumSTORE_ASSEMBLY_FILEVtbl;
-
- interface IEnumSTORE_ASSEMBLY_FILE
- {
- CONST_VTBL struct IEnumSTORE_ASSEMBLY_FILEVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTORE_ASSEMBLY_FILE_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumSTORE_ASSEMBLY_FILE_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumSTORE_ASSEMBLY_FILE_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumSTORE_ASSEMBLY_FILE_Next(This,celt,rgelt,pceltFetched) \
- (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched)
-
-#define IEnumSTORE_ASSEMBLY_FILE_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumSTORE_ASSEMBLY_FILE_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumSTORE_ASSEMBLY_FILE_Clone(This,ppEnum) \
- (This)->lpVtbl -> Clone(This,ppEnum)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_FILE_Next_Proxy(
- IEnumSTORE_ASSEMBLY_FILE * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY_FILE rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_FILE_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_FILE_Skip_Proxy(
- IEnumSTORE_ASSEMBLY_FILE * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_FILE_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_FILE_Reset_Proxy(
- IEnumSTORE_ASSEMBLY_FILE * This);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_FILE_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_FILE_Clone_Proxy(
- IEnumSTORE_ASSEMBLY_FILE * This,
- /* [out] */ IEnumSTORE_ASSEMBLY_FILE **ppEnum);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_FILE_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumSTORE_ASSEMBLY_FILE_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_INTERFACE_DEFINED__
-#define __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_INTERFACE_DEFINED__
-
-/* interface IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("d8b1aacb-5142-4abb-bcc1-e9dc9052a89e")
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY_INSTALLATION_REFERENCE rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG celt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE **ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCEVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY_INSTALLATION_REFERENCE rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
- /* [in] */ ULONG celt);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
- /* [out] */ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE **ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE);
-
- END_INTERFACE
- } IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCEVtbl;
-
- interface IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE
- {
- CONST_VTBL struct IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCEVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Next(This,celt,rgelt,pceltFetched) \
- (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched)
-
-#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Skip(This,celt) \
- (This)->lpVtbl -> Skip(This,celt)
-
-#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Clone(This,ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE) \
- (This)->lpVtbl -> Clone(This,ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Next_Proxy(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ STORE_ASSEMBLY_INSTALLATION_REFERENCE rgelt[ ],
- /* [optional][out] */ ULONG *pceltFetched);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Skip_Proxy(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
- /* [in] */ ULONG celt);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Reset_Proxy(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Clone_Proxy(
- IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
- /* [out] */ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE **ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE);
-
-
-void __RPC_STUB IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumCATEGORY_INTERFACE_DEFINED__
-#define __IEnumCATEGORY_INTERFACE_DEFINED__
-
-/* interface IEnumCATEGORY */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumCATEGORY;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("02249bf3-e0ef-4396-b8b7-8882e981175f")
- IEnumCATEGORY : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ CATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG ulElements) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumCATEGORY **ppIEnumCATEGORY) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumCATEGORYVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumCATEGORY * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumCATEGORY * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumCATEGORY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumCATEGORY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ CATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumCATEGORY * This,
- /* [in] */ ULONG ulElements);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumCATEGORY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumCATEGORY * This,
- /* [out] */ IEnumCATEGORY **ppIEnumCATEGORY);
-
- END_INTERFACE
- } IEnumCATEGORYVtbl;
-
- interface IEnumCATEGORY
- {
- CONST_VTBL struct IEnumCATEGORYVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumCATEGORY_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumCATEGORY_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumCATEGORY_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumCATEGORY_Next(This,celt,rgElements,pulFetched) \
- (This)->lpVtbl -> Next(This,celt,rgElements,pulFetched)
-
-#define IEnumCATEGORY_Skip(This,ulElements) \
- (This)->lpVtbl -> Skip(This,ulElements)
-
-#define IEnumCATEGORY_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumCATEGORY_Clone(This,ppIEnumCATEGORY) \
- (This)->lpVtbl -> Clone(This,ppIEnumCATEGORY)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_Next_Proxy(
- IEnumCATEGORY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ CATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched);
-
-
-void __RPC_STUB IEnumCATEGORY_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_Skip_Proxy(
- IEnumCATEGORY * This,
- /* [in] */ ULONG ulElements);
-
-
-void __RPC_STUB IEnumCATEGORY_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_Reset_Proxy(
- IEnumCATEGORY * This);
-
-
-void __RPC_STUB IEnumCATEGORY_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_Clone_Proxy(
- IEnumCATEGORY * This,
- /* [out] */ IEnumCATEGORY **ppIEnumCATEGORY);
-
-
-void __RPC_STUB IEnumCATEGORY_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumCATEGORY_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumCATEGORY_SUBCATEGORY_INTERFACE_DEFINED__
-#define __IEnumCATEGORY_SUBCATEGORY_INTERFACE_DEFINED__
-
-/* interface IEnumCATEGORY_SUBCATEGORY */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumCATEGORY_SUBCATEGORY;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("5f9fdbe5-57e1-49f6-bb9d-28c1a1503818")
- IEnumCATEGORY_SUBCATEGORY : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ CATEGORY_SUBCATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG ulElements) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumCATEGORY_SUBCATEGORY **ppIEnumCATEGORY_SUBCATEGORY) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumCATEGORY_SUBCATEGORYVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumCATEGORY_SUBCATEGORY * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumCATEGORY_SUBCATEGORY * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumCATEGORY_SUBCATEGORY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumCATEGORY_SUBCATEGORY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ CATEGORY_SUBCATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumCATEGORY_SUBCATEGORY * This,
- /* [in] */ ULONG ulElements);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumCATEGORY_SUBCATEGORY * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumCATEGORY_SUBCATEGORY * This,
- /* [out] */ IEnumCATEGORY_SUBCATEGORY **ppIEnumCATEGORY_SUBCATEGORY);
-
- END_INTERFACE
- } IEnumCATEGORY_SUBCATEGORYVtbl;
-
- interface IEnumCATEGORY_SUBCATEGORY
- {
- CONST_VTBL struct IEnumCATEGORY_SUBCATEGORYVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumCATEGORY_SUBCATEGORY_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumCATEGORY_SUBCATEGORY_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumCATEGORY_SUBCATEGORY_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumCATEGORY_SUBCATEGORY_Next(This,celt,rgElements,pulFetched) \
- (This)->lpVtbl -> Next(This,celt,rgElements,pulFetched)
-
-#define IEnumCATEGORY_SUBCATEGORY_Skip(This,ulElements) \
- (This)->lpVtbl -> Skip(This,ulElements)
-
-#define IEnumCATEGORY_SUBCATEGORY_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumCATEGORY_SUBCATEGORY_Clone(This,ppIEnumCATEGORY_SUBCATEGORY) \
- (This)->lpVtbl -> Clone(This,ppIEnumCATEGORY_SUBCATEGORY)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_SUBCATEGORY_Next_Proxy(
- IEnumCATEGORY_SUBCATEGORY * This,
- /* [in] */ ULONG celt,
- /* [length_is][size_is][out] */ CATEGORY_SUBCATEGORY rgElements[ ],
- /* [out] */ ULONG *pulFetched);
-
-
-void __RPC_STUB IEnumCATEGORY_SUBCATEGORY_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_SUBCATEGORY_Skip_Proxy(
- IEnumCATEGORY_SUBCATEGORY * This,
- /* [in] */ ULONG ulElements);
-
-
-void __RPC_STUB IEnumCATEGORY_SUBCATEGORY_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_SUBCATEGORY_Reset_Proxy(
- IEnumCATEGORY_SUBCATEGORY * This);
-
-
-void __RPC_STUB IEnumCATEGORY_SUBCATEGORY_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_SUBCATEGORY_Clone_Proxy(
- IEnumCATEGORY_SUBCATEGORY * This,
- /* [out] */ IEnumCATEGORY_SUBCATEGORY **ppIEnumCATEGORY_SUBCATEGORY);
-
-
-void __RPC_STUB IEnumCATEGORY_SUBCATEGORY_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumCATEGORY_SUBCATEGORY_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumCATEGORY_INSTANCE_INTERFACE_DEFINED__
-#define __IEnumCATEGORY_INSTANCE_INTERFACE_DEFINED__
-
-/* interface IEnumCATEGORY_INSTANCE */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IEnumCATEGORY_INSTANCE;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("8d8842d8-e031-4a7e-8571-dc0b03385807")
- IEnumCATEGORY_INSTANCE : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE Next(
- /* [in] */ ULONG ulElements,
- /* [length_is][size_is][out] */ CATEGORY_INSTANCE rgInstances[ ],
- /* [out] */ ULONG *pulFetched) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Skip(
- /* [in] */ ULONG ulElements) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Clone(
- /* [out] */ IEnumCATEGORY_INSTANCE **ppIEnumCATEGORY_INSTANCE) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IEnumCATEGORY_INSTANCEVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IEnumCATEGORY_INSTANCE * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IEnumCATEGORY_INSTANCE * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IEnumCATEGORY_INSTANCE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Next )(
- IEnumCATEGORY_INSTANCE * This,
- /* [in] */ ULONG ulElements,
- /* [length_is][size_is][out] */ CATEGORY_INSTANCE rgInstances[ ],
- /* [out] */ ULONG *pulFetched);
-
- HRESULT ( STDMETHODCALLTYPE *Skip )(
- IEnumCATEGORY_INSTANCE * This,
- /* [in] */ ULONG ulElements);
-
- HRESULT ( STDMETHODCALLTYPE *Reset )(
- IEnumCATEGORY_INSTANCE * This);
-
- HRESULT ( STDMETHODCALLTYPE *Clone )(
- IEnumCATEGORY_INSTANCE * This,
- /* [out] */ IEnumCATEGORY_INSTANCE **ppIEnumCATEGORY_INSTANCE);
-
- END_INTERFACE
- } IEnumCATEGORY_INSTANCEVtbl;
-
- interface IEnumCATEGORY_INSTANCE
- {
- CONST_VTBL struct IEnumCATEGORY_INSTANCEVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumCATEGORY_INSTANCE_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IEnumCATEGORY_INSTANCE_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IEnumCATEGORY_INSTANCE_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IEnumCATEGORY_INSTANCE_Next(This,ulElements,rgInstances,pulFetched) \
- (This)->lpVtbl -> Next(This,ulElements,rgInstances,pulFetched)
-
-#define IEnumCATEGORY_INSTANCE_Skip(This,ulElements) \
- (This)->lpVtbl -> Skip(This,ulElements)
-
-#define IEnumCATEGORY_INSTANCE_Reset(This) \
- (This)->lpVtbl -> Reset(This)
-
-#define IEnumCATEGORY_INSTANCE_Clone(This,ppIEnumCATEGORY_INSTANCE) \
- (This)->lpVtbl -> Clone(This,ppIEnumCATEGORY_INSTANCE)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_INSTANCE_Next_Proxy(
- IEnumCATEGORY_INSTANCE * This,
- /* [in] */ ULONG ulElements,
- /* [length_is][size_is][out] */ CATEGORY_INSTANCE rgInstances[ ],
- /* [out] */ ULONG *pulFetched);
-
-
-void __RPC_STUB IEnumCATEGORY_INSTANCE_Next_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_INSTANCE_Skip_Proxy(
- IEnumCATEGORY_INSTANCE * This,
- /* [in] */ ULONG ulElements);
-
-
-void __RPC_STUB IEnumCATEGORY_INSTANCE_Skip_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_INSTANCE_Reset_Proxy(
- IEnumCATEGORY_INSTANCE * This);
-
-
-void __RPC_STUB IEnumCATEGORY_INSTANCE_Reset_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IEnumCATEGORY_INSTANCE_Clone_Proxy(
- IEnumCATEGORY_INSTANCE * This,
- /* [out] */ IEnumCATEGORY_INSTANCE **ppIEnumCATEGORY_INSTANCE);
-
-
-void __RPC_STUB IEnumCATEGORY_INSTANCE_Clone_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IEnumCATEGORY_INSTANCE_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0343 */
-/* [local] */
-
-typedef /* [v1_enum] */
-enum _STATE_AXIS
- { STATE_AXIS_INVALID = 0,
- STATE_AXIS_USER = 1,
- STATE_AXIS_APPLICATION = 2,
- STATE_AXIS_COMPONENT = 3
- } STATE_AXIS;
-
-typedef /* [v1_enum] */ enum _STATE_AXIS *PSTATE_AXIS;
-
-typedef const STATE_AXIS *PCSTATE_AXIS;
-
-typedef
-enum _STATE_COORDINATE_VALUE_USER
- { STATE_COORDINATE_VALUE_USER_INVALID = 0,
- STATE_COORDINATE_VALUE_USER_NEUTRAL = 1,
- STATE_COORDINATE_VALUE_USER_LOCAL_MACHINE = 2,
- STATE_COORDINATE_VALUE_USER_GLOBAL = 3
- } STATE_COORDINATE_VALUE_USER;
-
-typedef
-enum _STATE_COORDINATE_VALUE_APPLICATION
- { STATE_COORDINATE_VALUE_APPLICATION_INVALID = 0,
- STATE_COORDINATE_VALUE_APPLICATION_NEUTRAL = 1,
- STATE_COORDINATE_VALUE_APPLICATION_VERSION_INDEPENDENT = 2,
- STATE_COORDINATE_VALUE_APPLICATION_VERSION_FUNCTIONALITY = 3,
- STATE_COORDINATE_VALUE_APPLICATION_VERSIONED = 4
- } STATE_COORDINATE_VALUE_APPLICATION;
-
-typedef enum _STATE_COORDINATE_VALUE_APPLICATION *PSTATE_COORDINATE_VALUE_APPLICATION;
-
-typedef const STATE_COORDINATE_VALUE_APPLICATION *PCSTATE_COORDINATE_VALUE_APPLICATION;
-
-typedef
-enum _STATE_COORDINATE_VALUE_COMPONENT
- { STATE_COORDINATE_VALUE_COMPONENT_INVALID = 0,
- STATE_COORDINATE_VALUE_COMPONENT_NEUTRAL = 1,
- STATE_COORDINATE_VALUE_COMPONENT_VERSION_INDEPENDENT = 2,
- STATE_COORDINATE_VALUE_COMPONENT_VERSION_FUNCTIONALITY = 3,
- STATE_COORDINATE_VALUE_COMPONENT_VERSIONED = 4
- } STATE_COORDINATE_VALUE_COMPONENT;
-
-typedef enum _STATE_COORDINATE_VALUE_COMPONENT *PSTATE_COORDINATE_VALUE_COMPONENT;
-
-typedef const STATE_COORDINATE_VALUE_COMPONENT *PCSTATE_COORDINATE_VALUE_COMPONENT;
-
-typedef /* [switch_type] */ union _STATE_COORDINATE_VALUE
- {
- /* [case()] */ STATE_COORDINATE_VALUE_USER User;
- /* [case()] */ STATE_COORDINATE_VALUE_APPLICATION Application;
- /* [case()] */ STATE_COORDINATE_VALUE_COMPONENT Component;
- } STATE_COORDINATE_VALUE;
-
-typedef /* [switch_type] */ union _STATE_COORDINATE_VALUE *PSTATE_COORDINATE_VALUE;
-
-typedef const STATE_COORDINATE_VALUE *PCSTATE_COORDINATE_VALUE;
-
-typedef struct _STATE_COORDINATE
- {
- STATE_AXIS Axis;
- STATE_COORDINATE_VALUE Value;
- } STATE_COORDINATE;
-
-typedef struct _STATE_COORDINATE *PSTATE_COORDINATE;
-
-typedef const STATE_COORDINATE *PCSTATE_COORDINATE;
-
-typedef struct _STATE_COORDINATE_LIST
- {
- SIZE_T Count;
- PCSTATE_COORDINATE List;
- } STATE_COORDINATE_LIST;
-
-typedef struct _STATE_COORDINATE_LIST *PSTATE_COORDINATE_LIST;
-
-typedef const STATE_COORDINATE_LIST *PCSTATE_COORDINATE_LIST;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0343_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0343_v0_0_s_ifspec;
-
-#ifndef __IManifestInformation_INTERFACE_DEFINED__
-#define __IManifestInformation_INTERFACE_DEFINED__
-
-/* interface IManifestInformation */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IManifestInformation;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("81c85208-fe61-4c15-b5bb-ff5ea66baad9")
- IManifestInformation : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FullPath(
- /* [retval][out] */ LPWSTR *ManifestPath) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IManifestInformationVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IManifestInformation * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IManifestInformation * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IManifestInformation * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FullPath )(
- IManifestInformation * This,
- /* [retval][out] */ LPWSTR *ManifestPath);
-
- END_INTERFACE
- } IManifestInformationVtbl;
-
- interface IManifestInformation
- {
- CONST_VTBL struct IManifestInformationVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IManifestInformation_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IManifestInformation_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IManifestInformation_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IManifestInformation_get_FullPath(This,ManifestPath) \
- (This)->lpVtbl -> get_FullPath(This,ManifestPath)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IManifestInformation_get_FullPath_Proxy(
- IManifestInformation * This,
- /* [retval][out] */ LPWSTR *ManifestPath);
-
-
-void __RPC_STUB IManifestInformation_get_FullPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IManifestInformation_INTERFACE_DEFINED__ */
-
-
-#ifndef __IActContext_INTERFACE_DEFINED__
-#define __IActContext_INTERFACE_DEFINED__
-
-/* interface IActContext */
-/* [local][unique][uuid][object] */
-
-/* [v1_enum] */
-enum _IAPP_CONTEXT_REPLACE_STRING_MACROS_FLAGS
- { IAPP_CONTEXT_REPLACE_STRING_MACROS_FLAG_NO_COMPONENT = 0x1
- } ;
-typedef struct _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS
- {
- ULONG ulSize;
- DWORD dwFlags;
- } IAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS;
-
-typedef struct _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS *PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS;
-
-typedef const IAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS *PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS;
-
-/* [v1_enum] */
-enum _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS_FLAGS
- { IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS_FLAG_OVERALL_DISPOSITION_VALID = 0x1
- } ;
-typedef struct _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS
- {
- ULONG ulSize;
- DWORD dwFlags;
- DWORD dwOverallDisposition;
- } IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS;
-
-typedef struct _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS *PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS;
-
-typedef const IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS *PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS;
-
-/* [v1_enum] */
-enum _IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATES
- { IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_UNDEFINED = 0,
- IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_STARTING = 1,
- IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_RUNNING = 2
- } ;
-/* [v1_enum] */
-enum _IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITIONS
- { IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_UNDEFINED = 0,
- IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_STARTING = 1,
- IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_STARTING_MIGRATED = 1 << 16,
- IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_RUNNING = 2,
- IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_RUNNING_FIRST_RUN = 1 << 17
- } ;
-/* [v1_enum] */
-enum IAPP_CONTEXT_GET_APPLICATION_STATE_FILESYSTEM_LOCATION_FLAGS
- { IAPP_CONTEXT_GET_APPLICATION_STATE_FILESYSTEM_LOCATION_FLAG_NO_COMPONENT = 0x1
- } ;
-/* [v1_enum] */
-enum _IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATES
- { IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATE_UNDEFINED = 0,
- IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATE_NOT_LOOKED_AT = 1,
- IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATE_FOUND = 2,
- IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATE_NOT_FOUND = 3
- } ;
-/* [v1_enum] */
-enum _IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATES
- { IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATE_UNDEFINED = 0,
- IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATE_NOT_LOOKED_AT = 1,
- IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATE_FOUND = 2,
- IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATE_NOT_FOUND = 3
- } ;
-/* [v1_enum] */
-enum _IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_FLAGS
- { IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_FLAG_REQUIRE_EXACT_MATCH = 0x1
- } ;
-
-EXTERN_C const IID IID_IActContext;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("0af57545-a72a-4fbe-813c-8554ed7d4528")
- IActContext : public IUnknown
- {
- public:
- virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AppId(
- /* [retval][out] */ IDefinitionAppId **ppAppId) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumCategories(
- /* [in] */ DWORD dwFlags,
- /* [unique][in] */ IReferenceIdentity *pReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumSubcategories(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ LPCWSTR pszSubcategoryPathPattern,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumCategoryInstances(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Category,
- /* [in] */ LPCWSTR pszSubcategoryPath,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ReplaceMacrosInStrings(
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ SIZE_T cStrings,
- /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
- /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
- /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetComponentStringTableStrings(
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ SIZE_T cStrings,
- /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
- /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
- /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetApplicationProperties(
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cProperties,
- /* [size_is][in] */ const LPCWSTR rgpszPropertyNames[ ],
- /* [size_is][out] */ LPWSTR rgpszPropertyValues[ ],
- /* [size_is][out] */ SIZE_T rgiComponentIndices[ ]) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ApplicationBasePath(
- /* [in] */ DWORD dwFlags,
- /* [retval][out] */ LPWSTR *ApplicationPath) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetComponentManifest(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *Component,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetComponentPayloadPath(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *Component,
- /* [retval][out] */ LPWSTR *ppwszComponentPayloadPath) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE FindReferenceInContext(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *Reference,
- /* [retval][out] */ IDefinitionIdentity **MatchedDefinition) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CreateActContextFromCategoryInstance(
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCCATEGORY_INSTANCE CategoryInstance,
- /* [retval][out] */ IActContext **ppCreatedAppContext) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE EnumComponents(
- /* [in] */ DWORD dwFlags,
- /* [retval][out] */ IEnumDefinitionIdentity **ppIdentityEnum) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE PrepareForExecution(
- /* [in] */ PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS pInputs,
- /* [out][in] */ PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS pOutputs) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetApplicationRunningState(
- /* [in] */ DWORD dwFlags,
- /* [in] */ ULONG ulState,
- /* [retval][out] */ ULONG *Disposition) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetApplicationStateFilesystemLocation(
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
- /* [out] */ LPWSTR *ppszPath) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE FindComponentsByDefinition(
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cComponents,
- /* [size_is][in] */ IDefinitionIdentity *pIDefinitionIdentities[ ],
- /* [size_is][out] */ SIZE_T rgiComponentIndices[ ],
- /* [size_is][out] */ ULONG rgulDispositions[ ]) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE FindComponentsByReference(
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cComponents,
- /* [size_is][in] */ IReferenceIdentity *pIReferenceIdentities[ ],
- /* [size_is][out] */ SIZE_T rgComponentIndices[ ],
- /* [size_is][out] */ ULONG rgulDispositions[ ]) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IActContextVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IActContext * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IActContext * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IActContext * This);
-
- /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AppId )(
- IActContext * This,
- /* [retval][out] */ IDefinitionAppId **ppAppId);
-
- HRESULT ( STDMETHODCALLTYPE *EnumCategories )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [unique][in] */ IReferenceIdentity *pReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
- HRESULT ( STDMETHODCALLTYPE *EnumSubcategories )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ LPCWSTR pszSubcategoryPathPattern,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
- HRESULT ( STDMETHODCALLTYPE *EnumCategoryInstances )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Category,
- /* [in] */ LPCWSTR pszSubcategoryPath,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
- HRESULT ( STDMETHODCALLTYPE *ReplaceMacrosInStrings )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ SIZE_T cStrings,
- /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
- /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
- /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList);
-
- HRESULT ( STDMETHODCALLTYPE *GetComponentStringTableStrings )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ SIZE_T cStrings,
- /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
- /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
- /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList);
-
- HRESULT ( STDMETHODCALLTYPE *GetApplicationProperties )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cProperties,
- /* [size_is][in] */ const LPCWSTR rgpszPropertyNames[ ],
- /* [size_is][out] */ LPWSTR rgpszPropertyValues[ ],
- /* [size_is][out] */ SIZE_T rgiComponentIndices[ ]);
-
- HRESULT ( STDMETHODCALLTYPE *ApplicationBasePath )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [retval][out] */ LPWSTR *ApplicationPath);
-
- HRESULT ( STDMETHODCALLTYPE *GetComponentManifest )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *Component,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
- HRESULT ( STDMETHODCALLTYPE *GetComponentPayloadPath )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *Component,
- /* [retval][out] */ LPWSTR *ppwszComponentPayloadPath);
-
- HRESULT ( STDMETHODCALLTYPE *FindReferenceInContext )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *Reference,
- /* [retval][out] */ IDefinitionIdentity **MatchedDefinition);
-
- HRESULT ( STDMETHODCALLTYPE *CreateActContextFromCategoryInstance )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCCATEGORY_INSTANCE CategoryInstance,
- /* [retval][out] */ IActContext **ppCreatedAppContext);
-
- HRESULT ( STDMETHODCALLTYPE *EnumComponents )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [retval][out] */ IEnumDefinitionIdentity **ppIdentityEnum);
-
- HRESULT ( STDMETHODCALLTYPE *PrepareForExecution )(
- IActContext * This,
- /* [in] */ PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS pInputs,
- /* [out][in] */ PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS pOutputs);
-
- HRESULT ( STDMETHODCALLTYPE *SetApplicationRunningState )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ ULONG ulState,
- /* [retval][out] */ ULONG *Disposition);
-
- HRESULT ( STDMETHODCALLTYPE *GetApplicationStateFilesystemLocation )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
- /* [out] */ LPWSTR *ppszPath);
-
- HRESULT ( STDMETHODCALLTYPE *FindComponentsByDefinition )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cComponents,
- /* [size_is][in] */ IDefinitionIdentity *pIDefinitionIdentities[ ],
- /* [size_is][out] */ SIZE_T rgiComponentIndices[ ],
- /* [size_is][out] */ ULONG rgulDispositions[ ]);
-
- HRESULT ( STDMETHODCALLTYPE *FindComponentsByReference )(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cComponents,
- /* [size_is][in] */ IReferenceIdentity *pIReferenceIdentities[ ],
- /* [size_is][out] */ SIZE_T rgComponentIndices[ ],
- /* [size_is][out] */ ULONG rgulDispositions[ ]);
-
- END_INTERFACE
- } IActContextVtbl;
-
- interface IActContext
- {
- CONST_VTBL struct IActContextVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IActContext_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IActContext_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IActContext_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IActContext_get_AppId(This,ppAppId) \
- (This)->lpVtbl -> get_AppId(This,ppAppId)
-
-#define IActContext_EnumCategories(This,dwFlags,pReferenceIdentity_ToMatch,riid,ppIUnknown) \
- (This)->lpVtbl -> EnumCategories(This,dwFlags,pReferenceIdentity_ToMatch,riid,ppIUnknown)
-
-#define IActContext_EnumSubcategories(This,dwFlags,pIDefinitionIdentity,pszSubcategoryPathPattern,riid,ppIUnknown) \
- (This)->lpVtbl -> EnumSubcategories(This,dwFlags,pIDefinitionIdentity,pszSubcategoryPathPattern,riid,ppIUnknown)
-
-#define IActContext_EnumCategoryInstances(This,dwFlags,pIDefinitionIdentity_Category,pszSubcategoryPath,riid,ppIUnknown) \
- (This)->lpVtbl -> EnumCategoryInstances(This,dwFlags,pIDefinitionIdentity_Category,pszSubcategoryPath,riid,ppIUnknown)
-
-#define IActContext_ReplaceMacrosInStrings(This,dwFlags,iComponentIndex,cStrings,rgpszSourceStrings,rgpszDestinationStrings,pCultureFallbackList) \
- (This)->lpVtbl -> ReplaceMacrosInStrings(This,dwFlags,iComponentIndex,cStrings,rgpszSourceStrings,rgpszDestinationStrings,pCultureFallbackList)
-
-#define IActContext_GetComponentStringTableStrings(This,dwFlags,iComponentIndex,cStrings,rgpszSourceStrings,rgpszDestinationStrings,pCultureFallbackList) \
- (This)->lpVtbl -> GetComponentStringTableStrings(This,dwFlags,iComponentIndex,cStrings,rgpszSourceStrings,rgpszDestinationStrings,pCultureFallbackList)
-
-#define IActContext_GetApplicationProperties(This,dwFlags,cProperties,rgpszPropertyNames,rgpszPropertyValues,rgiComponentIndices) \
- (This)->lpVtbl -> GetApplicationProperties(This,dwFlags,cProperties,rgpszPropertyNames,rgpszPropertyValues,rgiComponentIndices)
-
-#define IActContext_ApplicationBasePath(This,dwFlags,ApplicationPath) \
- (This)->lpVtbl -> ApplicationBasePath(This,dwFlags,ApplicationPath)
-
-#define IActContext_GetComponentManifest(This,dwFlags,Component,riid,ppIUnknown) \
- (This)->lpVtbl -> GetComponentManifest(This,dwFlags,Component,riid,ppIUnknown)
-
-#define IActContext_GetComponentPayloadPath(This,dwFlags,Component,ppwszComponentPayloadPath) \
- (This)->lpVtbl -> GetComponentPayloadPath(This,dwFlags,Component,ppwszComponentPayloadPath)
-
-#define IActContext_FindReferenceInContext(This,dwFlags,Reference,MatchedDefinition) \
- (This)->lpVtbl -> FindReferenceInContext(This,dwFlags,Reference,MatchedDefinition)
-
-#define IActContext_CreateActContextFromCategoryInstance(This,dwFlags,CategoryInstance,ppCreatedAppContext) \
- (This)->lpVtbl -> CreateActContextFromCategoryInstance(This,dwFlags,CategoryInstance,ppCreatedAppContext)
-
-#define IActContext_EnumComponents(This,dwFlags,ppIdentityEnum) \
- (This)->lpVtbl -> EnumComponents(This,dwFlags,ppIdentityEnum)
-
-#define IActContext_PrepareForExecution(This,pInputs,pOutputs) \
- (This)->lpVtbl -> PrepareForExecution(This,pInputs,pOutputs)
-
-#define IActContext_SetApplicationRunningState(This,dwFlags,ulState,Disposition) \
- (This)->lpVtbl -> SetApplicationRunningState(This,dwFlags,ulState,Disposition)
-
-#define IActContext_GetApplicationStateFilesystemLocation(This,dwFlags,iComponentIndex,pCoordinateList,ppszPath) \
- (This)->lpVtbl -> GetApplicationStateFilesystemLocation(This,dwFlags,iComponentIndex,pCoordinateList,ppszPath)
-
-#define IActContext_FindComponentsByDefinition(This,dwFlags,cComponents,pIDefinitionIdentities,rgiComponentIndices,rgulDispositions) \
- (This)->lpVtbl -> FindComponentsByDefinition(This,dwFlags,cComponents,pIDefinitionIdentities,rgiComponentIndices,rgulDispositions)
-
-#define IActContext_FindComponentsByReference(This,dwFlags,cComponents,pIReferenceIdentities,rgComponentIndices,rgulDispositions) \
- (This)->lpVtbl -> FindComponentsByReference(This,dwFlags,cComponents,pIReferenceIdentities,rgComponentIndices,rgulDispositions)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-/* [propget] */ HRESULT STDMETHODCALLTYPE IActContext_get_AppId_Proxy(
- IActContext * This,
- /* [retval][out] */ IDefinitionAppId **ppAppId);
-
-
-void __RPC_STUB IActContext_get_AppId_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_EnumCategories_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [unique][in] */ IReferenceIdentity *pReferenceIdentity_ToMatch,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
-
-void __RPC_STUB IActContext_EnumCategories_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_EnumSubcategories_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
- /* [in] */ LPCWSTR pszSubcategoryPathPattern,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
-
-void __RPC_STUB IActContext_EnumSubcategories_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_EnumCategoryInstances_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Category,
- /* [in] */ LPCWSTR pszSubcategoryPath,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
-
-void __RPC_STUB IActContext_EnumCategoryInstances_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_ReplaceMacrosInStrings_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ SIZE_T cStrings,
- /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
- /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
- /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList);
-
-
-void __RPC_STUB IActContext_ReplaceMacrosInStrings_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_GetComponentStringTableStrings_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ SIZE_T cStrings,
- /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
- /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
- /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList);
-
-
-void __RPC_STUB IActContext_GetComponentStringTableStrings_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_GetApplicationProperties_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cProperties,
- /* [size_is][in] */ const LPCWSTR rgpszPropertyNames[ ],
- /* [size_is][out] */ LPWSTR rgpszPropertyValues[ ],
- /* [size_is][out] */ SIZE_T rgiComponentIndices[ ]);
-
-
-void __RPC_STUB IActContext_GetApplicationProperties_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_ApplicationBasePath_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [retval][out] */ LPWSTR *ApplicationPath);
-
-
-void __RPC_STUB IActContext_ApplicationBasePath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_GetComponentManifest_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *Component,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIUnknown);
-
-
-void __RPC_STUB IActContext_GetComponentManifest_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_GetComponentPayloadPath_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionIdentity *Component,
- /* [retval][out] */ LPWSTR *ppwszComponentPayloadPath);
-
-
-void __RPC_STUB IActContext_GetComponentPayloadPath_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_FindReferenceInContext_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IReferenceIdentity *Reference,
- /* [retval][out] */ IDefinitionIdentity **MatchedDefinition);
-
-
-void __RPC_STUB IActContext_FindReferenceInContext_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_CreateActContextFromCategoryInstance_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ PCCATEGORY_INSTANCE CategoryInstance,
- /* [retval][out] */ IActContext **ppCreatedAppContext);
-
-
-void __RPC_STUB IActContext_CreateActContextFromCategoryInstance_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_EnumComponents_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [retval][out] */ IEnumDefinitionIdentity **ppIdentityEnum);
-
-
-void __RPC_STUB IActContext_EnumComponents_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_PrepareForExecution_Proxy(
- IActContext * This,
- /* [in] */ PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS pInputs,
- /* [out][in] */ PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS pOutputs);
-
-
-void __RPC_STUB IActContext_PrepareForExecution_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_SetApplicationRunningState_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ ULONG ulState,
- /* [retval][out] */ ULONG *Disposition);
-
-
-void __RPC_STUB IActContext_SetApplicationRunningState_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_GetApplicationStateFilesystemLocation_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T iComponentIndex,
- /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
- /* [out] */ LPWSTR *ppszPath);
-
-
-void __RPC_STUB IActContext_GetApplicationStateFilesystemLocation_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_FindComponentsByDefinition_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cComponents,
- /* [size_is][in] */ IDefinitionIdentity *pIDefinitionIdentities[ ],
- /* [size_is][out] */ SIZE_T rgiComponentIndices[ ],
- /* [size_is][out] */ ULONG rgulDispositions[ ]);
-
-
-void __RPC_STUB IActContext_FindComponentsByDefinition_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IActContext_FindComponentsByReference_Proxy(
- IActContext * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ SIZE_T cComponents,
- /* [size_is][in] */ IReferenceIdentity *pIReferenceIdentities[ ],
- /* [size_is][out] */ SIZE_T rgComponentIndices[ ],
- /* [size_is][out] */ ULONG rgulDispositions[ ]);
-
-
-void __RPC_STUB IActContext_FindComponentsByReference_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IActContext_INTERFACE_DEFINED__ */
-
-
-#ifndef __IStateManager_INTERFACE_DEFINED__
-#define __IStateManager_INTERFACE_DEFINED__
-
-/* interface IStateManager */
-/* [local][unique][uuid][object] */
-
-/* [v1_enum] */
-enum _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS_FLAGS
- { ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS_FLAG_APPLICATION_TO_PREPARE_VALID = 0x1
- } ;
-typedef struct _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS
- {
- ULONG ulSize;
- DWORD dwFlags;
- IActContext *pApplicationToPrepare;
- } ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS;
-
-typedef struct _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS *PISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS;
-
-typedef const ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS *PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS;
-
-/* [v1_enum] */
-enum _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS_FLAGS
- { ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS_FLAG_OVERALL_DISPOSITION_VALID = 0x1
- } ;
-typedef struct _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS
- {
- ULONG ulSize;
- DWORD dwFlags;
- DWORD dwOverallDisposition;
- } ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS;
-
-typedef struct _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS *PISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS;
-
-typedef const ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS *PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS;
-
-/* [v1_enum] */
-enum _ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATES
- { ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_UNDEFINED = 0,
- ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_STARTING = 1,
- ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_RUNNING = 2
- } ;
-/* [v1_enum] */
-enum _ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITIONS
- { ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_UNDEFINED = 0,
- ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_STARTING = 1,
- ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_STARTING_MIGRATED = 1 << 16,
- ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_RUNNING = 2,
- ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_RUNNING_FIRST_RUN = 1 << 17
- } ;
-
-EXTERN_C const IID IID_IStateManager;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("07662534-750b-4ed5-9cfb-1c5bc5acfd07")
- IStateManager : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE PrepareApplicationState(
- /* [in] */ PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS pInputs,
- /* [out][in] */ PISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS pOutputs) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetApplicationRunningState(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IActContext *pIActContext,
- /* [in] */ ULONG ulState,
- /* [in] */ ULONG *pulDisposition) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetApplicationStateFilesystemLocation(
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId_Application,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Component,
- /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
- /* [out] */ LPWSTR *ppszPath) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Scavenge(
- /* [in] */ DWORD dwFlags,
- /* [out] */ DWORD *pdwDisposition) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IStateManagerVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IStateManager * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IStateManager * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IStateManager * This);
-
- HRESULT ( STDMETHODCALLTYPE *PrepareApplicationState )(
- IStateManager * This,
- /* [in] */ PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS pInputs,
- /* [out][in] */ PISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS pOutputs);
-
- HRESULT ( STDMETHODCALLTYPE *SetApplicationRunningState )(
- IStateManager * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IActContext *pIActContext,
- /* [in] */ ULONG ulState,
- /* [in] */ ULONG *pulDisposition);
-
- HRESULT ( STDMETHODCALLTYPE *GetApplicationStateFilesystemLocation )(
- IStateManager * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId_Application,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Component,
- /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
- /* [out] */ LPWSTR *ppszPath);
-
- HRESULT ( STDMETHODCALLTYPE *Scavenge )(
- IStateManager * This,
- /* [in] */ DWORD dwFlags,
- /* [out] */ DWORD *pdwDisposition);
-
- END_INTERFACE
- } IStateManagerVtbl;
-
- interface IStateManager
- {
- CONST_VTBL struct IStateManagerVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IStateManager_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IStateManager_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IStateManager_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IStateManager_PrepareApplicationState(This,pInputs,pOutputs) \
- (This)->lpVtbl -> PrepareApplicationState(This,pInputs,pOutputs)
-
-#define IStateManager_SetApplicationRunningState(This,dwFlags,pIActContext,ulState,pulDisposition) \
- (This)->lpVtbl -> SetApplicationRunningState(This,dwFlags,pIActContext,ulState,pulDisposition)
-
-#define IStateManager_GetApplicationStateFilesystemLocation(This,dwFlags,pIDefinitionAppId_Application,pIDefinitionIdentity_Component,pCoordinateList,ppszPath) \
- (This)->lpVtbl -> GetApplicationStateFilesystemLocation(This,dwFlags,pIDefinitionAppId_Application,pIDefinitionIdentity_Component,pCoordinateList,ppszPath)
-
-#define IStateManager_Scavenge(This,dwFlags,pdwDisposition) \
- (This)->lpVtbl -> Scavenge(This,dwFlags,pdwDisposition)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IStateManager_PrepareApplicationState_Proxy(
- IStateManager * This,
- /* [in] */ PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS pInputs,
- /* [out][in] */ PISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS pOutputs);
-
-
-void __RPC_STUB IStateManager_PrepareApplicationState_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStateManager_SetApplicationRunningState_Proxy(
- IStateManager * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IActContext *pIActContext,
- /* [in] */ ULONG ulState,
- /* [in] */ ULONG *pulDisposition);
-
-
-void __RPC_STUB IStateManager_SetApplicationRunningState_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStateManager_GetApplicationStateFilesystemLocation_Proxy(
- IStateManager * This,
- /* [in] */ DWORD dwFlags,
- /* [in] */ IDefinitionAppId *pIDefinitionAppId_Application,
- /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Component,
- /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
- /* [out] */ LPWSTR *ppszPath);
-
-
-void __RPC_STUB IStateManager_GetApplicationStateFilesystemLocation_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-HRESULT STDMETHODCALLTYPE IStateManager_Scavenge_Proxy(
- IStateManager * This,
- /* [in] */ DWORD dwFlags,
- /* [out] */ DWORD *pdwDisposition);
-
-
-void __RPC_STUB IStateManager_Scavenge_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IStateManager_INTERFACE_DEFINED__ */
-
-
-#ifndef __IManifestParseErrorCallback_INTERFACE_DEFINED__
-#define __IManifestParseErrorCallback_INTERFACE_DEFINED__
-
-/* interface IManifestParseErrorCallback */
-/* [local][unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IManifestParseErrorCallback;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
- MIDL_INTERFACE("ace1b703-1aac-4956-ab87-90cac8b93ce6")
- IManifestParseErrorCallback : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE OnError(
- /* [in] */ ULONG nStartLine,
- /* [in] */ ULONG nStartColumn,
- /* [in] */ ULONG cCharacterCount,
- /* [in] */ HRESULT hr,
- /* [in] */ LPCWSTR pszErrorStatusHostFile,
- /* [in] */ ULONG cParameterCount,
- /* [size_is][in] */ LPCWSTR *prgpszParameters) = 0;
-
- };
-
-#else /* C style interface */
-
- typedef struct IManifestParseErrorCallbackVtbl
- {
- BEGIN_INTERFACE
-
- HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IManifestParseErrorCallback * This,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ void **ppvObject);
-
- ULONG ( STDMETHODCALLTYPE *AddRef )(
- IManifestParseErrorCallback * This);
-
- ULONG ( STDMETHODCALLTYPE *Release )(
- IManifestParseErrorCallback * This);
-
- HRESULT ( STDMETHODCALLTYPE *OnError )(
- IManifestParseErrorCallback * This,
- /* [in] */ ULONG nStartLine,
- /* [in] */ ULONG nStartColumn,
- /* [in] */ ULONG cCharacterCount,
- /* [in] */ HRESULT hr,
- /* [in] */ LPCWSTR pszErrorStatusHostFile,
- /* [in] */ ULONG cParameterCount,
- /* [size_is][in] */ LPCWSTR *prgpszParameters);
-
- END_INTERFACE
- } IManifestParseErrorCallbackVtbl;
-
- interface IManifestParseErrorCallback
- {
- CONST_VTBL struct IManifestParseErrorCallbackVtbl *lpVtbl;
- };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IManifestParseErrorCallback_QueryInterface(This,riid,ppvObject) \
- (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
-
-#define IManifestParseErrorCallback_AddRef(This) \
- (This)->lpVtbl -> AddRef(This)
-
-#define IManifestParseErrorCallback_Release(This) \
- (This)->lpVtbl -> Release(This)
-
-
-#define IManifestParseErrorCallback_OnError(This,nStartLine,nStartColumn,cCharacterCount,hr,pszErrorStatusHostFile,cParameterCount,prgpszParameters) \
- (This)->lpVtbl -> OnError(This,nStartLine,nStartColumn,cCharacterCount,hr,pszErrorStatusHostFile,cParameterCount,prgpszParameters)
-
-#endif /* COBJMACROS */
-
-
-#endif /* C style interface */
-
-
-
-HRESULT STDMETHODCALLTYPE IManifestParseErrorCallback_OnError_Proxy(
- IManifestParseErrorCallback * This,
- /* [in] */ ULONG nStartLine,
- /* [in] */ ULONG nStartColumn,
- /* [in] */ ULONG cCharacterCount,
- /* [in] */ HRESULT hr,
- /* [in] */ LPCWSTR pszErrorStatusHostFile,
- /* [in] */ ULONG cParameterCount,
- /* [size_is][in] */ LPCWSTR *prgpszParameters);
-
-
-void __RPC_STUB IManifestParseErrorCallback_OnError_Stub(
- IRpcStubBuffer *This,
- IRpcChannelBuffer *_pRpcChannelBuffer,
- PRPC_MESSAGE _pRpcMessage,
- DWORD *_pdwStubPhase);
-
-
-
-#endif /* __IManifestParseErrorCallback_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_isolation_0347 */
-/* [local] */
-
-/* [local] */ HRESULT __stdcall GetAppIdAuthority(
- /* [out] */ IAppIdAuthority **ppIAppIdAuthority);
-
-/* [local] */ HRESULT __stdcall GetIdentityAuthority(
- /* [out] */ IIdentityAuthority **ppIIdentityAuthority);
-
-/* [local] */ HRESULT __stdcall SetIsolationIMalloc(
- /* [in] */ IMalloc *pIMalloc);
-
-/* [local] */ HRESULT __stdcall GetSystemStore(
- /* [in] */ DWORD dwFlags,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIStore);
-
-/* [local] */ HRESULT __stdcall GetUserStore(
- /* [in] */ DWORD dwFlags,
- /* [in] */ HANDLE hToken,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppIStore);
-
-/* [local] */ HRESULT __stdcall GetUserStateManager(
- /* [in] */ DWORD Flags,
- /* [in] */ HANDLE hToken,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppManager);
-
-/* [local] */ HRESULT __stdcall ParseManifest(
- /* [in] */ LPCWSTR pszManifestPath,
- /* [unique][in] */ IManifestParseErrorCallback *pIManifestParseErrorCallback,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppManifest);
-
-/* [local] */ HRESULT __stdcall CreateCMSFromXml(
- /* [in] */ void *Data,
- /* [in] */ DWORD DataSize,
- /* [unique][in] */ IManifestParseErrorCallback *pIManifestParseErrorCallback,
- /* [in] */ REFIID riid,
- /* [iid_is][out] */ IUnknown **ppManifest);
-
-/* [local] */ HRESULT __stdcall GetCurrentActContext(
- /* [out] */ IActContext **ppIActContext);
-
-/* [local] */ HRESULT __stdcall CreateActContext(
- /* [in] */ PCCREATE_APP_CONTEXT_DATA Data,
- /* [out] */ IActContext **ppIActContext);
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0347_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_isolation_0347_v0_0_s_ifspec;
-
-
-#ifndef __Isolation_LIBRARY_DEFINED__
-#define __Isolation_LIBRARY_DEFINED__
-
-/* library Isolation */
-/* [version][helpstring][uuid] */
-
-
-EXTERN_C const IID LIBID_Isolation;
-#endif /* __Isolation_LIBRARY_DEFINED__ */
-
-/* Additional Prototypes for ALL interfaces */
-
-unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * );
-unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * );
-unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
-void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * );
-
-unsigned long __RPC_USER LPSAFEARRAY_UserSize( unsigned long *, unsigned long , LPSAFEARRAY * );
-unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( unsigned long *, unsigned char *, LPSAFEARRAY * );
-unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * );
-void __RPC_USER LPSAFEARRAY_UserFree( unsigned long *, LPSAFEARRAY * );
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
diff --git a/src/inc/marvin32.h b/src/inc/marvin32.h
deleted file mode 100644
index 85b9e958ad..0000000000
--- a/src/inc/marvin32.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// 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.
-
-#ifndef MARVIN32_INCLUDED
-#define MARVIN32_INCLUDED
-
-
-#include "common.h"
-#include "windows.h"
-
-//
-// Pointer-const typedefs:
-//
-// These definitions are missing from the standard Windows declarations.
-// Should probably be moved to a central typedef file.
-//
-typedef const BYTE * PCBYTE;
-typedef const USHORT * PCUSHORT;
-typedef const ULONG * PCULONG;
-typedef const ULONGLONG * PCULONGLONG;
-typedef const VOID * PCVOID;
-
-
-
-//
-// MARVIN32
-//
-
-#define SYMCRYPT_MARVIN32_RESULT_SIZE (8)
-#define SYMCRYPT_MARVIN32_SEED_SIZE (8)
-#define SYMCRYPT_MARVIN32_INPUT_BLOCK_SIZE (4)
-
-// These macros only support little-endian machines with unaligned access
-#define LOAD_LSBFIRST16( p ) ( *(USHORT *)(p))
-#define LOAD_LSBFIRST32( p ) ( *(ULONG *)(p))
-#define STORE_LSBFIRST32( p, x ) ( *(ULONG *)(p) = (x) )
-
-// Disable the warning about padding the struct on amd64
-#pragma warning(push)
-#pragma warning(disable:4324)
-
-typedef struct _SYMCRYPT_MARVIN32_EXPANDED_SEED
-{
- ULONG s[2];
-} SYMCRYPT_MARVIN32_EXPANDED_SEED, *PSYMCRYPT_MARVIN32_EXPANDED_SEED;
-
-typedef SYMCRYPT_MARVIN32_EXPANDED_SEED SYMCRYPT_MARVIN32_CHAINING_STATE, *PSYMCRYPT_MARVIN32_CHAINING_STATE;
-typedef const SYMCRYPT_MARVIN32_EXPANDED_SEED * PCSYMCRYPT_MARVIN32_EXPANDED_SEED;
-
-typedef struct _SYMCRYPT_MARVIN32_STATE
-{
- BYTE buffer[8]; // 4 bytes of data, 4 more bytes for final padding
- SYMCRYPT_MARVIN32_CHAINING_STATE chain; // chaining state
- PCSYMCRYPT_MARVIN32_EXPANDED_SEED pSeed; //
- ULONG dataLength; // length of the data processed so far, mod 2^32
-} SYMCRYPT_MARVIN32_STATE, *PSYMCRYPT_MARVIN32_STATE;
-typedef const SYMCRYPT_MARVIN32_STATE *PCSYMCRYPT_MARVIN32_STATE;
-#pragma warning(pop)
-
-//
-// Function declarations
-//
-HRESULT SymCryptMarvin32ExpandSeed(
- __out PSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed,
- __in_ecount(cbSeed) PCBYTE pbSeed,
- SIZE_T cbSeed);
-
-VOID SymCryptMarvin32Init(_Out_ PSYMCRYPT_MARVIN32_STATE pState,
- _In_ PCSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed);
-
-VOID SymCryptMarvin32Result(
- _Inout_ PSYMCRYPT_MARVIN32_STATE pState,
- _Out_ PBYTE pbResult);
-
-VOID SymCryptMarvin32Append(_Inout_ SYMCRYPT_MARVIN32_STATE * state,
- _In_reads_bytes_(cbData) PCBYTE pbData,
- SIZE_T cbData);
-
-VOID SymCryptMarvin32(
- __in PCSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed,
- __in_ecount(cbData) PCBYTE pbData,
- SIZE_T cbData,
- __out_ecount(SYMCRYPT_MARVIN32_RESULT_SIZE) PBYTE pbResult);
-#endif // MARVIN32_INCLUDED
diff --git a/src/inc/metahost.idl b/src/inc/metahost.idl
index ac889e2594..2bc7f1a3c9 100644
--- a/src/inc/metahost.idl
+++ b/src/inc/metahost.idl
@@ -93,6 +93,9 @@ cpp_quote("EXTERN_GUID(IID_ICLRProfiling, 0xb349abe3, 0xb56f, 0x4689, 0xbf, 0xcd
// IID ICLRDebuggingLibraryProvider interface : uuid{3151C08D-4D09-4f9b-8838-2880BF18FE51}
cpp_quote("EXTERN_GUID(IID_ICLRDebuggingLibraryProvider, 0x3151c08d, 0x4d09, 0x4f9b, 0x88, 0x38, 0x28, 0x80, 0xbf, 0x18, 0xfe, 0x51);")
+// IID ICLRDebuggingLibraryProvider2 interface : uuid{E04E2FF1-DCFD-45D5-BCD1-16FFF2FAF7BA}
+cpp_quote("EXTERN_GUID(IID_ICLRDebuggingLibraryProvider2, 0xE04E2FF1, 0xDCFD, 0x45D5, 0xBC, 0xD1, 0x16, 0xFF, 0xF2, 0xFA, 0xF7, 0xBA);")
+
typedef HRESULT(__stdcall * CLRCreateInstanceFnPtr)(
REFCLSID clsid,
REFIID riid,
@@ -402,7 +405,7 @@ CLR_DEBUGGING_PROCESS_FLAGS;
interface ICLRDebuggingLibraryProvider : IUnknown
{
/**********************************************************************************
- ** The goal of this method is to allow the debugger to provide a handle to a **
+ ** The goal of this method is to allow the debugger to provide a handle to a **
** module which is needed for debugging. The debugger may use any available means**
** to locate and/or procure the module. See the security note below for important**
** information about implementing this method securely. **
@@ -429,6 +432,50 @@ interface ICLRDebuggingLibraryProvider : IUnknown
[out] HMODULE* phModule);
}
+ /**************************************************************************************
+ ** ICLRDebuggingLibraryProvider2 **
+ ** Implemented by API user **
+ ** This interface allows the debugger to provide module paths which are needed for **
+ ** debugging a particular CLR such as mscordbi and mscordacwks. **
+ **************************************************************************************/
+[
+ uuid(E04E2FF1-DCFD-45D5-BCD1-16FFF2FAF7BA),
+ version(1.0),
+ helpstring("CLR debugging LibraryProvider callback interface"),
+ local
+]
+interface ICLRDebuggingLibraryProvider2 : IUnknown
+{
+ /**********************************************************************************
+ ** The goal of this method is to allow the debugger to provide a module path **
+ ** which is needed for debugging. The debugger may use any available means to **
+ ** locate and/or procure the module. See the security note below for important **
+ ** information about implementing this method securely. **
+ ** Arguments: **
+ ** pwzFileName - The name of the module being requested **
+ ** dwTimeStamp - The date time stamp stored in the COFF file header of PE files **
+ ** dwSizeOfImage - The SizeOfImage field stored in the COFF optional file header **
+ ** of PE files **
+ ** ppResolvedModulePath - Where *ppResolvedModulePath is a null terminated **
+ ** path to the module dll. On Windows it should be **
+ ** allocated with CoTaskMemAlloc. On Unix it should be **
+ ** allocated with malloc. Failure leave it untouched. See **
+ ** security note below! **
+ ** **
+ ** Return value - S_OK if the module was provided, or any other convenient **
+ ** error HRESULT if the module could not be provided **
+ ** **
+ ** !!!!!!!!!!!!!! **
+ ** SECURITY NOTE: Anything the caller would not be willing to execute itself, it **
+ ** should not provide to the this API call **
+ ***********************************************************************************/
+ HRESULT ProvideLibrary2(
+ [in] const WCHAR* pwszFileName,
+ [in] DWORD dwTimestamp,
+ [in] DWORD dwSizeOfImage,
+ [out] LPWSTR* ppResolvedModulePath);
+}
+
/**************************************************************************************
** ICLRDebugging **
** Activated using mscoree!CLRCreateInstance. **
diff --git a/src/inc/mscoree_mktlb.rc b/src/inc/mscoree_mktlb.rc
deleted file mode 100644
index e46fef6f5a..0000000000
--- a/src/inc/mscoree_mktlb.rc
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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.
-
-#define FX_VER_FILEDESCRIPTION_STR "Microsoft .NET Runtime CLR Loading and Configuration Interfaces\0"
-#define FX_VER_INTERNALNAME_STR MSCOREE.DLL
-#define FX_VFT VFT_DLL
-
-#include <fxver.h>
-#include <fxver.rc>
-
-1 typelib REAL_TLB_FILE
diff --git a/src/inc/newapis.h b/src/inc/newapis.h
deleted file mode 100644
index e0e6d999e1..0000000000
--- a/src/inc/newapis.h
+++ /dev/null
@@ -1,354 +0,0 @@
-// 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.
-////////////////////////////////////////////////////////////////////////////
-//
-// File: newapis.h
-//
-
-
-//
-// Purpose: functions that need to be emulated on downlevel platforms.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#ifndef MUI_LANGUAGE_NAME
-#define MUI_LANGUAGE_NAME 0
-#endif
-
-#ifndef CALINFO_ENUMPROCEXEX
-typedef BOOL (CALLBACK* CALINFO_ENUMPROCEXEX)(LPWSTR, CALID, LPWSTR, LPARAM);
-#endif
-
-#ifndef DATEFMT_ENUMPROCEXEX
-typedef BOOL (CALLBACK* DATEFMT_ENUMPROCEXEX)(LPWSTR, CALID, LPARAM);
-#endif
-
-#ifndef TIMEFMT_ENUMPROCEX
-typedef BOOL (CALLBACK* TIMEFMT_ENUMPROCEX)(LPWSTR, LPARAM);
-#endif
-
-#ifndef LOCALE_ENUMPROCEX
-typedef BOOL (CALLBACK* LOCALE_ENUMPROCEX)(LPWSTR, DWORD, LPARAM);
-#endif
-
-#if !defined(LPNLSVERSIONINFOEX)
-#define LPNLSVERSIONINFOEX LPNLSVERSIONINFO
-#endif
-
-#ifndef COMPARE_OPTIONS_ORDINAL
-#define COMPARE_OPTIONS_ORDINAL 0x40000000
-#endif
-
-#ifndef LINGUISTIC_IGNORECASE
-#define LINGUISTIC_IGNORECASE 0x00000010 // linguistically appropriate 'ignore case'
-#endif
-
-#ifndef FIND_STARTSWITH
-#define FIND_STARTSWITH 0x00100000 // see if value is at the beginning of source
-#endif
-
-#ifndef FIND_ENDSWITH
-#define FIND_ENDSWITH 0x00200000 // see if value is at the end of source
-#endif
-
-#ifndef FIND_FROMSTART
-#define FIND_FROMSTART 0x00400000 // look for value in source, starting at the beginning
-#endif
-
-#ifndef FIND_FROMEND
-#define FIND_FROMEND 0x00800000 // look for value in source, starting at the end
-#endif
-
-#ifndef NORM_LINGUISTIC_CASING
-#define NORM_LINGUISTIC_CASING 0x08000000 // use linguistic rules for casing
-#endif
-
-#ifndef LCMAP_LINGUISTIC_CASING
-#define LCMAP_LINGUISTIC_CASING 0x01000000 // use linguistic rules for casing
-#endif
-
-#ifndef LCMAP_TITLECASE
-#define LCMAP_TITLECASE 0x00000300 // Title Case Letters
-#endif
-
-#ifndef LCMAP_SORTHANDLE
-#define LCMAP_SORTHANDLE 0x20000000
-#endif
-
-#ifndef LCMAP_HASH
-#define LCMAP_HASH 0x00040000
-#endif
-
-#ifndef LOCALE_ALL
-#define LOCALE_ALL 0 // enumerate all named based locales
-#endif // LOCALE_ALL
-
-#ifndef LOCALE_WINDOWS
-#define LOCALE_WINDOWS 0x00000001 // shipped locales and/or replacements for them
-#endif // LOCALE_WINDOWS
-
-#ifndef LOCALE_SUPPLEMENTAL
-#define LOCALE_SUPPLEMENTAL 0x00000002 // supplemental locales only
-#endif // LOCALE_SUPPLEMENTAL
-
-#ifndef LOCALE_ALTERNATE_SORTS
-#define LOCALE_ALTERNATE_SORTS 0x00000004 // alternate sort locales
-#endif // LOCALE_ALTERNATE_SORTS
-
-#ifndef LOCALE_NEUTRALDATA
-#define LOCALE_NEUTRALDATA 0x00000010 // Locales that are "neutral" (language only, region data is default)
-#endif // LOCALE_NEUTRALDATA
-
-#ifndef LOCALE_SPECIFICDATA
-#define LOCALE_SPECIFICDATA 0x00000020 // Locales that contain language and region data
-#endif // LOCALE_SPECIFICDATA
-
-#ifndef LOCALE_INEUTRAL
-#define LOCALE_INEUTRAL 0x00000071 // Returns 0 for specific cultures, 1 for neutral cultures.
-#endif // LOCALE_INEUTRAL
-
-#ifndef LOCALE_SSORTLOCALE
-#define LOCALE_SSORTLOCALE 0x0000007b // Name of locale to use for sorting/collation/casing behavior.
-#endif // LOCALE_SSORTLOCALE
-
-#ifndef LOCALE_RETURN_NUMBER
-#define LOCALE_RETURN_NUMBER 0x20000000 // return number instead of string
-#endif // LOCALE_RETURN_NUMBER
-
-#ifndef LOCALE_ALLOW_NEUTRAL_NAMES
-#define LOCALE_ALLOW_NEUTRAL_NAMES 0x08000000 //Flag to allow returning neutral names/lcids for name conversion
-#endif // LOCALE_ALLOW_NEUTRAL_NAMES
-
-#ifndef LOCALE_SNAME
-#define LOCALE_SNAME 0x0000005c
-#endif
-
-#define FIND_NLS_STRING_FLAGS_NEGATION (~(FIND_STARTSWITH | FIND_ENDSWITH | FIND_FROMSTART | FIND_FROMEND))
-#define CASING_BITS (NORM_LINGUISTIC_CASING | LINGUISTIC_IGNORECASE | NORM_IGNORECASE)
-
-
-#ifndef __out_xcount_opt
-#define __out_xcount_opt(var)
-#endif
-
- // TODO: NLS Arrowhead -This isn't really right, custom locales could start with en- and have different sort behavior
- // IS_FAST_COMPARE_LOCALE is used to do the fast ordinal index of when having string of Lower Ansi codepoints
- // that less than 0x80. There are some locales that we cannot do optimization with, like Turkish and Azeri
- // because of Turkish I problem and Humgerian because of lower Ansi compressions.
-#define IS_FAST_COMPARE_LOCALE(loc) \
- (wcsncmp(loc,W("tr-"),3)!=0 && wcsncmp(loc,W("az-"),3)!=0 && wcsncmp(loc,W("hu-"),3)!=0)
-
-#define TURKISH_LOCALE_NAME W("tr-TR")
-#define AZERBAIJAN_LOCALE_NAME W("az-Latn-AZ")
-#define TURKISH_SORTING_LOCALE_NAME W("tr-TR_turkic")
-#define AZERBAIJAN_SORTING_LOCALE_NAME W("az-Latn-AZ_turkic")
-
-#define MUI_MERGE_SYSTEM_FALLBACK 0x10
-#define MUI_MERGE_USER_FALLBACK 0x20
-
-
-namespace NewApis
-{
-#if defined(FEATURE_CORESYSTEM)
- __inline bool IsWindows7Platform()
- {
- return true;
- }
-
- __inline bool IsVistaPlatform()
- {
- return false;
- }
-
- __inline BOOL IsZhTwSku()
- {
- return false;
- }
-
-#else
- // Return true if we're on Windows 7 or up (ie: if we have neutral native support and sorting knows about versions)
- __inline bool IsWindows7Platform()
- {
- static int isRunningOnWindows7 = -1; // -1 notinitialized, 0 not running on Windows 7, other value means running on Windows 7
-
- if (isRunningOnWindows7 == -1)
- {
- OSVERSIONINFOEX sVer;
- ZeroMemory(&sVer, sizeof(OSVERSIONINFOEX));
- sVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- sVer.dwMajorVersion = 6;
- sVer.dwMinorVersion = 1;
- sVer.dwPlatformId = VER_PLATFORM_WIN32_NT;
-
- DWORDLONG dwlConditionMask = 0;
- VER_SET_CONDITION(dwlConditionMask, CLR_VER_MAJORVERSION, VER_GREATER_EQUAL);
- VER_SET_CONDITION(dwlConditionMask, CLR_VER_MINORVERSION, VER_GREATER_EQUAL);
- VER_SET_CONDITION(dwlConditionMask, CLR_VER_PLATFORMID, VER_EQUAL);
-
- if(VerifyVersionInfo(&sVer, CLR_VER_MAJORVERSION|CLR_VER_MINORVERSION|CLR_VER_PLATFORMID, dwlConditionMask))
- {
- isRunningOnWindows7 = 1;
- }
- else
- {
- isRunningOnWindows7 = 0;
- }
- }
-
- return isRunningOnWindows7 == 1;
- }
-
- //
- // IsVistaPlatform return true if running on Vista and false if running on pre or post Vista
- //
- __inline BOOL IsVistaPlatform()
- {
- static int isRunningOnVista = -1; // -1 notinitialized, 0 not running on Vista, other value meanse running on Vista
-
- if (isRunningOnVista == -1)
- {
- OSVERSIONINFOEX sVer;
- ZeroMemory(&sVer, sizeof(OSVERSIONINFOEX));
- sVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- sVer.dwMajorVersion = 6;
- sVer.dwMinorVersion = 0;
- sVer.dwPlatformId = VER_PLATFORM_WIN32_NT;
-
- DWORDLONG dwlConditionMask = 0;
- VER_SET_CONDITION(dwlConditionMask, CLR_VER_MAJORVERSION, VER_EQUAL);
- VER_SET_CONDITION(dwlConditionMask, CLR_VER_MINORVERSION, VER_EQUAL);
- VER_SET_CONDITION(dwlConditionMask, CLR_VER_PLATFORMID, VER_EQUAL);
-
- if(VerifyVersionInfo(&sVer, CLR_VER_MAJORVERSION|CLR_VER_MINORVERSION|CLR_VER_PLATFORMID, dwlConditionMask))
- {
- isRunningOnVista = 1;
- }
- else
- {
- isRunningOnVista = 0;
- }
- }
-
- return isRunningOnVista == 1;
- }
-
-
- __inline BOOL IsZhTwSku()
- {
- const INT32 LANGID_ZH_TW = 0x0404;
- LPCWSTR DEFAULT_REGION_NAME_0404 = W("\x53f0\x7063");
-
- if(::GetSystemDefaultUILanguage() == LANGID_ZH_TW)
- {
- WCHAR wszBuffer[32];
- int result = ::GetLocaleInfoW(LANGID_ZH_TW, LOCALE_SNATIVECTRYNAME, wszBuffer, 32);
- if (result)
- {
- if (wcsncmp(wszBuffer, DEFAULT_REGION_NAME_0404, 3) != 0)
- {
- return true;
- }
- }
- }
- return false;
- }
-#endif // FEATURE_CORESYSTEM
-
- __inline BOOL NotLeakingFrameworkOnlyCultures(__in LPCWSTR lpLocaleName)
- {
- return wcscmp(lpLocaleName, W("zh-CHS")) != 0
- && wcscmp(lpLocaleName, W("zh-CHT")) != 0;
- }
-
- // System/user defaults
- __success(return == TRUE) BOOL
- GetUserPreferredUILanguages (__in DWORD dwFlags, __out PULONG pulNumLanguages, __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer, __in PULONG pcchLanguagesBuffer);
-
- __success(return > 0) int
- GetSystemDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
-
- __success(return != 0) int
- GetUserDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
-
- // Comparison functions (ala CompareInfo)
- int CompareStringEx(__in LPCWSTR lpLocaleName, __in DWORD dwCmpFlags, __in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2,
- __in int cchCount2, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam );
-
- int CompareStringOrdinal(__in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2, __in int cchCount2, __in BOOL bIgnoreCase);
-
- int LCMapStringEx (__in LPCWSTR lpLocaleName, __in DWORD dwMapFlags, __in_ecount(cchSrc) LPCWSTR lpSrcStr, __in int cchSrc,
- __out_xcount_opt(cchDest) LPWSTR lpDestStr, __in int cchDest, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam );
-
- LPWSTR GetLingusticLocaleName(__in LPWSTR pLocaleName, __in DWORD dwFlags);
-
- int IndexOfString(__in LPCWSTR lpLocaleName,
- __in_ecount(cchCount1) LPCWSTR pString1, // String to search in
- __in int cchCount1, // length of pString1
- __in_ecount(cchCount2) LPCWSTR pString2, // String we're looking for
- __in int cchCount2, // length of pString2
- __in DWORD dwFlags, // search flags
- __in BOOL startWith,
- __out_opt LPINT pcchFound);
-
- int LastIndexOfString(__in LPCWSTR lpLocaleName,
- __in_ecount(cchCount1) LPCWSTR pString1, // String to search in
- __in int cchCount1, // length of pString1
- __in_ecount(cchCount2) LPCWSTR pString2, // String we're looking for
- __in int cchCount2, // length of pString2
- __in DWORD dwFlags,
- __in BOOL endWith,
- __out_opt LPINT pcchFound);
-
- int FindNLSStringEx(__in LPCWSTR lpLocaleName,
- __in DWORD dwFindNLSStringFlags,
- __in_ecount(cchSource) LPCWSTR lpStringSource,
- __in int cchSource,
- __in_ecount(cchValue) LPCWSTR lpStringValue,
- __in int cchValue,
- __out_opt LPINT pcchFound,
- __in_opt LPNLSVERSIONINFO lpVersionInformation,
- __in_opt LPVOID lpReserved,
- __in_opt LPARAM lParam);
-
- BOOL IsNLSDefinedString(__in NLS_FUNCTION Function, __in DWORD dwFlags, __in_opt LPNLSVERSIONINFOEX lpVersionInfo, __in LPCWSTR lpString, __in int cchStr );
-
- // Calendar and locale information
- __success(return != 0) int
- GetCalendarInfoEx(__in LPCWSTR lpLocaleName, __in CALID Calendar, __in_opt LPCWSTR pReserved, __in CALTYPE CalType, __out_ecount_opt(cchData) LPWSTR lpCalData, __in int cchData, __out_opt LPDWORD lpValue );
-
- __success(return != 0) int
- GetLocaleInfoEx (__in LPCWSTR lpLocaleName, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData);
-
- __success(return != 0) int
- GetDateFormatEx(__in LPCWSTR lpLocaleName, __in DWORD dwFlags, __in_opt CONST SYSTEMTIME* lpDate, __in_opt LPCWSTR lpFormat,
- __out_ecount(cchDate) LPWSTR lpDateStr, __in int cchDate, __in_opt LPCWSTR lpCalendar);
-
- // Enumeration functions
- __success(return != 0) BOOL
- EnumDateFormatsExEx (DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
- __success(return != 0)
- BOOL EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
- __success(return != 0)
- BOOL EnumCalendarInfoExEx(CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, LPCWSTR lpLocaleName, CALID Calendar, CALTYPE CalType, LPARAM lParam);
-
- int LCIDToLocaleName(__in LCID Locale, __out_ecount_opt(cchName) LPWSTR lpName, __in int cchName, __in DWORD dwFlags);
- LCID LocaleNameToLCID(__in LPCWSTR lpName , __in DWORD dwFlags);
-
- int ResolveLocaleName(__in LPCWSTR lpNameToResolve, __in_ecount_opt(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
-
- __success(return == TRUE) BOOL
- GetThreadPreferredUILanguages(__in DWORD dwFlags,
- __out PULONG pulNumLanguages,
- __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer,
- __inout PULONG pcchLanguagesBuffer);
-
- BOOL WINAPI EnumSystemLocalesEx(__in LOCALE_ENUMPROCEX lpLocaleEnumProc,
- __in DWORD dwFlags,
- __in LPARAM lParam,
- __in_opt LPVOID lpReserved);
-
-};
-
-
-
diff --git a/src/inc/quirksapi.h b/src/inc/quirksapi.h
deleted file mode 100644
index 9927f16833..0000000000
--- a/src/inc/quirksapi.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.
-
-//*****************************************************************************
-// QuirksApi.h
-//
-
-//
-// definitions required for querying windows quirk DB
-//*****************************************************************************
-
-#ifndef _QUIRKSAPI_H_
-#define _QUIRKSAPI_H_
-
-
-#define QUIRKSAPI_DLL W("api-ms-win-core-quirks-l1-1-0.dll")
-
-typedef struct _CPT_QUIRK_DATA {
- DWORD Size;
- DWORD Id;
- WCHAR Name[128];
- WCHAR CommandLine[128];
-} CPT_QUIRK_DATA, *PCPT_QUIRK_DATA;
-
-
-
-typedef bool (STDMETHODCALLTYPE * PFN_CptQuirkIsEnabled3)(
- PCWSTR QuirkName,
- DWORD ComponentVersion);
-
-typedef HRESULT (STDMETHODCALLTYPE * PFN_CptQuirkGetData2)(
- PCWSTR QuirkName,
- PCPT_QUIRK_DATA QuirkData);
-
-#endif // _QUIRKSAPI_H_
-
diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h
index 9226d682e2..de9ba01ad7 100644
--- a/src/inc/utilcode.h
+++ b/src/inc/utilcode.h
@@ -595,7 +595,7 @@ BOOL CLRFreeLibrary(HMODULE hModule);
// Load a string using the resources for the current module.
STDAPI UtilLoadStringRC(UINT iResouceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax, int bQuiet=FALSE);
-#if defined(ENABLE_DOWNLEVEL_FOR_NLS) || defined(FEATURE_USE_LCID)
+#ifdef FEATURE_USE_LCID
STDAPI UtilLoadStringRCEx(LCID lcid, UINT iResourceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax, int bQuiet, int *pcwchUsed);
#endif
@@ -5317,7 +5317,7 @@ inline T* InterlockedExchangeT(
std::nullptr_t value) // When nullptr is provided as argument.
{
//STATIC_ASSERT(value == 0);
- return InterlockedExchangeT(target, reinterpret_cast<T*>(value));
+ return InterlockedExchangeT(target, static_cast<T*>(value));
}
template <typename T>
@@ -5327,7 +5327,7 @@ inline T* InterlockedCompareExchangeT(
T* comparand)
{
//STATIC_ASSERT(exchange == 0);
- return InterlockedCompareExchangeT(destination, reinterpret_cast<T*>(exchange), comparand);
+ return InterlockedCompareExchangeT(destination, static_cast<T*>(exchange), comparand);
}
template <typename T>
@@ -5337,7 +5337,7 @@ inline T* InterlockedCompareExchangeT(
std::nullptr_t comparand) // When nullptr is provided as argument.
{
//STATIC_ASSERT(comparand == 0);
- return InterlockedCompareExchangeT(destination, exchange, reinterpret_cast<T*>(comparand));
+ return InterlockedCompareExchangeT(destination, exchange, static_cast<T*>(comparand));
}
#undef InterlockedExchangePointer
diff --git a/src/inc/winwrap.h b/src/inc/winwrap.h
index fbc565aa25..8138c92335 100644
--- a/src/inc/winwrap.h
+++ b/src/inc/winwrap.h
@@ -343,14 +343,6 @@ WszCreateProcess(
LPPROCESS_INFORMATION lpProcessInformation
);
-DWORD
-WszGetWorkingSet(
- VOID
- );
-
-SIZE_T WszGetPagefileUsage();
-DWORD WszGetProcessHandleCount();
-
#if defined(_X86_) && defined(_MSC_VER)
//
diff --git a/src/jit/DIRS.proj b/src/jit/DIRS.proj
index b09e433dc0..f49d4d6d26 100644
--- a/src/jit/DIRS.proj
+++ b/src/jit/DIRS.proj
@@ -25,9 +25,13 @@
<!-- Only the main JIT gets built for CoreSys. The other jits (e.g., altjits) do not. -->
<ItemGroup Condition="'$(BuildExePhase)' == '1' and '$(BuildProjectName)' != 'CoreSys'">
+ <!-- FrankenJit and FrankenAltJit builds are disabled. We do not test them in CoreCLR and changes from there regularly break legacy_bakend for x86, it is why it is disabled now
+ and should be completely deleted soon. -->
<!-- Build the "FrankenJit" (RyuJIT front-end, legacy back-end) and "FrankenAltjit". These can't conflict with the names of the JIT32 directory outputs. -->
+ <!--
<ProjectFile Condition="'$(BuildArchitecture)' == 'i386' or '$(BuildArchitecture)' == 'arm'" Include="frankenjit\frankenjit.nativeproj" />
<ProjectFile Condition="'$(BuildArchitecture)' == 'i386'" Include="frankenaltjit\frankenaltjit.nativeproj" />
+ -->
<!-- This might be useful, to help make sure JIT devs build all configurations of the JIT (including crossgen), but
it appears to cause problems with the build system, and it slows down normal JIT developer productivity by adding a seldom-useful build.
diff --git a/src/jit/codegen.h b/src/jit/codegen.h
index 5a086e99fe..f38b4dc13a 100644
--- a/src/jit/codegen.h
+++ b/src/jit/codegen.h
@@ -361,7 +361,7 @@ protected:
void genMov32RelocatableDisplacement(BasicBlock* block, regNumber reg);
void genMov32RelocatableDataLabel(unsigned value, regNumber reg);
- void genMov32RelocatableImmediate(emitAttr size, unsigned value, regNumber reg);
+ void genMov32RelocatableImmediate(emitAttr size, size_t value, regNumber reg);
bool genUsedPopToReturn; // True if we use the pop into PC to return,
// False if we didn't and must branch to LR to return.
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 22491c8bda..72a91d9a0e 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -1082,17 +1082,13 @@ void Compiler::compUpdateLifeVar(GenTree* tree, VARSET_TP* pLastUseVars)
template void Compiler::compUpdateLifeVar<false>(GenTree* tree, VARSET_TP* pLastUseVars);
template <bool ForCodeGen>
-void Compiler::compChangeLife(VARSET_VALARG_TP newLife DEBUGARG(GenTree* tree))
+void Compiler::compChangeLife(VARSET_VALARG_TP newLife)
{
LclVarDsc* varDsc;
#ifdef DEBUG
if (verbose)
{
- if (tree != nullptr)
- {
- Compiler::printTreeID(tree);
- }
printf("Change life %s ", VarSetOps::ToString(this, compCurLife));
dumpConvertedVarSet(this, compCurLife);
printf(" -> %s ", VarSetOps::ToString(this, newLife));
@@ -1163,7 +1159,7 @@ void Compiler::compChangeLife(VARSET_VALARG_TP newLife DEBUGARG(GenTree* tree))
{
codeGen->gcInfo.gcRegByrefSetCur &= ~regMask;
}
- codeGen->genUpdateRegLife(varDsc, false /*isBorn*/, true /*isDying*/ DEBUGARG(tree));
+ codeGen->genUpdateRegLife(varDsc, false /*isBorn*/, true /*isDying*/ DEBUGARG(nullptr));
}
#ifndef LEGACY_BACKEND
// This isn't in a register, so update the gcVarPtrSetCur.
@@ -1197,7 +1193,7 @@ void Compiler::compChangeLife(VARSET_VALARG_TP newLife DEBUGARG(GenTree* tree))
#endif // DEBUG
VarSetOps::RemoveElemD(this, codeGen->gcInfo.gcVarPtrSetCur, bornVarIndex);
#endif // !LEGACY_BACKEND
- codeGen->genUpdateRegLife(varDsc, true /*isBorn*/, false /*isDying*/ DEBUGARG(tree));
+ codeGen->genUpdateRegLife(varDsc, true /*isBorn*/, false /*isDying*/ DEBUGARG(nullptr));
regMaskTP regMask = varDsc->lvRegMask();
if (isGCRef)
{
@@ -1222,7 +1218,7 @@ void Compiler::compChangeLife(VARSET_VALARG_TP newLife DEBUGARG(GenTree* tree))
}
// Need an explicit instantiation.
-template void Compiler::compChangeLife<true>(VARSET_VALARG_TP newLife DEBUGARG(GenTree* tree));
+template void Compiler::compChangeLife<true>(VARSET_VALARG_TP newLife);
#ifdef LEGACY_BACKEND
@@ -5689,7 +5685,8 @@ void CodeGen::genCheckUseBlockInit()
{
// Var is completely on the stack, in the legacy JIT case, or
// on the stack at entry, in the RyuJIT case.
- initStkLclCnt += (unsigned)roundUp(compiler->lvaLclSize(varNum)) / sizeof(int);
+ initStkLclCnt +=
+ (unsigned)roundUp(compiler->lvaLclSize(varNum), TARGET_POINTER_SIZE) / sizeof(int);
}
}
else
@@ -5720,7 +5717,7 @@ void CodeGen::genCheckUseBlockInit()
{
varDsc->lvMustInit = true;
- initStkLclCnt += (unsigned)roundUp(compiler->lvaLclSize(varNum)) / sizeof(int);
+ initStkLclCnt += (unsigned)roundUp(compiler->lvaLclSize(varNum), TARGET_POINTER_SIZE) / sizeof(int);
}
continue;
@@ -6328,9 +6325,7 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni
}
#endif // !_TARGET_XARCH_
-#if CPU_LOAD_STORE_ARCH
instGen_Set_Reg_To_Zero(EA_PTRSIZE, initReg);
-#endif // CPU_LOAD_STORE_ARCH
//
// Can't have a label inside the ReJIT padding area
@@ -6391,53 +6386,40 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni
// The encoding differs based on the architecture and what register is
// used (namely, using RAX has a smaller encoding).
//
- // For x86
- // lea eax, [esp - frameSize]
// loop:
- // lea esp, [esp - pageSize] 7
- // test [esp], eax 3
- // cmp esp, eax 2
+ // For x86
+ // test [esp + eax], eax 3
+ // sub eax, 0x1000 5
+ // cmp EAX, -frameSize 5
// jge loop 2
- // lea rsp, [rbp + frameSize]
//
// For AMD64 using RAX
- // lea rax, [rsp - frameSize]
- // loop:
- // lea rsp, [rsp - pageSize] 8
- // test [rsp], rax 4
- // cmp rsp, rax 3
+ // test [rsp + rax], rax 4
+ // sub rax, 0x1000 6
+ // cmp rax, -frameSize 6
// jge loop 2
- // lea rsp, [rax + frameSize]
//
// For AMD64 using RBP
- // lea rbp, [rsp - frameSize]
- // loop:
- // lea rsp, [rsp - pageSize] 8
- // test [rsp], rbp 4
- // cmp rsp, rbp 3
+ // test [rsp + rbp], rbp 4
+ // sub rbp, 0x1000 7
+ // cmp rbp, -frameSize 7
// jge loop 2
- // lea rsp, [rbp + frameSize]
-
- int sPageSize = (int)pageSize;
-
- getEmitter()->emitIns_R_AR(INS_lea, EA_PTRSIZE, initReg, REG_SPBASE, -((ssize_t)frameSize)); // get frame border
- getEmitter()->emitIns_R_AR(INS_lea, EA_PTRSIZE, REG_SPBASE, REG_SPBASE, -sPageSize);
- getEmitter()->emitIns_R_AR(INS_TEST, EA_PTRSIZE, initReg, REG_SPBASE, 0);
- inst_RV_RV(INS_cmp, REG_SPBASE, initReg);
+ getEmitter()->emitIns_R_ARR(INS_TEST, EA_PTRSIZE, initReg, REG_SPBASE, initReg, 0);
+ inst_RV_IV(INS_sub, initReg, pageSize, EA_PTRSIZE);
+ inst_RV_IV(INS_cmp, initReg, -((ssize_t)frameSize), EA_PTRSIZE);
int bytesForBackwardJump;
#ifdef _TARGET_AMD64_
assert((initReg == REG_EAX) || (initReg == REG_EBP)); // We use RBP as initReg for EH funclets.
- bytesForBackwardJump = -17;
+ bytesForBackwardJump = ((initReg == REG_EAX) ? -18 : -20);
#else // !_TARGET_AMD64_
assert(initReg == REG_EAX);
- bytesForBackwardJump = -14;
+ bytesForBackwardJump = -15;
#endif // !_TARGET_AMD64_
inst_IV(INS_jge, bytesForBackwardJump); // Branch backwards to start of loop
- getEmitter()->emitIns_R_AR(INS_lea, EA_PTRSIZE, REG_SPBASE, initReg, frameSize); // restore stack pointer
#endif // !CPU_LOAD_STORE_ARCH
*pInitRegZeroed = false; // The initReg does not contain zero
@@ -6640,7 +6622,7 @@ void CodeGen::genMov32RelocatableDataLabel(unsigned value, regNumber reg)
*
* Move of relocatable immediate to register
*/
-void CodeGen::genMov32RelocatableImmediate(emitAttr size, unsigned value, regNumber reg)
+void CodeGen::genMov32RelocatableImmediate(emitAttr size, size_t value, regNumber reg)
{
_ASSERTE(EA_IS_RELOC(size));
diff --git a/src/jit/codegenlegacy.cpp b/src/jit/codegenlegacy.cpp
index 7fb946dbed..648a48162d 100644
--- a/src/jit/codegenlegacy.cpp
+++ b/src/jit/codegenlegacy.cpp
@@ -12971,7 +12971,7 @@ void CodeGen::genCodeForBBlist()
gcInfo.gcMarkRegSetNpt(gcrefRegs | byrefRegs);
if (!VarSetOps::Equal(compiler, compiler->compCurLife, block->bbLiveOut))
- compiler->genChangeLife(block->bbLiveOut DEBUGARG(NULL));
+ compiler->genChangeLife(block->bbLiveOut);
/* Both stacks should always be empty on exit from a basic block */
diff --git a/src/jit/codegenlinear.cpp b/src/jit/codegenlinear.cpp
index eddec19c1f..6faaf612be 100644
--- a/src/jit/codegenlinear.cpp
+++ b/src/jit/codegenlinear.cpp
@@ -896,10 +896,15 @@ void CodeGen::genUnspillRegIfNeeded(GenTree* tree)
inst_RV_TT(ins_Load(treeType, compiler->isSIMDTypeLocalAligned(lcl->gtLclNum)), dstReg, unspillTree);
}
#elif defined(_TARGET_ARM64_)
- var_types targetType = unspillTree->gtType;
- instruction ins = ins_Load(targetType, compiler->isSIMDTypeLocalAligned(lcl->gtLclNum));
- emitAttr attr = emitTypeSize(targetType);
- emitter* emit = getEmitter();
+ var_types targetType = unspillTree->gtType;
+ if (targetType != genActualType(varDsc->lvType) && !varTypeIsGC(targetType) && !varDsc->lvNormalizeOnLoad())
+ {
+ assert(!varTypeIsGC(varDsc));
+ targetType = genActualType(varDsc->lvType);
+ }
+ instruction ins = ins_Load(targetType, compiler->isSIMDTypeLocalAligned(lcl->gtLclNum));
+ emitAttr attr = emitTypeSize(targetType);
+ emitter* emit = getEmitter();
// Fixes Issue #3326
attr = varTypeIsFloating(targetType) ? attr : emit->emitInsAdjustLoadStoreAttr(ins, attr);
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index 0c00e4a7e3..9f7f38d3e3 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -6354,7 +6354,7 @@ void CodeGen::genIntToIntCast(GenTree* treeNode)
bool isUnsignedSrc = varTypeIsUnsigned(srcType);
// if necessary, force the srcType to unsigned when the GT_UNSIGNED flag is set
- if (!isUnsignedSrc && (treeNode->gtFlags & GTF_UNSIGNED) != 0)
+ if (!isUnsignedSrc && treeNode->IsUnsigned())
{
srcType = genUnsignedType(srcType);
isUnsignedSrc = true;
@@ -6371,37 +6371,29 @@ void CodeGen::genIntToIntCast(GenTree* treeNode)
if (srcSize < dstSize)
{
- // Widening cast
- // Is this an Overflow checking cast?
- // We only need to handle one case, as the other casts can never overflow.
- // cast from TYP_INT to TYP_ULONG
- //
- if (treeNode->gtOverflow() && (srcType == TYP_INT) && (dstType == TYP_ULONG))
+#ifdef _TARGET_X86_
+ // dstType cannot be a long type on x86, such casts should have been decomposed.
+ // srcType cannot be a small type since it's the "actual type" of the cast operand.
+ // This means that widening casts do not actually occur on x86.
+ unreached();
+#else
+ // This is a widening cast from TYP_(U)INT to TYP_(U)LONG.
+ assert(dstSize == EA_8BYTE);
+ assert(srcSize == EA_4BYTE);
+
+ // When widening, overflows can only happen if the source type is signed and the
+ // destination type is unsigned. Since the overflow check ensures that the value
+ // is positive a cheaper mov instruction can be used instead of movsxd.
+ if (treeNode->gtOverflow() && !isUnsignedSrc && isUnsignedDst)
{
requiresOverflowCheck = true;
ins = INS_mov;
}
else
{
- noway_assert(srcSize < EA_PTRSIZE);
-
- ins = ins_Move_Extend(srcType, false);
-
- /*
- Special case: ins_Move_Extend assumes the destination type is no bigger
- than TYP_INT. movsx and movzx can already extend all the way to
- 64-bit, and a regular 32-bit mov clears the high 32 bits (like the non-existant movzxd),
- but for a sign extension from TYP_INT to TYP_LONG, we need to use movsxd opcode.
- */
- if (!isUnsignedSrc && !isUnsignedDst)
- {
-#ifdef _TARGET_X86_
- NYI_X86("Cast to 64 bit for x86/RyuJIT");
-#else // !_TARGET_X86_
- ins = INS_movsxd;
-#endif // !_TARGET_X86_
- }
+ ins = isUnsignedSrc ? INS_mov : INS_movsxd;
}
+#endif
}
else
{
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index bc0159ca2e..31bb2b4be6 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -4410,12 +4410,14 @@ bool Compiler::compRsvdRegCheck(FrameLayoutState curState)
// Always do the layout even if returning early. Callers might
// depend on us to do the layout.
unsigned frameSize = lvaFrameSize(curState);
+ JITDUMP("\ncompRsvdRegCheck\n frame size = %6d\n compArgSize = %6d\n", frameSize, compArgSize);
if (opts.MinOpts())
{
// Have a recovery path in case we fail to reserve REG_OPT_RSVD and go
// over the limit of SP and FP offset ranges due to large
// temps.
+ JITDUMP(" Returning true (MinOpts)\n\n");
return true;
}
@@ -4430,6 +4432,7 @@ bool Compiler::compRsvdRegCheck(FrameLayoutState curState)
#if defined(_TARGET_ARM64_)
// TODO-ARM64-CQ: update this!
+ JITDUMP(" Returning true (ARM64)\n\n");
return true; // just always assume we'll need it, for now
#else // _TARGET_ARM_
@@ -4462,13 +4465,21 @@ bool Compiler::compRsvdRegCheck(FrameLayoutState curState)
//
unsigned maxR11ArgLimit = (compFloatingPointUsed ? 0x03FC : 0x0FFC);
unsigned maxR11LclLimit = 0x0078;
+ JITDUMP(" maxR11ArgLimit = %6d\n maxR11LclLimit = %6d\n", maxR11ArgLimit, maxR11LclLimit);
if (codeGen->isFramePointerRequired())
{
unsigned maxR11LclOffs = frameSize;
unsigned maxR11ArgOffs = compArgSize + (2 * REGSIZE_BYTES);
- if (maxR11LclOffs > maxR11LclLimit || maxR11ArgOffs > maxR11ArgLimit)
+ JITDUMP(" maxR11LclOffs = %6d\n maxR11ArgOffs = %6d\n", maxR11LclOffs, maxR11ArgOffs)
+ if (maxR11LclOffs > maxR11LclLimit)
{
+ JITDUMP(" Returning true (frame reqd and maxR11LclOffs)\n\n");
+ return true;
+ }
+ if (maxR11ArgOffs > maxR11ArgLimit)
+ {
+ JITDUMP(" Returning true (frame reqd and maxR11ArgOffs)\n\n");
return true;
}
}
@@ -4479,19 +4490,23 @@ bool Compiler::compRsvdRegCheck(FrameLayoutState curState)
// Check local coverage first. If vldr/vstr will be used the limit can be +/-imm8.
unsigned maxSPLclLimit = (compFloatingPointUsed ? 0x03F8 : 0x0FF8);
+ JITDUMP(" maxSPLclLimit = %6d\n", maxSPLclLimit);
if (frameSize > (codeGen->isFramePointerUsed() ? (maxR11LclLimit + maxSPLclLimit) : maxSPLclLimit))
{
+ JITDUMP(" Returning true (frame reqd; local coverage)\n\n");
return true;
}
// Check arguments coverage.
if ((!codeGen->isFramePointerUsed() || (compArgSize > maxR11ArgLimit)) && (compArgSize + frameSize) > maxSPLclLimit)
{
+ JITDUMP(" Returning true (no frame; arg coverage)\n\n");
return true;
}
// We won't need to reserve REG_OPT_RSVD.
//
+ JITDUMP(" Returning false\n\n");
return false;
#endif // _TARGET_ARM_
}
@@ -5005,12 +5020,20 @@ void Compiler::compCompile(void** methodCodePtr, ULONG* methodCodeSize, JitFlags
codeGen->regSet.rsMaskResvd |= RBM_SAVED_LOCALLOC_SP;
}
#endif // _TARGET_ARM_
-#ifdef _TARGET_ARMARCH_
+#if defined(_TARGET_ARMARCH_) && defined(LEGACY_BACKEND)
+ // Determine whether we need to reserve a register for large lclVar offsets.
+ // The determination depends heavily on the number of locals, which changes for RyuJIT backend
+ // due to the introduction of new temps during Rationalizer and Lowering.
+ // In LEGACY_BACKEND we do that here even though the decision to have a frame pointer or not may
+ // change during register allocation, changing the computation somewhat.
+ // In RyuJIT backend we do this after determining the frame type, and before beginning
+ // register allocation.
if (compRsvdRegCheck(PRE_REGALLOC_FRAME_LAYOUT))
{
// We reserve R10/IP1 in this case to hold the offsets in load/store instructions
codeGen->regSet.rsMaskResvd |= RBM_OPT_RSVD;
assert(REG_OPT_RSVD != REG_FP);
+ JITDUMP(" Reserved REG_OPT_RSVD (%s) due to large frame\n", getRegName(REG_OPT_RSVD));
}
// compRsvdRegCheck() has read out the FramePointerUsed property, but doLinearScan()
// tries to overwrite it later. This violates the PhasedVar rule and triggers an assertion.
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index f1c9529205..46eed69001 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -2128,9 +2128,9 @@ public:
GenTree* gtUnusedValNode(GenTree* expr);
- GenTree* gtNewCastNode(var_types typ, GenTree* op1, var_types castType);
+ GenTreeCast* gtNewCastNode(var_types typ, GenTree* op1, bool fromUnsigned, var_types castType);
- GenTree* gtNewCastNodeL(var_types typ, GenTree* op1, var_types castType);
+ GenTreeCast* gtNewCastNodeL(var_types typ, GenTree* op1, bool fromUnsigned, var_types castType);
GenTree* gtNewAllocObjNode(unsigned int helper, CORINFO_CLASS_HANDLE clsHnd, var_types type, GenTree* op1);
@@ -2270,7 +2270,8 @@ public:
BR_REMOVE_AND_NARROW, // remove effects, minimize remaining work, return possibly narrowed source tree
BR_REMOVE_AND_NARROW_WANT_TYPE_HANDLE, // remove effects and minimize remaining work, return type handle tree
BR_REMOVE_BUT_NOT_NARROW, // remove effects, return original source tree
- BR_DONT_REMOVE, // just check if removal is possible
+ BR_DONT_REMOVE, // check if removal is possible, return copy source tree
+ BR_DONT_REMOVE_WANT_TYPE_HANDLE, // check if removal is possible, return type handle tree
BR_MAKE_LOCAL_COPY // revise box to copy to temp local and return local's address
};
@@ -2555,9 +2556,9 @@ public:
unsigned lvaShadowSPslotsVar; // TYP_BLK variable for all the shadow SP slots
#endif // FEATURE_EH_FUNCLETS
- unsigned lvaCachedGenericContextArgOffs;
- unsigned lvaCachedGenericContextArgOffset(); // For CORINFO_CALLCONV_PARAMTYPE and if generic context is passed as
- // THIS pointer
+ int lvaCachedGenericContextArgOffs;
+ int lvaCachedGenericContextArgOffset(); // For CORINFO_CALLCONV_PARAMTYPE and if generic context is passed as
+ // THIS pointer
unsigned lvaLocAllocSPvar; // variable which has the result of the last alloca/localloc
@@ -7249,11 +7250,11 @@ public:
GenTree* compCurLifeTree; // node after which compCurLife has been computed
template <bool ForCodeGen>
- void compChangeLife(VARSET_VALARG_TP newLife DEBUGARG(GenTree* tree));
+ void compChangeLife(VARSET_VALARG_TP newLife);
- void genChangeLife(VARSET_VALARG_TP newLife DEBUGARG(GenTree* tree))
+ void genChangeLife(VARSET_VALARG_TP newLife)
{
- compChangeLife</*ForCodeGen*/ true>(newLife DEBUGARG(tree));
+ compChangeLife</*ForCodeGen*/ true>(newLife);
}
template <bool ForCodeGen>
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index 36012fbc38..2b9f3aa94b 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -1436,6 +1436,15 @@ inline void GenTree::SetOper(genTreeOps oper, ValueNumberUpdate vnUpdate)
assert(GenTree::s_gtNodeSizes[oper] == TREE_NODE_SZ_SMALL || GenTree::s_gtNodeSizes[oper] == TREE_NODE_SZ_LARGE);
assert(GenTree::s_gtNodeSizes[oper] == TREE_NODE_SZ_SMALL || (gtDebugFlags & GTF_DEBUG_NODE_LARGE));
+#if defined(_HOST_64BIT_) && !defined(_TARGET_64BIT_)
+ if (gtOper == GT_CNS_LNG && oper == GT_CNS_INT)
+ {
+ // When casting from LONG to INT, we need to force cast of the value,
+ // if the host architecture represents INT and LONG with the same data size.
+ gtLngCon.gtLconVal = (INT64)(INT32)gtLngCon.gtLconVal;
+ }
+#endif // defined(_HOST_64BIT_) && !defined(_TARGET_64BIT_)
+
SetOperRaw(oper);
#ifdef DEBUG
@@ -1476,13 +1485,13 @@ inline void GenTree::SetOper(genTreeOps oper, ValueNumberUpdate vnUpdate)
}
}
-inline GenTree* Compiler::gtNewCastNode(var_types typ, GenTree* op1, var_types castType)
+inline GenTreeCast* Compiler::gtNewCastNode(var_types typ, GenTree* op1, bool fromUnsigned, var_types castType)
{
- GenTree* res = new (this, GT_CAST) GenTreeCast(typ, op1, castType);
+ GenTreeCast* res = new (this, GT_CAST) GenTreeCast(typ, op1, fromUnsigned, castType);
return res;
}
-inline GenTree* Compiler::gtNewCastNodeL(var_types typ, GenTree* op1, var_types castType)
+inline GenTreeCast* Compiler::gtNewCastNodeL(var_types typ, GenTree* op1, bool fromUnsigned, var_types castType)
{
/* Some casts get transformed into 'GT_CALL' or 'GT_IND' nodes */
@@ -1491,7 +1500,8 @@ inline GenTree* Compiler::gtNewCastNodeL(var_types typ, GenTree* op1, var_types
/* Make a big node first and then change it to be GT_CAST */
- GenTree* res = new (this, LargeOpOpcode()) GenTreeCast(typ, op1, castType DEBUGARG(/*largeNode*/ true));
+ GenTreeCast* res =
+ new (this, LargeOpOpcode()) GenTreeCast(typ, op1, fromUnsigned, castType DEBUGARG(/*largeNode*/ true));
return res;
}
@@ -2325,7 +2335,7 @@ inline bool Compiler::lvaReportParamTypeArg()
//*****************************************************************************
-inline unsigned Compiler::lvaCachedGenericContextArgOffset()
+inline int Compiler::lvaCachedGenericContextArgOffset()
{
assert(lvaDoneFrameLayout == FINAL_FRAME_LAYOUT);
@@ -3589,7 +3599,7 @@ inline void Compiler::compUpdateLife(VARSET_VALARG_TP newLife)
{
if (!VarSetOps::Equal(this, compCurLife, newLife))
{
- compChangeLife<ForCodeGen>(newLife DEBUGARG(nullptr));
+ compChangeLife<ForCodeGen>(newLife);
}
#ifdef DEBUG
else
@@ -4355,7 +4365,13 @@ inline GenTree* Compiler::impCheckForNullPointer(GenTree* obj)
if (obj->gtOper == GT_CNS_INT)
{
assert(obj->gtType == TYP_REF || obj->gtType == TYP_BYREF);
- assert(obj->gtIntCon.gtIconVal == 0);
+
+ // We can see non-zero byrefs for RVA statics.
+ if (obj->gtIntCon.gtIconVal != 0)
+ {
+ assert(obj->gtType == TYP_BYREF);
+ return obj;
+ }
unsigned tmp = lvaGrabTemp(true DEBUGARG("CheckForNullPointer"));
diff --git a/src/jit/compphases.h b/src/jit/compphases.h
index 4906ec206a..c8f0d75365 100644
--- a/src/jit/compphases.h
+++ b/src/jit/compphases.h
@@ -59,7 +59,7 @@ CompPhaseNameMacro(PHASE_BUILD_SSA, "Build SSA representation",
CompPhaseNameMacro(PHASE_BUILD_SSA_TOPOSORT, "SSA: topological sort", "SSA-SORT", false, PHASE_BUILD_SSA, false)
CompPhaseNameMacro(PHASE_BUILD_SSA_DOMS, "SSA: Doms1", "SSA-DOMS", false, PHASE_BUILD_SSA, false)
CompPhaseNameMacro(PHASE_BUILD_SSA_LIVENESS, "SSA: liveness", "SSA-LIVE", false, PHASE_BUILD_SSA, false)
-CompPhaseNameMacro(PHASE_BUILD_SSA_IDF, "SSA: IDF", "SSA-IDF", false, PHASE_BUILD_SSA, false)
+CompPhaseNameMacro(PHASE_BUILD_SSA_DF, "SSA: DF", "SSA-DF", false, PHASE_BUILD_SSA, false)
CompPhaseNameMacro(PHASE_BUILD_SSA_INSERT_PHIS, "SSA: insert phis", "SSA-PHI", false, PHASE_BUILD_SSA, false)
CompPhaseNameMacro(PHASE_BUILD_SSA_RENAME, "SSA: rename", "SSA-REN", false, PHASE_BUILD_SSA, false)
diff --git a/src/jit/decomposelongs.cpp b/src/jit/decomposelongs.cpp
index 5c8a7c9735..ae5d8a73ec 100644
--- a/src/jit/decomposelongs.cpp
+++ b/src/jit/decomposelongs.cpp
@@ -1924,12 +1924,7 @@ GenTree* DecomposeLongs::EnsureIntSized(GenTree* node, bool signExtend)
return node;
}
- GenTree* const cast = m_compiler->gtNewCastNode(TYP_INT, node, node->TypeGet());
- if (!signExtend)
- {
- cast->gtFlags |= GTF_UNSIGNED;
- }
-
+ GenTree* const cast = m_compiler->gtNewCastNode(TYP_INT, node, !signExtend, node->TypeGet());
Range().InsertAfter(node, cast);
return cast;
}
diff --git a/src/jit/emit.cpp b/src/jit/emit.cpp
index 5c70e08e37..7a1d106f17 100644
--- a/src/jit/emit.cpp
+++ b/src/jit/emit.cpp
@@ -5460,8 +5460,8 @@ void emitter::emitOutputDataSec(dataSecDsc* sec, BYTE* dst)
JITDUMP(" section %u, size %u, block absolute addr\n", secNum++, dscSize);
assert(dscSize && dscSize % TARGET_POINTER_SIZE == 0);
- size_t numElems = dscSize / TARGET_POINTER_SIZE;
- BYTE** bDst = (BYTE**)dst;
+ size_t numElems = dscSize / TARGET_POINTER_SIZE;
+ target_size_t* bDst = (target_size_t*)dst;
for (unsigned i = 0; i < numElems; i++)
{
BasicBlock* block = ((BasicBlock**)dsc->dsCont)[i];
@@ -5475,7 +5475,7 @@ void emitter::emitOutputDataSec(dataSecDsc* sec, BYTE* dst)
#ifdef _TARGET_ARM_
target = (BYTE*)((size_t)target | 1); // Or in thumb bit
#endif
- bDst[i] = target;
+ bDst[i] = (target_size_t)target;
if (emitComp->opts.compReloc)
{
emitRecordRelocation(&(bDst[i]), target, IMAGE_REL_BASED_HIGHLOW);
diff --git a/src/jit/emitarm.cpp b/src/jit/emitarm.cpp
index bcf0cb4f33..ca5575a470 100644
--- a/src/jit/emitarm.cpp
+++ b/src/jit/emitarm.cpp
@@ -1673,7 +1673,7 @@ void emitter::emitIns_R(instruction ins, emitAttr attr, regNumber reg)
*/
void emitter::emitIns_R_I(
- instruction ins, emitAttr attr, regNumber reg, int imm, insFlags flags /* = INS_FLAGS_DONT_CARE */)
+ instruction ins, emitAttr attr, regNumber reg, ssize_t imm, insFlags flags /* = INS_FLAGS_DONT_CARE */)
{
insFormat fmt = IF_NONE;
diff --git a/src/jit/emitfmtsxarch.h b/src/jit/emitfmtsxarch.h
index b7ab38f0c0..4d97c4d8c5 100644
--- a/src/jit/emitfmtsxarch.h
+++ b/src/jit/emitfmtsxarch.h
@@ -139,6 +139,8 @@ IF_DEF(MRD_CNS, IS_GM_RD, DSP_CNS) // read [mem], const
IF_DEF(MWR_CNS, IS_GM_WR, DSP_CNS) // write [mem], const
IF_DEF(MRW_CNS, IS_GM_RW, DSP_CNS) // r/w [mem], const
+IF_DEF(MWR_RRD_CNS, IS_GM_WR|IS_R1_RD, DSP_CNS) // write [mem], read reg, const
+
IF_DEF(MRW_SHF, IS_GM_RW, DSP_CNS) // shift [mem], const
//----------------------------------------------------------------------------
@@ -194,6 +196,8 @@ IF_DEF(ARD_CNS, IS_AM_RD, AMD_CNS) // read [adr], const
IF_DEF(AWR_CNS, IS_AM_WR, AMD_CNS) // write [adr], const
IF_DEF(ARW_CNS, IS_AM_RW, AMD_CNS) // r/w [adr], const
+IF_DEF(AWR_RRD_CNS, IS_AM_WR|IS_R1_RD, AMD_CNS) // write [adr], read reg, const
+
IF_DEF(ARW_SHF, IS_AM_RW, AMD_CNS) // shift [adr], const
diff --git a/src/jit/emitxarch.cpp b/src/jit/emitxarch.cpp
index 4e1bec97fb..094776b17d 100644
--- a/src/jit/emitxarch.cpp
+++ b/src/jit/emitxarch.cpp
@@ -223,7 +223,12 @@ bool emitter::IsDstDstSrcAVXInstruction(instruction ins)
case INS_unpcklpd:
case INS_vinsertf128:
case INS_vinserti128:
+ case INS_vmaskmovps:
+ case INS_vmaskmovpd:
case INS_vperm2i128:
+ case INS_vperm2f128:
+ case INS_vpermilpsvar:
+ case INS_vpermilpdvar:
case INS_vpsrlvd:
case INS_vpsrlvq:
case INS_vpsravd:
@@ -2725,6 +2730,9 @@ emitter::insFormat emitter::emitMapFmtAtoM(insFormat fmt)
case IF_ARW_CNS:
return IF_MRW_CNS;
+ case IF_AWR_RRD_CNS:
+ return IF_MWR_RRD_CNS;
+
case IF_ARW_SHF:
return IF_MRW_SHF;
@@ -5062,6 +5070,32 @@ void emitter::emitIns_AR_R(instruction ins, emitAttr attr, regNumber ireg, regNu
emitAdjustStackDepthPushPop(ins);
}
+#ifndef LEGACY_BACKEND
+void emitter::emitIns_AR_R_I(instruction ins, emitAttr attr, regNumber base, int disp, regNumber ireg, int ival)
+{
+ assert(ins == INS_vextracti128 || ins == INS_vextractf128);
+ assert(base != REG_NA);
+ assert(ireg != REG_NA);
+ UNATIVE_OFFSET sz;
+ instrDesc* id = emitNewInstrAmdCns(attr, disp, ival);
+
+ id->idIns(ins);
+ id->idInsFmt(IF_AWR_RRD_CNS);
+ id->idAddr()->iiaAddrMode.amBaseReg = base;
+ id->idAddr()->iiaAddrMode.amIndxReg = REG_NA;
+ id->idReg1(ireg);
+
+ assert(emitGetInsAmdAny(id) == disp); // make sure "disp" is stored properly
+
+ // the code size of "vextracti/f128 [mem], ymm, imm8" is 6 byte
+ sz = 6;
+ id->idCodeSize(sz);
+
+ dispIns(id);
+ emitCurIGsize += sz;
+}
+#endif
+
void emitter::emitIns_AI_R(instruction ins, emitAttr attr, regNumber ireg, ssize_t disp)
{
UNATIVE_OFFSET sz;
@@ -7785,6 +7819,32 @@ void emitter::emitDispIns(
break;
}
+ case IF_AWR_RRD_CNS:
+ {
+ assert(ins == INS_vextracti128 || ins == INS_vextractf128);
+ // vextracti/f128 extracts 128-bit data, so we fix sstr as "xmm ptr"
+ sstr = codeGen->genSizeStr(EA_ATTR(16));
+ printf(sstr);
+ emitDispAddrMode(id);
+ printf(", %s", emitRegName(id->idReg1(), attr));
+
+ emitGetInsAmdCns(id, &cnsVal);
+
+ val = cnsVal.cnsVal;
+ printf(", ");
+
+ if (cnsVal.cnsReloc)
+ {
+ emitDispReloc(val);
+ }
+ else
+ {
+ goto PRINT_CONSTANT;
+ }
+
+ break;
+ }
+
case IF_RWR_RRD_ARD:
printf("%s, %s, %s", emitRegName(id->idReg1(), attr), emitRegName(id->idReg2(), attr), sstr);
emitDispAddrMode(id);
@@ -8161,6 +8221,32 @@ void emitter::emitDispIns(
break;
}
+ case IF_MWR_RRD_CNS:
+ {
+ assert(ins == INS_vextracti128 || ins == INS_vextractf128);
+ // vextracti/f128 extracts 128-bit data, so we fix sstr as "xmm ptr"
+ sstr = codeGen->genSizeStr(EA_ATTR(16));
+ printf(sstr);
+ offs = emitGetInsDsp(id);
+ emitDispClsVar(id->idAddr()->iiaFieldHnd, offs, ID_INFO_DSP_RELOC);
+ printf(", %s", emitRegName(id->idReg1(), attr));
+ emitGetInsDcmCns(id, &cnsVal);
+
+ val = cnsVal.cnsVal;
+ printf(", ");
+
+ if (cnsVal.cnsReloc)
+ {
+ emitDispReloc(val);
+ }
+ else
+ {
+ goto PRINT_CONSTANT;
+ }
+
+ break;
+ }
+
case IF_RWR_RRD_MRD:
printf("%s, %s, %s", emitRegName(id->idReg1(), attr), emitRegName(id->idReg2(), attr), sstr);
offs = emitGetInsDsp(id);
@@ -12213,6 +12299,15 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp)
sz = emitSizeOfInsDsc(id);
break;
+ case IF_AWR_RRD_CNS:
+ assert(ins == INS_vextracti128 || ins == INS_vextractf128);
+ assert(UseVEXEncoding());
+ emitGetInsAmdCns(id, &cnsVal);
+ code = insCodeMR(ins);
+ dst = emitOutputAM(dst, id, code, &cnsVal);
+ sz = emitSizeOfInsDsc(id);
+ break;
+
case IF_RRD_ARD:
case IF_RWR_ARD:
case IF_RRW_ARD:
@@ -12525,6 +12620,17 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp)
sz = emitSizeOfInsDsc(id);
break;
+ case IF_MWR_RRD_CNS:
+ assert(ins == INS_vextracti128 || ins == INS_vextractf128);
+ assert(UseVEXEncoding());
+ emitGetInsDcmCns(id, &cnsVal);
+ code = insCodeMR(ins);
+ // only AVX2 vextracti128 and AVX vextractf128 can reach this path,
+ // they do not need VEX.vvvv to encode the register operand
+ dst = emitOutputCV(dst, id, code, &cnsVal);
+ sz = emitSizeOfInsDsc(id);
+ break;
+
case IF_RRD_MRD:
case IF_RWR_MRD:
case IF_RRW_MRD:
diff --git a/src/jit/emitxarch.h b/src/jit/emitxarch.h
index a5bc303719..4cfa24fcde 100644
--- a/src/jit/emitxarch.h
+++ b/src/jit/emitxarch.h
@@ -416,6 +416,7 @@ void emitIns_R_R_A_I(
instruction ins, emitAttr attr, regNumber reg1, regNumber reg2, GenTreeIndir* indir, int ival, insFormat fmt);
void emitIns_R_R_AR_I(
instruction ins, emitAttr attr, regNumber reg1, regNumber reg2, regNumber base, int offs, int ival);
+void emitIns_AR_R_I(instruction ins, emitAttr attr, regNumber base, int disp, regNumber ireg, int ival);
#endif // !LEGACY_BACKEND
void emitIns_R_R_C_I(
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index b1a4fef8e2..68e67ca018 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -261,7 +261,7 @@ void Compiler::fgInstrumentMethod()
int countOfBlocks = 0;
BasicBlock* block;
- for (block = fgFirstBB; block; block = block->bbNext)
+ for (block = fgFirstBB; (block != nullptr); block = block->bbNext)
{
if (!(block->bbFlags & BBF_IMPORTED) || (block->bbFlags & BBF_INTERNAL))
{
@@ -272,11 +272,9 @@ void Compiler::fgInstrumentMethod()
// Allocate the profile buffer
- ICorJitInfo::ProfileBuffer* bbProfileBuffer;
-
- HRESULT res = info.compCompHnd->allocBBProfileBuffer(countOfBlocks, &bbProfileBuffer);
+ ICorJitInfo::ProfileBuffer* bbProfileBufferStart;
- ICorJitInfo::ProfileBuffer* bbProfileBufferStart = bbProfileBuffer;
+ HRESULT res = info.compCompHnd->allocBBProfileBuffer(countOfBlocks, &bbProfileBufferStart);
GenTree* stmt;
@@ -300,9 +298,16 @@ void Compiler::fgInstrumentMethod()
}
else
{
- // Assign a buffer entry for each basic block
+ // For each BasicBlock (non-Internal)
+ // 1. Assign the blocks bbCodeOffs to the ILOffset field of this blocks profile data.
+ // 2. Add an operation that increments the ExecutionCount field at the beginning of the block.
- for (block = fgFirstBB; block; block = block->bbNext)
+ // Each (non-Internal) block has it own ProfileBuffer tuple [ILOffset, ExecutionCount]
+ // To start we initialize our current one with the first one that we allocated
+ //
+ ICorJitInfo::ProfileBuffer* bbCurrentBlockProfileBuffer = bbProfileBufferStart;
+
+ for (block = fgFirstBB; (block != nullptr); block = block->bbNext)
{
if (!(block->bbFlags & BBF_IMPORTED) || (block->bbFlags & BBF_INTERNAL))
{
@@ -310,25 +315,31 @@ void Compiler::fgInstrumentMethod()
}
// Assign the current block's IL offset into the profile data
- bbProfileBuffer->ILOffset = block->bbCodeOffs;
+ bbCurrentBlockProfileBuffer->ILOffset = block->bbCodeOffs;
+ assert(bbCurrentBlockProfileBuffer->ExecutionCount == 0); // This value should already be zero-ed out
- size_t addrOfBlockCount = (size_t)&bbProfileBuffer->ExecutionCount;
+ size_t addrOfCurrentExecutionCount = (size_t)&bbCurrentBlockProfileBuffer->ExecutionCount;
// Read Basic-Block count value
- GenTree* valueNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfBlockCount, GTF_ICON_BBC_PTR, false);
+ GenTree* valueNode =
+ gtNewIndOfIconHandleNode(TYP_INT, addrOfCurrentExecutionCount, GTF_ICON_BBC_PTR, false);
// Increment value by 1
GenTree* rhsNode = gtNewOperNode(GT_ADD, TYP_INT, valueNode, gtNewIconNode(1));
// Write new Basic-Block count value
- GenTree* lhsNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfBlockCount, GTF_ICON_BBC_PTR, false);
+ GenTree* lhsNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfCurrentExecutionCount, GTF_ICON_BBC_PTR, false);
GenTree* asgNode = gtNewAssignNode(lhsNode, rhsNode);
fgInsertStmtAtBeg(block, asgNode);
+ // Advance to the next ProfileBuffer tuple [ILOffset, ExecutionCount]
+ bbCurrentBlockProfileBuffer++;
+
+ // One less block
countOfBlocks--;
- bbProfileBuffer++;
}
+ // Check that we allocated and initialized the same number of ProfileBuffer tuples
noway_assert(countOfBlocks == 0);
// Add the method entry callback node
@@ -359,10 +370,11 @@ void Compiler::fgInstrumentMethod()
GenTreeArgList* args = gtNewArgList(arg);
GenTree* call = gtNewHelperCallNode(CORINFO_HELP_BBT_FCN_ENTER, TYP_VOID, args);
- size_t addrOfBlockCount = (size_t)&bbProfileBuffer->ExecutionCount;
+ // Get the address of the first blocks ExecutionCount
+ size_t addrOfFirstExecutionCount = (size_t)&bbProfileBufferStart->ExecutionCount;
// Read Basic-Block count value
- GenTree* valueNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfBlockCount, GTF_ICON_BBC_PTR, false);
+ GenTree* valueNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfFirstExecutionCount, GTF_ICON_BBC_PTR, false);
// Compare Basic-Block count value against zero
GenTree* relop = gtNewOperNode(GT_NE, TYP_INT, valueNode, gtNewIconNode(0, TYP_INT));
@@ -7456,7 +7468,7 @@ GenTree* Compiler::fgDoNormalizeOnStore(GenTree* tree)
if (fgCastNeeded(op2, varDsc->TypeGet()))
{
- op2 = gtNewCastNode(TYP_INT, op2, varDsc->TypeGet());
+ op2 = gtNewCastNode(TYP_INT, op2, false, varDsc->TypeGet());
tree->gtOp.gtOp2 = op2;
// Propagate GTF_COLON_COND
@@ -20680,12 +20692,12 @@ Compiler::fgWalkResult Compiler::fgStress64RsltMulCB(GenTree** pTree, fgWalkData
#endif // DEBUG
// To ensure optNarrowTree() doesn't fold back to the original tree.
- tree->gtOp.gtOp1 = pComp->gtNewCastNode(TYP_LONG, tree->gtOp.gtOp1, TYP_LONG);
+ tree->gtOp.gtOp1 = pComp->gtNewCastNode(TYP_LONG, tree->gtOp.gtOp1, false, TYP_LONG);
tree->gtOp.gtOp1 = pComp->gtNewOperNode(GT_NOP, TYP_LONG, tree->gtOp.gtOp1);
- tree->gtOp.gtOp1 = pComp->gtNewCastNode(TYP_LONG, tree->gtOp.gtOp1, TYP_LONG);
- tree->gtOp.gtOp2 = pComp->gtNewCastNode(TYP_LONG, tree->gtOp.gtOp2, TYP_LONG);
+ tree->gtOp.gtOp1 = pComp->gtNewCastNode(TYP_LONG, tree->gtOp.gtOp1, false, TYP_LONG);
+ tree->gtOp.gtOp2 = pComp->gtNewCastNode(TYP_LONG, tree->gtOp.gtOp2, false, TYP_LONG);
tree->gtType = TYP_LONG;
- *pTree = pComp->gtNewCastNode(TYP_INT, tree, TYP_INT);
+ *pTree = pComp->gtNewCastNode(TYP_INT, tree, false, TYP_INT);
#ifdef DEBUG
if (pComp->verbose)
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index 41733d0de8..10ef3738f1 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -6648,7 +6648,8 @@ GenTreeCall* Compiler::gtNewCallNode(
#endif // LEGACY_BACKEND
#ifdef FEATURE_READYTORUN_COMPILER
- node->gtEntryPoint.addr = nullptr;
+ node->gtEntryPoint.addr = nullptr;
+ node->gtEntryPoint.accessType = IAT_VALUE;
#endif
#if defined(DEBUG) || defined(INLINE_DATA)
@@ -7819,8 +7820,9 @@ GenTree* Compiler::gtCloneExpr(
break;
case GT_CAST:
- copy = new (this, LargeOpOpcode()) GenTreeCast(tree->TypeGet(), tree->gtCast.CastOp(),
- tree->gtCast.gtCastType DEBUGARG(/*largeNode*/ TRUE));
+ copy =
+ new (this, LargeOpOpcode()) GenTreeCast(tree->TypeGet(), tree->gtCast.CastOp(), tree->IsUnsigned(),
+ tree->gtCast.gtCastType DEBUGARG(/*largeNode*/ TRUE));
break;
// The nodes below this are not bashed, so they can be allocated at their individual sizes.
@@ -7992,10 +7994,6 @@ GenTree* Compiler::gtCloneExpr(
{
copy->gtFlags |= GTF_OVERFLOW;
}
- if (copy->OperGet() == GT_CAST)
- {
- copy->gtFlags |= (tree->gtFlags & GTF_UNSIGNED);
- }
if (tree->gtOp.gtOp1)
{
@@ -13468,7 +13466,7 @@ GenTree* Compiler::gtTryRemoveBoxUpstreamEffects(GenTree* op, BoxRemovalOptions
// If we're eventually going to return the type handle, remember it now.
GenTree* boxTypeHandle = nullptr;
- if (options == BR_REMOVE_AND_NARROW_WANT_TYPE_HANDLE)
+ if ((options == BR_REMOVE_AND_NARROW_WANT_TYPE_HANDLE) || (options == BR_DONT_REMOVE_WANT_TYPE_HANDLE))
{
GenTree* asgSrc = asg->gtOp.gtOp2;
genTreeOps asgSrcOper = asgSrc->OperGet();
@@ -13632,6 +13630,11 @@ GenTree* Compiler::gtTryRemoveBoxUpstreamEffects(GenTree* op, BoxRemovalOptions
return copySrc;
}
+ if (options == BR_DONT_REMOVE_WANT_TYPE_HANDLE)
+ {
+ return boxTypeHandle;
+ }
+
// Otherwise, proceed with the optimization.
//
// Change the assignment expression to a NOP.
@@ -13994,15 +13997,22 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)
goto CNS_INT;
case TYP_ULONG:
- if (!(tree->gtFlags & GTF_UNSIGNED) && tree->gtOverflow() && i1 < 0)
+ if (tree->IsUnsigned())
{
- goto LNG_OVF;
+ lval1 = UINT64(UINT32(i1));
+ }
+ else
+ {
+ if (tree->gtOverflow() && (i1 < 0))
+ {
+ goto LNG_OVF;
+ }
+ lval1 = UINT64(INT32(i1));
}
- lval1 = UINT64(UINT32(i1));
goto CNS_LONG;
case TYP_LONG:
- if (tree->gtFlags & GTF_UNSIGNED)
+ if (tree->IsUnsigned())
{
lval1 = INT64(UINT32(i1));
}
@@ -15425,11 +15435,11 @@ GenTree* Compiler::gtNewRefCOMfield(GenTree* objPtr,
}
else if (lclTyp == TYP_DOUBLE && assg->TypeGet() == TYP_FLOAT)
{
- assg = gtNewCastNode(TYP_DOUBLE, assg, TYP_DOUBLE);
+ assg = gtNewCastNode(TYP_DOUBLE, assg, false, TYP_DOUBLE);
}
else if (lclTyp == TYP_FLOAT && assg->TypeGet() == TYP_DOUBLE)
{
- assg = gtNewCastNode(TYP_FLOAT, assg, TYP_FLOAT);
+ assg = gtNewCastNode(TYP_FLOAT, assg, false, TYP_FLOAT);
}
args = gtNewArgList(assg);
@@ -15489,7 +15499,7 @@ GenTree* Compiler::gtNewRefCOMfield(GenTree* objPtr,
else if (varTypeIsIntegral(lclTyp) && genTypeSize(lclTyp) < genTypeSize(TYP_INT))
{
// The helper does not extend the small return types.
- tree = gtNewCastNode(genActualType(lclTyp), tree, lclTyp);
+ tree = gtNewCastNode(genActualType(lclTyp), tree, false, lclTyp);
}
}
}
diff --git a/src/jit/gentree.h b/src/jit/gentree.h
index c33cb51d58..4ed7cf0461 100644
--- a/src/jit/gentree.h
+++ b/src/jit/gentree.h
@@ -3031,9 +3031,10 @@ struct GenTreeCast : public GenTreeOp
}
var_types gtCastType;
- GenTreeCast(var_types type, GenTree* op, var_types castType DEBUGARG(bool largeNode = false))
+ GenTreeCast(var_types type, GenTree* op, bool fromUnsigned, var_types castType DEBUGARG(bool largeNode = false))
: GenTreeOp(GT_CAST, type, op, nullptr DEBUGARG(largeNode)), gtCastType(castType)
{
+ gtFlags |= fromUnsigned ? GTF_UNSIGNED : 0;
}
#if DEBUGGABLE_GENTREE
GenTreeCast() : GenTreeOp()
diff --git a/src/jit/hwintrinsiccodegenxarch.cpp b/src/jit/hwintrinsiccodegenxarch.cpp
index d19fe8000c..acf013e207 100644
--- a/src/jit/hwintrinsiccodegenxarch.cpp
+++ b/src/jit/hwintrinsiccodegenxarch.cpp
@@ -134,7 +134,14 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
}
else if (category == HW_Category_MemoryLoad)
{
- emit->emitIns_SIMD_R_R_AR(ins, simdSize, targetReg, op1Reg, op2Reg);
+ if (intrinsicID == NI_AVX_MaskLoad)
+ {
+ emit->emitIns_SIMD_R_R_AR(ins, simdSize, targetReg, op2Reg, op1Reg);
+ }
+ else
+ {
+ emit->emitIns_SIMD_R_R_AR(ins, simdSize, targetReg, op1Reg, op2Reg);
+ }
}
else if (Compiler::isImmHWIntrinsic(intrinsicID, op2))
{
@@ -1183,7 +1190,7 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node)
if (baseType == TYP_FLOAT)
{
// extract instructions return to GP-registers, so it needs int size as the emitsize
- emit->emitIns_SIMD_R_R_I(ins, emitTypeSize(TYP_INT), op1Reg, tmpTargetReg, (int)i);
+ emit->emitIns_SIMD_R_R_I(ins, emitTypeSize(TYP_INT), tmpTargetReg, op1Reg, (int)i);
emit->emitIns_R_R(INS_mov_i2xmm, EA_4BYTE, targetReg, tmpTargetReg);
}
else
@@ -1311,6 +1318,67 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
break;
}
+ case NI_AVX_SetAllVector256:
+ {
+ assert(op1 != nullptr);
+ assert(op2 == nullptr);
+ op1Reg = op1->gtRegNum;
+ if (varTypeIsIntegral(baseType))
+ {
+ // If the argument is a integer, it needs to be moved into a XMM register
+ regNumber tmpXMM = node->ExtractTempReg();
+ emit->emitIns_R_R(INS_mov_i2xmm, emitActualTypeSize(baseType), tmpXMM, op1Reg);
+ op1Reg = tmpXMM;
+ }
+
+ if (compiler->compSupports(InstructionSet_AVX2))
+ {
+ // generate broadcast instructions if AVX2 is available
+ emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD32), targetReg, op1Reg);
+ }
+ else
+ {
+ // duplicate the scalar argument to XMM register
+ switch (baseType)
+ {
+ case TYP_FLOAT:
+ emit->emitIns_SIMD_R_R_I(INS_vpermilps, emitTypeSize(TYP_SIMD16), op1Reg, op1Reg, 0);
+ break;
+ case TYP_DOUBLE:
+ emit->emitIns_R_R(INS_movddup, emitTypeSize(TYP_SIMD16), op1Reg, op1Reg);
+ break;
+ case TYP_BYTE:
+ case TYP_UBYTE:
+ {
+ regNumber tmpZeroReg = node->GetSingleTempReg();
+ emit->emitIns_R_R(INS_pxor, emitTypeSize(TYP_SIMD16), tmpZeroReg, tmpZeroReg);
+ emit->emitIns_SIMD_R_R_R(INS_pshufb, emitTypeSize(TYP_SIMD16), op1Reg, op1Reg, tmpZeroReg);
+ break;
+ }
+ case TYP_SHORT:
+ case TYP_USHORT:
+ emit->emitIns_SIMD_R_R_I(INS_pshuflw, emitTypeSize(TYP_SIMD16), op1Reg, op1Reg, 0);
+ emit->emitIns_SIMD_R_R_I(INS_pshufd, emitTypeSize(TYP_SIMD16), op1Reg, op1Reg, 80);
+ break;
+ case TYP_INT:
+ case TYP_UINT:
+ emit->emitIns_SIMD_R_R_I(INS_pshufd, emitTypeSize(TYP_SIMD16), op1Reg, op1Reg, 0);
+ break;
+ case TYP_LONG:
+ case TYP_ULONG:
+ emit->emitIns_SIMD_R_R_I(INS_pshufd, emitTypeSize(TYP_SIMD16), op1Reg, op1Reg, 68);
+ break;
+
+ default:
+ unreached();
+ break;
+ }
+ // duplicate the XMM register to YMM register
+ emit->emitIns_SIMD_R_R_R_I(INS_vinsertf128, emitTypeSize(TYP_SIMD32), targetReg, op1Reg, op1Reg, 1);
+ }
+ break;
+ }
+
case NI_AVX_ExtendToVector256:
{
// ExtendToVector256 has zero-extend semantics in order to ensure it is deterministic
@@ -1331,7 +1399,6 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
if (op1Reg != targetReg)
{
- instruction ins = Compiler::insOfHWIntrinsic(intrinsicID, node->gtSIMDBaseType);
emit->emitIns_R_R(ins, emitTypeSize(TYP_SIMD32), targetReg, op1Reg);
}
break;
@@ -1406,7 +1473,7 @@ void CodeGen::genAvxOrAvx2Intrinsic(GenTreeHWIntrinsic* node)
{
if (intrinsicID == NI_AVX_ExtractVector128 || intrinsicID == NI_AVX2_ExtractVector128)
{
- emit->emitIns_R_AR_I(ins, attr, op2Reg, op1Reg, 0, (int)i);
+ emit->emitIns_AR_R_I(ins, attr, op1Reg, 0, op2Reg, (int)i);
}
else if (op2->TypeGet() == TYP_I_IMPL)
{
diff --git a/src/jit/hwintrinsiclistxarch.h b/src/jit/hwintrinsiclistxarch.h
index 7435c286fa..334796688e 100644
--- a/src/jit/hwintrinsiclistxarch.h
+++ b/src/jit/hwintrinsiclistxarch.h
@@ -167,7 +167,7 @@ HARDWARE_INTRINSIC(SSE2_CompareOrdered, "CompareOrd
HARDWARE_INTRINSIC(SSE2_CompareOrderedScalar, "CompareOrderedScalar", SSE2, 7, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_cmpsd}, HW_Category_SIMDScalar, HW_Flag_CopyUpperBits)
HARDWARE_INTRINSIC(SSE2_CompareUnordered, "CompareUnordered", SSE2, 3, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_cmppd}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(SSE2_CompareUnorderedScalar, "CompareUnorderedScalar", SSE2, 3, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_cmpsd}, HW_Category_SIMDScalar, HW_Flag_CopyUpperBits)
-HARDWARE_INTRINSIC(SSE2_ConvertToDouble, "ConvertToDouble", SSE2, -1, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movsd}, HW_Category_Helper, HW_Flag_BaseTypeFromFirstArg|HW_Flag_NoRMWSemantics)
+HARDWARE_INTRINSIC(SSE2_ConvertToDouble, "ConvertToDouble", SSE2, -1, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movsdsse2}, HW_Category_Helper, HW_Flag_BaseTypeFromFirstArg|HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(SSE2_ConvertToInt32, "ConvertToInt32", SSE2, -1, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_mov_xmm2i, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_cvtsd2si}, HW_Category_SIMDScalar, HW_Flag_BaseTypeFromFirstArg|HW_Flag_SpecialCodeGen|HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(SSE2_ConvertToInt32WithTruncation, "ConvertToInt32WithTruncation", SSE2, -1, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_cvttsd2si}, HW_Category_SIMDScalar, HW_Flag_BaseTypeFromFirstArg|HW_Flag_SpecialCodeGen|HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(SSE2_ConvertToInt64, "ConvertToInt64", SSE2, -1, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_mov_xmm2i, INS_invalid, INS_invalid, INS_cvtsd2si}, HW_Category_SIMDScalar, HW_Flag_BaseTypeFromFirstArg|HW_Flag_SpecialCodeGen|HW_Flag_NoRMWSemantics)
@@ -333,6 +333,7 @@ HARDWARE_INTRINSIC(AVX_BlendVariable, "BlendVaria
HARDWARE_INTRINSIC(AVX_Ceiling, "Ceiling", AVX, 10, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_roundps, INS_roundpd}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_BroadcastScalarToVector128, "BroadcastScalarToVector128", AVX, -1, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_vbroadcastss, INS_invalid}, HW_Category_MemoryLoad, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX_BroadcastScalarToVector256, "BroadcastScalarToVector256", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_vbroadcastss, INS_vbroadcastsd}, HW_Category_MemoryLoad, HW_Flag_NoFlag)
+HARDWARE_INTRINSIC(AVX_BroadcastVector128ToVector256, "BroadcastVector128ToVector256", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid,INS_vbroadcastf128,INS_vbroadcastf128}, HW_Category_MemoryLoad, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX_Compare, "Compare", AVX, -1, 32, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_cmpps, INS_cmppd}, HW_Category_IMM, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX_CompareScalar, "CompareScalar", AVX, -1, 16, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_cmpss, INS_cmpsd}, HW_Category_IMM, HW_Flag_CopyUpperBits)
HARDWARE_INTRINSIC(AVX_ConvertToSingle, "ConvertToSingle", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movss, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
@@ -347,21 +348,27 @@ HARDWARE_INTRINSIC(AVX_Divide, "Divide",
HARDWARE_INTRINSIC(AVX_DotProduct, "DotProduct", AVX, -1, 32, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_dpps, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM)
HARDWARE_INTRINSIC(AVX_DuplicateEvenIndexed, "DuplicateEvenIndexed", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movsldup, INS_movddup}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_DuplicateOddIndexed, "DuplicateOddIndexed", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movshdup, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
+HARDWARE_INTRINSIC(AVX_Extract, "Extract", AVX, -1, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_BaseTypeFromFirstArg|HW_Flag_FullRangeIMM|HW_Flag_NoCodeGen)
HARDWARE_INTRINSIC(AVX_ExtendToVector256, "ExtendToVector256", AVX, -1, 32, 1, {INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movaps, INS_movapd}, HW_Category_Helper, HW_Flag_OneTypeGeneric|HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_ExtractVector128, "ExtractVector128", AVX, -1, 32, -1, {INS_vextractf128,INS_vextractf128,INS_vextractf128,INS_vextractf128,INS_vextractf128,INS_vextractf128,INS_vextractf128,INS_vextractf128,INS_vextractf128, INS_vextractf128},HW_Category_IMM, HW_Flag_OneTypeGeneric|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_FullRangeIMM)
HARDWARE_INTRINSIC(AVX_Floor, "Floor", AVX, 9, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_roundps, INS_roundpd}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_GetLowerHalf, "GetLowerHalf", AVX, -1, 32, 1, {INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movaps, INS_movapd}, HW_Category_Helper, HW_Flag_OneTypeGeneric|HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_HorizontalAdd, "HorizontalAdd", AVX, -1, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_haddps, INS_haddpd}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX_HorizontalSubtract, "HorizontalSubtract", AVX, -1, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_hsubps, INS_hsubpd}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
+HARDWARE_INTRINSIC(AVX_Insert, "Insert", AVX, -1, 32, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM|HW_Flag_NoCodeGen|HW_Flag_SecondArgMaybe64Bit)
HARDWARE_INTRINSIC(AVX_InsertVector128, "InsertVector128", AVX, -1, 32, 3, {INS_vinsertf128,INS_vinsertf128,INS_vinsertf128,INS_vinsertf128,INS_vinsertf128,INS_vinsertf128,INS_vinsertf128,INS_vinsertf128,INS_vinsertf128, INS_vinsertf128},HW_Category_IMM, HW_Flag_FullRangeIMM|HW_Flag_OneTypeGeneric|HW_Flag_SpecialCodeGen)
HARDWARE_INTRINSIC(AVX_LoadAlignedVector256, "LoadAlignedVector256", AVX, -1, 32, 1, {INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movdqa, INS_movaps, INS_movapd}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_LoadDquVector256, "LoadDquVector256", AVX, -1, 32, 1, {INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_lddqu, INS_invalid, INS_invalid}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_LoadVector256, "LoadVector256", AVX, -1, 32, 1, {INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movdqu, INS_movups, INS_movupd}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_Max, "Max", AVX, -1, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_maxps, INS_maxpd}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
HARDWARE_INTRINSIC(AVX_Min, "Min", AVX, -1, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_minps, INS_minpd}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
+HARDWARE_INTRINSIC(AVX_MaskLoad, "MaskLoad", AVX, -1, 0, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_vmaskmovps,INS_vmaskmovpd}, HW_Category_MemoryLoad, HW_Flag_UnfixedSIMDSize)
+HARDWARE_INTRINSIC(AVX_MoveMask, "MoveMask", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_movmskps, INS_movmskpd}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_BaseTypeFromFirstArg)
HARDWARE_INTRINSIC(AVX_Multiply, "Multiply", AVX, -1, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_mulps, INS_mulpd}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
HARDWARE_INTRINSIC(AVX_Or, "Or", AVX, -1, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_orps, INS_orpd}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
HARDWARE_INTRINSIC(AVX_Permute, "Permute", AVX, -1, 0, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_vpermilps, INS_vpermilpd}, HW_Category_IMM, HW_Flag_FullRangeIMM|HW_Flag_UnfixedSIMDSize)
+HARDWARE_INTRINSIC(AVX_Permute2x128, "Permute2x128", AVX, -1, 32, 3, {INS_vperm2f128,INS_vperm2f128,INS_vperm2f128,INS_vperm2f128,INS_vperm2f128,INS_vperm2f128,INS_vperm2f128,INS_vperm2f128,INS_vperm2f128,INS_vperm2f128}, HW_Category_IMM, HW_Flag_OneTypeGeneric|HW_Flag_FullRangeIMM)
+HARDWARE_INTRINSIC(AVX_PermuteVar, "PermuteVar", AVX, -1, 0, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_vpermilpsvar,INS_vpermilpdvar}, HW_Category_SimpleSIMD, HW_Flag_UnfixedSIMDSize)
HARDWARE_INTRINSIC(AVX_Reciprocal, "Reciprocal", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_rcpps, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_ReciprocalSqrt, "ReciprocalSqrt", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_rsqrtps, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_RoundCurrentDirection, "RoundCurrentDirection", AVX, 4, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_roundps, INS_roundpd}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
@@ -369,6 +376,8 @@ HARDWARE_INTRINSIC(AVX_RoundToNearestInteger, "RoundToNea
HARDWARE_INTRINSIC(AVX_RoundToNegativeInfinity, "RoundToNegativeInfinity", AVX, 9, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_roundps, INS_roundpd}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_RoundToPositiveInfinity, "RoundToPositiveInfinity", AVX, 10, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_roundps, INS_roundpd}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_RoundToZero, "RoundToZero", AVX, 11, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_roundps, INS_roundpd}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
+HARDWARE_INTRINSIC(AVX_SetVector256, "SetVector256", AVX, -1, 32, -1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_Helper, HW_Flag_NoCodeGen|HW_Flag_SecondArgMaybe64Bit)
+HARDWARE_INTRINSIC(AVX_SetAllVector256, "SetAllVector256", AVX, -1, 32, 1, {INS_vpbroadcastb,INS_vpbroadcastb,INS_vpbroadcastw,INS_vpbroadcastw,INS_vpbroadcastd,INS_vpbroadcastd,INS_vpbroadcastq,INS_vpbroadcastq,INS_vbroadcastss,INS_vbroadcastsd},HW_Category_Helper, HW_Flag_MultiIns|HW_Flag_SpecialImport|HW_Flag_OneTypeGeneric)
HARDWARE_INTRINSIC(AVX_SetZeroVector256, "SetZeroVector256", AVX, -1, 32, 0, {INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_pxor, INS_xorps, INS_xorpd}, HW_Category_Helper, HW_Flag_OneTypeGeneric|HW_Flag_NoRMWSemantics)
HARDWARE_INTRINSIC(AVX_Shuffle, "Shuffle", AVX, -1, 32, 3, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_shufps, INS_shufpd}, HW_Category_IMM, HW_Flag_NoRMWSemantics|HW_Flag_FullRangeIMM)
HARDWARE_INTRINSIC(AVX_Sqrt, "Sqrt", AVX, -1, 32, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sqrtps, INS_sqrtpd}, HW_Category_SimpleSIMD, HW_Flag_NoRMWSemantics)
@@ -395,17 +404,28 @@ HARDWARE_INTRINSIC(AVX2_Average, "Average",
HARDWARE_INTRINSIC(AVX2_BlendVariable, "BlendVariable", AVX2, -1, 32, 3, {INS_vpblendvb, INS_vpblendvb, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX2_BroadcastScalarToVector128, "BroadcastScalarToVector128", AVX2, -1, 16, 1, {INS_vpbroadcastb,INS_vpbroadcastb,INS_vpbroadcastw,INS_vpbroadcastw,INS_vpbroadcastd,INS_vpbroadcastd,INS_vpbroadcastq,INS_vpbroadcastq,INS_vbroadcastss,INS_movddup}, HW_Category_SimpleSIMD, HW_Flag_OneTypeGeneric)
HARDWARE_INTRINSIC(AVX2_BroadcastScalarToVector256, "BroadcastScalarToVector256", AVX2, -1, 32, 1, {INS_vpbroadcastb,INS_vpbroadcastb,INS_vpbroadcastw,INS_vpbroadcastw,INS_vpbroadcastd,INS_vpbroadcastd,INS_vpbroadcastq,INS_vpbroadcastq,INS_vbroadcastss,INS_vbroadcastsd}, HW_Category_SimpleSIMD, HW_Flag_OneTypeGeneric)
+HARDWARE_INTRINSIC(AVX2_BroadcastVector128ToVector256, "BroadcastVector128ToVector256", AVX2, -1, 32, 1, {INS_vbroadcasti128,INS_vbroadcasti128,INS_vbroadcasti128,INS_vbroadcasti128,INS_vbroadcasti128,INS_vbroadcasti128,INS_vbroadcasti128,INS_vbroadcasti128,INS_invalid,INS_invalid},HW_Category_MemoryLoad, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX2_CompareEqual, "CompareEqual", AVX2, -1, 32, 2, {INS_pcmpeqb, INS_pcmpeqb, INS_pcmpeqw, INS_pcmpeqw, INS_pcmpeqd, INS_pcmpeqd, INS_pcmpeqq, INS_pcmpeqq, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
HARDWARE_INTRINSIC(AVX2_CompareGreaterThan, "CompareGreaterThan", AVX2, -1, 32, 2, {INS_pcmpgtb, INS_invalid, INS_pcmpgtw, INS_invalid, INS_pcmpgtd, INS_invalid, INS_pcmpgtq, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX2_ExtractVector128, "ExtractVector128", AVX2, -1, 32, -1, {INS_vextracti128,INS_vextracti128,INS_vextracti128,INS_vextracti128,INS_vextracti128,INS_vextracti128,INS_vextracti128,INS_vextracti128,INS_invalid, INS_invalid},HW_Category_IMM, HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_FullRangeIMM)
+HARDWARE_INTRINSIC(AVX2_ConvertToVector256Int16, "ConvertToVector256Int16", AVX2, -1, 32, 1, {INS_pmovsxbw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
+HARDWARE_INTRINSIC(AVX2_ConvertToVector256UInt16, "ConvertToVector256UInt16", AVX2, -1, 32, 1, {INS_invalid, INS_pmovzxbw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
+HARDWARE_INTRINSIC(AVX2_ConvertToVector256Int32, "ConvertToVector256Int32", AVX2, -1, 32, 1, {INS_pmovsxbd, INS_invalid, INS_pmovsxwd, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
+HARDWARE_INTRINSIC(AVX2_ConvertToVector256UInt32, "ConvertToVector256UInt32", AVX2, -1, 32, 1, {INS_invalid, INS_pmovzxbd, INS_invalid, INS_pmovzxwd, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
+HARDWARE_INTRINSIC(AVX2_ConvertToVector256Int64, "ConvertToVector256Int64", AVX2, -1, 32, 1, {INS_pmovsxbq, INS_invalid, INS_pmovsxwq, INS_invalid, INS_pmovsxdq, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
+HARDWARE_INTRINSIC(AVX2_ConvertToVector256UInt64, "ConvertToVector256UInt64", AVX2, -1, 32, 1, {INS_invalid, INS_pmovzxbq, INS_invalid, INS_pmovzxwq, INS_invalid, INS_pmovzxdq, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_BaseTypeFromFirstArg)
HARDWARE_INTRINSIC(AVX2_HorizontalAdd, "HorizontalAdd", AVX2, -1, 32, 2, {INS_invalid, INS_invalid, INS_phaddw, INS_invalid, INS_phaddd, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX2_HorizontalAddSaturate, "HorizontalAddSaturate", AVX2, -1, 32, 2, {INS_invalid, INS_invalid, INS_phaddsw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX2_HorizontalSubtract, "HorizontalSubtract", AVX2, -1, 32, 2, {INS_invalid, INS_invalid, INS_phsubw, INS_invalid, INS_phsubd, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX2_HorizontalSubtractSaturate, "HorizontalSubtractSaturate", AVX2, -1, 32, 2, {INS_invalid, INS_invalid, INS_phsubsw, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoFlag)
HARDWARE_INTRINSIC(AVX2_InsertVector128, "InsertVector128", AVX2, -1, 32, 3, {INS_vinserti128,INS_vinserti128,INS_vinserti128,INS_vinserti128,INS_vinserti128,INS_vinserti128,INS_vinserti128,INS_vinserti128,INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM|HW_Flag_SpecialCodeGen)
HARDWARE_INTRINSIC(AVX2_LoadAlignedVector256NonTemporal, "LoadAlignedVector256NonTemporal", AVX2, -1, 32, 1, {INS_movntdqa, INS_movntdqa, INS_movntdqa, INS_movntdqa, INS_movntdqa, INS_movntdqa, INS_movntdqa, INS_movntdqa, INS_invalid, INS_invalid}, HW_Category_MemoryLoad, HW_Flag_NoRMWSemantics)
+HARDWARE_INTRINSIC(AVX2_Max, "Max", AVX2, -1, 32, 2, {INS_pmaxsb, INS_pmaxub, INS_pmaxsw, INS_pmaxuw, INS_pmaxsd, INS_pmaxud, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
+HARDWARE_INTRINSIC(AVX2_Min, "Min", AVX2, -1, 32, 2, {INS_pminsb, INS_pminub, INS_pminsw, INS_pminuw, INS_pminsd, INS_pminud, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
+HARDWARE_INTRINSIC(AVX2_MoveMask, "MoveMask", AVX2, -1, 32, 1, {INS_pmovmskb, INS_pmovmskb, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_NoContainment|HW_Flag_BaseTypeFromFirstArg)
HARDWARE_INTRINSIC(AVX2_Multiply, "Multiply", AVX2, -1, 32, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_pmuldq, INS_pmuludq, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
HARDWARE_INTRINSIC(AVX2_Or, "Or", AVX2, -1, 32, 2, {INS_por, INS_por, INS_por, INS_por, INS_por, INS_por, INS_por, INS_por, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_Commutative)
+HARDWARE_INTRINSIC(AVX2_Permute2x128, "Permute2x128", AVX2, -1, 32, 3, {INS_vperm2i128,INS_vperm2i128,INS_vperm2i128,INS_vperm2i128,INS_vperm2i128,INS_vperm2i128,INS_vperm2i128,INS_vperm2i128,INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_OneTypeGeneric|HW_Flag_FullRangeIMM)
HARDWARE_INTRINSIC(AVX2_ShiftLeftLogical, "ShiftLeftLogical", AVX2, -1, 32, 2, {INS_invalid, INS_invalid, INS_psllw, INS_psllw, INS_pslld, INS_pslld, INS_psllq, INS_psllq, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_MaybeIMM|HW_Flag_NoJmpTableIMM|HW_Flag_FullRangeIMM)
HARDWARE_INTRINSIC(AVX2_ShiftLeftLogical128BitLane, "ShiftLeftLogical128BitLane", AVX2, -1, 32, 2, {INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_pslldq, INS_invalid, INS_invalid}, HW_Category_IMM, HW_Flag_FullRangeIMM)
HARDWARE_INTRINSIC(AVX2_ShiftLeftLogicalVariable, "ShiftLeftLogicalVariable", AVX2, -1, 0, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_vpsllvd, INS_vpsllvd, INS_vpsllvq, INS_vpsllvq, INS_invalid, INS_invalid}, HW_Category_SimpleSIMD, HW_Flag_UnfixedSIMDSize|HW_Flag_NoContainment)
diff --git a/src/jit/hwintrinsicxarch.cpp b/src/jit/hwintrinsicxarch.cpp
index c52958a170..df39c29ea6 100644
--- a/src/jit/hwintrinsicxarch.cpp
+++ b/src/jit/hwintrinsicxarch.cpp
@@ -20,8 +20,10 @@ struct HWIntrinsicInfo
};
static const HWIntrinsicInfo hwIntrinsicInfoArray[] = {
+// clang-format off
#define HARDWARE_INTRINSIC(id, name, isa, ival, size, numarg, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, category, flag) \
- {NI_##id, name, InstructionSet_##isa, ival, size, numarg, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, category, flag},
+ {NI_##id, name, InstructionSet_##isa, ival, size, numarg, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, category, static_cast<HWIntrinsicFlag>(flag)},
+// clang-format on
#include "hwintrinsiclistxarch.h"
};
@@ -540,15 +542,14 @@ GenTree* Compiler::addRangeCheckIfNeeded(NamedIntrinsic intrinsic, GenTree* last
// Arguments:
// isa - Instruction set
// Return Value:
-// true - all the hardware intrinsics of "isa" are implemented in RyuJIT.
+// true - all the hardware intrinsics of "isa" exposed in CoreFX
+// System.Runtime.Intrinsics.Experimental assembly are implemented in RyuJIT.
//
bool Compiler::isFullyImplmentedISAClass(InstructionSet isa)
{
switch (isa)
{
- case InstructionSet_SSE42:
- case InstructionSet_AVX:
- case InstructionSet_AVX2:
+ // These ISAs have no implementation
case InstructionSet_AES:
case InstructionSet_BMI1:
case InstructionSet_BMI2:
@@ -556,6 +557,13 @@ bool Compiler::isFullyImplmentedISAClass(InstructionSet isa)
case InstructionSet_PCLMULQDQ:
return false;
+ // These ISAs are partially implemented
+ case InstructionSet_AVX:
+ case InstructionSet_AVX2:
+ case InstructionSet_SSE42:
+ return true;
+
+ // These ISAs are fully implemented
case InstructionSet_SSE:
case InstructionSet_SSE2:
case InstructionSet_SSE3:
@@ -1058,6 +1066,26 @@ GenTree* Compiler::impSSE42Intrinsic(NamedIntrinsic intrinsic,
return retNode;
}
+//------------------------------------------------------------------------
+// normalizeAndGetHalfIndex: compute the half index of a Vector256<baseType>
+// and normalize the index to the specific range
+//
+// Arguments:
+// indexPtr -- OUT paramter, the pointer to the original index value
+// baseType -- the base type of the Vector256<T>
+//
+// Return Value:
+// retuen the middle index of a Vector256<baseType>
+// return the normalized index via indexPtr
+//
+static int normalizeAndGetHalfIndex(int* indexPtr, var_types baseType)
+{
+ assert(varTypeIsArithmetic(baseType));
+ // clear the unused bits to normalize the index into the range of [0, length of Vector256<baseType>)
+ *indexPtr = (*indexPtr) & (32 / genTypeSize(baseType) - 1);
+ return (16 / genTypeSize(baseType));
+}
+
GenTree* Compiler::impAvxOrAvx2Intrinsic(NamedIntrinsic intrinsic,
CORINFO_METHOD_HANDLE method,
CORINFO_SIG_INFO* sig,
@@ -1071,6 +1099,145 @@ GenTree* Compiler::impAvxOrAvx2Intrinsic(NamedIntrinsic intrinsic,
switch (intrinsic)
{
+ case NI_AVX_Extract:
+ {
+ // Avx.Extract executes software implementation when the imm8 argument is not compile-time constant
+ assert(!mustExpand);
+
+ GenTree* lastOp = impPopStack().val;
+ GenTree* vectorOp = impSIMDPopStack(TYP_SIMD32);
+ assert(lastOp->IsCnsIntOrI());
+ int ival = (int)lastOp->AsIntCon()->IconValue();
+ baseType = getBaseTypeOfSIMDType(info.compCompHnd->getArgClass(sig, sig->args));
+ var_types retType = JITtype2varType(sig->retType);
+ assert(varTypeIsArithmetic(baseType));
+
+ int midIndex = normalizeAndGetHalfIndex(&ival, baseType);
+ NamedIntrinsic extractIntrinsic = varTypeIsShort(baseType) ? NI_SSE2_Extract : NI_SSE41_Extract;
+ GenTree* half = nullptr;
+
+ if (ival >= midIndex)
+ {
+ half = gtNewSimdHWIntrinsicNode(TYP_SIMD16, vectorOp, gtNewIconNode(1), NI_AVX_ExtractVector128,
+ baseType, 32);
+ ival -= midIndex;
+ }
+ else
+ {
+ half = gtNewSimdHWIntrinsicNode(TYP_SIMD16, vectorOp, NI_AVX_GetLowerHalf, baseType, 32);
+ }
+
+ retNode = gtNewSimdHWIntrinsicNode(retType, half, gtNewIconNode(ival), extractIntrinsic, baseType, 16);
+ break;
+ }
+
+ case NI_AVX_Insert:
+ {
+ // Avx.Extract executes software implementation when the imm8 argument is not compile-time constant
+ assert(!mustExpand);
+
+ GenTree* lastOp = impPopStack().val;
+ GenTree* dataOp = impPopStack().val;
+ GenTree* vectorOp = impSIMDPopStack(TYP_SIMD32);
+ assert(lastOp->IsCnsIntOrI());
+ int ival = (int)lastOp->AsIntCon()->IconValue();
+ baseType = getBaseTypeOfSIMDType(sig->retTypeSigClass);
+ assert(varTypeIsArithmetic(baseType));
+
+ int midIndex = normalizeAndGetHalfIndex(&ival, baseType);
+ NamedIntrinsic insertIntrinsic = varTypeIsShort(baseType) ? NI_SSE2_Insert : NI_SSE41_Insert;
+
+ GenTree* clonedVectorOp;
+ vectorOp =
+ impCloneExpr(vectorOp, &clonedVectorOp, info.compCompHnd->getArgClass(sig, sig->args),
+ (unsigned)CHECK_SPILL_ALL, nullptr DEBUGARG("AVX Insert clones the vector operand"));
+
+ if (ival >= midIndex)
+ {
+ GenTree* halfVector = gtNewSimdHWIntrinsicNode(TYP_SIMD16, vectorOp, gtNewIconNode(1),
+ NI_AVX_ExtractVector128, baseType, 32);
+ GenTree* ModifiedHalfVector =
+ gtNewSimdHWIntrinsicNode(TYP_SIMD16, halfVector, dataOp, gtNewIconNode(ival - midIndex),
+ insertIntrinsic, baseType, 16);
+ retNode = gtNewSimdHWIntrinsicNode(TYP_SIMD32, clonedVectorOp, ModifiedHalfVector, gtNewIconNode(1),
+ NI_AVX_InsertVector128, baseType, 32);
+ }
+ else
+ {
+ GenTree* halfVector = gtNewSimdHWIntrinsicNode(TYP_SIMD16, vectorOp, NI_AVX_GetLowerHalf, baseType, 32);
+ GenTree* ModifiedHalfVector =
+ gtNewSimdHWIntrinsicNode(TYP_SIMD32, halfVector, dataOp, gtNewIconNode(ival), insertIntrinsic,
+ baseType, 16);
+ retNode = gtNewSimdHWIntrinsicNode(TYP_SIMD32, clonedVectorOp, ModifiedHalfVector, gtNewIconNode(15),
+ NI_AVX_Blend, TYP_FLOAT, 32);
+ }
+ break;
+ }
+
+ case NI_AVX_SetVector256:
+ {
+ // TODO-XARCH: support long/ulong on 32-bit platfroms (remove HW_Flag_SecondArgMaybe64Bit)
+ int numArgs = sig->numArgs;
+ assert(numArgs >= 4);
+ assert(numArgs <= 32);
+ baseType = getBaseTypeOfSIMDType(sig->retTypeSigClass);
+ GenTree* higherHalfVector = gtNewSimdHWIntrinsicNode(TYP_SIMD16, NI_SSE_SetZeroVector128, TYP_FLOAT, 16);
+ GenTree* lowerHalfVector = gtNewSimdHWIntrinsicNode(TYP_SIMD16, NI_SSE_SetZeroVector128, TYP_FLOAT, 16);
+ NamedIntrinsic insertIntrinsic = varTypeIsShort(baseType) ? NI_SSE2_Insert : NI_SSE41_Insert;
+ int ival = 0;
+
+ if (baseType != TYP_DOUBLE)
+ {
+ assert(varTypeIsIntegral(baseType) || baseType == TYP_FLOAT);
+
+ for (int i = 0; i < numArgs / 2; i++)
+ {
+ GenTree* arg = impPopStack().val;
+ // SSE4.1 insertps has different semantics from integral insert
+ ival = baseType == TYP_FLOAT ? i * 16 : i;
+ lowerHalfVector = gtNewSimdHWIntrinsicNode(TYP_SIMD16, lowerHalfVector, arg, gtNewIconNode(ival),
+ insertIntrinsic, baseType, 16);
+ }
+
+ for (int i = 0; i < numArgs / 2; i++)
+ {
+ GenTree* arg = impPopStack().val;
+ // SSE4.1 insertps has different semantics from integral insert
+ ival = baseType == TYP_FLOAT ? i * 16 : i;
+ higherHalfVector = gtNewSimdHWIntrinsicNode(TYP_SIMD16, higherHalfVector, arg, gtNewIconNode(ival),
+ insertIntrinsic, baseType, 16);
+ }
+ }
+ else
+ {
+ GenTree* op4 = impPopStack().val;
+ GenTree* op3 = impPopStack().val;
+ GenTree* op2 = impPopStack().val;
+ GenTree* op1 = impPopStack().val;
+ lowerHalfVector = gtNewSimdHWIntrinsicNode(TYP_SIMD16, op4, op3, NI_SSE2_UnpackLow, TYP_DOUBLE, 16);
+ higherHalfVector = gtNewSimdHWIntrinsicNode(TYP_SIMD16, op2, op1, NI_SSE2_UnpackLow, TYP_DOUBLE, 16);
+ }
+
+ retNode = gtNewSimdHWIntrinsicNode(TYP_SIMD32, lowerHalfVector, higherHalfVector, gtNewIconNode(1),
+ NI_AVX_InsertVector128, baseType, 32);
+ break;
+ }
+
+ case NI_AVX_SetAllVector256:
+ {
+ baseType = getBaseTypeOfSIMDType(sig->retTypeSigClass);
+#ifdef _TARGET_X86_
+ // TODO-XARCH: support long/ulong on 32-bit platfroms
+ if (varTypeIsLong(baseType))
+ {
+ return impUnsupportedHWIntrinsic(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, method, sig, mustExpand);
+ }
+#endif
+ GenTree* arg = impPopStack().val;
+ retNode = gtNewSimdHWIntrinsicNode(TYP_SIMD32, arg, NI_AVX_SetAllVector256, baseType, 32);
+ break;
+ }
+
case NI_AVX_ExtractVector128:
case NI_AVX2_ExtractVector128:
{
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 30faec23b8..e87065310d 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -901,11 +901,11 @@ GenTreeArgList* Compiler::impPopList(unsigned count, CORINFO_SIG_INFO* sig, GenT
if (corType == CORINFO_TYPE_DOUBLE && args->Current()->TypeGet() == TYP_FLOAT)
{
- args->Current() = gtNewCastNode(TYP_DOUBLE, args->Current(), TYP_DOUBLE);
+ args->Current() = gtNewCastNode(TYP_DOUBLE, args->Current(), false, TYP_DOUBLE);
}
else if (corType == CORINFO_TYPE_FLOAT && args->Current()->TypeGet() == TYP_DOUBLE)
{
- args->Current() = gtNewCastNode(TYP_FLOAT, args->Current(), TYP_FLOAT);
+ args->Current() = gtNewCastNode(TYP_FLOAT, args->Current(), false, TYP_FLOAT);
}
// insert any widening or narrowing casts for backwards compatibility
@@ -1879,7 +1879,8 @@ GenTree* Compiler::impMethodPointer(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI
}
else
{
- op1->gtFptrVal.gtEntryPoint.addr = nullptr;
+ op1->gtFptrVal.gtEntryPoint.addr = nullptr;
+ op1->gtFptrVal.gtEntryPoint.accessType = IAT_VALUE;
}
#endif
break;
@@ -2894,12 +2895,12 @@ GenTree* Compiler::impImplicitIorI4Cast(GenTree* tree, var_types dstTyp)
else if (varTypeIsI(wantedType) && (currType == TYP_INT))
{
// Note that this allows TYP_INT to be cast to a TYP_I_IMPL when wantedType is a TYP_BYREF or TYP_REF
- tree = gtNewCastNode(TYP_I_IMPL, tree, TYP_I_IMPL);
+ tree = gtNewCastNode(TYP_I_IMPL, tree, false, TYP_I_IMPL);
}
else if ((wantedType == TYP_INT) && varTypeIsI(currType))
{
// Note that this allows TYP_BYREF or TYP_REF to be cast to a TYP_INT
- tree = gtNewCastNode(TYP_INT, tree, TYP_INT);
+ tree = gtNewCastNode(TYP_INT, tree, false, TYP_INT);
}
#endif // _TARGET_64BIT_
}
@@ -2918,7 +2919,7 @@ GenTree* Compiler::impImplicitR4orR8Cast(GenTree* tree, var_types dstTyp)
#ifndef LEGACY_BACKEND
if (varTypeIsFloating(tree) && varTypeIsFloating(dstTyp) && (dstTyp != tree->gtType))
{
- tree = gtNewCastNode(dstTyp, tree, dstTyp);
+ tree = gtNewCastNode(dstTyp, tree, false, dstTyp);
}
#endif // !LEGACY_BACKEND
@@ -4010,10 +4011,11 @@ GenTree* Compiler::impMathIntrinsic(CORINFO_METHOD_HANDLE method,
noway_assert(varTypeIsFloating(op1));
#else // FEATURE_X87_DOUBLES
+ assert(varTypeIsFloating(op1));
if (op1->TypeGet() != callType)
{
- op1 = gtNewCastNode(callType, op1, callType);
+ op1 = gtNewCastNode(callType, op1, false, callType);
}
#endif // FEATURE_X87_DOUBLES
@@ -4034,14 +4036,16 @@ GenTree* Compiler::impMathIntrinsic(CORINFO_METHOD_HANDLE method,
noway_assert(varTypeIsFloating(op1));
#else // FEATURE_X87_DOUBLES
+ assert(varTypeIsFloating(op1));
+ assert(varTypeIsFloating(op2));
if (op2->TypeGet() != callType)
{
- op2 = gtNewCastNode(callType, op2, callType);
+ op2 = gtNewCastNode(callType, op2, false, callType);
}
if (op1->TypeGet() != callType)
{
- op1 = gtNewCastNode(callType, op1, callType);
+ op1 = gtNewCastNode(callType, op1, false, callType);
}
#endif // FEATURE_X87_DOUBLES
@@ -5715,7 +5719,7 @@ void Compiler::impImportAndPushBox(CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
assert((varTypeIsFloating(srcTyp) && varTypeIsFloating(dstTyp)) ||
(varTypeIsIntegral(srcTyp) && varTypeIsIntegral(dstTyp)));
- exprToBox = gtNewCastNode(dstTyp, exprToBox, dstTyp);
+ exprToBox = gtNewCastNode(dstTyp, exprToBox, false, dstTyp);
}
op1 = gtNewAssignNode(gtNewOperNode(GT_IND, lclTyp, op1), exprToBox);
}
@@ -7173,7 +7177,8 @@ var_types Compiler::impImportCall(OPCODE opcode,
}
else
{
- call->gtIntrinsic.gtEntryPoint.addr = nullptr;
+ call->gtIntrinsic.gtEntryPoint.addr = nullptr;
+ call->gtIntrinsic.gtEntryPoint.accessType = IAT_VALUE;
}
}
#endif
@@ -8344,7 +8349,7 @@ DONE_CALL:
if (checkForSmallType && varTypeIsIntegral(callRetTyp) && genTypeSize(callRetTyp) < genTypeSize(TYP_INT))
{
- call = gtNewCastNode(genActualType(callRetTyp), call, callRetTyp);
+ call = gtNewCastNode(genActualType(callRetTyp), call, false, callRetTyp);
}
}
@@ -9684,7 +9689,7 @@ var_types Compiler::impGetByRefResultType(genTreeOps oper, bool fUnsigned, GenTr
if (genActualType(op1->TypeGet()) != TYP_I_IMPL)
{
// insert an explicit upcast
- op1 = *pOp1 = gtNewCastNode(TYP_I_IMPL, op1, (var_types)(fUnsigned ? TYP_U_IMPL : TYP_I_IMPL));
+ op1 = *pOp1 = gtNewCastNode(TYP_I_IMPL, op1, fUnsigned, fUnsigned ? TYP_U_IMPL : TYP_I_IMPL);
}
#endif // _TARGET_64BIT_
@@ -9699,7 +9704,7 @@ var_types Compiler::impGetByRefResultType(genTreeOps oper, bool fUnsigned, GenTr
if ((genActualType(op2->TypeGet()) != TYP_I_IMPL))
{
// insert an explicit upcast
- op2 = *pOp2 = gtNewCastNode(TYP_I_IMPL, op2, (var_types)(fUnsigned ? TYP_U_IMPL : TYP_I_IMPL));
+ op2 = *pOp2 = gtNewCastNode(TYP_I_IMPL, op2, fUnsigned, fUnsigned ? TYP_U_IMPL : TYP_I_IMPL);
}
#endif // _TARGET_64BIT_
@@ -9723,13 +9728,13 @@ var_types Compiler::impGetByRefResultType(genTreeOps oper, bool fUnsigned, GenTr
if (genActualType(op1->TypeGet()) != TYP_I_IMPL)
{
// insert an explicit upcast
- op1 = *pOp1 = gtNewCastNode(TYP_I_IMPL, op1, (var_types)(fUnsigned ? TYP_U_IMPL : TYP_I_IMPL));
+ op1 = *pOp1 = gtNewCastNode(TYP_I_IMPL, op1, fUnsigned, fUnsigned ? TYP_U_IMPL : TYP_I_IMPL);
}
}
else if (genActualType(op2->TypeGet()) != TYP_I_IMPL)
{
// insert an explicit upcast
- op2 = *pOp2 = gtNewCastNode(TYP_I_IMPL, op2, (var_types)(fUnsigned ? TYP_U_IMPL : TYP_I_IMPL));
+ op2 = *pOp2 = gtNewCastNode(TYP_I_IMPL, op2, fUnsigned, fUnsigned ? TYP_U_IMPL : TYP_I_IMPL);
}
#endif // _TARGET_64BIT_
@@ -9747,12 +9752,12 @@ var_types Compiler::impGetByRefResultType(genTreeOps oper, bool fUnsigned, GenTr
if (genActualType(op1->TypeGet()) != TYP_I_IMPL)
{
// insert an explicit upcast
- op1 = *pOp1 = gtNewCastNode(TYP_I_IMPL, op1, (var_types)(fUnsigned ? TYP_U_IMPL : TYP_I_IMPL));
+ op1 = *pOp1 = gtNewCastNode(TYP_I_IMPL, op1, fUnsigned, fUnsigned ? TYP_U_IMPL : TYP_I_IMPL);
}
else if (genActualType(op2->TypeGet()) != TYP_I_IMPL)
{
// insert an explicit upcast
- op2 = *pOp2 = gtNewCastNode(TYP_I_IMPL, op2, (var_types)(fUnsigned ? TYP_U_IMPL : TYP_I_IMPL));
+ op2 = *pOp2 = gtNewCastNode(TYP_I_IMPL, op2, fUnsigned, fUnsigned ? TYP_U_IMPL : TYP_I_IMPL);
}
type = TYP_I_IMPL;
@@ -10708,7 +10713,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if (varTypeIsI(op1->TypeGet()) && (genActualType(lclTyp) == TYP_INT))
{
assert(!tiVerificationNeeded); // We should have thrown the VerificationException before.
- op1 = gtNewCastNode(TYP_INT, op1, TYP_INT);
+ op1 = gtNewCastNode(TYP_INT, op1, false, TYP_INT);
}
#endif // _TARGET_64BIT_
@@ -10799,7 +10804,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if ((op1->TypeGet() != op2->TypeGet()) && varTypeIsFloating(op1->gtType) &&
varTypeIsFloating(op2->gtType))
{
- op1 = gtNewCastNode(op2->TypeGet(), op1, op2->TypeGet());
+ op1 = gtNewCastNode(op2->TypeGet(), op1, false, op2->TypeGet());
}
#endif // !FEATURE_X87_DOUBLES
@@ -11736,12 +11741,12 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if (op1->TypeGet() != type)
{
// We insert a cast of op1 to 'type'
- op1 = gtNewCastNode(type, op1, type);
+ op1 = gtNewCastNode(type, op1, false, type);
}
if (op2->TypeGet() != type)
{
// We insert a cast of op2 to 'type'
- op2 = gtNewCastNode(type, op2, type);
+ op2 = gtNewCastNode(type, op2, false, type);
}
}
#endif // !FEATURE_X87_DOUBLES
@@ -12034,11 +12039,11 @@ void Compiler::impImportBlockCode(BasicBlock* block)
#ifdef _TARGET_64BIT_
if (varTypeIsI(op1->TypeGet()) && (genActualType(op2->TypeGet()) == TYP_INT))
{
- op2 = gtNewCastNode(TYP_I_IMPL, op2, (var_types)(uns ? TYP_U_IMPL : TYP_I_IMPL));
+ op2 = gtNewCastNode(TYP_I_IMPL, op2, uns, uns ? TYP_U_IMPL : TYP_I_IMPL);
}
else if (varTypeIsI(op2->TypeGet()) && (genActualType(op1->TypeGet()) == TYP_INT))
{
- op1 = gtNewCastNode(TYP_I_IMPL, op1, (var_types)(uns ? TYP_U_IMPL : TYP_I_IMPL));
+ op1 = gtNewCastNode(TYP_I_IMPL, op1, uns, uns ? TYP_U_IMPL : TYP_I_IMPL);
}
#endif // _TARGET_64BIT_
@@ -12134,11 +12139,11 @@ void Compiler::impImportBlockCode(BasicBlock* block)
#ifdef _TARGET_64BIT_
if ((op1->TypeGet() == TYP_I_IMPL) && (genActualType(op2->TypeGet()) == TYP_INT))
{
- op2 = gtNewCastNode(TYP_I_IMPL, op2, (var_types)(uns ? TYP_U_IMPL : TYP_I_IMPL));
+ op2 = gtNewCastNode(TYP_I_IMPL, op2, uns, uns ? TYP_U_IMPL : TYP_I_IMPL);
}
else if ((op2->TypeGet() == TYP_I_IMPL) && (genActualType(op1->TypeGet()) == TYP_INT))
{
- op1 = gtNewCastNode(TYP_I_IMPL, op1, (var_types)(uns ? TYP_U_IMPL : TYP_I_IMPL));
+ op1 = gtNewCastNode(TYP_I_IMPL, op1, uns, uns ? TYP_U_IMPL : TYP_I_IMPL);
}
#endif // _TARGET_64BIT_
@@ -12187,12 +12192,12 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if (op1->TypeGet() == TYP_DOUBLE)
{
// We insert a cast of op2 to TYP_DOUBLE
- op2 = gtNewCastNode(TYP_DOUBLE, op2, TYP_DOUBLE);
+ op2 = gtNewCastNode(TYP_DOUBLE, op2, false, TYP_DOUBLE);
}
else if (op2->TypeGet() == TYP_DOUBLE)
{
// We insert a cast of op1 to TYP_DOUBLE
- op1 = gtNewCastNode(TYP_DOUBLE, op1, TYP_DOUBLE);
+ op1 = gtNewCastNode(TYP_DOUBLE, op1, false, TYP_DOUBLE);
}
}
}
@@ -12483,22 +12488,18 @@ void Compiler::impImportBlockCode(BasicBlock* block)
#if SMALL_TREE_NODES
if (callNode)
{
- op1 = gtNewCastNodeL(type, op1, lclTyp);
+ op1 = gtNewCastNodeL(type, op1, uns, lclTyp);
}
else
#endif // SMALL_TREE_NODES
{
- op1 = gtNewCastNode(type, op1, lclTyp);
+ op1 = gtNewCastNode(type, op1, uns, lclTyp);
}
if (ovfl)
{
op1->gtFlags |= (GTF_OVERFLOW | GTF_EXCEPT);
}
- if (uns)
- {
- op1->gtFlags |= GTF_UNSIGNED;
- }
impPushOnStack(op1, tiRetVal);
break;
@@ -12681,14 +12682,14 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if (varTypeIsI(op2->gtType) && (genActualType(lclTyp) == TYP_INT))
{
assert(!tiVerificationNeeded); // We should have thrown the VerificationException before.
- op2 = gtNewCastNode(TYP_INT, op2, TYP_INT);
+ op2 = gtNewCastNode(TYP_INT, op2, false, TYP_INT);
}
// Allow an upcast of op2 from a 32-bit Int into TYP_I_IMPL for x86 JIT compatiblity
//
if (varTypeIsI(lclTyp) && (genActualType(op2->gtType) == TYP_INT))
{
assert(!tiVerificationNeeded); // We should have thrown the VerificationException before.
- op2 = gtNewCastNode(TYP_I_IMPL, op2, TYP_I_IMPL);
+ op2 = gtNewCastNode(TYP_I_IMPL, op2, false, TYP_I_IMPL);
}
}
#endif // _TARGET_64BIT_
@@ -12812,7 +12813,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if (genActualType(op1->gtType) == TYP_INT)
{
assert(!tiVerificationNeeded); // We should have thrown the VerificationException before.
- op1 = gtNewCastNode(TYP_I_IMPL, op1, TYP_I_IMPL);
+ op1 = gtNewCastNode(TYP_I_IMPL, op1, false, TYP_I_IMPL);
}
#endif
@@ -14147,7 +14148,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if ((op1->TypeGet() != op2->TypeGet()) && op2->OperIsConst() && varTypeIsIntOrI(op2->TypeGet()) &&
varTypeIsLong(op1->TypeGet()))
{
- op2 = gtNewCastNode(op1->TypeGet(), op2, op1->TypeGet());
+ op2 = gtNewCastNode(op1->TypeGet(), op2, false, op1->TypeGet());
}
#endif
@@ -14163,13 +14164,13 @@ void Compiler::impImportBlockCode(BasicBlock* block)
//
if (varTypeIsI(op2->gtType) && (genActualType(lclTyp) == TYP_INT))
{
- op2 = gtNewCastNode(TYP_INT, op2, TYP_INT);
+ op2 = gtNewCastNode(TYP_INT, op2, false, TYP_INT);
}
// Allow an upcast of op2 from a 32-bit Int into TYP_I_IMPL for x86 JIT compatiblity
//
if (varTypeIsI(lclTyp) && (genActualType(op2->gtType) == TYP_INT))
{
- op2 = gtNewCastNode(TYP_I_IMPL, op2, TYP_I_IMPL);
+ op2 = gtNewCastNode(TYP_I_IMPL, op2, false, TYP_I_IMPL);
}
}
#endif
@@ -14181,7 +14182,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if ((op1->TypeGet() != op2->TypeGet()) && varTypeIsFloating(op1->gtType) &&
varTypeIsFloating(op2->gtType))
{
- op2 = gtNewCastNode(op1->TypeGet(), op2, op1->TypeGet());
+ op2 = gtNewCastNode(op1->TypeGet(), op2, false, op1->TypeGet());
}
#endif // !FEATURE_X87_DOUBLES
@@ -15855,7 +15856,7 @@ bool Compiler::impReturnInstruction(BasicBlock* block, int prefixFlags, OPCODE&
fgCastNeeded(op2, fncRealRetType))
{
// Small-typed return values are normalized by the callee
- op2 = gtNewCastNode(TYP_INT, op2, fncRealRetType);
+ op2 = gtNewCastNode(TYP_INT, op2, false, fncRealRetType);
}
}
@@ -16644,7 +16645,7 @@ SPILLSTACK:
{
// Spill clique has decided this should be "native int", but this block only pushes an "int".
// Insert a sign-extension to "native int" so we match the clique.
- verCurrentState.esStack[level].val = gtNewCastNode(TYP_I_IMPL, tree, TYP_I_IMPL);
+ verCurrentState.esStack[level].val = gtNewCastNode(TYP_I_IMPL, tree, false, TYP_I_IMPL);
}
// Consider the case where one branch left a 'byref' on the stack and the other leaves
@@ -16668,7 +16669,7 @@ SPILLSTACK:
{
// Spill clique has decided this should be "byref", but this block only pushes an "int".
// Insert a sign-extension to "native int" so we match the clique size.
- verCurrentState.esStack[level].val = gtNewCastNode(TYP_I_IMPL, tree, TYP_I_IMPL);
+ verCurrentState.esStack[level].val = gtNewCastNode(TYP_I_IMPL, tree, false, TYP_I_IMPL);
}
}
#endif // _TARGET_64BIT_
@@ -16697,7 +16698,7 @@ SPILLSTACK:
{
// Spill clique has decided this should be "double", but this block only pushes a "float".
// Insert a cast to "double" so we match the clique.
- verCurrentState.esStack[level].val = gtNewCastNode(TYP_DOUBLE, tree, TYP_DOUBLE);
+ verCurrentState.esStack[level].val = gtNewCastNode(TYP_DOUBLE, tree, false, TYP_DOUBLE);
}
#endif // FEATURE_X87_DOUBLES
@@ -18418,7 +18419,7 @@ void Compiler::impInlineInitVars(InlineInfo* pInlineInfo)
continue;
}
- inlArgNode = inlArgInfo[i].argNode = gtNewCastNode(TYP_INT, inlArgNode, sigType);
+ inlArgNode = inlArgInfo[i].argNode = gtNewCastNode(TYP_INT, inlArgNode, false, sigType);
inlArgInfo[i].argIsLclVar = false;
@@ -18435,7 +18436,8 @@ void Compiler::impInlineInitVars(InlineInfo* pInlineInfo)
else if (genTypeSize(genActualType(inlArgNode->gtType)) < genTypeSize(sigType))
{
// This should only happen for int -> native int widening
- inlArgNode = inlArgInfo[i].argNode = gtNewCastNode(genActualType(sigType), inlArgNode, sigType);
+ inlArgNode = inlArgInfo[i].argNode =
+ gtNewCastNode(genActualType(sigType), inlArgNode, false, sigType);
inlArgInfo[i].argIsLclVar = false;
@@ -19502,8 +19504,8 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
}
// Fetch method attributes to see if method is marked final.
- const DWORD derivedMethodAttribs = info.compCompHnd->getMethodAttribs(derivedMethod);
- const bool derivedMethodIsFinal = ((derivedMethodAttribs & CORINFO_FLG_FINAL) != 0);
+ DWORD derivedMethodAttribs = info.compCompHnd->getMethodAttribs(derivedMethod);
+ const bool derivedMethodIsFinal = ((derivedMethodAttribs & CORINFO_FLG_FINAL) != 0);
#if defined(DEBUG)
const char* derivedClassName = "?derivedClass";
@@ -19597,7 +19599,6 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
JITDUMP("Now have direct call to boxed entry point, looking for unboxed entry point\n");
// Note for some shared methods the unboxed entry point requires an extra parameter.
- // We defer optimizing if so.
bool requiresInstMethodTableArg = false;
CORINFO_METHOD_HANDLE unboxedEntryMethod =
info.compCompHnd->getUnboxedEntry(derivedMethod, &requiresInstMethodTableArg);
@@ -19614,9 +19615,57 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
// the copy, we can undo the copy too.
if (requiresInstMethodTableArg)
{
- // We can likely handle this case by grabbing the argument passed to
- // the newobj in the box. But defer for now.
- JITDUMP("Found unboxed entry point, but it needs method table arg, deferring\n");
+ // Perform a trial box removal and ask for the type handle tree.
+ JITDUMP("Unboxed entry needs method table arg...\n");
+ GenTree* methodTableArg = gtTryRemoveBoxUpstreamEffects(thisObj, BR_DONT_REMOVE_WANT_TYPE_HANDLE);
+
+ if (methodTableArg != nullptr)
+ {
+ // If that worked, turn the box into a copy to a local var
+ JITDUMP("Found suitable method table arg tree [%06u]\n", dspTreeID(methodTableArg));
+ GenTree* localCopyThis = gtTryRemoveBoxUpstreamEffects(thisObj, BR_MAKE_LOCAL_COPY);
+
+ if (localCopyThis != nullptr)
+ {
+ // Pass the local var as this and the type handle as a new arg
+ JITDUMP("Success! invoking unboxed entry point on local copy, and passing method table arg\n");
+ call->gtCallObjp = localCopyThis;
+
+ // Prepend for R2L arg passing or empty L2R passing
+ if ((Target::g_tgtArgOrder == Target::ARG_ORDER_R2L) || (call->gtCallArgs == nullptr))
+ {
+ call->gtCallArgs = gtNewListNode(methodTableArg, call->gtCallArgs);
+ }
+ // Append for non-empty L2R
+ else
+ {
+ GenTreeArgList* beforeArg = call->gtCallArgs;
+ while (beforeArg->Rest() != nullptr)
+ {
+ beforeArg = beforeArg->Rest();
+ }
+
+ beforeArg->Rest() = gtNewListNode(methodTableArg, nullptr);
+ }
+
+ call->gtCallMethHnd = unboxedEntryMethod;
+ derivedMethod = unboxedEntryMethod;
+
+ // Method attributes will differ because unboxed entry point is shared
+ const DWORD unboxedMethodAttribs = info.compCompHnd->getMethodAttribs(unboxedEntryMethod);
+ JITDUMP("Updating method attribs from 0x%08x to 0x%08x\n", derivedMethodAttribs,
+ unboxedMethodAttribs);
+ derivedMethodAttribs = unboxedMethodAttribs;
+ }
+ else
+ {
+ JITDUMP("Sorry, failed to undo the box -- can't convert to local copy\n");
+ }
+ }
+ else
+ {
+ JITDUMP("Sorry, failed to undo the box -- can't find method table arg\n");
+ }
}
else
{
diff --git a/src/jit/instrsxarch.h b/src/jit/instrsxarch.h
index 3be838b274..8d210d9f2e 100644
--- a/src/jit/instrsxarch.h
+++ b/src/jit/instrsxarch.h
@@ -461,7 +461,8 @@ INST3( pinsrq, "pinsrq" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SS
INST3( pextrb, "pextrb" , 0, IUM_WR, 0, 0, SSE3A(0x14), BAD_CODE, BAD_CODE) // Extract Byte
INST3( pextrd, "pextrd" , 0, IUM_WR, 0, 0, SSE3A(0x16), BAD_CODE, BAD_CODE) // Extract Dword
INST3( pextrq, "pextrq" , 0, IUM_WR, 0, 0, SSE3A(0x16), BAD_CODE, BAD_CODE) // Extract Qword
-INST3( extractps, "extractps" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE3A(0x17)) // Extract Packed Floating-Point Values
+INST3( pextrw_sse41, "pextrw" , 0, IUM_WR, 0, 0, SSE3A(0x15), BAD_CODE, BAD_CODE) // Extract Word
+INST3( extractps, "extractps" , 0, IUM_WR, 0, 0, SSE3A(0x17), BAD_CODE, BAD_CODE) // Extract Packed Floating-Point Values
INST3(LAST_SSE4_INSTRUCTION, "LAST_SSE4_INSTRUCTION", 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, BAD_CODE)
@@ -473,8 +474,8 @@ INST3( vpbroadcastb, "pbroadcastb" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SS
INST3( vpbroadcastw, "pbroadcastw" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x79)) // Broadcast int16 value from reg/memory to entire ymm register
INST3( vpbroadcastd, "pbroadcastd" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x58)) // Broadcast int32 value from reg/memory to entire ymm register
INST3( vpbroadcastq, "pbroadcastq" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x59)) // Broadcast int64 value from reg/memory to entire ymm register
-INST3( vextractf128, "extractf128" , 0, IUM_WR, 0, 0, SSE3A(0x19), BAD_CODE, SSE3A(0x19)) // Extract 128-bit packed floating point values
-INST3( vextracti128, "extracti128" , 0, IUM_WR, 0, 0, SSE3A(0x39), BAD_CODE, SSE3A(0x39)) // Extract 128-bit packed integer values
+INST3( vextractf128, "extractf128" , 0, IUM_WR, 0, 0, SSE3A(0x19), BAD_CODE, BAD_CODE) // Extract 128-bit packed floating point values
+INST3( vextracti128, "extracti128" , 0, IUM_WR, 0, 0, SSE3A(0x39), BAD_CODE, BAD_CODE) // Extract 128-bit packed integer values
INST3( vinsertf128, "insertf128" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE3A(0x18)) // Insert 128-bit packed floating point values
INST3( vinserti128, "inserti128" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE3A(0x38)) // Insert 128-bit packed integer values
INST3( vzeroupper, "zeroupper" , 0, IUM_WR, 0, 0, 0xC577F8, BAD_CODE, BAD_CODE) // Zero upper 128-bits of all YMM regs (includes 2-byte fixed VEX prefix)
@@ -492,7 +493,13 @@ INST3( vpsllvd, "psllvd" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SS
INST3( vpsllvq, "psllvq" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x47)) // Variable Bit Shift Left Logical
INST3( vpermilps, "permilps" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE3A(0x04)) // Permute In-Lane of Quadruples of Single-Precision Floating-Point Values
INST3( vpermilpd, "permilpd" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE3A(0x05)) // Permute In-Lane of Quadruples of Double-Precision Floating-Point Values
-
+INST3( vpermilpsvar, "permilpsvar" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x0C)) // Permute In-Lane of Quadruples of Single-Precision Floating-Point Values
+INST3( vpermilpdvar, "permilpdvar" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x0D)) // Permute In-Lane of Quadruples of Double-Precision Floating-Point Values
+INST3( vperm2f128, "perm2f128" , 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE3A(0x06)) // Permute Floating-Point Values
+INST3(vbroadcastf128,"broadcastf128",0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x1A)) // Broadcast packed float values read from memory to entire ymm register
+INST3(vbroadcasti128,"broadcasti128",0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x5A)) // Broadcast packed integer values read from memory to entire ymm register
+INST3(vmaskmovps, "maskmovps" ,0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x2C)) // Conditional SIMD Packed Loads Float
+INST3(vmaskmovpd, "maskmovpd" ,0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, SSE38(0x2D)) // Conditional SIMD Packed Loads Double
INST3(LAST_AVX_INSTRUCTION, "LAST_AVX_INSTRUCTION", 0, IUM_WR, 0, 0, BAD_CODE, BAD_CODE, BAD_CODE)
// Scalar instructions in SSE4.2
diff --git a/src/jit/jitstd/vector.h b/src/jit/jitstd/vector.h
index d252e18253..3d57cbb304 100644
--- a/src/jit/jitstd/vector.h
+++ b/src/jit/jitstd/vector.h
@@ -439,10 +439,7 @@ void vector<T, Allocator>::clear()
{
m_pArray[i].~T();
}
- m_allocator.deallocate(m_pArray, m_nCapacity);
- m_pArray = NULL;
m_nSize = 0;
- m_nCapacity = 0;
}
template <typename T, typename Allocator>
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index 90fac94812..82c37d6bb8 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -2495,7 +2495,7 @@ void Compiler::lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool
// Class info matched. Are we updating exactness?
if (isExact)
{
- JITDUMP("\nlvaUpdateClass: Updating class for V%02i (%p) %s to be exact\n", varNum, varDsc->lvClassHnd,
+ JITDUMP("\nlvaUpdateClass: Updating class for V%02i (%p) %s to be exact\n", varNum, dspPtr(varDsc->lvClassHnd),
info.compCompHnd->getClassName(varDsc->lvClassHnd));
varDsc->lvClassIsExact = isExact;
@@ -4970,7 +4970,8 @@ void Compiler::lvaAssignVirtualFrameOffsetsToArgs()
argLcls++;
// Early out if we can. If size is 8 and base reg is 2, then the mask is 0x1100
- tempMask |= ((((1 << (roundUp(argSize) / REGSIZE_BYTES))) - 1) << lvaTable[preSpillLclNum].lvArgReg);
+ tempMask |= ((((1 << (roundUp(argSize, TARGET_POINTER_SIZE) / REGSIZE_BYTES))) - 1)
+ << lvaTable[preSpillLclNum].lvArgReg);
if (tempMask == preSpillMask)
{
// We won't encounter more pre-spilled registers,
@@ -5989,7 +5990,20 @@ void Compiler::lvaAssignVirtualFrameOffsetsToLocals()
unsigned fieldVarNum = varDsc->lvFieldLclStart;
lvaTable[fieldVarNum].lvStkOffs = varDsc->lvStkOffs;
}
-#endif
+#endif // _TARGET_ARM64_
+#ifdef _TARGET_ARM_
+ // If we have an incoming register argument that has a promoted long
+ // then we need to copy the lvStkOff (the stack home) from the reg arg to the field lclvar
+ //
+ if (varDsc->lvIsRegArg && varDsc->lvPromoted)
+ {
+ assert(varTypeIsLong(varDsc) && (varDsc->lvFieldCnt == 2));
+
+ unsigned fieldVarNum = varDsc->lvFieldLclStart;
+ lvaTable[fieldVarNum].lvStkOffs = varDsc->lvStkOffs;
+ lvaTable[fieldVarNum + 1].lvStkOffs = varDsc->lvStkOffs + 4;
+ }
+#endif // _TARGET_ARM_
}
}
@@ -7321,7 +7335,7 @@ Compiler::fgWalkResult Compiler::lvaStressLclFldCB(GenTree** pTree, fgWalkData*
// Change the variable to a TYP_BLK
if (varType != TYP_BLK)
{
- varDsc->lvExactSize = (unsigned)(roundUp(padding + pComp->lvaLclSize(lclNum)));
+ varDsc->lvExactSize = (unsigned)(roundUp(padding + pComp->lvaLclSize(lclNum), TARGET_POINTER_SIZE));
varDsc->lvType = TYP_BLK;
pComp->lvaSetVarAddrExposed(lclNum);
}
diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp
index 38bfeb79ce..dbac32d2c5 100644
--- a/src/jit/lower.cpp
+++ b/src/jit/lower.cpp
@@ -748,8 +748,7 @@ GenTree* Lowering::LowerSwitch(GenTree* node)
{
// SWITCH_TABLE expects the switch value (the index into the jump table) to be TYP_I_IMPL.
// Note that the switch value is unsigned so the cast should be unsigned as well.
- switchValue = comp->gtNewCastNode(TYP_I_IMPL, switchValue, TYP_U_IMPL);
- switchValue->gtFlags |= GTF_UNSIGNED;
+ switchValue = comp->gtNewCastNode(TYP_I_IMPL, switchValue, true, TYP_U_IMPL);
switchBlockRange.InsertAtEnd(switchValue);
}
#endif
@@ -3965,7 +3964,8 @@ GenTree* Lowering::LowerNonvirtPinvokeCall(GenTreeCall* call)
// stash the address for codegen
call->gtDirectCallAddress = addr;
#ifdef FEATURE_READYTORUN_COMPILER
- call->gtEntryPoint.addr = nullptr;
+ call->gtEntryPoint.addr = nullptr;
+ call->gtEntryPoint.accessType = IAT_VALUE;
#endif
}
break;
diff --git a/src/jit/lowerarmarch.cpp b/src/jit/lowerarmarch.cpp
index 10f182f72a..0d755fe4c2 100644
--- a/src/jit/lowerarmarch.cpp
+++ b/src/jit/lowerarmarch.cpp
@@ -63,33 +63,13 @@ bool Lowering::IsCallTargetInRange(void* addr)
// Return Value:
// True if the immediate can be folded into an instruction,
// for example small enough and non-relocatable.
+//
+// TODO-CQ: we can contain a floating point 0.0 constant in a compare instruction
+// (vcmp on arm, fcmp on arm64).
+//
bool Lowering::IsContainableImmed(GenTree* parentNode, GenTree* childNode)
{
- if (varTypeIsFloating(parentNode->TypeGet()))
- {
- // We can contain a floating point 0.0 constant in a compare instruction
- switch (parentNode->OperGet())
- {
- default:
- return false;
-
- case GT_EQ:
- case GT_NE:
- case GT_LT:
- case GT_LE:
- case GT_GE:
- case GT_GT:
- if (childNode->IsIntegralConst(0))
- {
- // TODO-ARM-Cleanup: not tested yet.
- NYI_ARM("ARM IsContainableImmed for floating point type");
-
- return true;
- }
- break;
- }
- }
- else
+ if (!varTypeIsFloating(parentNode->TypeGet()))
{
// Make sure we have an actual immediate
if (!childNode->IsCnsIntOrI())
@@ -106,9 +86,6 @@ bool Lowering::IsContainableImmed(GenTree* parentNode, GenTree* childNode)
switch (parentNode->OperGet())
{
- default:
- return false;
-
case GT_ADD:
case GT_SUB:
#ifdef _TARGET_ARM64_
@@ -129,18 +106,15 @@ bool Lowering::IsContainableImmed(GenTree* parentNode, GenTree* childNode)
case GT_GE:
case GT_GT:
return emitter::emitIns_valid_imm_for_cmp(immVal, size);
- break;
case GT_AND:
case GT_OR:
case GT_XOR:
case GT_TEST_EQ:
case GT_TEST_NE:
return emitter::emitIns_valid_imm_for_alu(immVal, size);
- break;
case GT_JCMP:
assert(((parentNode->gtFlags & GTF_JCMP_TST) == 0) ? (immVal == 0) : isPow2(immVal));
return true;
- break;
#elif defined(_TARGET_ARM_)
case GT_EQ:
case GT_NE:
@@ -153,15 +127,18 @@ bool Lowering::IsContainableImmed(GenTree* parentNode, GenTree* childNode)
case GT_OR:
case GT_XOR:
return emitter::emitIns_valid_imm_for_alu(immVal);
- break;
#endif // _TARGET_ARM_
#ifdef _TARGET_ARM64_
+ case GT_STORE_LCL_FLD:
case GT_STORE_LCL_VAR:
if (immVal == 0)
return true;
break;
#endif
+
+ default:
+ break;
}
}
@@ -445,8 +422,8 @@ void Lowering::LowerCast(GenTree* tree)
if (tmpType != TYP_UNDEF)
{
- GenTree* tmp = comp->gtNewCastNode(tmpType, op1, tmpType);
- tmp->gtFlags |= (tree->gtFlags & (GTF_UNSIGNED | GTF_OVERFLOW | GTF_EXCEPT));
+ GenTree* tmp = comp->gtNewCastNode(tmpType, op1, tree->IsUnsigned(), tmpType);
+ tmp->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT));
tree->gtFlags &= ~GTF_UNSIGNED;
tree->gtOp.gtOp1 = tmp;
diff --git a/src/jit/lowerxarch.cpp b/src/jit/lowerxarch.cpp
index 0aa56930d2..8216515c4d 100644
--- a/src/jit/lowerxarch.cpp
+++ b/src/jit/lowerxarch.cpp
@@ -748,8 +748,8 @@ void Lowering::LowerCast(GenTree* tree)
if (tmpType != TYP_UNDEF)
{
- GenTree* tmp = comp->gtNewCastNode(tmpType, castOp, tmpType);
- tmp->gtFlags |= (tree->gtFlags & (GTF_UNSIGNED | GTF_OVERFLOW | GTF_EXCEPT));
+ GenTree* tmp = comp->gtNewCastNode(tmpType, castOp, tree->IsUnsigned(), tmpType);
+ tmp->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT));
tree->gtFlags &= ~GTF_UNSIGNED;
tree->gtOp.gtOp1 = tmp;
diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp
index 6727599e48..086be38566 100644
--- a/src/jit/lsra.cpp
+++ b/src/jit/lsra.cpp
@@ -824,19 +824,24 @@ LinearScan::RegMaskIndex LinearScan::GetIndexForRegMask(regMaskTP mask)
return result;
}
-// We've decided that we can't use a register during register allocation (probably FPBASE),
+// We've decided that we can't use one or more registers during register allocation (probably FPBASE),
// but we've already added it to the register masks. Go through the masks and remove it.
-void LinearScan::RemoveRegisterFromMasks(regNumber reg)
+void LinearScan::RemoveRegistersFromMasks(regMaskTP removeMask)
{
- JITDUMP("Removing register %s from LSRA register masks\n", getRegName(reg));
+ if (VERBOSE)
+ {
+ JITDUMP("Removing registers from LSRA register masks: ");
+ INDEBUG(dumpRegMask(removeMask));
+ JITDUMP("\n");
+ }
- regMaskTP mask = ~genRegMask(reg);
+ regMaskTP mask = ~removeMask;
for (int i = 0; i < nextFreeMask; i++)
{
regMaskTable[i] &= mask;
}
- JITDUMP("After removing register:\n");
+ JITDUMP("After removing registers:\n");
DBEXEC(VERBOSE, dspRegisterMaskTable());
}
@@ -1958,7 +1963,7 @@ void LinearScan::identifyCandidates()
{
// Frame layout is only pre-computed for ARM
printf("\nlvaTable after IdentifyCandidates\n");
- compiler->lvaTableDump();
+ compiler->lvaTableDump(Compiler::FrameLayoutState::PRE_REGALLOC_FRAME_LAYOUT);
}
#endif // DEBUG
#endif // _TARGET_ARM_
@@ -2493,22 +2498,36 @@ void LinearScan::setFrameType()
// used during lowering. Luckily, the TreeNodeInfo only stores an index to
// the masks stored in the LinearScan class, so we only need to walk the
// unique masks and remove FPBASE.
+ regMaskTP removeMask = RBM_NONE;
if (frameType == FT_EBP_FRAME)
{
- if ((availableIntRegs & RBM_FPBASE) != 0)
- {
- RemoveRegisterFromMasks(REG_FPBASE);
-
- // We know that we're already in "read mode" for availableIntRegs. However,
- // we need to remove the FPBASE register, so subsequent users (like callers
- // to allRegs()) get the right thing. The RemoveRegisterFromMasks() code
- // fixes up everything that already took a dependency on the value that was
- // previously read, so this completes the picture.
- availableIntRegs.OverrideAssign(availableIntRegs & ~RBM_FPBASE);
- }
+ removeMask |= RBM_FPBASE;
}
compiler->rpFrameType = frameType;
+
+#ifdef _TARGET_ARMARCH_
+ // Determine whether we need to reserve a register for large lclVar offsets.
+ if (compiler->compRsvdRegCheck(Compiler::REGALLOC_FRAME_LAYOUT))
+ {
+ // We reserve R10/IP1 in this case to hold the offsets in load/store instructions
+ compiler->codeGen->regSet.rsMaskResvd |= RBM_OPT_RSVD;
+ assert(REG_OPT_RSVD != REG_FP);
+ JITDUMP(" Reserved REG_OPT_RSVD (%s) due to large frame\n", getRegName(REG_OPT_RSVD));
+ removeMask |= RBM_OPT_RSVD;
+ }
+#endif // _TARGET_ARMARCH_
+
+ if ((removeMask != RBM_NONE) && ((availableIntRegs & removeMask) != 0))
+ {
+ RemoveRegistersFromMasks(removeMask);
+ // We know that we're already in "read mode" for availableIntRegs. However,
+ // we need to remove these registers, so subsequent users (like callers
+ // to allRegs()) get the right thing. The RemoveRegistersFromMasks() code
+ // fixes up everything that already took a dependency on the value that was
+ // previously read, so this completes the picture.
+ availableIntRegs.OverrideAssign(availableIntRegs & ~removeMask);
+ }
}
//------------------------------------------------------------------------
@@ -5359,10 +5378,8 @@ void LinearScan::allocateRegisters()
// Update overlapping floating point register for TYP_DOUBLE
if (assignedInterval->registerType == TYP_DOUBLE)
{
- regRecord = getSecondHalfRegRec(regRecord);
- assignedInterval = regRecord->assignedInterval;
-
- assert(assignedInterval != nullptr && !assignedInterval->isActive && assignedInterval->isConstant);
+ regRecord = findAnotherHalfRegRec(regRecord);
+ assert(regRecord->assignedInterval == assignedInterval);
regRecord->assignedInterval = nullptr;
}
#endif
@@ -8260,10 +8277,51 @@ void LinearScan::resolveEdge(BasicBlock* fromBlock,
location[sourceReg] = REG_NA;
// Do we have a free targetReg?
- if (fromReg == sourceReg && source[fromReg] != REG_NA)
+ if (fromReg == sourceReg)
{
- regMaskTP fromRegMask = genRegMask(fromReg);
- targetRegsReady |= fromRegMask;
+ if (source[fromReg] != REG_NA)
+ {
+ regMaskTP fromRegMask = genRegMask(fromReg);
+ targetRegsReady |= fromRegMask;
+#ifdef _TARGET_ARM_
+ if (genIsValidDoubleReg(fromReg))
+ {
+ // Ensure that either:
+ // - the Interval targetting fromReg is not double, or
+ // - the other half of the double is free.
+ Interval* otherInterval = sourceIntervals[source[fromReg]];
+ regNumber upperHalfReg = REG_NEXT(fromReg);
+ if ((otherInterval->registerType == TYP_DOUBLE) && (location[upperHalfReg] != REG_NA))
+ {
+ targetRegsReady &= ~fromRegMask;
+ }
+ }
+ }
+ else if (genIsValidFloatReg(fromReg) && !genIsValidDoubleReg(fromReg))
+ {
+ // We may have freed up the other half of a double where the lower half
+ // was already free.
+ regNumber lowerHalfReg = REG_PREV(fromReg);
+ regNumber lowerHalfSrcReg = (regNumber)source[lowerHalfReg];
+ regNumber lowerHalfSrcLoc = (regNumber)location[lowerHalfReg];
+ // Necessary conditions:
+ // - There is a source register for this reg (lowerHalfSrcReg != REG_NA)
+ // - It is currently free (lowerHalfSrcLoc == REG_NA)
+ // - The source interval isn't yet completed (sourceIntervals[lowerHalfSrcReg] != nullptr)
+ // - It's not in the ready set ((targetRegsReady & genRegMask(lowerHalfReg)) ==
+ // RBM_NONE)
+ //
+ if ((lowerHalfSrcReg != REG_NA) && (lowerHalfSrcLoc == REG_NA) &&
+ (sourceIntervals[lowerHalfSrcReg] != nullptr) &&
+ ((targetRegsReady & genRegMask(lowerHalfReg)) == RBM_NONE))
+ {
+ // This must be a double interval, otherwise it would be in targetRegsReady, or already
+ // completed.
+ assert(sourceIntervals[lowerHalfSrcReg]->registerType == TYP_DOUBLE);
+ targetRegsReady |= genRegMask(lowerHalfReg);
+ }
+#endif // _TARGET_ARM_
+ }
}
}
if (targetRegsToDo != RBM_NONE)
diff --git a/src/jit/lsra.h b/src/jit/lsra.h
index fe1d71334d..d3d3f99b00 100644
--- a/src/jit/lsra.h
+++ b/src/jit/lsra.h
@@ -695,7 +695,7 @@ public:
RegMaskIndex GetIndexForRegMask(regMaskTP mask);
regMaskTP GetRegMaskForIndex(RegMaskIndex index);
- void RemoveRegisterFromMasks(regNumber reg);
+ void RemoveRegistersFromMasks(regMaskTP removeMask);
static bool isSingleRegister(regMaskTP regMask)
{
@@ -1654,9 +1654,14 @@ private:
void BuildStoreLoc(GenTree* tree);
void BuildReturn(GenTree* tree);
+#ifdef _TARGET_XARCH_
// This method, unlike the others, returns the number of sources, since it may be called when
// 'tree' is contained.
int BuildShiftRotate(GenTree* tree);
+#endif // _TARGET_XARCH_
+#ifdef _TARGET_ARM_
+ void BuildShiftLongCarry(GenTree* tree);
+#endif
void BuildPutArgReg(GenTreeUnOp* node);
void BuildCall(GenTreeCall* call);
void BuildCmp(GenTree* tree);
diff --git a/src/jit/lsraarm.cpp b/src/jit/lsraarm.cpp
index df4a435589..63e93fa8ea 100644
--- a/src/jit/lsraarm.cpp
+++ b/src/jit/lsraarm.cpp
@@ -113,6 +113,46 @@ void LinearScan::BuildLclHeap(GenTree* tree)
}
//------------------------------------------------------------------------
+// BuildShiftLongCarry: Set the node info for GT_LSH_HI or GT_RSH_LO.
+//
+// Arguments:
+// tree - The node of interest
+//
+// Note: these operands have uses that interfere with the def and need the special handling.
+//
+void LinearScan::BuildShiftLongCarry(GenTree* tree)
+{
+ assert(tree->OperGet() == GT_LSH_HI || tree->OperGet() == GT_RSH_LO);
+
+ GenTree* source = tree->gtOp.gtOp1;
+ assert((source->OperGet() == GT_LONG) && source->isContained());
+
+ TreeNodeInfo* info = currentNodeInfo;
+ info->srcCount = 2;
+
+ LocationInfoListNode* sourceLoInfo = getLocationInfo(source->gtOp.gtOp1);
+ LocationInfoListNode* sourceHiInfo = getLocationInfo(source->gtOp.gtOp2);
+ if (tree->OperGet() == GT_LSH_HI)
+ {
+ sourceLoInfo->info.isDelayFree = true;
+ }
+ else
+ {
+ sourceHiInfo->info.isDelayFree = true;
+ }
+ useList.Append(sourceLoInfo);
+ useList.Append(sourceHiInfo);
+ info->hasDelayFreeSrc = true;
+
+ GenTree* shiftBy = tree->gtOp.gtOp2;
+ if (!shiftBy->isContained())
+ {
+ appendLocationInfoToList(shiftBy);
+ info->srcCount += 1;
+ }
+}
+
+//------------------------------------------------------------------------
// BuildNode: Set the register requirements for RA.
//
// Notes:
@@ -335,11 +375,22 @@ void LinearScan::BuildNode(GenTree* tree)
case GT_AND:
case GT_OR:
case GT_XOR:
+ case GT_LSH:
+ case GT_RSH:
+ case GT_RSZ:
+ case GT_ROR:
assert(info->dstCount == 1);
info->srcCount = appendBinaryLocationInfoToList(tree->AsOp());
assert(info->srcCount == (tree->gtOp.gtOp2->isContained() ? 1 : 2));
break;
+ case GT_LSH_HI:
+ case GT_RSH_LO:
+ assert(info->dstCount == 1);
+ BuildShiftLongCarry(tree);
+ assert(info->srcCount == (tree->gtOp.gtOp2->isContained() ? 2 : 3));
+ break;
+
case GT_RETURNTRAP:
// this just turns into a compare of its child with an int
// + a conditional call
@@ -553,15 +604,6 @@ void LinearScan::BuildNode(GenTree* tree)
appendLocationInfoToList(tree->gtOp.gtOp1);
break;
- case GT_LSH:
- case GT_RSH:
- case GT_RSZ:
- case GT_ROR:
- case GT_LSH_HI:
- case GT_RSH_LO:
- BuildShiftRotate(tree);
- break;
-
case GT_EQ:
case GT_NE:
case GT_LT:
diff --git a/src/jit/lsraarm64.cpp b/src/jit/lsraarm64.cpp
index 6497ac877a..6c1fc4af29 100644
--- a/src/jit/lsraarm64.cpp
+++ b/src/jit/lsraarm64.cpp
@@ -219,6 +219,10 @@ void LinearScan::BuildNode(GenTree* tree)
case GT_AND:
case GT_OR:
case GT_XOR:
+ case GT_LSH:
+ case GT_RSH:
+ case GT_RSZ:
+ case GT_ROR:
info->srcCount = appendBinaryLocationInfoToList(tree->AsOp());
assert(info->dstCount == 1);
break;
@@ -341,13 +345,6 @@ void LinearScan::BuildNode(GenTree* tree)
assert(info->dstCount == 1);
break;
- case GT_LSH:
- case GT_RSH:
- case GT_RSZ:
- case GT_ROR:
- BuildShiftRotate(tree);
- break;
-
case GT_EQ:
case GT_NE:
case GT_LT:
diff --git a/src/jit/lsraarmarch.cpp b/src/jit/lsraarmarch.cpp
index 72acf829d1..22c96f919a 100644
--- a/src/jit/lsraarmarch.cpp
+++ b/src/jit/lsraarmarch.cpp
@@ -112,59 +112,6 @@ void LinearScan::BuildIndir(GenTreeIndir* indirTree)
}
//------------------------------------------------------------------------
-// BuildShiftRotate: Set the NodeInfo for a shift or rotate.
-//
-// Arguments:
-// tree - The node of interest
-//
-// Return Value:
-// None.
-//
-int LinearScan::BuildShiftRotate(GenTree* tree)
-{
- TreeNodeInfo* info = currentNodeInfo;
- GenTree* source = tree->gtOp.gtOp1;
- GenTree* shiftBy = tree->gtOp.gtOp2;
- assert(info->dstCount == 1);
- if (!shiftBy->isContained())
- {
- appendLocationInfoToList(shiftBy);
- info->srcCount = 1;
- }
-
-#ifdef _TARGET_ARM_
-
- // The first operand of a GT_LSH_HI and GT_RSH_LO oper is a GT_LONG so that
- // we can have a three operand form. Increment the srcCount.
- if (tree->OperGet() == GT_LSH_HI || tree->OperGet() == GT_RSH_LO)
- {
- assert((source->OperGet() == GT_LONG) && source->isContained());
- info->srcCount += 2;
-
- LocationInfoListNode* sourceLoInfo = getLocationInfo(source->gtOp.gtOp1);
- useList.Append(sourceLoInfo);
- LocationInfoListNode* sourceHiInfo = getLocationInfo(source->gtOp.gtOp2);
- useList.Append(sourceHiInfo);
- if (tree->OperGet() == GT_LSH_HI)
- {
- sourceLoInfo->info.isDelayFree = true;
- }
- else
- {
- sourceHiInfo->info.isDelayFree = true;
- }
- info->hasDelayFreeSrc = true;
- }
- else
-#endif // _TARGET_ARM_
- {
- appendLocationInfoToList(source);
- info->srcCount++;
- }
- return info->srcCount;
-}
-
-//------------------------------------------------------------------------
// BuildCall: Set the NodeInfo for a call.
//
// Arguments:
diff --git a/src/jit/lsraxarch.cpp b/src/jit/lsraxarch.cpp
index 2d7e6564e3..09cc9ca96e 100644
--- a/src/jit/lsraxarch.cpp
+++ b/src/jit/lsraxarch.cpp
@@ -2368,6 +2368,20 @@ void LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree)
break;
}
+ case NI_AVX_SetAllVector256:
+ {
+ if (varTypeIsIntegral(baseType))
+ {
+ info->internalFloatCount = 1;
+ if (!compiler->compSupports(InstructionSet_AVX2) && varTypeIsByte(baseType))
+ {
+ info->internalFloatCount += 1;
+ }
+ info->setInternalCandidates(this, allSIMDRegs());
+ }
+ break;
+ }
+
case NI_SSE2_MaskMove:
{
// SSE2 MaskMove hardcodes the destination (op3) in DI/EDI/RDI
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 1e2b1cbc52..22d6b619d5 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -85,7 +85,8 @@ GenTree* Compiler::fgMorphIntoHelperCall(GenTree* tree, int helper, GenTreeArgLi
#endif // DEBUG
#ifdef FEATURE_READYTORUN_COMPILER
- tree->gtCall.gtEntryPoint.addr = nullptr;
+ tree->gtCall.gtEntryPoint.addr = nullptr;
+ tree->gtCall.gtEntryPoint.accessType = IAT_VALUE;
#endif
#if (defined(_TARGET_X86_) || defined(_TARGET_ARM_)) && !defined(LEGACY_BACKEND)
@@ -190,7 +191,7 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
#endif // FEATURE_STACK_FP_X87
)
{
- oper = gtNewCastNode(TYP_DOUBLE, oper, TYP_DOUBLE);
+ oper = gtNewCastNode(TYP_DOUBLE, oper, false, TYP_DOUBLE);
}
// do we need to do it in two steps R -> I, '-> smallType
@@ -199,14 +200,14 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
#if defined(_TARGET_ARM64_) || defined(_TARGET_AMD64_)
if (dstSize < genTypeSize(TYP_INT))
{
- oper = gtNewCastNodeL(TYP_INT, oper, TYP_INT);
- oper->gtFlags |= (tree->gtFlags & (GTF_UNSIGNED | GTF_OVERFLOW | GTF_EXCEPT));
+ oper = gtNewCastNodeL(TYP_INT, oper, tree->IsUnsigned(), TYP_INT);
+ oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT));
tree->gtFlags &= ~GTF_UNSIGNED;
}
#else
if (dstSize < TARGET_POINTER_SIZE)
{
- oper = gtNewCastNodeL(TYP_I_IMPL, oper, TYP_I_IMPL);
+ oper = gtNewCastNodeL(TYP_I_IMPL, oper, false, TYP_I_IMPL);
oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT));
}
#endif
@@ -292,8 +293,8 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
// intermediate cast to native int.
else if (varTypeIsLong(srcType) && varTypeIsSmall(dstType))
{
- oper = gtNewCastNode(TYP_I_IMPL, oper, TYP_I_IMPL);
- oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT | GTF_UNSIGNED));
+ oper = gtNewCastNode(TYP_I_IMPL, oper, tree->IsUnsigned(), TYP_I_IMPL);
+ oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT));
tree->gtFlags &= ~GTF_UNSIGNED;
}
#endif //!_TARGET_64BIT_
@@ -321,7 +322,7 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
tree->CastToType() = TYP_DOUBLE;
tree->gtType = TYP_DOUBLE;
- tree = gtNewCastNode(TYP_FLOAT, tree, TYP_FLOAT);
+ tree = gtNewCastNode(TYP_FLOAT, tree, false, TYP_FLOAT);
return fgMorphTree(tree);
}
@@ -340,7 +341,7 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
// The following conversions are performed as two-step operations using above.
// U4 -> R4/8 = U4-> Long -> R4/8
// U8 -> R4 = U8 -> R8 -> R4
- else if ((tree->gtFlags & GTF_UNSIGNED) && varTypeIsFloating(dstType))
+ else if (tree->IsUnsigned() && varTypeIsFloating(dstType))
{
srcType = genUnsignedType(srcType);
@@ -355,14 +356,14 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
// - recurse into the resulting tree
tree->CastToType() = TYP_DOUBLE;
tree->gtType = TYP_DOUBLE;
- tree = gtNewCastNode(TYP_FLOAT, tree, TYP_FLOAT);
+ tree = gtNewCastNode(TYP_FLOAT, tree, false, TYP_FLOAT);
return fgMorphTree(tree);
}
}
else if (srcType == TYP_UINT)
{
- oper = gtNewCastNode(TYP_LONG, oper, TYP_LONG);
- oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT | GTF_UNSIGNED));
+ oper = gtNewCastNode(TYP_LONG, oper, true, TYP_LONG);
+ oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT));
tree->gtFlags &= ~GTF_UNSIGNED;
}
}
@@ -370,7 +371,7 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
#ifdef _TARGET_X86_
// Do we have to do two step U4/8 -> R4/8 ?
- else if ((tree->gtFlags & GTF_UNSIGNED) && varTypeIsFloating(dstType))
+ else if (tree->IsUnsigned() && varTypeIsFloating(dstType))
{
srcType = genUnsignedType(srcType);
@@ -380,8 +381,8 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
}
else if (srcType == TYP_UINT)
{
- oper = gtNewCastNode(TYP_LONG, oper, TYP_LONG);
- oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT | GTF_UNSIGNED));
+ oper = gtNewCastNode(TYP_LONG, oper, true, TYP_LONG);
+ oper->gtFlags |= (tree->gtFlags & (GTF_OVERFLOW | GTF_EXCEPT));
tree->gtFlags &= ~GTF_UNSIGNED;
#ifndef LEGACY_BACKEND
return fgMorphCastIntoHelper(tree, CORINFO_HELP_LNG2DBL, oper);
@@ -412,7 +413,7 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
oper->gtType = srcType;
// do the real cast
- GenTree* cast = gtNewCastNode(tree->TypeGet(), gtNewLclvNode(lclNum, TYP_I_IMPL), dstType);
+ GenTree* cast = gtNewCastNode(tree->TypeGet(), gtNewLclvNode(lclNum, TYP_I_IMPL), false, dstType);
// Generate the comma tree
oper = gtNewOperNode(GT_COMMA, tree->TypeGet(), asg, cast);
@@ -536,10 +537,10 @@ GenTree* Compiler::fgMorphCast(GenTree* tree)
DEBUG_DESTROY_NODE(tree);
// Insert narrowing casts for op1 and op2
- oper->gtOp.gtOp1 = gtNewCastNode(TYP_INT, oper->gtOp.gtOp1, dstType);
+ oper->gtOp.gtOp1 = gtNewCastNode(TYP_INT, oper->gtOp.gtOp1, false, dstType);
if (oper->gtOp.gtOp2 != nullptr)
{
- oper->gtOp.gtOp2 = gtNewCastNode(TYP_INT, oper->gtOp.gtOp2, dstType);
+ oper->gtOp.gtOp2 = gtNewCastNode(TYP_INT, oper->gtOp.gtOp2, false, dstType);
}
// Clear the GT_MUL_64RSLT if it is set
@@ -6161,7 +6162,7 @@ GenTree* Compiler::fgMorphArrayIndex(GenTree* tree)
if (bndsChkType != TYP_INT)
{
- arrLen = gtNewCastNode(bndsChkType, arrLen, bndsChkType);
+ arrLen = gtNewCastNode(bndsChkType, arrLen, false, bndsChkType);
}
GenTreeBoundsChk* arrBndsChk = new (this, GT_ARR_BOUNDS_CHECK)
@@ -6197,7 +6198,7 @@ GenTree* Compiler::fgMorphArrayIndex(GenTree* tree)
}
else
{
- index = gtNewCastNode(TYP_I_IMPL, index, TYP_I_IMPL);
+ index = gtNewCastNode(TYP_I_IMPL, index, false, TYP_I_IMPL);
}
}
#endif // _TARGET_64BIT_
@@ -6491,7 +6492,7 @@ GenTree* Compiler::fgMorphLocalVar(GenTree* tree, bool forceRemorph)
tree->gtType = TYP_INT;
fgMorphTreeDone(tree);
- tree = gtNewCastNode(TYP_INT, tree, varType);
+ tree = gtNewCastNode(TYP_INT, tree, false, varType);
fgMorphTreeDone(tree);
return tree;
}
@@ -11227,13 +11228,15 @@ GenTree* Compiler::fgMorphForRegisterFP(GenTree* tree)
GenTree* op1 = tree->gtOp.gtOp1;
GenTree* op2 = tree->gtGetOp2();
+ assert(varTypeIsFloating(op1->TypeGet()) && varTypeIsFloating(op2->TypeGet()));
+
if (op1->TypeGet() != tree->TypeGet())
{
- tree->gtOp.gtOp1 = gtNewCastNode(tree->TypeGet(), op1, tree->TypeGet());
+ tree->gtOp.gtOp1 = gtNewCastNode(tree->TypeGet(), op1, false, tree->TypeGet());
}
if (op2->TypeGet() != tree->TypeGet())
{
- tree->gtOp.gtOp2 = gtNewCastNode(tree->TypeGet(), op2, tree->TypeGet());
+ tree->gtOp.gtOp2 = gtNewCastNode(tree->TypeGet(), op2, false, tree->TypeGet());
}
}
}
@@ -11252,12 +11255,12 @@ GenTree* Compiler::fgMorphForRegisterFP(GenTree* tree)
if (op1->TypeGet() == TYP_FLOAT)
{
assert(op2->TypeGet() == TYP_DOUBLE);
- tree->gtOp.gtOp1 = gtNewCastNode(TYP_DOUBLE, op1, TYP_DOUBLE);
+ tree->gtOp.gtOp1 = gtNewCastNode(TYP_DOUBLE, op1, false, TYP_DOUBLE);
}
else if (op2->TypeGet() == TYP_FLOAT)
{
assert(op1->TypeGet() == TYP_DOUBLE);
- tree->gtOp.gtOp2 = gtNewCastNode(TYP_DOUBLE, op2, TYP_DOUBLE);
+ tree->gtOp.gtOp2 = gtNewCastNode(TYP_DOUBLE, op2, false, TYP_DOUBLE);
}
}
}
@@ -11879,12 +11882,12 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac)
}
else
{
- tree->gtOp.gtOp1 = op1 = gtNewCastNode(TYP_DOUBLE, op1, TYP_DOUBLE);
+ tree->gtOp.gtOp1 = op1 = gtNewCastNode(TYP_DOUBLE, op1, false, TYP_DOUBLE);
}
}
else if (op2->TypeGet() == TYP_FLOAT)
{
- tree->gtOp.gtOp2 = op2 = gtNewCastNode(TYP_DOUBLE, op2, TYP_DOUBLE);
+ tree->gtOp.gtOp2 = op2 = gtNewCastNode(TYP_DOUBLE, op2, false, TYP_DOUBLE);
}
goto USE_HELPER_FOR_ARITH;
}
@@ -12090,7 +12093,7 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac)
fgCastNeeded(op1, info.compRetType))
{
// Small-typed return values are normalized by the callee
- op1 = gtNewCastNode(TYP_INT, op1, info.compRetType);
+ op1 = gtNewCastNode(TYP_INT, op1, false, info.compRetType);
// Propagate GTF_COLON_COND
op1->gtFlags |= (tree->gtFlags & GTF_COLON_COND);
@@ -13045,7 +13048,7 @@ DONE_MORPHING_CHILDREN:
/* Now we know that we can cast gtOp.gtOp1 of AND to int */
- op1->gtOp.gtOp1 = gtNewCastNode(TYP_INT, op1->gtOp.gtOp1, TYP_INT);
+ op1->gtOp.gtOp1 = gtNewCastNode(TYP_INT, op1->gtOp.gtOp1, false, TYP_INT);
/* now replace the mask node (gtOp.gtOp2 of AND node) */
diff --git a/src/jit/namedintrinsiclist.h b/src/jit/namedintrinsiclist.h
index dd98821c66..d8dfabdb96 100644
--- a/src/jit/namedintrinsiclist.h
+++ b/src/jit/namedintrinsiclist.h
@@ -112,11 +112,6 @@ enum HWIntrinsicFlag : unsigned int
HW_Flag_SpecialImport = 0x80000,
};
-inline HWIntrinsicFlag operator|(HWIntrinsicFlag c1, HWIntrinsicFlag c2)
-{
- return static_cast<HWIntrinsicFlag>(static_cast<unsigned>(c1) | static_cast<unsigned>(c2));
-}
-
enum HWIntrinsicCategory : unsigned int
{
// Simple SIMD intrinsics
diff --git a/src/jit/optimizer.cpp b/src/jit/optimizer.cpp
index 69bc99f844..ea8f6a58d8 100644
--- a/src/jit/optimizer.cpp
+++ b/src/jit/optimizer.cpp
@@ -5790,7 +5790,7 @@ bool Compiler::optNarrowTree(GenTree* tree, var_types srct, var_types dstt, Valu
if (srcSize == 8)
{
assert(tree->gtType == TYP_INT);
- op1 = gtNewCastNode(TYP_INT, op1, TYP_INT);
+ op1 = gtNewCastNode(TYP_INT, op1, false, TYP_INT);
#ifdef DEBUG
op1->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED;
#endif
diff --git a/src/jit/simd.cpp b/src/jit/simd.cpp
index 56a1e9d09d..b49c5f1ca4 100644
--- a/src/jit/simd.cpp
+++ b/src/jit/simd.cpp
@@ -2513,7 +2513,7 @@ GenTree* Compiler::impSIMDIntrinsic(OPCODE opcode,
else
{
assert(baseType == TYP_UBYTE || baseType == TYP_USHORT);
- t1 = gtNewCastNode(TYP_INT, op2, TYP_INT);
+ t1 = gtNewCastNode(TYP_INT, op2, false, TYP_INT);
}
assert(t1 != nullptr);
diff --git a/src/jit/ssabuilder.cpp b/src/jit/ssabuilder.cpp
index 9cbf805b10..d64ba203ab 100644
--- a/src/jit/ssabuilder.cpp
+++ b/src/jit/ssabuilder.cpp
@@ -503,15 +503,26 @@ void SsaBuilder::DisplayDominators(BlkToBlkSetMap* domTree)
#endif // DEBUG
-// (Spec comment at declaration.)
-// See "A simple, fast dominance algorithm", by Cooper, Harvey, and Kennedy.
-// First we compute the dominance frontier for each block, then we convert these to iterated
-// dominance frontiers by a closure operation.
-BlkToBlkVectorMap* SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock** postOrder, int count)
+//------------------------------------------------------------------------
+// ComputeDominanceFrontiers: Compute flow graph dominance frontiers
+//
+// Arguments:
+// postOrder - an array containing all flow graph blocks
+// count - the number of blocks in the postOrder array
+// mapDF - a caller provided hashtable that will be populated
+// with blocks and their dominance frontiers (only those
+// blocks that have non-empty frontiers will be included)
+//
+// Notes:
+// Recall that the dominance frontier of a block B is the set of blocks
+// B3 such that there exists some B2 s.t. B3 is a successor of B2, and
+// B dominates B2. Note that this dominance need not be strict -- B2
+// and B may be the same node.
+// See "A simple, fast dominance algorithm", by Cooper, Harvey, and Kennedy.
+//
+void SsaBuilder::ComputeDominanceFrontiers(BasicBlock** postOrder, int count, BlkToBlkVectorMap* mapDF)
{
- BlkToBlkVectorMap mapDF(&m_allocator);
-
- DBG_SSA_JITDUMP("Computing IDF: First computing DF.\n");
+ DBG_SSA_JITDUMP("Computing DF:\n");
for (int i = 0; i < count; ++i)
{
@@ -557,7 +568,7 @@ BlkToBlkVectorMap* SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock** pos
{
DBG_SSA_JITDUMP(" Adding BB%02u to dom frontier of pred dom BB%02u.\n", block->bbNum, b1->bbNum);
- BlkVector& b1DF = *mapDF.Emplace(b1, &m_allocator);
+ BlkVector& b1DF = *mapDF->Emplace(b1, &m_allocator);
// It's possible to encounter the same DF multiple times, ensure that we don't add duplicates.
if (b1DF.empty() || (b1DF.back() != block))
{
@@ -576,42 +587,51 @@ BlkToBlkVectorMap* SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock** pos
BasicBlock* b = postOrder[i];
printf("Block BB%02u := {", b->bbNum);
- bool first = true;
- BlkVector* bDF = mapDF.LookupPointer(b);
+ BlkVector* bDF = mapDF->LookupPointer(b);
if (bDF != nullptr)
{
+ int index = 0;
for (BasicBlock* f : *bDF)
{
- if (!first)
- {
- printf(",");
- }
- printf("BB%02u", f->bbNum);
- first = false;
+ printf("%sBB%02u", (index++ == 0) ? "" : ",", f->bbNum);
}
}
printf("}\n");
}
}
#endif
+}
+
+//------------------------------------------------------------------------
+// ComputeIteratedDominanceFrontier: Compute the iterated dominance frontier
+// for the specified block.
+//
+// Arguments:
+// b - the block to computed the frontier for
+// mapDF - a map containing the dominance frontiers of all blocks
+// bIDF - a caller provided vector where the IDF is to be stored
+//
+// Notes:
+// The iterated dominance frontier is formed by a closure operation:
+// the IDF of B is the smallest set that includes B's dominance frontier,
+// and also includes the dominance frontier of all elements of the set.
+//
+void SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock* b, const BlkToBlkVectorMap* mapDF, BlkVector* bIDF)
+{
+ assert(bIDF->empty());
- // Now do the closure operation to make the dominance frontier into an IDF.
- BlkToBlkVectorMap* mapIDF = new (&m_allocator) BlkToBlkVectorMap(&m_allocator);
- mapIDF->Reallocate(mapDF.GetCount());
+ BlkVector* bDF = mapDF->LookupPointer(b);
- for (BlkToBlkVectorMap::KeyIterator ki = mapDF.Begin(); !ki.Equal(mapDF.End()); ki++)
+ if (bDF != nullptr)
{
// Compute IDF(b) - start by adding DF(b) to IDF(b).
- BasicBlock* b = ki.Get();
- BlkVector& bDF = ki.GetValue();
- BlkVector& bIDF = *mapIDF->Emplace(b, &m_allocator);
- bIDF.reserve(bDF.size());
+ bIDF->reserve(bDF->size());
BitVecOps::ClearD(&m_visitedTraits, m_visited);
- for (BasicBlock* f : bDF)
+ for (BasicBlock* f : *bDF)
{
BitVecOps::AddElemD(&m_visitedTraits, m_visited, f->bbNum);
- bIDF.push_back(f);
+ bIDF->push_back(f);
}
// Now for each block f from IDF(b) add DF(f) to IDF(b). This may result in new
@@ -619,10 +639,10 @@ BlkToBlkVectorMap* SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock** pos
// are added. Note that since we keep adding to bIDF we can't use iterators as
// they may get invalidated. This happens to be a convenient way to avoid having
// to track newly added blocks in a separate set.
- for (size_t newIndex = 0; newIndex < bIDF.size(); newIndex++)
+ for (size_t newIndex = 0; newIndex < bIDF->size(); newIndex++)
{
- BasicBlock* f = bIDF[newIndex];
- BlkVector* fDF = mapDF.LookupPointer(f);
+ BasicBlock* f = (*bIDF)[newIndex];
+ BlkVector* fDF = mapDF->LookupPointer(f);
if (fDF != nullptr)
{
@@ -630,7 +650,7 @@ BlkToBlkVectorMap* SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock** pos
{
if (BitVecOps::TryAddElemD(&m_visitedTraits, m_visited, ff->bbNum))
{
- bIDF.push_back(ff);
+ bIDF->push_back(ff);
}
}
}
@@ -640,32 +660,15 @@ BlkToBlkVectorMap* SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock** pos
#ifdef DEBUG
if (m_pCompiler->verboseSsa)
{
- printf("\nComputed IDF:\n");
- for (int i = 0; i < count; ++i)
+ printf("IDF(BB%02u) := {", b->bbNum);
+ int index = 0;
+ for (BasicBlock* f : *bIDF)
{
- BasicBlock* b = postOrder[i];
- printf("Block BB%02u := {", b->bbNum);
-
- bool first = true;
- BlkVector* bIDF = mapIDF->LookupPointer(b);
- if (bIDF != nullptr)
- {
- for (BasicBlock* f : *bIDF)
- {
- if (!first)
- {
- printf(",");
- }
- printf("BB%02u", f->bbNum);
- first = false;
- }
- }
- printf("}\n");
+ printf("%sBB%02u", (index++ == 0) ? "" : ",", f->bbNum);
}
+ printf("}\n");
}
#endif
-
- return mapIDF;
}
/**
@@ -719,8 +722,12 @@ void SsaBuilder::InsertPhiFunctions(BasicBlock** postOrder, int count)
EndPhase(PHASE_BUILD_SSA_LIVENESS);
// Compute dominance frontier.
- BlkToBlkVectorMap* mapIDF = ComputeIteratedDominanceFrontier(postOrder, count);
- EndPhase(PHASE_BUILD_SSA_IDF);
+ BlkToBlkVectorMap mapDF(&m_allocator);
+ ComputeDominanceFrontiers(postOrder, count, &mapDF);
+ EndPhase(PHASE_BUILD_SSA_DF);
+
+ // Use the same IDF vector for all blocks to avoid unnecessary memory allocations
+ BlkVector blockIDF(&m_allocator);
JITDUMP("Inserting phi functions:\n");
@@ -729,9 +736,10 @@ void SsaBuilder::InsertPhiFunctions(BasicBlock** postOrder, int count)
BasicBlock* block = postOrder[i];
DBG_SSA_JITDUMP("Considering dominance frontier of block BB%02u:\n", block->bbNum);
- // If the block's dominance frontier is empty, go on to the next block.
- BlkVector* blkIdf = mapIDF->LookupPointer(block);
- if (blkIdf == nullptr)
+ blockIDF.clear();
+ ComputeIteratedDominanceFrontier(block, &mapDF, &blockIDF);
+
+ if (blockIDF.empty())
{
continue;
}
@@ -751,7 +759,7 @@ void SsaBuilder::InsertPhiFunctions(BasicBlock** postOrder, int count)
}
// For each block "bbInDomFront" that is in the dominance frontier of "block"...
- for (BasicBlock* bbInDomFront : *blkIdf)
+ for (BasicBlock* bbInDomFront : blockIDF)
{
DBG_SSA_JITDUMP(" Considering BB%02u in dom frontier of BB%02u:\n", bbInDomFront->bbNum,
block->bbNum);
@@ -792,7 +800,7 @@ void SsaBuilder::InsertPhiFunctions(BasicBlock** postOrder, int count)
if (block->bbMemoryDef != 0)
{
// For each block "bbInDomFront" that is in the dominance frontier of "block".
- for (BasicBlock* bbInDomFront : *blkIdf)
+ for (BasicBlock* bbInDomFront : blockIDF)
{
DBG_SSA_JITDUMP(" Considering BB%02u in dom frontier of BB%02u for Memory phis:\n",
bbInDomFront->bbNum, block->bbNum);
diff --git a/src/jit/ssabuilder.h b/src/jit/ssabuilder.h
index 4be76f7851..3b1ca22289 100644
--- a/src/jit/ssabuilder.h
+++ b/src/jit/ssabuilder.h
@@ -86,14 +86,11 @@ private:
static void DisplayDominators(BlkToBlkSetMap* domTree);
#endif // DEBUG
- // Requires "postOrder" to hold the blocks of the flowgraph in topologically sorted order. Requires
- // count to be the valid entries in the "postOrder" array. Returns a mapping from blocks to their
- // iterated dominance frontiers. (Recall that the dominance frontier of a block B is the set of blocks
- // B3 such that there exists some B2 s.t. B3 is a successor of B2, and B dominates B2. Note that this dominance
- // need not be strict -- B2 and B may be the same node. The iterated dominance frontier is formed by a closure
- // operation: the IDF of B is the smallest set that includes B's dominance frontier, and also includes the dominance
- // frontier of all elements of the set.)
- BlkToBlkVectorMap* ComputeIteratedDominanceFrontier(BasicBlock** postOrder, int count);
+ // Compute flow graph dominance frontiers.
+ void ComputeDominanceFrontiers(BasicBlock** postOrder, int count, BlkToBlkVectorMap* mapDF);
+
+ // Compute the iterated dominance frontier for the specified block.
+ void ComputeIteratedDominanceFrontier(BasicBlock* b, const BlkToBlkVectorMap* mapDF, BlkVector* bIDF);
// Requires "postOrder" to hold the blocks of the flowgraph in topologically sorted order. Requires
// count to be the valid entries in the "postOrder" array. Inserts GT_PHI nodes at the beginning
diff --git a/src/jit/target.h b/src/jit/target.h
index 453f8f9e6c..397ecbdb00 100644
--- a/src/jit/target.h
+++ b/src/jit/target.h
@@ -2394,6 +2394,14 @@ C_ASSERT((RBM_INT_CALLEE_SAVED & RBM_FPBASE) == RBM_NONE);
#endif
/*****************************************************************************/
+#ifdef _TARGET_64BIT_
+typedef unsigned __int64 target_size_t;
+#else
+typedef unsigned int target_size_t;
+#endif
+
+C_ASSERT(sizeof(target_size_t) == TARGET_POINTER_SIZE);
+
/*****************************************************************************/
#endif // _TARGET_H_
/*****************************************************************************/
diff --git a/src/md/compiler/regmeta.h b/src/md/compiler/regmeta.h
index 0c6124653d..99aac2d539 100644
--- a/src/md/compiler/regmeta.h
+++ b/src/md/compiler/regmeta.h
@@ -16,7 +16,6 @@
#define __RegMeta__h__
#include <metamodelrw.h>
-#include <corperm.h>
#include "../inc/mdlog.h"
#include "utsem.h"
diff --git a/src/mscorlib/Common/Preprocessed/AssemblyRefs.g.cs b/src/mscorlib/Common/Preprocessed/AssemblyRefs.g.cs
deleted file mode 100644
index fba0953e20..0000000000
--- a/src/mscorlib/Common/Preprocessed/AssemblyRefs.g.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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.
-// #line 1 "d:\\projectk_2\\src\\ndp\\clr\\src\\bcl.oss\\open\\src\\common\\assemblyrefs.cspp"
-
-/*
- * Assembly attributes. This file is preprocessed to generate a .cs file
- * with the correct information. The original lives in VBL\Tools\DevDiv\
- */
-
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-
-internal static class FXAssembly
-{
- internal const string Version = "4.0.0.0";
-}
-
-internal static class ThisAssembly
-{
- internal const string Version = "4.0.0.0";
- internal const int DailyBuildNumber = 22306;
-}
-
-internal static class AssemblyRef
-{
- internal const string EcmaPublicKey = "b77a5c561934e089";
- internal const string EcmaPublicKeyToken = "b77a5c561934e089";
- internal const string MicrosoftPublicKeyToken = "b03f5f7f11d50a3a";
- internal const string SystemRuntimeWindowsRuntime = "System.Runtime.WindowsRuntime, Version=" + FXAssembly.Version + ", Culture=neutral, PublicKeyToken=" + EcmaPublicKey;
-}
diff --git a/src/mscorlib/ILLinkTrim.xml b/src/mscorlib/ILLinkTrim.xml
index 7704700027..3f8175093e 100644
--- a/src/mscorlib/ILLinkTrim.xml
+++ b/src/mscorlib/ILLinkTrim.xml
@@ -5,19 +5,25 @@
instantiations to save in the ngen image. -->
<method name="CommonlyUsedWinRTRedirectedInterfaceStubs" />
</type>
+ <!-- Properties and methods used by a debugger. -->
<type fullname="System.Threading.Tasks.Task">
- <!-- Properties used by a debugger. -->
<property name="ParentForDebugger" />
<property name="StateFlagsForDebugger" />
</type>
- <type fullname="System.Diagnostics.Tracing.EventListener">
- <!-- Method gets used when the code is mirrored into CoreFX
- and is packaged into Microsoft.Diagnostics.Tracing.EventSource.Redist. -->
- <method name="DisposeOnShutdown" />
+ <type fullname="System.Threading.ThreadPool">
+ <method name="GetQueuedWorkItemsForDebugger" />
+ <method name="GetGloballyQueuedWorkItemsForDebugger" />
+ <method name="GetLocallyQueuedWorkItemsForDebugger" />
+ </type>
+ <type fullname="System.Threading.Tasks.TaskScheduler">
+ <method name="GetScheduledTasksForDebugger" />
+ <method name="GetTaskSchedulersForDebugger" />
</type>
<type fullname="System.Threading.Tasks.Task">
<!-- Methods is used by VS Tasks Window. -->
<method name="GetActiveTaskFromId" />
</type>
+ <!-- Accessed via private reflection by tracing controller. -->
+ <type fullname="System.Diagnostics.Tracing.EventPipe*" />
</assembly>
</linker>
diff --git a/src/mscorlib/System.Private.CoreLib.csproj b/src/mscorlib/System.Private.CoreLib.csproj
index 79b36c356c..9e36d51052 100644
--- a/src/mscorlib/System.Private.CoreLib.csproj
+++ b/src/mscorlib/System.Private.CoreLib.csproj
@@ -322,7 +322,6 @@
<Compile Include="$(BclSourcesRoot)\System\Array.cs" />
<Compile Include="$(BclSourcesRoot)\System\ThrowHelper.cs" />
<Compile Include="$(BclSourcesRoot)\System\String.CoreCLR.cs" />
- <Compile Include="$(BclSourcesRoot)\System\String.Comparison.cs" />
<Compile Include="$(BclSourcesRoot)\System\Text\StringBuilder.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Text\StringBuilderCache.cs" />
<Compile Include="$(BclSourcesRoot)\System\Exception.cs" />
@@ -460,8 +459,12 @@
<Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.cs" />
</ItemGroup>
<ItemGroup Condition="'$(FeatureCoreFxGlobalization)' != 'true'">
- <Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingDataItem.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingTable.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Text\CodePageDataItem.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Text\EncodingTable.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(FeatureCoreFxGlobalization)' == 'true'">
+ <Compile Include="$(BclSourcesRoot)\System\Text\CodePageDataItem.Unix.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Text\EncodingTable.Unix.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Threading\SynchronizationContext.cs" />
@@ -586,10 +589,7 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
<Compile Include="$(BclSourcesRoot)\Interop\Unix\Interop.Libraries.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CultureInfo.Unix.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingTable.Unix.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingDataItem.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\Versioning\CompatibilitySwitch.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\ClrThreadPoolBoundHandle.Unix.cs" />
@@ -597,7 +597,6 @@
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="$(BclSourcesRoot)\Interop\Windows\Kernel32\Interop.GetSystemDirectoryW.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debug.Windows.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.Windows.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CultureInfo.Windows.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.Windows.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\ClrThreadPoolBoundHandle.Windows.cs" />
@@ -625,13 +624,11 @@
</ItemGroup>
<!-- Include additional sources shared files in the compilation -->
<ItemGroup>
- <!-- These are files are preprocessed -->
- <Compile Include="$(CommonPath)\Preprocessed\AssemblyRefs.g.cs" />
<!-- These files are shared with other framework components and don't live the same folder as the rest of them-->
<Compile Include="$(CommonPath)\NotImplemented.cs" />
<Compile Include="$(CommonPath)\System\SR.cs" />
<!-- Include Internals visible to file in the compilation -->
- <Compile Include="$(BclSourcesRoot)\mscorlib.Friends.cs" />
+ <Compile Include="$(BclSourcesRoot)\mscorlib.Friends.cs" Condition="'$(FeatureCominterop)' == 'true'" />
</ItemGroup>
<ItemGroup>
<Compile Include="src\System\Runtime\RuntimeImports.cs" />
diff --git a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs
index e64129b1cb..2f3aad85cc 100644
--- a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs
+++ b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs
@@ -21,7 +21,7 @@ internal partial class Interop
{
fixed (char* pBuffer = &lpBuffer)
fixed (char* pFileName = &lpFileName)
- return GetFullPathNameW(pFileName, nBufferLength, pBuffer, mustBeZero);
+ return GetFullPathNameW(pFileName, nBufferLength, pBuffer, lpFilePart);
}
#else
internal static extern uint GetFullPathNameW(ref char lpFileName, uint nBufferLength, ref char lpBuffer, IntPtr lpFilePart);
diff --git a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs
index 09e98d0c95..ef8fd36aa1 100644
--- a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs
+++ b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs
@@ -14,13 +14,14 @@ internal partial class Interop
/// </summary>
[DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
#if PROJECTN
- internal static extern unsafe uint GetLongPathNameW(ref char lpszShortPath, char* lpszLongPath, uint cchBuffer);
+ internal static extern unsafe uint GetLongPathNameW(char* lpszShortPath, char* lpszLongPath, uint cchBuffer);
// Works around https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=575202
internal static unsafe uint GetLongPathNameW(ref char lpszShortPath, ref char lpszLongPath, uint cchBuffer)
{
fixed (char* plpszLongPath = &lpszLongPath)
- return GetLongPathNameW(ref lpszShortPath, plpszLongPath, cchBuffer);
+ fixed (char* plpszShortPath = &lpszShortPath)
+ return GetLongPathNameW(plpszShortPath, plpszLongPath, cchBuffer);
}
#else
internal static extern uint GetLongPathNameW(ref char lpszShortPath, ref char lpszLongPath, uint cchBuffer);
diff --git a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs
index 97e1d82847..92da88c5df 100644
--- a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs
+++ b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs
@@ -9,6 +9,18 @@ internal partial class Interop
internal partial class Kernel32
{
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
+#if PROJECTN
+ internal static extern unsafe uint GetTempFileNameW(char* lpPathName, string lpPrefixString, uint uUnique, char* lpTempFileName);
+
+ // Works around https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=575202
+ internal static unsafe uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName)
+ {
+ fixed (char* plpPathName = &lpPathName)
+ fixed (char* plpTempFileName = &lpTempFileName)
+ return GetTempFileNameW(plpPathName, lpPrefixString, uUnique, plpTempFileName);
+ }
+#else
internal static extern uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName);
+#endif
}
}
diff --git a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs
index 7f7bb775c8..19dbae346b 100644
--- a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs
+++ b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs
@@ -9,6 +9,17 @@ internal partial class Interop
internal partial class Kernel32
{
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false)]
+#if PROJECTN
+ internal static extern unsafe uint GetTempPathW(int bufferLen, char* buffer);
+
+ // Works around https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=575202
+ internal static unsafe uint GetTempPathW(int bufferLen, ref char buffer)
+ {
+ fixed (char* pbuffer = &buffer)
+ return GetTempPathW(bufferLen, pbuffer);
+ }
+#else
internal static extern uint GetTempPathW(int bufferLen, ref char buffer);
+#endif
}
}
diff --git a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
index c18c944d44..1143580173 100644
--- a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
+++ b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
@@ -94,6 +94,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Configuration\Assemblies\AssemblyHashAlgorithm.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Configuration\Assemblies\AssemblyVersionCompatibility.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Convert.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Convert.Base64.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\CurrentSystemTimeZone.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\DataMisalignedException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\DateTime.cs" />
@@ -491,8 +492,10 @@
<Compile Include="$(MSBuildThisFileDirectory)System\SpanHelpers.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\SpanHelpers.BinarySearch.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\SpanHelpers.Byte.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\SpanHelpers.Char.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\SpanHelpers.T.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\String.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\String.Comparison.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\String.Manipulation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\String.Searching.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\StackOverflowException.cs" />
@@ -520,6 +523,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Text\Latin1Encoding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Text\NormalizationForm.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Text\StringBuilder.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Text\StringBuilder.Debug.cs" Condition="'$(Configuration)' == 'Debug'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Text\UnicodeEncoding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Text\UTF32Encoding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Text\UTF7Encoding.cs" />
@@ -711,6 +715,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFileHandle.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFindHandle.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarData.Windows.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.Windows.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.Windows.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\HijriCalendar.Win32.cs" Condition="'$(EnableWinRT)' != 'true' and '$(EnableDummyGlobalizationImplementation)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\HijriCalendar.WinRT.cs" Condition="'$(EnableWinRT)' == 'true'" />
@@ -792,6 +797,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Debug.Unix.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarData.Unix.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.Unix.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.Unix.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\HijriCalendar.Unix.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\IdnMapping.Unix.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'" />
diff --git a/src/mscorlib/shared/System/Buffers/OwnedMemory.cs b/src/mscorlib/shared/System/Buffers/OwnedMemory.cs
index eade1feff3..8acd5b224a 100644
--- a/src/mscorlib/shared/System/Buffers/OwnedMemory.cs
+++ b/src/mscorlib/shared/System/Buffers/OwnedMemory.cs
@@ -48,7 +48,7 @@ namespace System.Buffers
/// <summary>
/// Returns an array segment.
/// </summary>
- protected internal abstract bool TryGetArray(out ArraySegment<T> arraySegment);
+ protected internal abstract bool TryGetArray(out ArraySegment<T> segment);
/// <summary>
/// Implements IDisposable.
diff --git a/src/mscorlib/shared/System/Collections/Generic/Dictionary.cs b/src/mscorlib/shared/System/Collections/Generic/Dictionary.cs
index 16b7cdc130..d76df4041a 100644
--- a/src/mscorlib/shared/System/Collections/Generic/Dictionary.cs
+++ b/src/mscorlib/shared/System/Collections/Generic/Dictionary.cs
@@ -2,11 +2,10 @@
// 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;
-using System.Collections;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
+using System.Threading;
namespace System.Collections.Generic
{
@@ -34,7 +33,7 @@ namespace System.Collections.Generic
[DebuggerTypeProxy(typeof(IDictionaryDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
[Serializable]
- [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+ [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>, ISerializable, IDeserializationCallback
{
private struct Entry
@@ -217,7 +216,7 @@ namespace System.Collections.Generic
int i = FindEntry(key);
if (i >= 0) return _entries[i].value;
ThrowHelper.ThrowKeyNotFoundException(key);
- return default(TValue);
+ return default;
}
set
{
@@ -233,9 +232,7 @@ namespace System.Collections.Generic
}
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> keyValuePair)
- {
- Add(keyValuePair.Key, keyValuePair.Value);
- }
+ => Add(keyValuePair.Key, keyValuePair.Value);
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> keyValuePair)
{
@@ -268,30 +265,44 @@ namespace System.Collections.Generic
_count = 0;
_freeList = -1;
_freeCount = 0;
- _version++;
Array.Clear(_entries, 0, count);
}
+ _version++;
}
public bool ContainsKey(TKey key)
- {
- return FindEntry(key) >= 0;
- }
+ => FindEntry(key) >= 0;
public bool ContainsValue(TValue value)
{
+ Entry[] entries = _entries;
if (value == null)
{
for (int i = 0; i < _count; i++)
{
- if (_entries[i].hashCode >= 0 && _entries[i].value == null) return true;
+ if (entries[i].hashCode >= 0 && entries[i].value == null) return true;
}
}
else
{
- for (int i = 0; i < _count; i++)
+ if (default(TValue) != null)
{
- if (_entries[i].hashCode >= 0 && EqualityComparer<TValue>.Default.Equals(_entries[i].value, value)) return true;
+ // ValueType: Devirtualize with EqualityComparer<TValue>.Default intrinsic
+ for (int i = 0; i < _count; i++)
+ {
+ if (entries[i].hashCode >= 0 && EqualityComparer<TValue>.Default.Equals(entries[i].value, value)) return true;
+ }
+ }
+ else
+ {
+ // Object type: Shared Generic, EqualityComparer<TValue>.Default won't devirtualize
+ // https://github.com/dotnet/coreclr/issues/17273
+ // So cache in a local rather than get EqualityComparer per loop iteration
+ EqualityComparer<TValue> defaultComparer = EqualityComparer<TValue>.Default;
+ for (int i = 0; i < _count; i++)
+ {
+ if (entries[i].hashCode >= 0 && defaultComparer.Equals(entries[i].value, value)) return true;
+ }
}
}
return false;
@@ -304,7 +315,7 @@ namespace System.Collections.Generic
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
}
- if (index < 0 || index > array.Length)
+ if ((uint)index > (uint)array.Length)
{
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
}
@@ -326,14 +337,10 @@ namespace System.Collections.Generic
}
public Enumerator GetEnumerator()
- {
- return new Enumerator(this, Enumerator.KeyValuePair);
- }
+ => new Enumerator(this, Enumerator.KeyValuePair);
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
- {
- return new Enumerator(this, Enumerator.KeyValuePair);
- }
+ => new Enumerator(this, Enumerator.KeyValuePair);
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
@@ -373,24 +380,53 @@ namespace System.Collections.Generic
int hashCode = key.GetHashCode() & 0x7FFFFFFF;
// Value in _buckets is 1-based
i = buckets[hashCode % buckets.Length] - 1;
- do
+ if (default(TKey) != null)
{
- // Should be a while loop https://github.com/dotnet/coreclr/issues/15476
- // Test in if to drop range check for following array access
- if ((uint)i >= (uint)entries.Length || (entries[i].hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i].key, key)))
+ // ValueType: Devirtualize with EqualityComparer<TValue>.Default intrinsic
+ do
{
- break;
- }
-
- i = entries[i].next;
- if (collisionCount >= entries.Length)
+ // Should be a while loop https://github.com/dotnet/coreclr/issues/15476
+ // Test in if to drop range check for following array access
+ if ((uint)i >= (uint)entries.Length || (entries[i].hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i].key, key)))
+ {
+ break;
+ }
+
+ i = entries[i].next;
+ if (collisionCount >= entries.Length)
+ {
+ // The chain of entries forms a loop; which means a concurrent update has happened.
+ // Break out of the loop and throw, rather than looping forever.
+ ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
+ }
+ collisionCount++;
+ } while (true);
+ }
+ else
+ {
+ // Object type: Shared Generic, EqualityComparer<TValue>.Default won't devirtualize
+ // https://github.com/dotnet/coreclr/issues/17273
+ // So cache in a local rather than get EqualityComparer per loop iteration
+ EqualityComparer<TKey> defaultComparer = EqualityComparer<TKey>.Default;
+ do
{
- // The chain of entries forms a loop; which means a concurrent update has happened.
- // Break out of the loop and throw, rather than looping forever.
- ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
- }
- collisionCount++;
- } while (true);
+ // Should be a while loop https://github.com/dotnet/coreclr/issues/15476
+ // Test in if to drop range check for following array access
+ if ((uint)i >= (uint)entries.Length || (entries[i].hashCode == hashCode && defaultComparer.Equals(entries[i].key, key)))
+ {
+ break;
+ }
+
+ i = entries[i].next;
+ if (collisionCount >= entries.Length)
+ {
+ // The chain of entries forms a loop; which means a concurrent update has happened.
+ // Break out of the loop and throw, rather than looping forever.
+ ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
+ }
+ collisionCount++;
+ } while (true);
+ }
}
else
{
@@ -440,6 +476,7 @@ namespace System.Collections.Generic
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
+ _version++;
if (_buckets == null)
{
Initialize(0);
@@ -457,41 +494,85 @@ namespace System.Collections.Generic
if (comparer == null)
{
- do
+ if (default(TKey) != null)
{
- // Should be a while loop https://github.com/dotnet/coreclr/issues/15476
- // Test uint in if rather than loop condition to drop range check for following array access
- if ((uint)i >= (uint)entries.Length)
+ // ValueType: Devirtualize with EqualityComparer<TValue>.Default intrinsic
+ do
{
- break;
- }
+ // Should be a while loop https://github.com/dotnet/coreclr/issues/15476
+ // Test uint in if rather than loop condition to drop range check for following array access
+ if ((uint)i >= (uint)entries.Length)
+ {
+ break;
+ }
- if (entries[i].hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i].key, key))
- {
- if (behavior == InsertionBehavior.OverwriteExisting)
+ if (entries[i].hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i].key, key))
{
- entries[i].value = value;
- _version++;
- return true;
+ if (behavior == InsertionBehavior.OverwriteExisting)
+ {
+ entries[i].value = value;
+ return true;
+ }
+
+ if (behavior == InsertionBehavior.ThrowOnExisting)
+ {
+ ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key);
+ }
+
+ return false;
}
- if (behavior == InsertionBehavior.ThrowOnExisting)
+ i = entries[i].next;
+ if (collisionCount >= entries.Length)
{
- ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key);
+ // The chain of entries forms a loop; which means a concurrent update has happened.
+ // Break out of the loop and throw, rather than looping forever.
+ ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
+ }
+ collisionCount++;
+ } while (true);
+ }
+ else
+ {
+ // Object type: Shared Generic, EqualityComparer<TValue>.Default won't devirtualize
+ // https://github.com/dotnet/coreclr/issues/17273
+ // So cache in a local rather than get EqualityComparer per loop iteration
+ EqualityComparer<TKey> defaultComparer = EqualityComparer<TKey>.Default;
+ do
+ {
+ // Should be a while loop https://github.com/dotnet/coreclr/issues/15476
+ // Test uint in if rather than loop condition to drop range check for following array access
+ if ((uint)i >= (uint)entries.Length)
+ {
+ break;
}
- return false;
- }
+ if (entries[i].hashCode == hashCode && defaultComparer.Equals(entries[i].key, key))
+ {
+ if (behavior == InsertionBehavior.OverwriteExisting)
+ {
+ entries[i].value = value;
+ return true;
+ }
+
+ if (behavior == InsertionBehavior.ThrowOnExisting)
+ {
+ ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key);
+ }
+
+ return false;
+ }
- i = entries[i].next;
- if (collisionCount >= entries.Length)
- {
- // The chain of entries forms a loop; which means a concurrent update has happened.
- // Break out of the loop and throw, rather than looping forever.
- ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
- }
- collisionCount++;
- } while (true);
+ i = entries[i].next;
+ if (collisionCount >= entries.Length)
+ {
+ // The chain of entries forms a loop; which means a concurrent update has happened.
+ // Break out of the loop and throw, rather than looping forever.
+ ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported();
+ }
+ collisionCount++;
+ } while (true);
+ }
}
else
{
@@ -509,7 +590,6 @@ namespace System.Collections.Generic
if (behavior == InsertionBehavior.OverwriteExisting)
{
entries[i].value = value;
- _version++;
return true;
}
@@ -571,7 +651,6 @@ namespace System.Collections.Generic
entry.value = value;
// Value in _buckets is 1-based
targetBucket = index + 1;
- _version++;
// Value types never rehash
if (default(TKey) == null && collisionCount > HashHelpers.HashCollisionThreshold && comparer is NonRandomizedStringEqualityComparer)
@@ -587,8 +666,7 @@ namespace System.Collections.Generic
public virtual void OnDeserialization(object sender)
{
- SerializationInfo siInfo;
- HashHelpers.SerializationInfoTable.TryGetValue(this, out siInfo);
+ HashHelpers.SerializationInfoTable.TryGetValue(this, out SerializationInfo siInfo);
if (siInfo == null)
{
@@ -632,9 +710,7 @@ namespace System.Collections.Generic
}
private void Resize()
- {
- Resize(HashHelpers.ExpandPrime(_count), false);
- }
+ => Resize(HashHelpers.ExpandPrime(_count), false);
private void Resize(int newSize, bool forceNewHashCodes)
{
@@ -713,11 +789,11 @@ namespace System.Collections.Generic
if (RuntimeHelpers.IsReferenceOrContainsReferences<TKey>())
{
- entry.key = default(TKey);
+ entry.key = default;
}
if (RuntimeHelpers.IsReferenceOrContainsReferences<TValue>())
{
- entry.value = default(TValue);
+ entry.value = default;
}
_freeList = i;
_freeCount++;
@@ -772,11 +848,11 @@ namespace System.Collections.Generic
if (RuntimeHelpers.IsReferenceOrContainsReferences<TKey>())
{
- entry.key = default(TKey);
+ entry.key = default;
}
if (RuntimeHelpers.IsReferenceOrContainsReferences<TValue>())
{
- entry.value = default(TValue);
+ entry.value = default;
}
_freeList = i;
_freeCount++;
@@ -788,7 +864,7 @@ namespace System.Collections.Generic
i = entry.next;
}
}
- value = default(TValue);
+ value = default;
return false;
}
@@ -800,57 +876,37 @@ namespace System.Collections.Generic
value = _entries[i].value;
return true;
}
- value = default(TValue);
+ value = default;
return false;
}
- public bool TryAdd(TKey key, TValue value) => TryInsert(key, value, InsertionBehavior.None);
+ public bool TryAdd(TKey key, TValue value)
+ => TryInsert(key, value, InsertionBehavior.None);
- bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly
- {
- get { return false; }
- }
+ bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly => false;
void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int index)
- {
- CopyTo(array, index);
- }
+ => CopyTo(array, index);
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
- {
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- }
-
if (array.Rank != 1)
- {
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
- }
-
if (array.GetLowerBound(0) != 0)
- {
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
- }
-
- if (index < 0 || index > array.Length)
- {
+ if ((uint)index > (uint)array.Length)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
- }
-
if (array.Length - index < Count)
- {
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
- }
- KeyValuePair<TKey, TValue>[] pairs = array as KeyValuePair<TKey, TValue>[];
- if (pairs != null)
+ if (array is KeyValuePair<TKey, TValue>[] pairs)
{
CopyTo(pairs, index);
}
- else if (array is DictionaryEntry[])
+ else if (array is DictionaryEntry[] dictEntryArray)
{
- DictionaryEntry[] dictEntryArray = array as DictionaryEntry[];
Entry[] entries = _entries;
for (int i = 0; i < _count; i++)
{
@@ -888,9 +944,7 @@ namespace System.Collections.Generic
}
IEnumerator IEnumerable.GetEnumerator()
- {
- return new Enumerator(this, Enumerator.KeyValuePair);
- }
+ => new Enumerator(this, Enumerator.KeyValuePair);
/// <summary>
/// Ensures that the dictionary can hold up to 'capacity' entries without any further expansion of its backing storage
@@ -921,9 +975,7 @@ namespace System.Collections.Generic
/// dictionary.TrimExcess();
/// </summary>
public void TrimExcess()
- {
- TrimExcess(Count);
- }
+ => TrimExcess(Count);
/// <summary>
/// Sets the capacity of this dictionary to hold up 'capacity' entries without any further expansion of its backing storage
@@ -966,10 +1018,7 @@ namespace System.Collections.Generic
_freeCount = 0;
}
- bool ICollection.IsSynchronized
- {
- get { return false; }
- }
+ bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot
{
@@ -977,31 +1026,19 @@ namespace System.Collections.Generic
{
if (_syncRoot == null)
{
- System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null);
+ Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
}
return _syncRoot;
}
}
- bool IDictionary.IsFixedSize
- {
- get { return false; }
- }
+ bool IDictionary.IsFixedSize => false;
- bool IDictionary.IsReadOnly
- {
- get { return false; }
- }
+ bool IDictionary.IsReadOnly => false;
- ICollection IDictionary.Keys
- {
- get { return (ICollection)Keys; }
- }
+ ICollection IDictionary.Keys => (ICollection)Keys;
- ICollection IDictionary.Values
- {
- get { return (ICollection)Values; }
- }
+ ICollection IDictionary.Values => (ICollection)Values;
object IDictionary.this[object key]
{
@@ -1091,9 +1128,7 @@ namespace System.Collections.Generic
}
IDictionaryEnumerator IDictionary.GetEnumerator()
- {
- return new Enumerator(this, Enumerator.DictEntry);
- }
+ => new Enumerator(this, Enumerator.DictEntry);
void IDictionary.Remove(object key)
{
@@ -1149,10 +1184,7 @@ namespace System.Collections.Generic
return false;
}
- public KeyValuePair<TKey, TValue> Current
- {
- get { return _current; }
- }
+ public KeyValuePair<TKey, TValue> Current => _current;
public void Dispose()
{
@@ -1169,7 +1201,7 @@ namespace System.Collections.Generic
if (_getEnumeratorRetType == DictEntry)
{
- return new System.Collections.DictionaryEntry(_current.Key, _current.Value);
+ return new DictionaryEntry(_current.Key, _current.Value);
}
else
{
@@ -1245,9 +1277,7 @@ namespace System.Collections.Generic
}
public Enumerator GetEnumerator()
- {
- return new Enumerator(_dictionary);
- }
+ => new Enumerator(_dictionary);
public void CopyTo(TKey[] array, int index)
{
@@ -1274,30 +1304,18 @@ namespace System.Collections.Generic
}
}
- public int Count
- {
- get { return _dictionary.Count; }
- }
+ public int Count => _dictionary.Count;
- bool ICollection<TKey>.IsReadOnly
- {
- get { return true; }
- }
+ bool ICollection<TKey>.IsReadOnly => true;
void ICollection<TKey>.Add(TKey item)
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
- }
+ => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
void ICollection<TKey>.Clear()
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
- }
+ => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet);
bool ICollection<TKey>.Contains(TKey item)
- {
- return _dictionary.ContainsKey(item);
- }
+ => _dictionary.ContainsKey(item);
bool ICollection<TKey>.Remove(TKey item)
{
@@ -1306,44 +1324,25 @@ namespace System.Collections.Generic
}
IEnumerator<TKey> IEnumerable<TKey>.GetEnumerator()
- {
- return new Enumerator(_dictionary);
- }
+ => new Enumerator(_dictionary);
IEnumerator IEnumerable.GetEnumerator()
- {
- return new Enumerator(_dictionary);
- }
+ => new Enumerator(_dictionary);
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
- {
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- }
-
if (array.Rank != 1)
- {
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
- }
-
if (array.GetLowerBound(0) != 0)
- {
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
- }
-
- if (index < 0 || index > array.Length)
- {
+ if ((uint)index > (uint)array.Length)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
- }
-
if (array.Length - index < _dictionary.Count)
- {
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
- }
- TKey[] keys = array as TKey[];
- if (keys != null)
+ if (array is TKey[] keys)
{
CopyTo(keys, index);
}
@@ -1371,17 +1370,11 @@ namespace System.Collections.Generic
}
}
- bool ICollection.IsSynchronized
- {
- get { return false; }
- }
+ bool ICollection.IsSynchronized => false;
- object ICollection.SyncRoot
- {
- get { return ((ICollection)_dictionary).SyncRoot; }
- }
+ object ICollection.SyncRoot => ((ICollection)_dictionary).SyncRoot;
- public struct Enumerator : IEnumerator<TKey>, System.Collections.IEnumerator
+ public struct Enumerator : IEnumerator<TKey>, IEnumerator
{
private Dictionary<TKey, TValue> _dictionary;
private int _index;
@@ -1393,7 +1386,7 @@ namespace System.Collections.Generic
_dictionary = dictionary;
_version = dictionary._version;
_index = 0;
- _currentKey = default(TKey);
+ _currentKey = default;
}
public void Dispose()
@@ -1419,19 +1412,13 @@ namespace System.Collections.Generic
}
_index = _dictionary._count + 1;
- _currentKey = default(TKey);
+ _currentKey = default;
return false;
}
- public TKey Current
- {
- get
- {
- return _currentKey;
- }
- }
+ public TKey Current => _currentKey;
- object System.Collections.IEnumerator.Current
+ object IEnumerator.Current
{
get
{
@@ -1444,7 +1431,7 @@ namespace System.Collections.Generic
}
}
- void System.Collections.IEnumerator.Reset()
+ void IEnumerator.Reset()
{
if (_version != _dictionary._version)
{
@@ -1452,7 +1439,7 @@ namespace System.Collections.Generic
}
_index = 0;
- _currentKey = default(TKey);
+ _currentKey = default;
}
}
}
@@ -1473,9 +1460,7 @@ namespace System.Collections.Generic
}
public Enumerator GetEnumerator()
- {
- return new Enumerator(_dictionary);
- }
+ => new Enumerator(_dictionary);
public void CopyTo(TValue[] array, int index)
{
@@ -1502,20 +1487,12 @@ namespace System.Collections.Generic
}
}
- public int Count
- {
- get { return _dictionary.Count; }
- }
+ public int Count => _dictionary.Count;
- bool ICollection<TValue>.IsReadOnly
- {
- get { return true; }
- }
+ bool ICollection<TValue>.IsReadOnly => true;
void ICollection<TValue>.Add(TValue item)
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
- }
+ => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
bool ICollection<TValue>.Remove(TValue item)
{
@@ -1524,52 +1501,31 @@ namespace System.Collections.Generic
}
void ICollection<TValue>.Clear()
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
- }
+ => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ValueCollectionSet);
bool ICollection<TValue>.Contains(TValue item)
- {
- return _dictionary.ContainsValue(item);
- }
+ => _dictionary.ContainsValue(item);
IEnumerator<TValue> IEnumerable<TValue>.GetEnumerator()
- {
- return new Enumerator(_dictionary);
- }
+ => new Enumerator(_dictionary);
IEnumerator IEnumerable.GetEnumerator()
- {
- return new Enumerator(_dictionary);
- }
+ => new Enumerator(_dictionary);
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
- {
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- }
-
if (array.Rank != 1)
- {
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
- }
-
if (array.GetLowerBound(0) != 0)
- {
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
- }
-
- if (index < 0 || index > array.Length)
- {
+ if ((uint)index > (uint)array.Length)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
- }
-
if (array.Length - index < _dictionary.Count)
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
- TValue[] values = array as TValue[];
- if (values != null)
+ if (array is TValue[] values)
{
CopyTo(values, index);
}
@@ -1597,17 +1553,11 @@ namespace System.Collections.Generic
}
}
- bool ICollection.IsSynchronized
- {
- get { return false; }
- }
+ bool ICollection.IsSynchronized => false;
- object ICollection.SyncRoot
- {
- get { return ((ICollection)_dictionary).SyncRoot; }
- }
+ object ICollection.SyncRoot => ((ICollection)_dictionary).SyncRoot;
- public struct Enumerator : IEnumerator<TValue>, System.Collections.IEnumerator
+ public struct Enumerator : IEnumerator<TValue>, IEnumerator
{
private Dictionary<TKey, TValue> _dictionary;
private int _index;
@@ -1619,7 +1569,7 @@ namespace System.Collections.Generic
_dictionary = dictionary;
_version = dictionary._version;
_index = 0;
- _currentValue = default(TValue);
+ _currentValue = default;
}
public void Dispose()
@@ -1644,19 +1594,13 @@ namespace System.Collections.Generic
}
}
_index = _dictionary._count + 1;
- _currentValue = default(TValue);
+ _currentValue = default;
return false;
}
- public TValue Current
- {
- get
- {
- return _currentValue;
- }
- }
+ public TValue Current => _currentValue;
- object System.Collections.IEnumerator.Current
+ object IEnumerator.Current
{
get
{
@@ -1669,14 +1613,14 @@ namespace System.Collections.Generic
}
}
- void System.Collections.IEnumerator.Reset()
+ void IEnumerator.Reset()
{
if (_version != _dictionary._version)
{
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}
_index = 0;
- _currentValue = default(TValue);
+ _currentValue = default;
}
}
}
diff --git a/src/mscorlib/shared/System/Collections/Generic/List.cs b/src/mscorlib/shared/System/Collections/Generic/List.cs
index 56bbea895e..6b9f9b45b3 100644
--- a/src/mscorlib/shared/System/Collections/Generic/List.cs
+++ b/src/mscorlib/shared/System/Collections/Generic/List.cs
@@ -5,6 +5,7 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
+using System.Threading;
namespace System.Collections.Generic
{
@@ -17,8 +18,8 @@ namespace System.Collections.Generic
[DebuggerTypeProxy(typeof(ICollectionDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
[Serializable]
- [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- public class List<T> : IList<T>, System.Collections.IList, IReadOnlyList<T>
+ [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+ public class List<T> : IList<T>, IList, IReadOnlyList<T>
{
private const int DefaultCapacity = 4;
@@ -63,8 +64,7 @@ namespace System.Collections.Generic
if (collection == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
- ICollection<T> c = collection as ICollection<T>;
- if (c != null)
+ if (collection is ICollection<T> c)
{
int count = c.Count;
if (count == 0)
@@ -123,44 +123,26 @@ namespace System.Collections.Generic
}
// Read-only property describing how many elements are in the List.
- public int Count
- {
- get
- {
- return _size;
- }
- }
+ public int Count => _size;
- bool System.Collections.IList.IsFixedSize
- {
- get { return false; }
- }
+ bool IList.IsFixedSize => false;
// Is this List read-only?
- bool ICollection<T>.IsReadOnly
- {
- get { return false; }
- }
+ bool ICollection<T>.IsReadOnly => false;
- bool System.Collections.IList.IsReadOnly
- {
- get { return false; }
- }
+ bool IList.IsReadOnly => false;
// Is this List synchronized (thread-safe)?
- bool System.Collections.ICollection.IsSynchronized
- {
- get { return false; }
- }
+ bool ICollection.IsSynchronized => false;
// Synchronization root for this object.
- object System.Collections.ICollection.SyncRoot
+ object ICollection.SyncRoot
{
get
{
if (_syncRoot == null)
{
- System.Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
+ Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
}
return _syncRoot;
}
@@ -197,7 +179,7 @@ namespace System.Collections.Generic
return ((value is T) || (value == null && default(T) == null));
}
- object System.Collections.IList.this[int index]
+ object IList.this[int index]
{
get
{
@@ -225,9 +207,9 @@ namespace System.Collections.Generic
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Add(T item)
{
- var array = _items;
- var size = _size;
_version++;
+ T[] array = _items;
+ int size = _size;
if ((uint)size < (uint)array.Length)
{
_size = size + 1;
@@ -243,13 +225,13 @@ namespace System.Collections.Generic
[MethodImpl(MethodImplOptions.NoInlining)]
private void AddWithResize(T item)
{
- var size = _size;
+ int size = _size;
EnsureCapacity(size + 1);
_size = size + 1;
_items[size] = item;
}
- int System.Collections.IList.Add(Object item)
+ int IList.Add(object item)
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(item, ExceptionArgument.item);
@@ -270,14 +252,10 @@ namespace System.Collections.Generic
// capacity or the new size, whichever is larger.
//
public void AddRange(IEnumerable<T> collection)
- {
- InsertRange(_size, collection);
- }
+ => InsertRange(_size, collection);
public ReadOnlyCollection<T> AsReadOnly()
- {
- return new ReadOnlyCollection<T>(this);
- }
+ => new ReadOnlyCollection<T>(this);
// Searches a section of the list for a given element using a binary search
// algorithm. Elements of the list are compared to the search value using
@@ -312,25 +290,20 @@ namespace System.Collections.Generic
}
public int BinarySearch(T item)
- {
- return BinarySearch(0, Count, item, null);
- }
+ => BinarySearch(0, Count, item, null);
public int BinarySearch(T item, IComparer<T> comparer)
- {
- return BinarySearch(0, Count, item, comparer);
- }
-
+ => BinarySearch(0, Count, item, comparer);
// Clears the contents of List.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Clear()
{
+ _version++;
if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
{
int size = _size;
_size = 0;
- _version++;
if (size > 0)
{
Array.Clear(_items, 0, size); // Clear the elements so that the gc can reclaim the references.
@@ -339,7 +312,6 @@ namespace System.Collections.Generic
else
{
_size = 0;
- _version++;
}
}
@@ -360,7 +332,7 @@ namespace System.Collections.Generic
return _size != 0 && IndexOf(item) != -1;
}
- bool System.Collections.IList.Contains(object item)
+ bool IList.Contains(object item)
{
if (IsCompatibleObject(item))
{
@@ -388,13 +360,11 @@ namespace System.Collections.Generic
// Copies this List into array, which must be of a
// compatible array type.
public void CopyTo(T[] array)
- {
- CopyTo(array, 0);
- }
+ => CopyTo(array, 0);
// Copies this List into array, which must be of a
// compatible array type.
- void System.Collections.ICollection.CopyTo(Array array, int arrayIndex)
+ void ICollection.CopyTo(Array array, int arrayIndex)
{
if ((array != null) && (array.Rank != 1))
{
@@ -452,9 +422,7 @@ namespace System.Collections.Generic
}
public bool Exists(Predicate<T> match)
- {
- return FindIndex(match) != -1;
- }
+ => FindIndex(match) != -1;
public T Find(Predicate<T> match)
{
@@ -470,7 +438,7 @@ namespace System.Collections.Generic
return _items[i];
}
}
- return default(T);
+ return default;
}
public List<T> FindAll(Predicate<T> match)
@@ -492,14 +460,10 @@ namespace System.Collections.Generic
}
public int FindIndex(Predicate<T> match)
- {
- return FindIndex(0, _size, match);
- }
+ => FindIndex(0, _size, match);
public int FindIndex(int startIndex, Predicate<T> match)
- {
- return FindIndex(startIndex, _size - startIndex, match);
- }
+ => FindIndex(startIndex, _size - startIndex, match);
public int FindIndex(int startIndex, int count, Predicate<T> match)
{
@@ -540,18 +504,14 @@ namespace System.Collections.Generic
return _items[i];
}
}
- return default(T);
+ return default;
}
public int FindLastIndex(Predicate<T> match)
- {
- return FindLastIndex(_size - 1, _size, match);
- }
+ => FindLastIndex(_size - 1, _size, match);
public int FindLastIndex(int startIndex, Predicate<T> match)
- {
- return FindLastIndex(startIndex, startIndex + 1, match);
- }
+ => FindLastIndex(startIndex, startIndex + 1, match);
public int FindLastIndex(int startIndex, int count, Predicate<T> match)
{
@@ -622,19 +582,13 @@ namespace System.Collections.Generic
// GetObject methods of the enumerator will throw an exception.
//
public Enumerator GetEnumerator()
- {
- return new Enumerator(this);
- }
+ => new Enumerator(this);
IEnumerator<T> IEnumerable<T>.GetEnumerator()
- {
- return new Enumerator(this);
- }
+ => new Enumerator(this);
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return new Enumerator(this);
- }
+ IEnumerator IEnumerable.GetEnumerator()
+ => new Enumerator(this);
public List<T> GetRange(int index, int count)
{
@@ -669,11 +623,9 @@ namespace System.Collections.Generic
// search.
//
public int IndexOf(T item)
- {
- return Array.IndexOf(_items, item, 0, _size);
- }
+ => Array.IndexOf(_items, item, 0, _size);
- int System.Collections.IList.IndexOf(object item)
+ int IList.IndexOf(object item)
{
if (IsCompatibleObject(item))
{
@@ -739,7 +691,7 @@ namespace System.Collections.Generic
_version++;
}
- void System.Collections.IList.Insert(int index, Object item)
+ void IList.Insert(int index, object item)
{
ThrowHelper.IfNullAndNullsAreIllegalThenThrow<T>(item, ExceptionArgument.item);
@@ -770,9 +722,8 @@ namespace System.Collections.Generic
ThrowHelper.ThrowArgumentOutOfRange_IndexException();
}
- ICollection<T> c = collection as ICollection<T>;
- if (c != null)
- { // if collection is ICollection<T>
+ if (collection is ICollection<T> c)
+ {
int count = c.Count;
if (count > 0)
{
@@ -905,7 +856,7 @@ namespace System.Collections.Generic
return false;
}
- void System.Collections.IList.Remove(object item)
+ void IList.Remove(object item)
{
if (IsCompatibleObject(item))
{
@@ -967,7 +918,7 @@ namespace System.Collections.Generic
}
if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
{
- _items[_size] = default(T);
+ _items[_size] = default;
}
_version++;
}
@@ -1007,9 +958,7 @@ namespace System.Collections.Generic
// Reverses the elements in this list.
public void Reverse()
- {
- Reverse(0, Count);
- }
+ => Reverse(0, Count);
// Reverses the elements in a range of this list. Following a call to this
// method, an element in the range given by index and count
@@ -1041,16 +990,12 @@ namespace System.Collections.Generic
// Sorts the elements in this list. Uses the default comparer and
// Array.Sort.
public void Sort()
- {
- Sort(0, Count, null);
- }
+ => Sort(0, Count, null);
// Sorts the elements in this list. Uses Array.Sort with the
// provided comparer.
public void Sort(IComparer<T> comparer)
- {
- Sort(0, Count, comparer);
- }
+ => Sort(0, Count, comparer);
// Sorts the elements in a section of this list. The sort compares the
// elements to each other using the given IComparer interface. If
@@ -1150,9 +1095,9 @@ namespace System.Collections.Generic
Debug.Assert(enumerable != null);
Debug.Assert(!(enumerable is ICollection<T>), "We should have optimized for this beforehand.");
+ _version++; // Even if the enumerable has no items, we can update _version.
using (IEnumerator<T> en = enumerable.GetEnumerator())
{
- _version++; // Even if the enumerable has no items, we can update _version.
while (en.MoveNext())
{
@@ -1170,7 +1115,7 @@ namespace System.Collections.Generic
}
}
- public struct Enumerator : IEnumerator<T>, System.Collections.IEnumerator
+ public struct Enumerator : IEnumerator<T>, IEnumerator
{
private List<T> _list;
private int _index;
@@ -1182,7 +1127,7 @@ namespace System.Collections.Generic
_list = list;
_index = 0;
_version = list._version;
- _current = default(T);
+ _current = default;
}
public void Dispose()
@@ -1210,19 +1155,13 @@ namespace System.Collections.Generic
}
_index = _list._size + 1;
- _current = default(T);
+ _current = default;
return false;
}
- public T Current
- {
- get
- {
- return _current;
- }
- }
+ public T Current => _current;
- object System.Collections.IEnumerator.Current
+ object IEnumerator.Current
{
get
{
@@ -1234,7 +1173,7 @@ namespace System.Collections.Generic
}
}
- void System.Collections.IEnumerator.Reset()
+ void IEnumerator.Reset()
{
if (_version != _list._version)
{
@@ -1242,7 +1181,7 @@ namespace System.Collections.Generic
}
_index = 0;
- _current = default(T);
+ _current = default;
}
}
}
diff --git a/src/mscorlib/shared/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs b/src/mscorlib/shared/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs
index 72f62c2b9a..e7efa22b24 100644
--- a/src/mscorlib/shared/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs
+++ b/src/mscorlib/shared/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs
@@ -11,12 +11,8 @@ namespace System.Collections.Generic
// keeps the performance not affected till we hit collision threshold and then we switch to the comparer which is using
// randomized string hashing.
[Serializable] // Required for compatibility with .NET Core 2.0 as we exposed the NonRandomizedStringEqualityComparer inside the serialization blob
-#if CORERT
- public
-#else
- internal
-#endif
- sealed class NonRandomizedStringEqualityComparer : EqualityComparer<string>, ISerializable
+ // Needs to be public to support binary serialization compatibility
+ public sealed class NonRandomizedStringEqualityComparer : EqualityComparer<string>, ISerializable
{
internal static new IEqualityComparer<string> Default { get; } = new NonRandomizedStringEqualityComparer();
diff --git a/src/mscorlib/shared/System/Collections/ListDictionaryInternal.cs b/src/mscorlib/shared/System/Collections/ListDictionaryInternal.cs
index a8b7a187d9..eccb9f0347 100644
--- a/src/mscorlib/shared/System/Collections/ListDictionaryInternal.cs
+++ b/src/mscorlib/shared/System/Collections/ListDictionaryInternal.cs
@@ -20,12 +20,8 @@ namespace System.Collections
/// This should not be used if performance is important for large numbers of elements.
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-#if CORERT
- public
-#else
- internal
-#endif
- class ListDictionaryInternal : IDictionary
+ // Needs to be public to support binary serialization compatibility
+ public class ListDictionaryInternal : IDictionary
{
private DictionaryNode head; // Do not rename (binary serialization)
private int version; // Do not rename (binary serialization)
diff --git a/src/mscorlib/shared/System/Convert.Base64.cs b/src/mscorlib/shared/System/Convert.Base64.cs
new file mode 100644
index 0000000000..7e2aee31b2
--- /dev/null
+++ b/src/mscorlib/shared/System/Convert.Base64.cs
@@ -0,0 +1,217 @@
+// 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
+{
+ public static partial class Convert
+ {
+ /// <summary>
+ /// Decode the span of UTF-16 encoded text represented as base 64 into binary data.
+ /// If the input is not a multiple of 4, or contains illegal characters, it will decode as much as it can, to the largest possible multiple of 4.
+ /// This invariant allows continuation of the parse with a slower, whitespace-tolerant algorithm.
+ ///
+ /// <param name="utf16">The input span which contains UTF-16 encoded text in base 64 that needs to be decoded.</param>
+ /// <param name="bytes">The output span which contains the result of the operation, i.e. the decoded binary data.</param>
+ /// <param name="consumed">The number of input bytes consumed during the operation. This can be used to slice the input for subsequent calls, if necessary.</param>
+ /// <param name="written">The number of bytes written into the output span. This can be used to slice the output for subsequent calls, if necessary.</param>
+ /// <returns>Returns:
+ /// - true - The entire input span was successfully parsed.
+ /// - false - Only a part of the input span was successfully parsed. Failure causes may include embedded or trailing whitespace,
+ /// other illegal Base64 characters, trailing characters after an encoding pad ('='), an input span whose length is not divisible by 4
+ /// or a destination span that's too small. <paramref name="consumed"/> and <paramref name="written"/> are set so that
+ /// parsing can continue with a slower whitespace-tolerant algorithm.
+ ///
+ /// Note: This is a cut down version of the implementation of Base64.DecodeFromUtf8(), modified the accept UTF16 chars and act as a fast-path
+ /// helper for the Convert routines when the input string contains no whitespace.
+ ///
+ /// </summary>
+ private static bool TryDecodeFromUtf16(ReadOnlySpan<char> utf16, Span<byte> bytes, out int consumed, out int written)
+ {
+ ref char srcChars = ref MemoryMarshal.GetReference(utf16);
+ ref byte destBytes = ref MemoryMarshal.GetReference(bytes);
+
+ int srcLength = utf16.Length & ~0x3; // only decode input up to the closest multiple of 4.
+ int destLength = bytes.Length;
+
+ int sourceIndex = 0;
+ int destIndex = 0;
+
+ if (utf16.Length == 0)
+ goto DoneExit;
+
+ ref sbyte decodingMap = ref s_decodingMap[0];
+
+ // Last bytes could have padding characters, so process them separately and treat them as valid.
+ const int skipLastChunk = 4;
+
+ int maxSrcLength;
+ if (destLength >= (srcLength >> 2) * 3)
+ {
+ maxSrcLength = srcLength - skipLastChunk;
+ }
+ else
+ {
+ // This should never overflow since destLength here is less than int.MaxValue / 4 * 3 (i.e. 1610612733)
+ // Therefore, (destLength / 3) * 4 will always be less than 2147483641
+ maxSrcLength = (destLength / 3) * 4;
+ }
+
+ while (sourceIndex < maxSrcLength)
+ {
+ int result = Decode(ref Unsafe.Add(ref srcChars, sourceIndex), ref decodingMap);
+ if (result < 0)
+ goto InvalidExit;
+ WriteThreeLowOrderBytes(ref Unsafe.Add(ref destBytes, destIndex), result);
+ destIndex += 3;
+ sourceIndex += 4;
+ }
+
+ if (maxSrcLength != srcLength - skipLastChunk)
+ goto InvalidExit;
+
+ // If input is less than 4 bytes, srcLength == sourceIndex == 0
+ // If input is not a multiple of 4, sourceIndex == srcLength != 0
+ if (sourceIndex == srcLength)
+ {
+ goto InvalidExit;
+ }
+
+ int i0 = Unsafe.Add(ref srcChars, srcLength - 4);
+ int i1 = Unsafe.Add(ref srcChars, srcLength - 3);
+ int i2 = Unsafe.Add(ref srcChars, srcLength - 2);
+ int i3 = Unsafe.Add(ref srcChars, srcLength - 1);
+ if (((i0 | i1 | i2 | i3) & 0xffffff00) != 0)
+ goto InvalidExit;
+
+ i0 = Unsafe.Add(ref decodingMap, i0);
+ i1 = Unsafe.Add(ref decodingMap, i1);
+
+ i0 <<= 18;
+ i1 <<= 12;
+
+ i0 |= i1;
+
+ if (i3 != EncodingPad)
+ {
+ i2 = Unsafe.Add(ref decodingMap, i2);
+ i3 = Unsafe.Add(ref decodingMap, i3);
+
+ i2 <<= 6;
+
+ i0 |= i3;
+ i0 |= i2;
+
+ if (i0 < 0)
+ goto InvalidExit;
+ if (destIndex > destLength - 3)
+ goto InvalidExit;
+ WriteThreeLowOrderBytes(ref Unsafe.Add(ref destBytes, destIndex), i0);
+ destIndex += 3;
+ }
+ else if (i2 != EncodingPad)
+ {
+ i2 = Unsafe.Add(ref decodingMap, i2);
+
+ i2 <<= 6;
+
+ i0 |= i2;
+
+ if (i0 < 0)
+ goto InvalidExit;
+ if (destIndex > destLength - 2)
+ goto InvalidExit;
+ Unsafe.Add(ref destBytes, destIndex) = (byte)(i0 >> 16);
+ Unsafe.Add(ref destBytes, destIndex + 1) = (byte)(i0 >> 8);
+ destIndex += 2;
+ }
+ else
+ {
+ if (i0 < 0)
+ goto InvalidExit;
+ if (destIndex > destLength - 1)
+ goto InvalidExit;
+ Unsafe.Add(ref destBytes, destIndex) = (byte)(i0 >> 16);
+ destIndex += 1;
+ }
+
+ sourceIndex += 4;
+
+ if (srcLength != utf16.Length)
+ goto InvalidExit;
+
+ DoneExit:
+ consumed = sourceIndex;
+ written = destIndex;
+ return true;
+
+ InvalidExit:
+ consumed = sourceIndex;
+ written = destIndex;
+ Debug.Assert((consumed % 4) == 0);
+ return false;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static int Decode(ref char encodedChars, ref sbyte decodingMap)
+ {
+ int i0 = encodedChars;
+ int i1 = Unsafe.Add(ref encodedChars, 1);
+ int i2 = Unsafe.Add(ref encodedChars, 2);
+ int i3 = Unsafe.Add(ref encodedChars, 3);
+
+ if (((i0 | i1 | i2 | i3) & 0xffffff00) != 0)
+ return -1; // One or more chars falls outside the 00..ff range. This cannot be a valid Base64 character.
+
+ i0 = Unsafe.Add(ref decodingMap, i0);
+ i1 = Unsafe.Add(ref decodingMap, i1);
+ i2 = Unsafe.Add(ref decodingMap, i2);
+ i3 = Unsafe.Add(ref decodingMap, i3);
+
+ i0 <<= 18;
+ i1 <<= 12;
+ i2 <<= 6;
+
+ i0 |= i3;
+ i1 |= i2;
+
+ i0 |= i1;
+ return i0;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static void WriteThreeLowOrderBytes(ref byte destination, int value)
+ {
+ destination = (byte)(value >> 16);
+ Unsafe.Add(ref destination, 1) = (byte)(value >> 8);
+ Unsafe.Add(ref destination, 2) = (byte)value;
+ }
+
+ // Pre-computing this table using a custom string(s_characters) and GenerateDecodingMapAndVerify (found in tests)
+ private static readonly sbyte[] s_decodingMap = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, //62 is placed at index 43 (for +), 63 at index 47 (for /)
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, //52-61 are placed at index 48-57 (for 0-9), 64 at index 61 (for =)
+ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, //0-25 are placed at index 65-90 (for A-Z)
+ -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, //26-51 are placed at index 97-122 (for a-z)
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Bytes over 122 ('z') are invalid and cannot be decoded
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Hence, padding the map with 255, which indicates invalid input
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ };
+
+ private const byte EncodingPad = (byte)'='; // '=', for padding
+ }
+}
diff --git a/src/mscorlib/shared/System/Convert.cs b/src/mscorlib/shared/System/Convert.cs
index 756bf17fc5..63342ad000 100644
--- a/src/mscorlib/shared/System/Convert.cs
+++ b/src/mscorlib/shared/System/Convert.cs
@@ -96,7 +96,7 @@ namespace System
// When passed Value.DBNull, the Value.ToXXX() methods all throw an
// InvalidCastException.
- public static class Convert
+ public static partial class Convert
{
//A typeof operation is fairly expensive (does a system call), so we'll cache these here
//statically. These are exactly lined up with the TypeCode, eg. ConvertType[TypeCode.Int16]
@@ -2656,44 +2656,124 @@ namespace System
return TryFromBase64Chars(s.AsSpan(), bytes, out bytesWritten);
}
- public static unsafe bool TryFromBase64Chars(ReadOnlySpan<char> chars, Span<byte> bytes, out int bytesWritten)
+ public static bool TryFromBase64Chars(ReadOnlySpan<char> chars, Span<byte> bytes, out int bytesWritten)
{
- if (chars.Length == 0)
- {
- bytesWritten = 0;
- return true;
- }
+ // This is actually local to one of the nested blocks but is being declared at the top as we don't want multiple stackallocs
+ // for each iteraton of the loop.
+ Span<char> tempBuffer = stackalloc char[4]; // Note: The tempBuffer size could be made larger than 4 but the size must be a multiple of 4.
- // We need to get rid of any trailing white spaces.
- // Otherwise we would be rejecting input such as "abc= ":
- while (chars.Length > 0)
+ bytesWritten = 0;
+
+ while (chars.Length != 0)
{
- char lastChar = chars[chars.Length - 1];
- if (lastChar != ' ' && lastChar != '\n' && lastChar != '\r' && lastChar != '\t')
+ // Attempt to decode a segment that doesn't contain whitespace.
+ bool complete = TryDecodeFromUtf16(chars, bytes, out int consumedInThisIteration, out int bytesWrittenInThisIteration);
+ bytesWritten += bytesWrittenInThisIteration;
+ if (complete)
+ return true;
+
+ chars = chars.Slice(consumedInThisIteration);
+ bytes = bytes.Slice(bytesWrittenInThisIteration);
+
+ Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false.
+ if (chars[0].IsSpace())
{
- break;
- }
- chars = chars.Slice(0, chars.Length - 1);
- }
+ // If we got here, the very first character not consumed was a whitespace. We can skip past any consecutive whitespace, then continue decoding.
- fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
- {
- int resultLength = FromBase64_ComputeResultLength(charsPtr, chars.Length);
- Debug.Assert(resultLength >= 0);
- if (resultLength > bytes.Length)
+ int indexOfFirstNonSpace = 1;
+ for (; ; )
+ {
+ if (indexOfFirstNonSpace == chars.Length)
+ break;
+ if (!chars[indexOfFirstNonSpace].IsSpace())
+ break;
+ indexOfFirstNonSpace++;
+ }
+
+ chars = chars.Slice(indexOfFirstNonSpace);
+
+ if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0)
+ {
+ // If we got here, the last successfully decoded block encountered an end-marker, yet we have trailing non-whitespace characters.
+ // That is not allowed.
+ bytesWritten = default;
+ return false;
+ }
+
+ // We now loop again to decode the next run of non-space characters.
+ }
+ else
{
- bytesWritten = 0;
- return false;
+ Debug.Assert(chars.Length != 0 && !chars[0].IsSpace());
+
+ // If we got here, it is possible that there is whitespace that occurred in the middle of a 4-byte chunk. That is, we still have
+ // up to three Base64 characters that were left undecoded by the fast-path helper because they didn't form a complete 4-byte chunk.
+ // This is hopefully the rare case (multiline-formatted base64 message with a non-space character width that's not a multiple of 4.)
+ // We'll filter out whitespace and copy the remaining characters into a temporary buffer.
+ CopyToTempBufferWithoutWhiteSpace(chars, tempBuffer, out int consumedFromChars, out int charsWritten);
+ if ((charsWritten & 0x3) != 0)
+ {
+ // Even after stripping out whitespace, the number of characters is not divisible by 4. This cannot be a legal Base64 string.
+ bytesWritten = default;
+ return false;
+ }
+
+ tempBuffer = tempBuffer.Slice(0, charsWritten);
+ if (!TryDecodeFromUtf16(tempBuffer, bytes, out int consumedFromTempBuffer, out int bytesWrittenFromTempBuffer))
+ {
+ bytesWritten = default;
+ return false;
+ }
+ bytesWritten += bytesWrittenFromTempBuffer;
+ chars = chars.Slice(consumedFromChars);
+ bytes = bytes.Slice(bytesWrittenFromTempBuffer);
+
+ if ((bytesWrittenFromTempBuffer % 3) != 0)
+ {
+ // If we got here, this decode contained one or more padding characters ('='). We can accept trailing whitespace after this
+ // but nothing else.
+ for (int i = 0; i < chars.Length; i++)
+ {
+ if (!chars[i].IsSpace())
+ {
+ bytesWritten = default;
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // We now loop again to decode the next run of non-space characters.
}
+ }
- fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
+ return true;
+ }
+
+ private static void CopyToTempBufferWithoutWhiteSpace(ReadOnlySpan<char> chars, Span<char> tempBuffer, out int consumed, out int charsWritten)
+ {
+ Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer.
+
+ charsWritten = 0;
+ for (int i = 0; i < chars.Length; i++)
+ {
+ char c = chars[i];
+ if (!c.IsSpace())
{
- bytesWritten = FromBase64_Decode(charsPtr, chars.Length, bytesPtr, bytes.Length);
- return true;
+ tempBuffer[charsWritten++] = c;
+ if (charsWritten == tempBuffer.Length)
+ {
+ consumed = i + 1;
+ return;
+ }
}
}
+ consumed = chars.Length;
}
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static bool IsSpace(this char c) => c == ' ' || c == '\t' || c == '\r' || c == '\n';
+
/// <summary>
/// Converts the specified range of a Char array, which encodes binary data as Base64 digits, to the equivalent byte array.
/// </summary>
@@ -2730,8 +2810,6 @@ namespace System
}
}
-
-
/// <summary>
/// Convert Base64 encoding characters to bytes:
/// - Compute result length exactly by actually walking the input;
@@ -2769,11 +2847,10 @@ namespace System
Byte[] decodedBytes = new Byte[resultLength];
// Convert Base64 chars into bytes:
- Int32 actualResultLength;
- fixed (Byte* decodedBytesPtr = decodedBytes)
- actualResultLength = FromBase64_Decode(inputPtr, inputLength, decodedBytesPtr, resultLength);
+ if (!TryFromBase64Chars(new ReadOnlySpan<char>(inputPtr, inputLength), decodedBytes, out int _))
+ throw new FormatException(SR.Format_BadBase64Char);
- // Note that actualResultLength can differ from resultLength if the caller is modifying the array
+ // Note that the number of bytes written can differ from resultLength if the caller is modifying the array
// as it is being converted. Silently ignore the failure.
// Consider throwing exception in an non in-place release.
@@ -2781,199 +2858,6 @@ namespace System
return decodedBytes;
}
-
- /// <summary>
- /// Decode characters representing a Base64 encoding into bytes:
- /// Walk the input. Every time 4 chars are read, convert them to the 3 corresponding output bytes.
- /// This method is a bit lengthy on purpose. We are trying to avoid jumps to helpers in the loop
- /// to aid performance.
- /// </summary>
- /// <param name="inputPtr">Pointer to first input char</param>
- /// <param name="inputLength">Number of input chars</param>
- /// <param name="destPtr">Pointer to location for the first result byte</param>
- /// <param name="destLength">Max length of the preallocated result buffer</param>
- /// <returns>If the result buffer was not large enough to write all result bytes, return -1;
- /// Otherwise return the number of result bytes actually produced.</returns>
- private static unsafe Int32 FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
- {
- // You may find this method weird to look at. It's written for performance, not aesthetics.
- // You will find unrolled loops label jumps and bit manipulations.
-
- const UInt32 intA = (UInt32)'A';
- const UInt32 inta = (UInt32)'a';
- const UInt32 int0 = (UInt32)'0';
- const UInt32 intEq = (UInt32)'=';
- const UInt32 intPlus = (UInt32)'+';
- const UInt32 intSlash = (UInt32)'/';
- const UInt32 intSpace = (UInt32)' ';
- const UInt32 intTab = (UInt32)'\t';
- const UInt32 intNLn = (UInt32)'\n';
- const UInt32 intCRt = (UInt32)'\r';
- const UInt32 intAtoZ = (UInt32)('Z' - 'A'); // = ('z' - 'a')
- const UInt32 int0to9 = (UInt32)('9' - '0');
-
- Char* inputPtr = startInputPtr;
- Byte* destPtr = startDestPtr;
-
- // Pointers to the end of input and output:
- Char* endInputPtr = inputPtr + inputLength;
- Byte* endDestPtr = destPtr + destLength;
-
- // Current char code/value:
- UInt32 currCode;
-
- // This 4-byte integer will contain the 4 codes of the current 4-char group.
- // Eeach char codes for 6 bits = 24 bits.
- // The remaining byte will be FF, we use it as a marker when 4 chars have been processed.
- UInt32 currBlockCodes = 0x000000FFu;
-
- unchecked
- {
- while (true)
- {
- // break when done:
- if (inputPtr >= endInputPtr)
- goto _AllInputConsumed;
-
- // Get current char:
- currCode = (UInt32)(*inputPtr);
- inputPtr++;
-
- // Determine current char code:
-
- if (currCode - intA <= intAtoZ)
- currCode -= intA;
-
- else if (currCode - inta <= intAtoZ)
- currCode -= (inta - 26u);
-
- else if (currCode - int0 <= int0to9)
- currCode -= (int0 - 52u);
-
- else
- {
- // Use the slower switch for less common cases:
- switch (currCode)
- {
- // Significant chars:
- case intPlus:
- currCode = 62u;
- break;
-
- case intSlash:
- currCode = 63u;
- break;
-
- // Legal no-value chars (we ignore these):
- case intCRt:
- case intNLn:
- case intSpace:
- case intTab:
- continue;
-
- // The equality char is only legal at the end of the input.
- // Jump after the loop to make it easier for the JIT register predictor to do a good job for the loop itself:
- case intEq:
- goto _EqualityCharEncountered;
-
- // Other chars are illegal:
- default:
- throw new FormatException(SR.Format_BadBase64Char);
- }
- }
-
- // Ok, we got the code. Save it:
- currBlockCodes = (currBlockCodes << 6) | currCode;
-
- // Last bit in currBlockCodes will be on after in shifted right 4 times:
- if ((currBlockCodes & 0x80000000u) != 0u)
- {
- if ((Int32)(endDestPtr - destPtr) < 3)
- return -1;
-
- *(destPtr) = (Byte)(currBlockCodes >> 16);
- *(destPtr + 1) = (Byte)(currBlockCodes >> 8);
- *(destPtr + 2) = (Byte)(currBlockCodes);
- destPtr += 3;
-
- currBlockCodes = 0x000000FFu;
- }
- }
- } // unchecked while
-
- // 'd be nice to have an assert that we never get here, but CS0162: Unreachable code detected.
- // Debug.Fail("We only leave the above loop by jumping; should never get here.");
-
- // We jump here out of the loop if we hit an '=':
- _EqualityCharEncountered:
-
- Debug.Assert(currCode == intEq);
-
- // Recall that inputPtr is now one position past where '=' was read.
- // '=' can only be at the last input pos:
- if (inputPtr == endInputPtr)
- {
- // Code is zero for trailing '=':
- currBlockCodes <<= 6;
-
- // The '=' did not complete a 4-group. The input must be bad:
- if ((currBlockCodes & 0x80000000u) == 0u)
- throw new FormatException(SR.Format_BadBase64CharArrayLength);
-
- if ((int)(endDestPtr - destPtr) < 2) // Autch! We underestimated the output length!
- return -1;
-
- // We are good, store bytes form this past group. We had a single "=", so we take two bytes:
- *(destPtr++) = (Byte)(currBlockCodes >> 16);
- *(destPtr++) = (Byte)(currBlockCodes >> 8);
-
- currBlockCodes = 0x000000FFu;
- }
- else
- { // '=' can also be at the pre-last position iff the last is also a '=' excluding the white spaces:
- // We need to get rid of any intermediate white spaces.
- // Otherwise we would be rejecting input such as "abc= =":
- while (inputPtr < (endInputPtr - 1))
- {
- Int32 lastChar = *(inputPtr);
- if (lastChar != (Int32)' ' && lastChar != (Int32)'\n' && lastChar != (Int32)'\r' && lastChar != (Int32)'\t')
- break;
- inputPtr++;
- }
-
- if (inputPtr == (endInputPtr - 1) && *(inputPtr) == '=')
- {
- // Code is zero for each of the two '=':
- currBlockCodes <<= 12;
-
- // The '=' did not complete a 4-group. The input must be bad:
- if ((currBlockCodes & 0x80000000u) == 0u)
- throw new FormatException(SR.Format_BadBase64CharArrayLength);
-
- if ((Int32)(endDestPtr - destPtr) < 1) // Autch! We underestimated the output length!
- return -1;
-
- // We are good, store bytes form this past group. We had a "==", so we take only one byte:
- *(destPtr++) = (Byte)(currBlockCodes >> 16);
-
- currBlockCodes = 0x000000FFu;
- }
- else // '=' is not ok at places other than the end:
- throw new FormatException(SR.Format_BadBase64Char);
- }
-
- // We get here either from above or by jumping out of the loop:
- _AllInputConsumed:
-
- // The last block of chars has less than 4 items
- if (currBlockCodes != 0x000000FFu)
- throw new FormatException(SR.Format_BadBase64CharArrayLength);
-
- // Return how many bytes were actually recovered:
- return (Int32)(destPtr - startDestPtr);
- } // Int32 FromBase64_Decode(...)
-
-
/// <summary>
/// Compute the number of bytes encoded in the specified Base 64 char array:
/// Walk the entire input counting white spaces and padding chars, then compute result length
diff --git a/src/mscorlib/shared/System/DateTime.cs b/src/mscorlib/shared/System/DateTime.cs
index d3116ee25a..9c3b3989e4 100644
--- a/src/mscorlib/shared/System/DateTime.cs
+++ b/src/mscorlib/shared/System/DateTime.cs
@@ -1255,46 +1255,46 @@ namespace System
public String ToLongDateString()
{
- return DateTimeFormat.Format(this, "D", DateTimeFormatInfo.CurrentInfo);
+ return DateTimeFormat.Format(this, "D", null);
}
public String ToLongTimeString()
{
- return DateTimeFormat.Format(this, "T", DateTimeFormatInfo.CurrentInfo);
+ return DateTimeFormat.Format(this, "T", null);
}
public String ToShortDateString()
{
- return DateTimeFormat.Format(this, "d", DateTimeFormatInfo.CurrentInfo);
+ return DateTimeFormat.Format(this, "d", null);
}
public String ToShortTimeString()
{
- return DateTimeFormat.Format(this, "t", DateTimeFormatInfo.CurrentInfo);
+ return DateTimeFormat.Format(this, "t", null);
}
public override String ToString()
{
- return DateTimeFormat.Format(this, null, DateTimeFormatInfo.CurrentInfo);
+ return DateTimeFormat.Format(this, null, null);
}
public String ToString(String format)
{
- return DateTimeFormat.Format(this, format, DateTimeFormatInfo.CurrentInfo);
+ return DateTimeFormat.Format(this, format, null);
}
public String ToString(IFormatProvider provider)
{
- return DateTimeFormat.Format(this, null, DateTimeFormatInfo.GetInstance(provider));
+ return DateTimeFormat.Format(this, null, provider);
}
public String ToString(String format, IFormatProvider provider)
{
- return DateTimeFormat.Format(this, format, DateTimeFormatInfo.GetInstance(provider));
+ return DateTimeFormat.Format(this, format, provider);
}
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider provider = null) =>
- DateTimeFormat.TryFormat(this, destination, out charsWritten, format, DateTimeFormatInfo.GetInstance(provider));
+ DateTimeFormat.TryFormat(this, destination, out charsWritten, format, provider);
public DateTime ToUniversalTime()
{
diff --git a/src/mscorlib/shared/System/DateTimeOffset.cs b/src/mscorlib/shared/System/DateTimeOffset.cs
index 1498f9365c..3c3f3f42a2 100644
--- a/src/mscorlib/shared/System/DateTimeOffset.cs
+++ b/src/mscorlib/shared/System/DateTimeOffset.cs
@@ -755,26 +755,26 @@ namespace System
public override String ToString()
{
- return DateTimeFormat.Format(ClockDateTime, null, DateTimeFormatInfo.CurrentInfo, Offset);
+ return DateTimeFormat.Format(ClockDateTime, null, null, Offset);
}
public String ToString(String format)
{
- return DateTimeFormat.Format(ClockDateTime, format, DateTimeFormatInfo.CurrentInfo, Offset);
+ return DateTimeFormat.Format(ClockDateTime, format, null, Offset);
}
public String ToString(IFormatProvider formatProvider)
{
- return DateTimeFormat.Format(ClockDateTime, null, DateTimeFormatInfo.GetInstance(formatProvider), Offset);
+ return DateTimeFormat.Format(ClockDateTime, null, formatProvider, Offset);
}
public String ToString(String format, IFormatProvider formatProvider)
{
- return DateTimeFormat.Format(ClockDateTime, format, DateTimeFormatInfo.GetInstance(formatProvider), Offset);
+ return DateTimeFormat.Format(ClockDateTime, format, formatProvider, Offset);
}
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider formatProvider = null) =>
- DateTimeFormat.TryFormat(ClockDateTime, destination, out charsWritten, format, DateTimeFormatInfo.GetInstance(formatProvider), Offset);
+ DateTimeFormat.TryFormat(ClockDateTime, destination, out charsWritten, format, formatProvider, Offset);
public DateTimeOffset ToUniversalTime()
{
diff --git a/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs b/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs
index 21e03e0fd1..1836a1f27d 100644
--- a/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs
+++ b/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs
@@ -901,7 +901,7 @@ namespace System.Diagnostics.Tracing
EventSource.EventData* descrs = stackalloc EventSource.EventData[2];
descrs[0].DataPointer = (IntPtr)string1Bytes;
descrs[0].Size = ((arg1.Length + 1) * 2);
- descrs[1].Reserved = 0;
+ descrs[0].Reserved = 0;
descrs[1].DataPointer = (IntPtr)(&arg2);
descrs[1].Size = 8;
descrs[1].Reserved = 0;
diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs b/src/mscorlib/shared/System/Globalization/CompareInfo.Unix.cs
index e9fdf01ab6..5a68492c69 100644
--- a/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs
+++ b/src/mscorlib/shared/System/Globalization/CompareInfo.Unix.cs
@@ -2,6 +2,7 @@
// 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.Buffers;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -180,6 +181,8 @@ namespace System.Globalization
private static unsafe int CompareStringOrdinalIgnoreCase(char* string1, int count1, char* string2, int count2)
{
Debug.Assert(!GlobalizationMode.Invariant);
+ Debug.Assert(string1 != null);
+ Debug.Assert(string2 != null);
return Interop.Globalization.CompareStringOrdinalIgnoreCase(string1, count1, string2, count2);
}
@@ -240,6 +243,7 @@ namespace System.Globalization
return index;
}
+#if CORECLR
if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && target.IsFastSort())
{
index = IndexOf(source, target, startIndex, count, GetOrdinalCompareOptions(options));
@@ -250,6 +254,7 @@ namespace System.Globalization
}
return index;
}
+#endif
fixed (char* pSource = source)
{
@@ -430,10 +435,12 @@ namespace System.Globalization
return LastIndexOfOrdinalCore(source, target, startIndex, count, ignoreCase: false);
}
+#if CORECLR
if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && target.IsFastSort())
{
return LastIndexOf(source, target, startIndex, count, GetOrdinalCompareOptions(options));
}
+#endif
// startIndex is the index into source where we start search backwards from. leftStartIndex is the index into source
// of the start of the string that is count characters away from startIndex.
@@ -455,10 +462,12 @@ namespace System.Globalization
Debug.Assert(!string.IsNullOrEmpty(prefix));
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
+#if CORECLR
if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && prefix.IsFastSort())
{
return IsPrefix(source, prefix, GetOrdinalCompareOptions(options));
}
+#endif
return Interop.Globalization.StartsWith(_sortHandle, prefix, prefix.Length, source, source.Length, options);
}
@@ -586,10 +595,12 @@ namespace System.Globalization
Debug.Assert(!string.IsNullOrEmpty(suffix));
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
+#if CORECLR
if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && suffix.IsFastSort())
{
return IsSuffix(source, suffix, GetOrdinalCompareOptions(options));
}
+#endif
return Interop.Globalization.EndsWith(_sortHandle, suffix, suffix.Length, source, source.Length, options);
}
@@ -601,7 +612,7 @@ namespace System.Globalization
Debug.Assert(!source.IsEmpty);
Debug.Assert(!suffix.IsEmpty);
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
+
if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options))
{
if (source.Length < suffix.Length)
@@ -732,7 +743,10 @@ namespace System.Globalization
fixed (byte* pSortKey = keyData)
{
- Interop.Globalization.GetSortKey(_sortHandle, source, source.Length, pSortKey, sortKeyLength, options);
+ if (Interop.Globalization.GetSortKey(_sortHandle, source, source.Length, pSortKey, sortKeyLength, options) != sortKeyLength)
+ {
+ throw new ArgumentException(SR.Arg_ExternalException);
+ }
}
}
@@ -796,25 +810,29 @@ namespace System.Globalization
int sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, source, source.Length, null, 0, options);
- // As an optimization, for small sort keys we allocate the buffer on the stack.
- if (sortKeyLength <= 256)
+ byte[] borrowedArr = null;
+ Span<byte> span = sortKeyLength <= 512 ?
+ stackalloc byte[512] :
+ (borrowedArr = ArrayPool<byte>.Shared.Rent(sortKeyLength));
+
+ fixed (byte* pSortKey = &MemoryMarshal.GetReference(span))
{
- byte* pSortKey = stackalloc byte[sortKeyLength];
- Interop.Globalization.GetSortKey(_sortHandle, source, source.Length, pSortKey, sortKeyLength, options);
- return InternalHashSortKey(pSortKey, sortKeyLength);
+ if (Interop.Globalization.GetSortKey(_sortHandle, source, source.Length, pSortKey, sortKeyLength, options) != sortKeyLength)
+ {
+ throw new ArgumentException(SR.Arg_ExternalException);
+ }
}
- byte[] sortKey = new byte[sortKeyLength];
+ int hash = Marvin.ComputeHash32(span.Slice(0, sortKeyLength), Marvin.DefaultSeed);
- fixed (byte* pSortKey = sortKey)
+ // Return the borrowed array if necessary.
+ if (borrowedArr != null)
{
- Interop.Globalization.GetSortKey(_sortHandle, source, source.Length, pSortKey, sortKeyLength, options);
- return InternalHashSortKey(pSortKey, sortKeyLength);
+ ArrayPool<byte>.Shared.Return(borrowedArr);
}
- }
- [DllImport(JitHelpers.QCall)]
- private static extern unsafe int InternalHashSortKey(byte* sortKey, int sortKeyLength);
+ return hash;
+ }
private static CompareOptions GetOrdinalCompareOptions(CompareOptions options)
{
diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs b/src/mscorlib/shared/System/Globalization/CompareInfo.Windows.cs
index 1188c21167..37ed9469d9 100644
--- a/src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs
+++ b/src/mscorlib/shared/System/Globalization/CompareInfo.Windows.cs
@@ -2,10 +2,11 @@
// 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.Security;
+using System.Buffers;
using System.Diagnostics;
-using System.Runtime.InteropServices;
+using System.Security;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
namespace System.Globalization
{
@@ -15,9 +16,6 @@ namespace System.Globalization
{
_sortName = culture.SortName;
- m_name = culture._name;
- _sortName = culture.SortName;
-
if (_invariantMode)
{
_sortHandle = IntPtr.Zero;
@@ -25,6 +23,7 @@ namespace System.Globalization
else
{
const uint LCMAP_SORTHANDLE = 0x20000000;
+
IntPtr handle;
int ret = Interop.Kernel32.LCMapStringEx(_sortName, LCMAP_SORTHANDLE, null, 0, &handle, IntPtr.Size, null, null, IntPtr.Zero);
_sortHandle = ret > 0 ? handle : IntPtr.Zero;
@@ -41,6 +40,8 @@ namespace System.Globalization
bool bIgnoreCase)
{
Debug.Assert(!GlobalizationMode.Invariant);
+ Debug.Assert(stringSource != null);
+ Debug.Assert(value != null);
fixed (char* pSource = stringSource)
fixed (char* pValue = value)
@@ -63,6 +64,8 @@ namespace System.Globalization
bool bIgnoreCase)
{
Debug.Assert(!GlobalizationMode.Invariant);
+ Debug.Assert(!source.IsEmpty);
+ Debug.Assert(!value.IsEmpty);
fixed (char* pSource = &MemoryMarshal.GetReference(source))
fixed (char* pValue = &MemoryMarshal.GetReference(value))
@@ -120,29 +123,54 @@ namespace System.Globalization
return 0;
}
- int flags = GetNativeCompareFlags(options);
- int tmpHash = 0;
-#if CORECLR
- tmpHash = InternalGetGlobalizedHashCode(_sortHandle, _sortName, source, source.Length, flags);
-#else
+ uint flags = LCMAP_SORTKEY | (uint)GetNativeCompareFlags(options);
+
fixed (char* pSource = source)
{
- if (Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName,
- LCMAP_HASH | (uint)flags,
+ int sortKeyLength = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName,
+ flags,
pSource, source.Length,
- &tmpHash, sizeof(int),
- null, null, _sortHandle) == 0)
+ null, 0,
+ null, null, _sortHandle);
+ if (sortKeyLength == 0)
+ {
+ throw new ArgumentException(SR.Arg_ExternalException);
+ }
+
+ byte[] borrowedArr = null;
+ Span<byte> span = sortKeyLength <= 512 ?
+ stackalloc byte[512] :
+ (borrowedArr = ArrayPool<byte>.Shared.Rent(sortKeyLength));
+
+ fixed (byte* pSortKey = &MemoryMarshal.GetReference(span))
{
- Environment.FailFast("LCMapStringEx failed!");
+ if (Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName,
+ flags,
+ pSource, source.Length,
+ pSortKey, sortKeyLength,
+ null, null, _sortHandle) != sortKeyLength)
+ {
+ throw new ArgumentException(SR.Arg_ExternalException);
+ }
}
+
+ int hash = Marvin.ComputeHash32(span.Slice(0, sortKeyLength), Marvin.DefaultSeed);
+
+ // Return the borrowed array if necessary.
+ if (borrowedArr != null)
+ {
+ ArrayPool<byte>.Shared.Return(borrowedArr);
+ }
+
+ return hash;
}
-#endif
- return tmpHash;
}
private static unsafe int CompareStringOrdinalIgnoreCase(char* string1, int count1, char* string2, int count2)
{
Debug.Assert(!GlobalizationMode.Invariant);
+ Debug.Assert(string1 != null);
+ Debug.Assert(string2 != null);
// Use the OS to compare and then convert the result to expected value by subtracting 2
return Interop.Kernel32.CompareStringOrdinal(string1, count1, string2, count2, true) - 2;
@@ -163,6 +191,7 @@ namespace System.Globalization
fixed (char* pString1 = &MemoryMarshal.GetReference(string1))
fixed (char* pString2 = &string2.GetRawStringData())
{
+ Debug.Assert(pString1 != null);
int result = Interop.Kernel32.CompareStringEx(
pLocaleName,
(uint)GetNativeCompareFlags(options),
@@ -176,7 +205,7 @@ namespace System.Globalization
if (result == 0)
{
- Environment.FailFast("CompareStringEx failed");
+ throw new ArgumentException(SR.Arg_ExternalException);
}
// Map CompareStringEx return value to -1, 0, 1.
@@ -195,6 +224,8 @@ namespace System.Globalization
fixed (char* pString1 = &MemoryMarshal.GetReference(string1))
fixed (char* pString2 = &MemoryMarshal.GetReference(string2))
{
+ Debug.Assert(pString1 != null);
+ Debug.Assert(pString2 != null);
int result = Interop.Kernel32.CompareStringEx(
pLocaleName,
(uint)GetNativeCompareFlags(options),
@@ -208,7 +239,7 @@ namespace System.Globalization
if (result == 0)
{
- Environment.FailFast("CompareStringEx failed");
+ throw new ArgumentException(SR.Arg_ExternalException);
}
// Map CompareStringEx return value to -1, 0, 1.
@@ -223,6 +254,8 @@ namespace System.Globalization
int* pcchFound)
{
Debug.Assert(!_invariantMode);
+ Debug.Assert(!lpStringSource.IsEmpty);
+ Debug.Assert(!lpStringValue.IsEmpty);
string localeName = _sortHandle != IntPtr.Zero ? null : _sortName;
@@ -255,6 +288,8 @@ namespace System.Globalization
int* pcchFound)
{
Debug.Assert(!_invariantMode);
+ Debug.Assert(lpStringSource != null);
+ Debug.Assert(lpStringValue != null);
string localeName = _sortHandle != IntPtr.Zero ? null : _sortName;
@@ -342,10 +377,8 @@ namespace System.Globalization
Debug.Assert(target != null);
Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
- // TODO: Consider moving this up to the relevent APIs we need to ensure this behavior for
- // and add a precondition that target is not empty.
if (target.Length == 0)
- return startIndex; // keep Whidbey compatibility
+ return startIndex;
if ((options & CompareOptions.Ordinal) != 0)
{
@@ -516,27 +549,32 @@ namespace System.Globalization
}
else
{
+ uint flags = LCMAP_SORTKEY | (uint)GetNativeCompareFlags(options);
+
fixed (char *pSource = source)
{
- int result = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName,
- LCMAP_SORTKEY | (uint) GetNativeCompareFlags(options),
+ int sortKeyLength = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName,
+ flags,
pSource, source.Length,
null, 0,
null, null, _sortHandle);
- if (result == 0)
+ if (sortKeyLength == 0)
{
- throw new ArgumentException(SR.Argument_InvalidFlag, "source");
+ throw new ArgumentException(SR.Arg_ExternalException);
}
- keyData = new byte[result];
+ keyData = new byte[sortKeyLength];
fixed (byte* pBytes = keyData)
{
- result = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName,
- LCMAP_SORTKEY | (uint) GetNativeCompareFlags(options),
+ if (Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName,
+ flags,
pSource, source.Length,
pBytes, keyData.Length,
- null, null, _sortHandle);
+ null, null, _sortHandle) != sortKeyLength)
+ {
+ throw new ArgumentException(SR.Arg_ExternalException);
+ }
}
}
}
@@ -547,6 +585,7 @@ namespace System.Globalization
private static unsafe bool IsSortable(char* text, int length)
{
Debug.Assert(!GlobalizationMode.Invariant);
+ Debug.Assert(text != null);
return Interop.Kernel32.IsNLSDefinedString(Interop.Kernel32.COMPARE_STRING, 0, IntPtr.Zero, text, length);
}
@@ -594,18 +633,12 @@ namespace System.Globalization
Debug.Assert(!_invariantMode);
Interop.Kernel32.NlsVersionInfoEx nlsVersion = new Interop.Kernel32.NlsVersionInfoEx();
- nlsVersion.dwNLSVersionInfoSize = Marshal.SizeOf(typeof(Interop.Kernel32.NlsVersionInfoEx));
+ nlsVersion.dwNLSVersionInfoSize = sizeof(Interop.Kernel32.NlsVersionInfoEx);
Interop.Kernel32.GetNLSVersionEx(Interop.Kernel32.COMPARE_STRING, _sortName, &nlsVersion);
return new SortVersion(
nlsVersion.dwNLSVersion,
nlsVersion.dwEffectiveId == 0 ? LCID : nlsVersion.dwEffectiveId,
nlsVersion.guidCustomVersion);
}
-
-#if CORECLR
- // Get a locale sensitive sort hash code from native code -- COMNlsInfo::InternalGetGlobalizedHashCode
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- private static extern int InternalGetGlobalizedHashCode(IntPtr handle, string localeName, string source, int length, int dwFlags);
-#endif
}
}
diff --git a/src/mscorlib/shared/System/Globalization/CompareInfo.cs b/src/mscorlib/shared/System/Globalization/CompareInfo.cs
index f54ecd9144..079b8afbc0 100644
--- a/src/mscorlib/shared/System/Globalization/CompareInfo.cs
+++ b/src/mscorlib/shared/System/Globalization/CompareInfo.cs
@@ -341,7 +341,7 @@ namespace System.Globalization
if (_invariantMode)
{
if ((options & CompareOptions.IgnoreCase) != 0)
- return CompareOrdinalIgnoreCase(string1, 0, string1.Length, string2, 0, string2.Length);
+ return CompareOrdinalIgnoreCase(string1, string2);
return String.CompareOrdinal(string1, string2);
}
@@ -391,15 +391,23 @@ namespace System.Globalization
return CompareString(string1, string2, options);
}
- internal virtual int CompareOptionNone(ReadOnlySpan<char> string1, ReadOnlySpan<char> string2)
+ internal int CompareOptionNone(ReadOnlySpan<char> string1, ReadOnlySpan<char> string2)
{
+ // Check for empty span or span from a null string
+ if (string1.Length == 0 || string2.Length == 0)
+ return string1.Length - string2.Length;
+
return _invariantMode ?
string.CompareOrdinal(string1, string2) :
CompareString(string1, string2, CompareOptions.None);
}
- internal virtual int CompareOptionIgnoreCase(ReadOnlySpan<char> string1, ReadOnlySpan<char> string2)
+ internal int CompareOptionIgnoreCase(ReadOnlySpan<char> string1, ReadOnlySpan<char> string2)
{
+ // Check for empty span or span from a null string
+ if (string1.Length == 0 || string2.Length == 0)
+ return string1.Length - string2.Length;
+
return _invariantMode ?
CompareOrdinalIgnoreCase(string1, string2) :
CompareString(string1, string2, CompareOptions.IgnoreCase);
@@ -493,35 +501,23 @@ namespace System.Globalization
return (1);
}
+ ReadOnlySpan<char> span1 = string1.AsSpan(offset1, length1);
+ ReadOnlySpan<char> span2 = string2.AsSpan(offset2, length2);
+
if (options == CompareOptions.Ordinal)
{
- return CompareOrdinal(string1, offset1, length1,
- string2, offset2, length2);
+ return string.CompareOrdinal(span1, span2);
}
if (_invariantMode)
{
if ((options & CompareOptions.IgnoreCase) != 0)
- return CompareOrdinalIgnoreCase(string1, offset1, length1, string2, offset2, length2);
+ return CompareOrdinalIgnoreCase(span1, span2);
- return CompareOrdinal(string1, offset1, length1, string2, offset2, length2);
+ return string.CompareOrdinal(span1, span2);
}
- return CompareString(
- string1.AsSpan(offset1, length1),
- string2.AsSpan(offset2, length2),
- options);
- }
-
- private static int CompareOrdinal(string string1, int offset1, int length1, string string2, int offset2, int length2)
- {
- int result = String.CompareOrdinal(string1, offset1, string2, offset2,
- (length1 < length2 ? length1 : length2));
- if ((length1 != length2) && result == 0)
- {
- return (length1 > length2 ? 1 : -1);
- }
- return (result);
+ return CompareString(span1, span2, options);
}
//
@@ -892,15 +888,19 @@ namespace System.Globalization
return IndexOfCore(source, value, startIndex, count, options, null);
}
- internal virtual int IndexOfOrdinal(ReadOnlySpan<char> source, ReadOnlySpan<char> value, bool ignoreCase)
+ internal int IndexOfOrdinal(ReadOnlySpan<char> source, ReadOnlySpan<char> value, bool ignoreCase)
{
Debug.Assert(!_invariantMode);
+ Debug.Assert(!source.IsEmpty);
+ Debug.Assert(!value.IsEmpty);
return IndexOfOrdinalCore(source, value, ignoreCase);
}
- internal unsafe virtual int IndexOf(ReadOnlySpan<char> source, ReadOnlySpan<char> value, CompareOptions options)
+ internal unsafe int IndexOf(ReadOnlySpan<char> source, ReadOnlySpan<char> value, CompareOptions options)
{
Debug.Assert(!_invariantMode);
+ Debug.Assert(!source.IsEmpty);
+ Debug.Assert(!value.IsEmpty);
return IndexOfCore(source, value, options, null);
}
@@ -1237,7 +1237,7 @@ namespace System.Globalization
int charsWritten = source.AsSpan().ToUpperInvariant(span);
// Slice the array to the size returned by ToUpperInvariant.
- int hash = Marvin.ComputeHash32(span.Slice(0, charsWritten).AsBytes(), Marvin.DefaultSeed);
+ int hash = Marvin.ComputeHash32(MemoryMarshal.AsBytes(span.Slice(0, charsWritten)), Marvin.DefaultSeed);
// Return the borrowed array if necessary.
if (borrowedArr != null)
diff --git a/src/mscorlib/shared/System/Globalization/DateTimeFormat.cs b/src/mscorlib/shared/System/Globalization/DateTimeFormat.cs
index cd3a150033..092ad0365d 100644
--- a/src/mscorlib/shared/System/Globalization/DateTimeFormat.cs
+++ b/src/mscorlib/shared/System/Globalization/DateTimeFormat.cs
@@ -7,6 +7,7 @@ using System.Diagnostics;
using System.Globalization;
using System.Text;
using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
namespace System
{
@@ -852,9 +853,15 @@ namespace System
offset = offset.Negate();
}
- AppendNumber(result, offset.Hours, 2);
+ Append2DigitNumber(result, offset.Hours);
result.Append(':');
- AppendNumber(result, offset.Minutes, 2);
+ Append2DigitNumber(result, offset.Minutes);
+ }
+
+ private static void Append2DigitNumber(StringBuilder result, int val)
+ {
+ result.Append((char)('0' + (val / 10)));
+ result.Append((char)('0' + (val % 10)));
}
internal static String GetRealFormat(ReadOnlySpan<char> format, DateTimeFormatInfo dtfi)
@@ -981,19 +988,65 @@ namespace System
return GetRealFormat(format, dtfi);
}
- internal static String Format(DateTime dateTime, String format, DateTimeFormatInfo dtfi)
+ internal static String Format(DateTime dateTime, String format, IFormatProvider provider)
{
- return Format(dateTime, format, dtfi, NullOffset);
+ return Format(dateTime, format, provider, NullOffset);
}
- internal static string Format(DateTime dateTime, String format, DateTimeFormatInfo dtfi, TimeSpan offset) =>
- StringBuilderCache.GetStringAndRelease(FormatStringBuilder(dateTime, format, dtfi, offset));
+ internal static string Format(DateTime dateTime, String format, IFormatProvider provider, TimeSpan offset)
+ {
+ if (format != null && format.Length == 1)
+ {
+ // Optimize for these standard formats that are not affected by culture.
+ switch (format[0])
+ {
+ // Round trip format
+ case 'o':
+ case 'O':
+ const int MinFormatOLength = 27, MaxFormatOLength = 33;
+ Span<char> span = stackalloc char[MaxFormatOLength];
+ TryFormatO(dateTime, offset, span, out int ochars);
+ Debug.Assert(ochars >= MinFormatOLength && ochars <= MaxFormatOLength);
+ return span.Slice(0, ochars).ToString();
+
+ // RFC1123
+ case 'r':
+ case 'R':
+ const int FormatRLength = 29;
+ string str = string.FastAllocateString(FormatRLength);
+ TryFormatR(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out int rchars);
+ Debug.Assert(rchars == str.Length);
+ return str;
+ }
+ }
+
+ DateTimeFormatInfo dtfi = DateTimeFormatInfo.GetInstance(provider);
+ return StringBuilderCache.GetStringAndRelease(FormatStringBuilder(dateTime, format, dtfi, offset));
+ }
- internal static bool TryFormat(DateTime dateTime, Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi) =>
- TryFormat(dateTime, destination, out charsWritten, format, dtfi, NullOffset);
+ internal static bool TryFormat(DateTime dateTime, Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider) =>
+ TryFormat(dateTime, destination, out charsWritten, format, provider, NullOffset);
- internal static bool TryFormat(DateTime dateTime, Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, TimeSpan offset)
+ internal static bool TryFormat(DateTime dateTime, Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider, TimeSpan offset)
{
+ if (format.Length == 1)
+ {
+ // Optimize for these standard formats that are not affected by culture.
+ switch (format[0])
+ {
+ // Round trip format
+ case 'o':
+ case 'O':
+ return TryFormatO(dateTime, offset, destination, out charsWritten);
+
+ // RFC1123
+ case 'r':
+ case 'R':
+ return TryFormatR(dateTime, offset, destination, out charsWritten);
+ }
+ }
+
+ DateTimeFormatInfo dtfi = DateTimeFormatInfo.GetInstance(provider);
StringBuilder sb = FormatStringBuilder(dateTime, format, dtfi, offset);
bool success = sb.Length <= destination.Length;
@@ -1011,7 +1064,7 @@ namespace System
return success;
}
- internal static StringBuilder FormatStringBuilder(DateTime dateTime, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, TimeSpan offset)
+ private static StringBuilder FormatStringBuilder(DateTime dateTime, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, TimeSpan offset)
{
Debug.Assert(dtfi != null);
if (format.Length == 0)
@@ -1060,101 +1113,204 @@ namespace System
if (format.Length == 1)
{
- switch (format[0])
+ format = ExpandPredefinedFormat(format, ref dateTime, ref dtfi, ref offset);
+ }
+
+ return FormatCustomized(dateTime, format, dtfi, offset, result: null);
+ }
+
+ // Roundtrippable format. One of
+ // 012345678901234567890123456789012
+ // ---------------------------------
+ // 2017-06-12T05:30:45.7680000-07:00
+ // 2017-06-12T05:30:45.7680000Z (Z is short for "+00:00" but also distinguishes DateTimeKind.Utc from DateTimeKind.Local)
+ // 2017-06-12T05:30:45.7680000 (interpreted as local time wrt to current time zone)
+ private static bool TryFormatO(DateTime dateTime, TimeSpan offset, Span<char> destination, out int charsWritten)
+ {
+ const int MinimumBytesNeeded = 27;
+
+ int charsRequired = MinimumBytesNeeded;
+ DateTimeKind kind = DateTimeKind.Local;
+
+ if (offset == NullOffset)
+ {
+ kind = dateTime.Kind;
+ if (kind == DateTimeKind.Local)
{
- case 'O':
- case 'o':
- return FastFormatRoundtrip(dateTime, offset);
- case 'R':
- case 'r':
- return FastFormatRfc1123(dateTime, offset, dtfi);
+ offset = TimeZoneInfo.Local.GetUtcOffset(dateTime);
+ charsRequired += 6;
+ }
+ else if (kind == DateTimeKind.Utc)
+ {
+ charsRequired += 1;
}
+ }
+ else
+ {
+ charsRequired += 6;
+ }
- format = ExpandPredefinedFormat(format, ref dateTime, ref dtfi, ref offset);
+ if (destination.Length < charsRequired)
+ {
+ charsWritten = 0;
+ return false;
}
+ charsWritten = charsRequired;
+
+ // Hoist most of the bounds checks on destination.
+ { var unused = destination[MinimumBytesNeeded - 1]; }
+
+ WriteFourDecimalDigits((uint)dateTime.Year, destination, 0);
+ destination[4] = '-';
+ WriteTwoDecimalDigits((uint)dateTime.Month, destination, 5);
+ destination[7] = '-';
+ WriteTwoDecimalDigits((uint)dateTime.Day, destination, 8);
+ destination[10] = 'T';
+ WriteTwoDecimalDigits((uint)dateTime.Hour, destination, 11);
+ destination[13] = ':';
+ WriteTwoDecimalDigits((uint)dateTime.Minute, destination, 14);
+ destination[16] = ':';
+ WriteTwoDecimalDigits((uint)dateTime.Second, destination, 17);
+ destination[19] = '.';
+ WriteDigits((uint)((ulong)dateTime.Ticks % (ulong)TimeSpan.TicksPerSecond), destination.Slice(20, 7));
+
+ if (kind == DateTimeKind.Local)
+ {
+ char sign;
+ if (offset < default(TimeSpan) /* a "const" version of TimeSpan.Zero */)
+ {
+ sign = '-';
+ offset = TimeSpan.FromTicks(-offset.Ticks);
+ }
+ else
+ {
+ sign = '+';
+ }
- return FormatCustomized(dateTime, format, dtfi, offset, result: null);
+ // Writing the value backward allows the JIT to optimize by
+ // performing a single bounds check against buffer.
+ WriteTwoDecimalDigits((uint)offset.Minutes, destination, 31);
+ destination[30] = ':';
+ WriteTwoDecimalDigits((uint)offset.Hours, destination, 28);
+ destination[27] = sign;
+ }
+ else if (kind == DateTimeKind.Utc)
+ {
+ destination[27] = 'Z';
+ }
+
+ return true;
}
- internal static StringBuilder FastFormatRfc1123(DateTime dateTime, TimeSpan offset, DateTimeFormatInfo dtfi)
+ // Rfc1123
+ // 01234567890123456789012345678
+ // -----------------------------
+ // Tue, 03 Jan 2017 08:08:05 GMT
+ private static bool TryFormatR(DateTime dateTime, TimeSpan offset, Span<char> destination, out int charsWritten)
{
- // ddd, dd MMM yyyy HH:mm:ss GMT
- const int Rfc1123FormatLength = 29;
- StringBuilder result = StringBuilderCache.Acquire(Rfc1123FormatLength);
+ // Writing the check in this fashion elides all bounds checks on 'destination'
+ // for the remainder of the method.
+ if (28 >= (uint)destination.Length)
+ {
+ charsWritten = 0;
+ return false;
+ }
if (offset != NullOffset)
{
- // Convert to UTC invariants
+ // Convert to UTC invariants.
dateTime = dateTime - offset;
}
dateTime.GetDatePart(out int year, out int month, out int day);
- result.Append(InvariantAbbreviatedDayNames[(int)dateTime.DayOfWeek]);
- result.Append(',');
- result.Append(' ');
- AppendNumber(result, day, 2);
- result.Append(' ');
- result.Append(InvariantAbbreviatedMonthNames[month - 1]);
- result.Append(' ');
- AppendNumber(result, year, 4);
- result.Append(' ');
- AppendHHmmssTimeOfDay(result, dateTime);
- result.Append(' ');
- result.Append(Gmt);
- return result;
+ string dayAbbrev = InvariantAbbreviatedDayNames[(int)dateTime.DayOfWeek];
+ Debug.Assert(dayAbbrev.Length == 3);
+
+ string monthAbbrev = InvariantAbbreviatedMonthNames[month - 1];
+ Debug.Assert(monthAbbrev.Length == 3);
+
+ destination[0] = dayAbbrev[0];
+ destination[1] = dayAbbrev[1];
+ destination[2] = dayAbbrev[2];
+ destination[3] = ',';
+ destination[4] = ' ';
+ WriteTwoDecimalDigits((uint)day, destination, 5);
+ destination[7] = ' ';
+ destination[8] = monthAbbrev[0];
+ destination[9] = monthAbbrev[1];
+ destination[10] = monthAbbrev[2];
+ destination[11] = ' ';
+ WriteFourDecimalDigits((uint)year, destination, 12);
+ destination[16] = ' ';
+ WriteTwoDecimalDigits((uint)dateTime.Hour, destination, 17);
+ destination[19] = ':';
+ WriteTwoDecimalDigits((uint)dateTime.Minute, destination, 20);
+ destination[22] = ':';
+ WriteTwoDecimalDigits((uint)dateTime.Second, destination, 23);
+ destination[25] = ' ';
+ destination[26] = 'G';
+ destination[27] = 'M';
+ destination[28] = 'T';
+
+ charsWritten = 29;
+ return true;
}
- internal static StringBuilder FastFormatRoundtrip(DateTime dateTime, TimeSpan offset)
+ /// <summary>
+ /// Writes a value [ 00 .. 99 ] to the buffer starting at the specified offset.
+ /// This method performs best when the starting index is a constant literal.
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static void WriteTwoDecimalDigits(uint value, Span<char> destination, int offset)
{
- // yyyy-MM-ddTHH:mm:ss.fffffffK
- const int roundTripFormatLength = 28;
- StringBuilder result = StringBuilderCache.Acquire(roundTripFormatLength);
+ Debug.Assert(0 <= value && value <= 99);
- dateTime.GetDatePart(out int year, out int month, out int day);
- AppendNumber(result, year, 4);
- result.Append('-');
- AppendNumber(result, month, 2);
- result.Append('-');
- AppendNumber(result, day, 2);
- result.Append('T');
- AppendHHmmssTimeOfDay(result, dateTime);
- result.Append('.');
+ uint temp = '0' + value;
+ value /= 10;
+ destination[offset + 1] = (char)(temp - (value * 10));
+ destination[offset] = (char)('0' + value);
+ }
- long fraction = dateTime.Ticks % TimeSpan.TicksPerSecond;
- AppendNumber(result, fraction, 7);
+ /// <summary>
+ /// Writes a value [ 0000 .. 9999 ] to the buffer starting at the specified offset.
+ /// This method performs best when the starting index is a constant literal.
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static void WriteFourDecimalDigits(uint value, Span<char> buffer, int startingIndex = 0)
+ {
+ Debug.Assert(0 <= value && value <= 9999);
- FormatCustomizedRoundripTimeZone(dateTime, offset, result);
+ uint temp = '0' + value;
+ value /= 10;
+ buffer[startingIndex + 3] = (char)(temp - (value * 10));
- return result;
- }
+ temp = '0' + value;
+ value /= 10;
+ buffer[startingIndex + 2] = (char)(temp - (value * 10));
- private static void AppendHHmmssTimeOfDay(StringBuilder result, DateTime dateTime)
- {
- // HH:mm:ss
- AppendNumber(result, dateTime.Hour, 2);
- result.Append(':');
- AppendNumber(result, dateTime.Minute, 2);
- result.Append(':');
- AppendNumber(result, dateTime.Second, 2);
+ temp = '0' + value;
+ value /= 10;
+ buffer[startingIndex + 1] = (char)(temp - (value * 10));
+
+ buffer[startingIndex] = (char)('0' + value);
}
- internal static void AppendNumber(StringBuilder builder, long val, int digits)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static void WriteDigits(ulong value, Span<char> buffer)
{
- for (int i = 0; i < digits; i++)
- {
- builder.Append('0');
- }
+ // We can mutate the 'value' parameter since it's a copy-by-value local.
+ // It'll be used to represent the value left over after each division by 10.
- int index = 1;
- while (val > 0 && index <= digits)
+ for (int i = buffer.Length - 1; i >= 1; i--)
{
- builder[builder.Length - index] = (char)('0' + (val % 10));
- val = val / 10;
- index++;
+ ulong temp = '0' + value;
+ value /= 10;
+ buffer[i] = (char)(temp - (value * 10));
}
- Debug.Assert(val == 0, "DateTimeFormat.AppendNumber(): digits less than size of val");
+ Debug.Assert(value < 10);
+ buffer[0] = (char)('0' + value);
}
internal static String[] GetAllDateTimes(DateTime dateTime, char format, DateTimeFormatInfo dtfi)
diff --git a/src/mscorlib/shared/System/IO/FileStream.cs b/src/mscorlib/shared/System/IO/FileStream.cs
index 717b73ff13..a6ad63c6eb 100644
--- a/src/mscorlib/shared/System/IO/FileStream.cs
+++ b/src/mscorlib/shared/System/IO/FileStream.cs
@@ -304,7 +304,7 @@ namespace System.IO
ReadSpan(new Span<byte>(array, offset, count));
}
- public override int Read(Span<byte> destination)
+ public override int Read(Span<byte> buffer)
{
if (GetType() == typeof(FileStream) && !_useAsyncIO)
{
@@ -312,7 +312,7 @@ namespace System.IO
{
throw Error.GetFileNotOpen();
}
- return ReadSpan(destination);
+ return ReadSpan(buffer);
}
else
{
@@ -322,7 +322,7 @@ namespace System.IO
// of Read(byte[],int,int) overload. Or if the stream is in async mode, we can't call the
// synchronous ReadSpan, so we similarly call the base Read, which will turn delegate to
// Read(byte[],int,int), which will do the right thing if we're in async mode.
- return base.Read(destination);
+ return base.Read(buffer);
}
}
@@ -355,14 +355,14 @@ namespace System.IO
return ReadAsyncTask(buffer, offset, count, cancellationToken);
}
- public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
if (!_useAsyncIO || GetType() != typeof(FileStream))
{
// If we're not using async I/O, delegate to the base, which will queue a call to Read.
// Or if this isn't a concrete FileStream, a derived type may have overridden ReadAsync(byte[],...),
// which was introduced first, so delegate to the base which will delegate to that.
- return base.ReadAsync(destination, cancellationToken);
+ return base.ReadAsync(buffer, cancellationToken);
}
if (cancellationToken.IsCancellationRequested)
@@ -375,7 +375,7 @@ namespace System.IO
throw Error.GetFileNotOpen();
}
- Task<int> t = ReadAsyncInternal(destination, cancellationToken, out int synchronousResult);
+ Task<int> t = ReadAsyncInternal(buffer, cancellationToken, out int synchronousResult);
return t != null ?
new ValueTask<int>(t) :
new ValueTask<int>(synchronousResult);
@@ -412,7 +412,7 @@ namespace System.IO
}
}
- public override void Write(ReadOnlySpan<byte> destination)
+ public override void Write(ReadOnlySpan<byte> buffer)
{
if (GetType() == typeof(FileStream) && !_useAsyncIO)
{
@@ -420,7 +420,7 @@ namespace System.IO
{
throw Error.GetFileNotOpen();
}
- WriteSpan(destination);
+ WriteSpan(buffer);
}
else
{
@@ -430,7 +430,7 @@ namespace System.IO
// of Write(byte[],int,int) overload. Or if the stream is in async mode, we can't call the
// synchronous WriteSpan, so we similarly call the base Write, which will turn delegate to
// Write(byte[],int,int), which will do the right thing if we're in async mode.
- base.Write(destination);
+ base.Write(buffer);
}
}
@@ -461,14 +461,14 @@ namespace System.IO
return WriteAsyncInternal(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken).AsTask();
}
- public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
if (!_useAsyncIO || GetType() != typeof(FileStream))
{
// If we're not using async I/O, delegate to the base, which will queue a call to Write.
// Or if this isn't a concrete FileStream, a derived type may have overridden WriteAsync(byte[],...),
// which was introduced first, so delegate to the base which will delegate to that.
- return base.WriteAsync(source, cancellationToken);
+ return base.WriteAsync(buffer, cancellationToken);
}
if (cancellationToken.IsCancellationRequested)
@@ -481,7 +481,7 @@ namespace System.IO
throw Error.GetFileNotOpen();
}
- return WriteAsyncInternal(source, cancellationToken);
+ return WriteAsyncInternal(buffer, cancellationToken);
}
/// <summary>
diff --git a/src/mscorlib/shared/System/IO/MemoryStream.cs b/src/mscorlib/shared/System/IO/MemoryStream.cs
index ffe7f60936..fb319de7c2 100644
--- a/src/mscorlib/shared/System/IO/MemoryStream.cs
+++ b/src/mscorlib/shared/System/IO/MemoryStream.cs
@@ -367,19 +367,19 @@ namespace System.IO
return n;
}
- public override int Read(Span<byte> destination)
+ public override int Read(Span<byte> buffer)
{
if (GetType() != typeof(MemoryStream))
{
// MemoryStream is not sealed, and a derived type may have overridden Read(byte[], int, int) prior
// to this Read(Span<byte>) overload being introduced. In that case, this Read(Span<byte>) overload
// should use the behavior of Read(byte[],int,int) overload.
- return base.Read(destination);
+ return base.Read(buffer);
}
EnsureNotClosed();
- int n = Math.Min(_length - _position, destination.Length);
+ int n = Math.Min(_length - _position, buffer.Length);
if (n <= 0)
return 0;
@@ -387,7 +387,7 @@ namespace System.IO
// Read(byte[], int, int) has an n <= 8 optimization, presumably based
// on benchmarking. Determine if/where such a cut-off is here and add
// an equivalent optimization if necessary.
- new Span<byte>(_buffer, _position, n).CopyTo(destination);
+ new Span<byte>(_buffer, _position, n).CopyTo(buffer);
_position += n;
return n;
@@ -426,7 +426,7 @@ namespace System.IO
}
}
- public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
if (cancellationToken.IsCancellationRequested)
{
@@ -448,9 +448,9 @@ namespace System.IO
// something other than an array and this is a MemoryStream-derived type that doesn't override Read(Span<byte>) will
// it then fall back to doing the ArrayPool/copy behavior.
return new ValueTask<int>(
- MemoryMarshal.TryGetArray(destination, out ArraySegment<byte> destinationArray) ?
+ MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> destinationArray) ?
Read(destinationArray.Array, destinationArray.Offset, destinationArray.Count) :
- Read(destination.Span));
+ Read(buffer.Span));
}
catch (OperationCanceledException oce)
{
@@ -681,14 +681,14 @@ namespace System.IO
_position = i;
}
- public override void Write(ReadOnlySpan<byte> source)
+ public override void Write(ReadOnlySpan<byte> buffer)
{
if (GetType() != typeof(MemoryStream))
{
// MemoryStream is not sealed, and a derived type may have overridden Write(byte[], int, int) prior
// to this Write(Span<byte>) overload being introduced. In that case, this Write(Span<byte>) overload
// should use the behavior of Write(byte[],int,int) overload.
- base.Write(source);
+ base.Write(buffer);
return;
}
@@ -696,7 +696,7 @@ namespace System.IO
EnsureWriteable();
// Check for overflow
- int i = _position + source.Length;
+ int i = _position + buffer.Length;
if (i < 0)
throw new IOException(SR.IO_StreamTooLong);
@@ -718,7 +718,7 @@ namespace System.IO
_length = i;
}
- source.CopyTo(new Span<byte>(_buffer, _position, source.Length));
+ buffer.CopyTo(new Span<byte>(_buffer, _position, buffer.Length));
_position = i;
}
@@ -752,7 +752,7 @@ namespace System.IO
}
}
- public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
if (cancellationToken.IsCancellationRequested)
{
@@ -763,13 +763,13 @@ namespace System.IO
{
// See corresponding comment in ReadAsync for why we don't just always use Write(ReadOnlySpan<byte>).
// Unlike ReadAsync, we could delegate to WriteAsync(byte[], ...) here, but we don't for consistency.
- if (MemoryMarshal.TryGetArray(source, out ArraySegment<byte> sourceArray))
+ if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> sourceArray))
{
Write(sourceArray.Array, sourceArray.Offset, sourceArray.Count);
}
else
{
- Write(source.Span);
+ Write(buffer.Span);
}
return default;
}
diff --git a/src/mscorlib/shared/System/IO/Path.Windows.cs b/src/mscorlib/shared/System/IO/Path.Windows.cs
index 8f1bed0a64..f22a9913ea 100644
--- a/src/mscorlib/shared/System/IO/Path.Windows.cs
+++ b/src/mscorlib/shared/System/IO/Path.Windows.cs
@@ -165,20 +165,15 @@ namespace System.IO
Span<char> initialBuffer = stackalloc char[PathInternal.MaxShortPath];
var builder = new ValueStringBuilder(initialBuffer);
- uint result = 0;
- while ((result = Interop.Kernel32.GetTempFileNameW(
- ref tempPathBuilder.GetPinnableReference(), "tmp", 0, ref builder.GetPinnableReference())) > builder.Capacity)
- {
- // Reported size is greater than the buffer size. Increase the capacity.
- builder.EnsureCapacity(checked((int)result));
- }
+ uint result = Interop.Kernel32.GetTempFileNameW(
+ ref tempPathBuilder.GetPinnableReference(), "tmp", 0, ref builder.GetPinnableReference());
tempPathBuilder.Dispose();
if (result == 0)
throw Win32Marshal.GetExceptionForLastWin32Error();
- builder.Length = (int)result;
+ builder.Length = builder.RawChars.IndexOf('\0');
string path = PathHelper.Normalize(ref builder);
builder.Dispose();
diff --git a/src/mscorlib/shared/System/IO/PathHelper.Windows.cs b/src/mscorlib/shared/System/IO/PathHelper.Windows.cs
index 2b17fff091..ed49422c1a 100644
--- a/src/mscorlib/shared/System/IO/PathHelper.Windows.cs
+++ b/src/mscorlib/shared/System/IO/PathHelper.Windows.cs
@@ -56,7 +56,7 @@ namespace System.IO
// Get the full path
GetFullPathName(path.AsSpan(terminate: true), ref builder);
- string result = builder.AsSpan().Contains('~')
+ string result = builder.AsSpan().IndexOf('~') >= 0
? TryExpandShortFileName(ref builder, originalPath: null)
: builder.ToString();
diff --git a/src/mscorlib/shared/System/IO/PinnedBufferMemoryStream.cs b/src/mscorlib/shared/System/IO/PinnedBufferMemoryStream.cs
index dfcc05d066..94331a2ef8 100644
--- a/src/mscorlib/shared/System/IO/PinnedBufferMemoryStream.cs
+++ b/src/mscorlib/shared/System/IO/PinnedBufferMemoryStream.cs
@@ -38,9 +38,9 @@ namespace System.IO
Initialize(ptr, len, len, FileAccess.Read);
}
- public override int Read(Span<byte> destination) => ReadCore(destination);
+ public override int Read(Span<byte> buffer) => ReadCore(buffer);
- public override void Write(ReadOnlySpan<byte> source) => WriteCore(source);
+ public override void Write(ReadOnlySpan<byte> buffer) => WriteCore(buffer);
~PinnedBufferMemoryStream()
{
diff --git a/src/mscorlib/shared/System/IO/StreamReader.cs b/src/mscorlib/shared/System/IO/StreamReader.cs
index 22ec6e645b..ea30541f5a 100644
--- a/src/mscorlib/shared/System/IO/StreamReader.cs
+++ b/src/mscorlib/shared/System/IO/StreamReader.cs
@@ -70,21 +70,21 @@ namespace System.IO
// We don't guarantee thread safety on StreamReader, but we should at
// least prevent users from trying to read anything while an Async
// read from the same thread is in progress.
- private volatile Task _asyncReadTask;
+ private Task _asyncReadTask = Task.CompletedTask;
private void CheckAsyncTaskInProgress()
{
// We are not locking the access to _asyncReadTask because this is not meant to guarantee thread safety.
// We are simply trying to deter calling any Read APIs while an async Read from the same thread is in progress.
-
- Task t = _asyncReadTask;
-
- if (t != null && !t.IsCompleted)
+ if (!_asyncReadTask.IsCompleted)
{
- throw new InvalidOperationException(SR.InvalidOperation_AsyncIOInProgress);
+ ThrowAsyncIOInProgress();
}
}
+ private static void ThrowAsyncIOInProgress() =>
+ throw new InvalidOperationException(SR.InvalidOperation_AsyncIOInProgress);
+
// StreamReader by default will ignore illegal UTF8 characters. We don't want to
// throw here because we want to be able to read ill-formed data without choking.
// The high level goal is to be tolerant of encoding errors when we read and very strict
diff --git a/src/mscorlib/shared/System/IO/StreamWriter.cs b/src/mscorlib/shared/System/IO/StreamWriter.cs
index a376244280..06d94d2385 100644
--- a/src/mscorlib/shared/System/IO/StreamWriter.cs
+++ b/src/mscorlib/shared/System/IO/StreamWriter.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
@@ -44,19 +45,21 @@ namespace System.IO
// We don't guarantee thread safety on StreamWriter, but we should at
// least prevent users from trying to write anything while an Async
// write from the same thread is in progress.
- private volatile Task _asyncWriteTask;
+ private Task _asyncWriteTask = Task.CompletedTask;
private void CheckAsyncTaskInProgress()
{
// We are not locking the access to _asyncWriteTask because this is not meant to guarantee thread safety.
// We are simply trying to deter calling any Write APIs while an async Write from the same thread is in progress.
-
- Task t = _asyncWriteTask;
-
- if (t != null && !t.IsCompleted)
- throw new InvalidOperationException(SR.InvalidOperation_AsyncIOInProgress);
+ if (!_asyncWriteTask.IsCompleted)
+ {
+ ThrowAsyncIOInProgress();
+ }
}
+ private static void ThrowAsyncIOInProgress() =>
+ throw new InvalidOperationException(SR.InvalidOperation_AsyncIOInProgress);
+
// The high level goal is to be tolerant of encoding errors when we read and very strict
// when we write. Hence, default StreamWriter encoding will throw on encoding error.
// Note: when StreamWriter throws on invalid encoding chars (for ex, high surrogate character
@@ -323,14 +326,13 @@ namespace System.IO
}
}
+ [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites
public override void Write(char[] buffer)
{
- if (buffer != null)
- {
- WriteCore(buffer, _autoFlush);
- }
+ WriteSpan(buffer, appendNewLine: false);
}
+ [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites
public override void Write(char[] buffer, int index, int count)
{
if (buffer == null)
@@ -350,14 +352,15 @@ namespace System.IO
throw new ArgumentException(SR.Argument_InvalidOffLen);
}
- WriteCore(new ReadOnlySpan<char>(buffer, index, count), _autoFlush);
+ WriteSpan(buffer.AsSpan(index, count), appendNewLine: false);
}
+ [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites
public override void Write(ReadOnlySpan<char> buffer)
{
if (GetType() == typeof(StreamWriter))
{
- WriteCore(buffer, _autoFlush);
+ WriteSpan(buffer, appendNewLine: false);
}
else
{
@@ -367,7 +370,8 @@ namespace System.IO
}
}
- private unsafe void WriteCore(ReadOnlySpan<char> buffer, bool autoFlush)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private unsafe void WriteSpan(ReadOnlySpan<char> buffer, bool appendNewLine)
{
CheckAsyncTaskInProgress();
@@ -422,41 +426,47 @@ namespace System.IO
}
}
- if (autoFlush)
+ if (appendNewLine)
+ {
+ char[] coreNewLine = CoreNewLine;
+ for (int i = 0; i < coreNewLine.Length; i++) // Generally 1 (\n) or 2 (\r\n) iterations
+ {
+ if (_charPos == _charLen)
+ {
+ Flush(false, false);
+ }
+
+ _charBuffer[_charPos] = coreNewLine[i];
+ _charPos++;
+ }
+ }
+
+ if (_autoFlush)
{
Flush(true, false);
}
}
+ [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites
public override void Write(string value)
{
- if (value != null)
- {
- WriteCore(value.AsSpan(), _autoFlush);
- }
+ WriteSpan(value, appendNewLine: false);
}
- //
- // Optimize the most commonly used WriteLine overload. This optimization is important for System.Console in particular
- // because of it will make one WriteLine equal to one call to the OS instead of two in the common case.
- //
+ [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites
public override void WriteLine(string value)
{
CheckAsyncTaskInProgress();
- if (value != null)
- {
- WriteCore(value.AsSpan(), autoFlush: false);
- }
- WriteCore(new ReadOnlySpan<char>(CoreNewLine), autoFlush: true);
+ WriteSpan(value, appendNewLine: true);
}
+ [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites
public override void WriteLine(ReadOnlySpan<char> value)
{
if (GetType() == typeof(StreamWriter))
{
CheckAsyncTaskInProgress();
- WriteCore(value, autoFlush: false);
- WriteCore(new ReadOnlySpan<char>(CoreNewLine), autoFlush: true);
+ WriteSpan(value, appendNewLine: true);
}
else
{
diff --git a/src/mscorlib/shared/System/IO/UnmanagedMemoryStream.cs b/src/mscorlib/shared/System/IO/UnmanagedMemoryStream.cs
index d1a13156a8..2bcb16f24e 100644
--- a/src/mscorlib/shared/System/IO/UnmanagedMemoryStream.cs
+++ b/src/mscorlib/shared/System/IO/UnmanagedMemoryStream.cs
@@ -379,22 +379,22 @@ namespace System.IO
return ReadCore(new Span<byte>(buffer, offset, count));
}
- public override int Read(Span<byte> destination)
+ public override int Read(Span<byte> buffer)
{
if (GetType() == typeof(UnmanagedMemoryStream))
{
- return ReadCore(destination);
+ return ReadCore(buffer);
}
else
{
// UnmanagedMemoryStream is not sealed, and a derived type may have overridden Read(byte[], int, int) prior
// to this Read(Span<byte>) overload being introduced. In that case, this Read(Span<byte>) overload
// should use the behavior of Read(byte[],int,int) overload.
- return base.Read(destination);
+ return base.Read(buffer);
}
}
- internal int ReadCore(Span<byte> destination)
+ internal int ReadCore(Span<byte> buffer)
{
EnsureNotClosed();
EnsureReadable();
@@ -403,7 +403,7 @@ namespace System.IO
// changes our position after we decide we can read some bytes.
long pos = Interlocked.Read(ref _position);
long len = Interlocked.Read(ref _length);
- long n = Math.Min(len - pos, destination.Length);
+ long n = Math.Min(len - pos, buffer.Length);
if (n <= 0)
{
return 0;
@@ -418,7 +418,7 @@ namespace System.IO
unsafe
{
- fixed (byte* pBuffer = &MemoryMarshal.GetReference(destination))
+ fixed (byte* pBuffer = &MemoryMarshal.GetReference(buffer))
{
if (_buffer != null)
{
@@ -486,9 +486,9 @@ namespace System.IO
/// <summary>
/// Reads bytes from stream and puts them into the buffer
/// </summary>
- /// <param name="destination">Buffer to read the bytes to.</param>
+ /// <param name="buffer">Buffer to read the bytes to.</param>
/// <param name="cancellationToken">Token that can be used to cancel this operation.</param>
- public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
if (cancellationToken.IsCancellationRequested)
{
@@ -510,9 +510,9 @@ namespace System.IO
// something other than an array and this is an UnmanagedMemoryStream-derived type that doesn't override Read(Span<byte>) will
// it then fall back to doing the ArrayPool/copy behavior.
return new ValueTask<int>(
- MemoryMarshal.TryGetArray(destination, out ArraySegment<byte> destinationArray) ?
+ MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> destinationArray) ?
Read(destinationArray.Array, destinationArray.Offset, destinationArray.Count) :
- Read(destination.Span));
+ Read(buffer.Span));
}
catch (Exception ex)
{
@@ -659,29 +659,29 @@ namespace System.IO
WriteCore(new Span<byte>(buffer, offset, count));
}
- public override void Write(ReadOnlySpan<byte> source)
+ public override void Write(ReadOnlySpan<byte> buffer)
{
if (GetType() == typeof(UnmanagedMemoryStream))
{
- WriteCore(source);
+ WriteCore(buffer);
}
else
{
// UnmanagedMemoryStream is not sealed, and a derived type may have overridden Write(byte[], int, int) prior
// to this Write(Span<byte>) overload being introduced. In that case, this Write(Span<byte>) overload
// should use the behavior of Write(byte[],int,int) overload.
- base.Write(source);
+ base.Write(buffer);
}
}
- internal unsafe void WriteCore(ReadOnlySpan<byte> source)
+ internal unsafe void WriteCore(ReadOnlySpan<byte> buffer)
{
EnsureNotClosed();
EnsureWriteable();
long pos = Interlocked.Read(ref _position); // Use a local to avoid a race condition
long len = Interlocked.Read(ref _length);
- long n = pos + source.Length;
+ long n = pos + buffer.Length;
// Check for overflow
if (n < 0)
{
@@ -709,12 +709,12 @@ namespace System.IO
}
}
- fixed (byte* pBuffer = &MemoryMarshal.GetReference(source))
+ fixed (byte* pBuffer = &MemoryMarshal.GetReference(buffer))
{
if (_buffer != null)
{
long bytesLeft = _capacity - pos;
- if (bytesLeft < source.Length)
+ if (bytesLeft < buffer.Length)
{
throw new ArgumentException(SR.Arg_BufferTooSmall);
}
@@ -724,7 +724,7 @@ namespace System.IO
try
{
_buffer.AcquirePointer(ref pointer);
- Buffer.Memcpy(pointer + pos + _offset, pBuffer, source.Length);
+ Buffer.Memcpy(pointer + pos + _offset, pBuffer, buffer.Length);
}
finally
{
@@ -736,7 +736,7 @@ namespace System.IO
}
else
{
- Buffer.Memcpy(_mem + pos, pBuffer, source.Length);
+ Buffer.Memcpy(_mem + pos, pBuffer, buffer.Length);
}
}
@@ -783,7 +783,7 @@ namespace System.IO
/// </summary>
/// <param name="buffer">Buffer that will be written.</param>
/// <param name="cancellationToken">Token that can be used to cancel the operation.</param>
- public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
if (cancellationToken.IsCancellationRequested)
{
@@ -794,13 +794,13 @@ namespace System.IO
{
// See corresponding comment in ReadAsync for why we don't just always use Write(ReadOnlySpan<byte>).
// Unlike ReadAsync, we could delegate to WriteAsync(byte[], ...) here, but we don't for consistency.
- if (MemoryMarshal.TryGetArray(source, out ArraySegment<byte> sourceArray))
+ if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> sourceArray))
{
Write(sourceArray.Array, sourceArray.Offset, sourceArray.Count);
}
else
{
- Write(source.Span);
+ Write(buffer.Span);
}
return default;
}
diff --git a/src/mscorlib/shared/System/IO/UnmanagedMemoryStreamWrapper.cs b/src/mscorlib/shared/System/IO/UnmanagedMemoryStreamWrapper.cs
index f34c3c4137..65a33961db 100644
--- a/src/mscorlib/shared/System/IO/UnmanagedMemoryStreamWrapper.cs
+++ b/src/mscorlib/shared/System/IO/UnmanagedMemoryStreamWrapper.cs
@@ -112,9 +112,9 @@ namespace System.IO
return _unmanagedStream.Read(buffer, offset, count);
}
- public override int Read(Span<byte> destination)
+ public override int Read(Span<byte> buffer)
{
- return _unmanagedStream.Read(destination);
+ return _unmanagedStream.Read(buffer);
}
public override int ReadByte()
@@ -139,9 +139,9 @@ namespace System.IO
_unmanagedStream.Write(buffer, offset, count);
}
- public override void Write(ReadOnlySpan<byte> source)
+ public override void Write(ReadOnlySpan<byte> buffer)
{
- _unmanagedStream.Write(source);
+ _unmanagedStream.Write(buffer);
}
public override void WriteByte(byte value)
@@ -206,9 +206,9 @@ namespace System.IO
return _unmanagedStream.ReadAsync(buffer, offset, count, cancellationToken);
}
- public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
- return _unmanagedStream.ReadAsync(destination, cancellationToken);
+ return _unmanagedStream.ReadAsync(buffer, cancellationToken);
}
@@ -217,9 +217,9 @@ namespace System.IO
return _unmanagedStream.WriteAsync(buffer, offset, count, cancellationToken);
}
- public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
- return _unmanagedStream.WriteAsync(source, cancellationToken);
+ return _unmanagedStream.WriteAsync(buffer, cancellationToken);
}
} // class UnmanagedMemoryStreamWrapper
} // namespace
diff --git a/src/mscorlib/shared/System/IO/Win32Marshal.cs b/src/mscorlib/shared/System/IO/Win32Marshal.cs
index 060f823684..7888d8d61b 100644
--- a/src/mscorlib/shared/System/IO/Win32Marshal.cs
+++ b/src/mscorlib/shared/System/IO/Win32Marshal.cs
@@ -27,29 +27,25 @@ namespace System.IO
switch (errorCode)
{
case Interop.Errors.ERROR_FILE_NOT_FOUND:
- return string.IsNullOrEmpty(path)
- ? new FileNotFoundException(SR.IO_FileNotFound)
- : new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, path), path);
+ return new FileNotFoundException(
+ string.IsNullOrEmpty(path) ? SR.IO_FileNotFound : SR.Format(SR.IO_FileNotFound_FileName, path), path);
case Interop.Errors.ERROR_PATH_NOT_FOUND:
- return string.IsNullOrEmpty(path)
- ? new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName)
- : new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, path));
+ return new DirectoryNotFoundException(
+ string.IsNullOrEmpty(path) ? SR.IO_PathNotFound_NoPathName : SR.Format(SR.IO_PathNotFound_Path, path));
case Interop.Errors.ERROR_ACCESS_DENIED:
- return string.IsNullOrEmpty(path)
- ? new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName)
- : new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, path));
+ return new UnauthorizedAccessException(
+ string.IsNullOrEmpty(path) ? SR.UnauthorizedAccess_IODenied_NoPathName : SR.Format(SR.UnauthorizedAccess_IODenied_Path, path));
case Interop.Errors.ERROR_ALREADY_EXISTS:
if (string.IsNullOrEmpty(path))
goto default;
return new IOException(SR.Format(SR.IO_AlreadyExists_Name, path), MakeHRFromErrorCode(errorCode));
case Interop.Errors.ERROR_FILENAME_EXCED_RANGE:
- return string.IsNullOrEmpty(path)
- ? new PathTooLongException(SR.IO_PathTooLong)
- : new PathTooLongException(SR.Format(SR.IO_PathTooLong_Path, path));
+ return new PathTooLongException(
+ string.IsNullOrEmpty(path) ? SR.IO_PathTooLong : SR.Format(SR.IO_PathTooLong_Path, path));
case Interop.Errors.ERROR_SHARING_VIOLATION:
- return string.IsNullOrEmpty(path)
- ? new IOException(SR.IO_SharingViolation_NoFileName, MakeHRFromErrorCode(errorCode))
- : new IOException(SR.Format(SR.IO_SharingViolation_File, path), MakeHRFromErrorCode(errorCode));
+ return new IOException(
+ string.IsNullOrEmpty(path) ? SR.IO_SharingViolation_NoFileName : SR.Format(SR.IO_SharingViolation_File, path),
+ MakeHRFromErrorCode(errorCode));
case Interop.Errors.ERROR_FILE_EXISTS:
if (string.IsNullOrEmpty(path))
goto default;
@@ -58,9 +54,9 @@ namespace System.IO
return new OperationCanceledException();
case Interop.Errors.ERROR_INVALID_PARAMETER:
default:
- return string.IsNullOrEmpty(path)
- ? new IOException(GetMessage(errorCode), MakeHRFromErrorCode(errorCode))
- : new IOException($"{GetMessage(errorCode)} : '{path}'");
+ return new IOException(
+ string.IsNullOrEmpty(path) ? GetMessage(errorCode) : $"{GetMessage(errorCode)} : '{path}'",
+ MakeHRFromErrorCode(errorCode));
}
}
diff --git a/src/mscorlib/shared/System/IntPtr.cs b/src/mscorlib/shared/System/IntPtr.cs
index 684c1389a4..44638ddd8e 100644
--- a/src/mscorlib/shared/System/IntPtr.cs
+++ b/src/mscorlib/shared/System/IntPtr.cs
@@ -81,9 +81,9 @@ namespace System
return false;
}
- unsafe bool IEquatable<IntPtr>.Equals(IntPtr value)
+ unsafe bool IEquatable<IntPtr>.Equals(IntPtr other)
{
- return _value == value._value;
+ return _value == other._value;
}
public unsafe override int GetHashCode()
diff --git a/src/mscorlib/shared/System/Marvin.cs b/src/mscorlib/shared/System/Marvin.cs
index ca4e7cb1a4..e51ad9c552 100644
--- a/src/mscorlib/shared/System/Marvin.cs
+++ b/src/mscorlib/shared/System/Marvin.cs
@@ -5,62 +5,86 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using Internal.Runtime.CompilerServices;
+
+#if BIT64
+using nuint = System.UInt64;
+#else
+using nuint = System.UInt32;
+#endif
namespace System
{
internal static class Marvin
{
/// <summary>
- /// Convenience method to compute a Marvin hash and collapse it into a 32-bit hash.
+ /// Compute a Marvin hash and collapse it into a 32-bit hash.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int ComputeHash32(ReadOnlySpan<byte> data, ulong seed)
- {
- long hash64 = ComputeHash(data, seed);
- return ((int)(hash64 >> 32)) ^ (int)hash64;
- }
+ public static int ComputeHash32(ReadOnlySpan<byte> data, ulong seed) => ComputeHash32(ref MemoryMarshal.GetReference(data), data.Length, seed);
/// <summary>
- /// Computes a 64-hash using the Marvin algorithm.
+ /// Compute a Marvin hash and collapse it into a 32-bit hash.
/// </summary>
- public static long ComputeHash(ReadOnlySpan<byte> data, ulong seed)
+ public static int ComputeHash32(ref byte data, int count, ulong seed)
{
+ nuint ucount = (nuint)count;
uint p0 = (uint)seed;
uint p1 = (uint)(seed >> 32);
- if (data.Length >= sizeof(uint))
+ nuint byteOffset = 0;
+
+ while (ucount >= 8)
{
- ReadOnlySpan<uint> uData = MemoryMarshal.Cast<byte, uint>(data);
+ p0 += Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref data, byteOffset));
+ Block(ref p0, ref p1);
- for (int i = 0; i < uData.Length; i++)
- {
- p0 += uData[i];
- Block(ref p0, ref p1);
- }
+ p0 += Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref data, byteOffset + 4));
+ Block(ref p0, ref p1);
- // byteOffset = data.Length - data.Length % 4
- // is equivalent to clearing last 2 bits of length
- // Using it directly gives a perf hit for short strings making it at least 5% or more slower.
- int byteOffset = data.Length & (~3);
- data = data.Slice(byteOffset);
+ byteOffset += 8;
+ ucount -= 8;
}
- switch (data.Length)
+ switch (ucount)
{
+ case 4:
+ p0 += Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref data, byteOffset));
+ Block(ref p0, ref p1);
+ goto case 0;
+
case 0:
p0 += 0x80u;
break;
+ case 5:
+ p0 += Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref data, byteOffset));
+ byteOffset += 4;
+ Block(ref p0, ref p1);
+ goto case 1;
+
case 1:
- p0 += 0x8000u | data[0];
+ p0 += 0x8000u | Unsafe.AddByteOffset(ref data, byteOffset);
break;
+ case 6:
+ p0 += Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref data, byteOffset));
+ byteOffset += 4;
+ Block(ref p0, ref p1);
+ goto case 2;
+
case 2:
- p0 += 0x800000u | MemoryMarshal.Cast<byte, ushort>(data)[0];
+ p0 += 0x800000u | Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref data, byteOffset));
break;
+ case 7:
+ p0 += Unsafe.ReadUnaligned<uint>(ref Unsafe.AddByteOffset(ref data, byteOffset));
+ byteOffset += 4;
+ Block(ref p0, ref p1);
+ goto case 3;
+
case 3:
- p0 += 0x80000000u | (((uint)data[2]) << 16) | (uint)(MemoryMarshal.Cast<byte, ushort>(data)[0]);
+ p0 += 0x80000000u | (((uint)(Unsafe.AddByteOffset(ref data, byteOffset + 2))) << 16)| (uint)(Unsafe.ReadUnaligned<ushort>(ref Unsafe.AddByteOffset(ref data, byteOffset)));
break;
default:
@@ -71,7 +95,7 @@ namespace System
Block(ref p0, ref p1);
Block(ref p0, ref p1);
- return (((long)p1) << 32) | p0;
+ return (int)(p1 ^ p0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -107,9 +131,9 @@ namespace System
private static unsafe ulong GenerateSeed()
{
- ulong result;
- Interop.GetRandomBytes((byte*)&result, sizeof(ulong));
- return result;
+ ulong seed;
+ Interop.GetRandomBytes((byte*)&seed, sizeof(ulong));
+ return seed;
}
}
}
diff --git a/src/mscorlib/shared/System/Memory.cs b/src/mscorlib/shared/System/Memory.cs
index 82c66d6ea9..bb2b1557a9 100644
--- a/src/mscorlib/shared/System/Memory.cs
+++ b/src/mscorlib/shared/System/Memory.cs
@@ -137,7 +137,7 @@ namespace System
/// <summary>
/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="Memory{T}"/>
/// </summary>
- public static implicit operator Memory<T>(ArraySegment<T> arraySegment) => new Memory<T>(arraySegment.Array, arraySegment.Offset, arraySegment.Count);
+ public static implicit operator Memory<T>(ArraySegment<T> segment) => new Memory<T>(segment.Array, segment.Offset, segment.Count);
/// <summary>
/// Defines an implicit conversion of a <see cref="Memory{T}"/> to a <see cref="ReadOnlyMemory{T}"/>
@@ -270,9 +270,49 @@ namespace System
public bool TryCopyTo(Memory<T> destination) => Span.TryCopyTo(destination.Span);
/// <summary>
- /// Returns a handle for the array.
- /// <param name="pin">If pin is true, the GC will not move the array and hence its address can be taken</param>
+ /// Creates a handle for the memory.
+ /// The GC will not move the array until the returned <see cref="MemoryHandle"/>
+ /// is disposed, enabling taking and using the memory's address.
/// </summary>
+ public unsafe MemoryHandle Pin()
+ {
+ if (_index < 0)
+ {
+ return ((OwnedMemory<T>)_object).Pin((_index & RemoveOwnedFlagBitMask) * Unsafe.SizeOf<T>());
+ }
+ else if (typeof(T) == typeof(char) && _object is string s)
+ {
+ // This case can only happen if a ReadOnlyMemory<char> was created around a string
+ // and then that was cast to a Memory<char> using unsafe / marshaling code. This needs
+ // to work, however, so that code that uses a single Memory<char> field to store either
+ // a readable ReadOnlyMemory<char> or a writable Memory<char> can still be pinned and
+ // used for interop purposes.
+ GCHandle handle = GCHandle.Alloc(s, GCHandleType.Pinned);
+#if FEATURE_PORTABLE_SPAN
+ void* pointer = Unsafe.Add<T>((void*)handle.AddrOfPinnedObject(), _index);
+#else
+ void* pointer = Unsafe.Add<T>(Unsafe.AsPointer(ref s.GetRawStringData()), _index);
+#endif // FEATURE_PORTABLE_SPAN
+ return new MemoryHandle(null, pointer, handle);
+ }
+ else if (_object is T[] array)
+ {
+ var handle = GCHandle.Alloc(array, GCHandleType.Pinned);
+#if FEATURE_PORTABLE_SPAN
+ void* pointer = Unsafe.Add<T>((void*)handle.AddrOfPinnedObject(), _index);
+#else
+ void* pointer = Unsafe.Add<T>(Unsafe.AsPointer(ref array.GetRawSzArrayData()), _index);
+#endif // FEATURE_PORTABLE_SPAN
+ return new MemoryHandle(null, pointer, handle);
+ }
+ return default;
+ }
+
+ /// <summary>[Obsolete, use Pin()] Creates a handle for the memory.</summary>
+ /// <param name="pin">
+ /// If pin is true, the GC will not move the array until the returned <see cref="MemoryHandle"/>
+ /// is disposed, enabling taking and using the memory's address.
+ /// </param>
public unsafe MemoryHandle Retain(bool pin = false)
{
MemoryHandle memoryHandle = default;
diff --git a/src/mscorlib/shared/System/MemoryExtensions.Fast.cs b/src/mscorlib/shared/System/MemoryExtensions.Fast.cs
index d28c3d6883..d9e3af8804 100644
--- a/src/mscorlib/shared/System/MemoryExtensions.Fast.cs
+++ b/src/mscorlib/shared/System/MemoryExtensions.Fast.cs
@@ -28,35 +28,35 @@ namespace System
}
/// <summary>
- /// Determines whether this <paramref name="span"/> and the specified <paramref name="value"/> span have the same characters
+ /// Determines whether this <paramref name="span"/> and the specified <paramref name="other"/> span have the same characters
/// when compared using the specified <paramref name="comparisonType"/> option.
/// <param name="span">The source span.</param>
- /// <param name="value">The value to compare with the source span.</param>
- /// <param name="comparisonType">One of the enumeration values that determines how the <paramref name="span"/> and <paramref name="value"/> are compared.</param>
+ /// <param name="other">The value to compare with the source span.</param>
+ /// <param name="comparisonType">One of the enumeration values that determines how the <paramref name="span"/> and <paramref name="other"/> are compared.</param>
/// </summary>
- public static bool Equals(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType)
+ public static bool Equals(this ReadOnlySpan<char> span, ReadOnlySpan<char> other, StringComparison comparisonType)
{
string.CheckStringComparison(comparisonType);
switch (comparisonType)
{
case StringComparison.CurrentCulture:
- return (CultureInfo.CurrentCulture.CompareInfo.CompareOptionNone(span, value) == 0);
+ return (CultureInfo.CurrentCulture.CompareInfo.CompareOptionNone(span, other) == 0);
case StringComparison.CurrentCultureIgnoreCase:
- return (CultureInfo.CurrentCulture.CompareInfo.CompareOptionIgnoreCase(span, value) == 0);
+ return (CultureInfo.CurrentCulture.CompareInfo.CompareOptionIgnoreCase(span, other) == 0);
case StringComparison.InvariantCulture:
- return (CompareInfo.Invariant.CompareOptionNone(span, value) == 0);
+ return (CompareInfo.Invariant.CompareOptionNone(span, other) == 0);
case StringComparison.InvariantCultureIgnoreCase:
- return (CompareInfo.Invariant.CompareOptionIgnoreCase(span, value) == 0);
+ return (CompareInfo.Invariant.CompareOptionIgnoreCase(span, other) == 0);
case StringComparison.Ordinal:
- return EqualsOrdinal(span, value);
+ return EqualsOrdinal(span, other);
case StringComparison.OrdinalIgnoreCase:
- return EqualsOrdinalIgnoreCase(span, value);
+ return EqualsOrdinalIgnoreCase(span, other);
}
Debug.Fail("StringComparison outside range");
@@ -98,37 +98,37 @@ namespace System
}
/// <summary>
- /// Compares the specified <paramref name="span"/> and <paramref name="value"/> using the specified <paramref name="comparisonType"/>,
+ /// Compares the specified <paramref name="span"/> and <paramref name="other"/> using the specified <paramref name="comparisonType"/>,
/// and returns an integer that indicates their relative position in the sort order.
/// <param name="span">The source span.</param>
- /// <param name="value">The value to compare with the source span.</param>
- /// <param name="comparisonType">One of the enumeration values that determines how the <paramref name="span"/> and <paramref name="value"/> are compared.</param>
+ /// <param name="other">The value to compare with the source span.</param>
+ /// <param name="comparisonType">One of the enumeration values that determines how the <paramref name="span"/> and <paramref name="other"/> are compared.</param>
/// </summary>
- public static int CompareTo(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType)
+ public static int CompareTo(this ReadOnlySpan<char> span, ReadOnlySpan<char> other, StringComparison comparisonType)
{
string.CheckStringComparison(comparisonType);
switch (comparisonType)
{
case StringComparison.CurrentCulture:
- return CultureInfo.CurrentCulture.CompareInfo.CompareOptionNone(span, value);
+ return CultureInfo.CurrentCulture.CompareInfo.CompareOptionNone(span, other);
case StringComparison.CurrentCultureIgnoreCase:
- return CultureInfo.CurrentCulture.CompareInfo.CompareOptionIgnoreCase(span, value);
+ return CultureInfo.CurrentCulture.CompareInfo.CompareOptionIgnoreCase(span, other);
case StringComparison.InvariantCulture:
- return CompareInfo.Invariant.CompareOptionNone(span, value);
+ return CompareInfo.Invariant.CompareOptionNone(span, other);
case StringComparison.InvariantCultureIgnoreCase:
- return CompareInfo.Invariant.CompareOptionIgnoreCase(span, value);
+ return CompareInfo.Invariant.CompareOptionIgnoreCase(span, other);
case StringComparison.Ordinal:
- if (span.Length == 0 || value.Length == 0)
- return span.Length - value.Length;
- return string.CompareOrdinal(span, value);
+ if (span.Length == 0 || other.Length == 0)
+ return span.Length - other.Length;
+ return string.CompareOrdinal(span, other);
case StringComparison.OrdinalIgnoreCase:
- return CompareInfo.CompareOrdinalIgnoreCase(span, value);
+ return CompareInfo.CompareOrdinalIgnoreCase(span, other);
}
Debug.Fail("StringComparison outside range");
@@ -357,52 +357,6 @@ namespace System
}
/// <summary>
- /// Casts a Span of one primitive type <typeparamref name="T"/> to Span of bytes.
- /// That type may not contain pointers or references. This is checked at runtime in order to preserve type safety.
- /// </summary>
- /// <param name="source">The source slice, of type <typeparamref name="T"/>.</param>
- /// <exception cref="System.ArgumentException">
- /// Thrown when <typeparamref name="T"/> contains pointers.
- /// </exception>
- /// <exception cref="System.OverflowException">
- /// Thrown if the Length property of the new Span would exceed Int32.MaxValue.
- /// </exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Span<byte> AsBytes<T>(this Span<T> source)
- where T : struct
- {
- if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
- ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
-
- return new Span<byte>(
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(source)),
- checked(source.Length * Unsafe.SizeOf<T>()));
- }
-
- /// <summary>
- /// Casts a ReadOnlySpan of one primitive type <typeparamref name="T"/> to ReadOnlySpan of bytes.
- /// That type may not contain pointers or references. This is checked at runtime in order to preserve type safety.
- /// </summary>
- /// <param name="source">The source slice, of type <typeparamref name="T"/>.</param>
- /// <exception cref="System.ArgumentException">
- /// Thrown when <typeparamref name="T"/> contains pointers.
- /// </exception>
- /// <exception cref="System.OverflowException">
- /// Thrown if the Length property of the new Span would exceed Int32.MaxValue.
- /// </exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ReadOnlySpan<byte> AsBytes<T>(this ReadOnlySpan<T> source)
- where T : struct
- {
- if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
- ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
-
- return new ReadOnlySpan<byte>(
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(source)),
- checked(source.Length * Unsafe.SizeOf<T>()));
- }
-
- /// <summary>
/// Creates a new span over the portion of the target array.
/// </summary>
public static Span<T> AsSpan<T>(this T[] array, int start)
diff --git a/src/mscorlib/shared/System/MemoryExtensions.cs b/src/mscorlib/shared/System/MemoryExtensions.cs
index be6d22e09c..1a3b33acc7 100644
--- a/src/mscorlib/shared/System/MemoryExtensions.cs
+++ b/src/mscorlib/shared/System/MemoryExtensions.cs
@@ -113,6 +113,7 @@ namespace System
/// </summary>
/// <param name="span">The source span from which the characters are removed.</param>
/// <param name="trimChars">The span which contains the set of characters to remove.</param>
+ /// <remarks>If <paramref name="trimChars"/> is empty, white-space characters are removed instead.</remarks>
public static ReadOnlySpan<char> Trim(this ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars)
{
return span.TrimStart(trimChars).TrimEnd(trimChars);
@@ -124,8 +125,14 @@ namespace System
/// </summary>
/// <param name="span">The source span from which the characters are removed.</param>
/// <param name="trimChars">The span which contains the set of characters to remove.</param>
+ /// <remarks>If <paramref name="trimChars"/> is empty, white-space characters are removed instead.</remarks>
public static ReadOnlySpan<char> TrimStart(this ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars)
{
+ if (trimChars.IsEmpty)
+ {
+ return span.TrimStart();
+ }
+
int start = 0;
for (; start < span.Length; start++)
{
@@ -147,8 +154,14 @@ namespace System
/// </summary>
/// <param name="span">The source span from which the characters are removed.</param>
/// <param name="trimChars">The span which contains the set of characters to remove.</param>
+ /// <remarks>If <paramref name="trimChars"/> is empty, white-space characters are removed instead.</remarks>
public static ReadOnlySpan<char> TrimEnd(this ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars)
{
+ if (trimChars.IsEmpty)
+ {
+ return span.TrimEnd();
+ }
+
int end = span.Length - 1;
for (; end >= 0; end--)
{
@@ -191,6 +204,11 @@ namespace System
ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
Unsafe.As<T, byte>(ref value),
span.Length);
+ if (typeof(T) == typeof(char))
+ return SpanHelpers.IndexOf(
+ ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
+ Unsafe.As<T, char>(ref value),
+ span.Length);
return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
}
@@ -255,35 +273,42 @@ namespace System
/// Determines whether two sequences are equal by comparing the elements using IEquatable{T}.Equals(T).
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool SequenceEqual<T>(this Span<T> first, ReadOnlySpan<T> second)
+ public static bool SequenceEqual<T>(this Span<T> span, ReadOnlySpan<T> other)
where T : IEquatable<T>
{
- int length = first.Length;
+ int length = span.Length;
if (default(T) != null && IsTypeComparableAsBytes<T>(out nuint size))
- return length == second.Length &&
+ return length == other.Length &&
SpanHelpers.SequenceEqual(
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(first)),
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(second)),
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)),
((nuint)length) * size); // If this multiplication overflows, the Span we got overflows the entire address range. There's no happy outcome for this api in such a case so we choose not to take the overhead of checking.
- return length == second.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(first), ref MemoryMarshal.GetReference(second), length);
+ return length == other.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other), length);
}
/// <summary>
/// Determines the relative order of the sequences being compared by comparing the elements using IComparable{T}.CompareTo(T).
/// </summary>
- public static int SequenceCompareTo<T>(this Span<T> first, ReadOnlySpan<T> second)
+ public static int SequenceCompareTo<T>(this Span<T> span, ReadOnlySpan<T> other)
where T : IComparable<T>
{
if (typeof(T) == typeof(byte))
return SpanHelpers.SequenceCompareTo(
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(first)),
- first.Length,
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(second)),
- second.Length);
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
+ span.Length,
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)),
+ other.Length);
+
+ if (typeof(T) == typeof(char))
+ return SpanHelpers.SequenceCompareTo(
+ ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
+ span.Length,
+ ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)),
+ other.Length);
- return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(first), first.Length, ref MemoryMarshal.GetReference(second), second.Length);
+ return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length);
}
/// <summary>
@@ -300,6 +325,11 @@ namespace System
ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
Unsafe.As<T, byte>(ref value),
span.Length);
+ if (typeof(T) == typeof(char))
+ return SpanHelpers.IndexOf(
+ ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
+ Unsafe.As<T, char>(ref value),
+ span.Length);
return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
}
@@ -608,35 +638,42 @@ namespace System
/// Determines whether two sequences are equal by comparing the elements using IEquatable{T}.Equals(T).
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool SequenceEqual<T>(this ReadOnlySpan<T> first, ReadOnlySpan<T> second)
+ public static bool SequenceEqual<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> other)
where T : IEquatable<T>
{
- int length = first.Length;
+ int length = span.Length;
if (default(T) != null && IsTypeComparableAsBytes<T>(out nuint size))
- return length == second.Length &&
+ return length == other.Length &&
SpanHelpers.SequenceEqual(
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(first)),
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(second)),
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)),
((nuint)length) * size); // If this multiplication overflows, the Span we got overflows the entire address range. There's no happy outcome for this api in such a case so we choose not to take the overhead of checking.
- return length == second.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(first), ref MemoryMarshal.GetReference(second), length);
+ return length == other.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other), length);
}
/// <summary>
/// Determines the relative order of the sequences being compared by comparing the elements using IComparable{T}.CompareTo(T).
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int SequenceCompareTo<T>(this ReadOnlySpan<T> first, ReadOnlySpan<T> second)
+ public static int SequenceCompareTo<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> other)
where T : IComparable<T>
{
if (typeof(T) == typeof(byte))
return SpanHelpers.SequenceCompareTo(
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(first)),
- first.Length,
- ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(second)),
- second.Length);
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
+ span.Length,
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)),
+ other.Length);
+
+ if (typeof(T) == typeof(char))
+ return SpanHelpers.SequenceCompareTo(
+ ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
+ span.Length,
+ ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)),
+ other.Length);
- return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(first), first.Length, ref MemoryMarshal.GetReference(second), second.Length);
+ return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length);
}
/// <summary>
@@ -901,16 +938,16 @@ namespace System
/// and destinations overlap, this method behaves as if the original values in
/// a temporary location before the destination is overwritten.
///
- ///<param name="array">The array to copy items from.</param>
+ ///<param name="source">The array to copy items from.</param>
/// <param name="destination">The span to copy items into.</param>
/// <exception cref="System.ArgumentException">
/// Thrown when the destination Span is shorter than the source array.
/// </exception>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void CopyTo<T>(this T[] array, Span<T> destination)
+ public static void CopyTo<T>(this T[] source, Span<T> destination)
{
- new ReadOnlySpan<T>(array).CopyTo(destination);
+ new ReadOnlySpan<T>(source).CopyTo(destination);
}
/// <summary>
@@ -918,16 +955,16 @@ namespace System
/// and destinations overlap, this method behaves as if the original values are in
/// a temporary location before the destination is overwritten.
///
- ///<param name="array">The array to copy items from.</param>
+ ///<param name="source">The array to copy items from.</param>
/// <param name="destination">The memory to copy items into.</param>
/// <exception cref="System.ArgumentException">
/// Thrown when the destination is shorter than the source array.
/// </exception>
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void CopyTo<T>(this T[] array, Memory<T> destination)
+ public static void CopyTo<T>(this T[] source, Memory<T> destination)
{
- array.CopyTo(destination.Span);
+ source.CopyTo(destination.Span);
}
//
@@ -1062,65 +1099,65 @@ namespace System
/// Determines whether two sequences overlap in memory.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool Overlaps<T>(this Span<T> first, ReadOnlySpan<T> second)
+ public static bool Overlaps<T>(this Span<T> span, ReadOnlySpan<T> other)
{
- return Overlaps((ReadOnlySpan<T>)first, second);
+ return Overlaps((ReadOnlySpan<T>)span, other);
}
/// <summary>
/// Determines whether two sequences overlap in memory and outputs the element offset.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool Overlaps<T>(this Span<T> first, ReadOnlySpan<T> second, out int elementOffset)
+ public static bool Overlaps<T>(this Span<T> span, ReadOnlySpan<T> other, out int elementOffset)
{
- return Overlaps((ReadOnlySpan<T>)first, second, out elementOffset);
+ return Overlaps((ReadOnlySpan<T>)span, other, out elementOffset);
}
/// <summary>
/// Determines whether two sequences overlap in memory.
/// </summary>
- public static bool Overlaps<T>(this ReadOnlySpan<T> first, ReadOnlySpan<T> second)
+ public static bool Overlaps<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> other)
{
- if (first.IsEmpty || second.IsEmpty)
+ if (span.IsEmpty || other.IsEmpty)
{
return false;
}
IntPtr byteOffset = Unsafe.ByteOffset(
- ref MemoryMarshal.GetReference(first),
- ref MemoryMarshal.GetReference(second));
+ ref MemoryMarshal.GetReference(span),
+ ref MemoryMarshal.GetReference(other));
if (Unsafe.SizeOf<IntPtr>() == sizeof(int))
{
- return (uint)byteOffset < (uint)(first.Length * Unsafe.SizeOf<T>()) ||
- (uint)byteOffset > (uint)-(second.Length * Unsafe.SizeOf<T>());
+ return (uint)byteOffset < (uint)(span.Length * Unsafe.SizeOf<T>()) ||
+ (uint)byteOffset > (uint)-(other.Length * Unsafe.SizeOf<T>());
}
else
{
- return (ulong)byteOffset < (ulong)((long)first.Length * Unsafe.SizeOf<T>()) ||
- (ulong)byteOffset > (ulong)-((long)second.Length * Unsafe.SizeOf<T>());
+ return (ulong)byteOffset < (ulong)((long)span.Length * Unsafe.SizeOf<T>()) ||
+ (ulong)byteOffset > (ulong)-((long)other.Length * Unsafe.SizeOf<T>());
}
}
/// <summary>
/// Determines whether two sequences overlap in memory and outputs the element offset.
/// </summary>
- public static bool Overlaps<T>(this ReadOnlySpan<T> first, ReadOnlySpan<T> second, out int elementOffset)
+ public static bool Overlaps<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> other, out int elementOffset)
{
- if (first.IsEmpty || second.IsEmpty)
+ if (span.IsEmpty || other.IsEmpty)
{
elementOffset = 0;
return false;
}
IntPtr byteOffset = Unsafe.ByteOffset(
- ref MemoryMarshal.GetReference(first),
- ref MemoryMarshal.GetReference(second));
+ ref MemoryMarshal.GetReference(span),
+ ref MemoryMarshal.GetReference(other));
if (Unsafe.SizeOf<IntPtr>() == sizeof(int))
{
- if ((uint)byteOffset < (uint)(first.Length * Unsafe.SizeOf<T>()) ||
- (uint)byteOffset > (uint)-(second.Length * Unsafe.SizeOf<T>()))
+ if ((uint)byteOffset < (uint)(span.Length * Unsafe.SizeOf<T>()) ||
+ (uint)byteOffset > (uint)-(other.Length * Unsafe.SizeOf<T>()))
{
if ((int)byteOffset % Unsafe.SizeOf<T>() != 0)
ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch();
@@ -1136,8 +1173,8 @@ namespace System
}
else
{
- if ((ulong)byteOffset < (ulong)((long)first.Length * Unsafe.SizeOf<T>()) ||
- (ulong)byteOffset > (ulong)-((long)second.Length * Unsafe.SizeOf<T>()))
+ if ((ulong)byteOffset < (ulong)((long)span.Length * Unsafe.SizeOf<T>()) ||
+ (ulong)byteOffset > (ulong)-((long)other.Length * Unsafe.SizeOf<T>()))
{
if ((long)byteOffset % Unsafe.SizeOf<T>() != 0)
ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch();
diff --git a/src/mscorlib/shared/System/ReadOnlyMemory.cs b/src/mscorlib/shared/System/ReadOnlyMemory.cs
index 90a9decf66..dca7db3dfd 100644
--- a/src/mscorlib/shared/System/ReadOnlyMemory.cs
+++ b/src/mscorlib/shared/System/ReadOnlyMemory.cs
@@ -105,7 +105,7 @@ namespace System
/// <summary>
/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="ReadOnlyMemory{T}"/>
/// </summary>
- public static implicit operator ReadOnlyMemory<T>(ArraySegment<T> arraySegment) => new ReadOnlyMemory<T>(arraySegment.Array, arraySegment.Offset, arraySegment.Count);
+ public static implicit operator ReadOnlyMemory<T>(ArraySegment<T> segment) => new ReadOnlyMemory<T>(segment.Array, segment.Offset, segment.Count);
/// <summary>
/// Returns an empty <see cref="ReadOnlyMemory{T}"/>
@@ -226,10 +226,44 @@ namespace System
/// <param name="destination">The span to copy items into.</param>
public bool TryCopyTo(Memory<T> destination) => Span.TryCopyTo(destination.Span);
- /// <summary>Creates a handle for the memory.</summary>
+ /// <summary>
+ /// Creates a handle for the memory.
+ /// The GC will not move the array until the returned <see cref="MemoryHandle"/>
+ /// is disposed, enabling taking and using the memory's address.
+ /// </summary>
+ public unsafe MemoryHandle Pin()
+ {
+ if (_index < 0)
+ {
+ return ((OwnedMemory<T>)_object).Pin((_index & RemoveOwnedFlagBitMask) * Unsafe.SizeOf<T>());
+ }
+ else if (typeof(T) == typeof(char) && _object is string s)
+ {
+ GCHandle handle = GCHandle.Alloc(s, GCHandleType.Pinned);
+#if FEATURE_PORTABLE_SPAN
+ void* pointer = Unsafe.Add<T>((void*)handle.AddrOfPinnedObject(), _index);
+#else
+ void* pointer = Unsafe.Add<T>(Unsafe.AsPointer(ref s.GetRawStringData()), _index);
+#endif // FEATURE_PORTABLE_SPAN
+ return new MemoryHandle(null, pointer, handle);
+ }
+ else if (_object is T[] array)
+ {
+ var handle = GCHandle.Alloc(array, GCHandleType.Pinned);
+#if FEATURE_PORTABLE_SPAN
+ void* pointer = Unsafe.Add<T>((void*)handle.AddrOfPinnedObject(), _index);
+#else
+ void* pointer = Unsafe.Add<T>(Unsafe.AsPointer(ref array.GetRawSzArrayData()), _index);
+#endif // FEATURE_PORTABLE_SPAN
+ return new MemoryHandle(null, pointer, handle);
+ }
+ return default;
+ }
+
+ /// <summary>[Obsolete, use Pin()] Creates a handle for the memory.</summary>
/// <param name="pin">
/// If pin is true, the GC will not move the array until the returned <see cref="MemoryHandle"/>
- /// is disposed, enabling the memory's address can be taken and used.
+ /// is disposed, enabling taking and using the memory's address.
/// </param>
public unsafe MemoryHandle Retain(bool pin = false)
{
diff --git a/src/mscorlib/shared/System/ReadOnlySpan.cs b/src/mscorlib/shared/System/ReadOnlySpan.cs
index 906a3c4317..14b33e23f2 100644
--- a/src/mscorlib/shared/System/ReadOnlySpan.cs
+++ b/src/mscorlib/shared/System/ReadOnlySpan.cs
@@ -88,8 +88,8 @@ namespace System
/// <summary>
/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="ReadOnlySpan{T}"/>
/// </summary>
- public static implicit operator ReadOnlySpan<T>(ArraySegment<T> arraySegment)
- => new ReadOnlySpan<T>(arraySegment.Array, arraySegment.Offset, arraySegment.Count);
+ public static implicit operator ReadOnlySpan<T>(ArraySegment<T> segment)
+ => new ReadOnlySpan<T>(segment.Array, segment.Offset, segment.Count);
/// <summary>
/// Returns a 0-length read-only span whose base is the null pointer.
diff --git a/src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs b/src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs
index 34881e77a9..80ae450b51 100644
--- a/src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs
+++ b/src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.Fast.cs
@@ -15,8 +15,54 @@ namespace System.Runtime.InteropServices
/// </summary>
public static partial class MemoryMarshal
{
+ /// <summary>
+ /// Casts a Span of one primitive type <typeparamref name="T"/> to Span of bytes.
+ /// That type may not contain pointers or references. This is checked at runtime in order to preserve type safety.
+ /// </summary>
+ /// <param name="span">The source slice, of type <typeparamref name="T"/>.</param>
+ /// <exception cref="System.ArgumentException">
+ /// Thrown when <typeparamref name="T"/> contains pointers.
+ /// </exception>
+ /// <exception cref="System.OverflowException">
+ /// Thrown if the Length property of the new Span would exceed Int32.MaxValue.
+ /// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Span<byte> AsBytes<T>(Span<T> span)
+ where T : struct
+ {
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
+ ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
+
+ return new Span<byte>(
+ ref Unsafe.As<T, byte>(ref GetReference(span)),
+ checked(span.Length * Unsafe.SizeOf<T>()));
+ }
+
+ /// <summary>
+ /// Casts a ReadOnlySpan of one primitive type <typeparamref name="T"/> to ReadOnlySpan of bytes.
+ /// That type may not contain pointers or references. This is checked at runtime in order to preserve type safety.
+ /// </summary>
+ /// <param name="span">The source slice, of type <typeparamref name="T"/>.</param>
+ /// <exception cref="System.ArgumentException">
+ /// Thrown when <typeparamref name="T"/> contains pointers.
+ /// </exception>
+ /// <exception cref="System.OverflowException">
+ /// Thrown if the Length property of the new Span would exceed Int32.MaxValue.
+ /// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ReadOnlySpan<byte> AsBytes<T>(ReadOnlySpan<T> span)
+ where T : struct
+ {
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
+ ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
+
+ return new ReadOnlySpan<byte>(
+ ref Unsafe.As<T, byte>(ref GetReference(span)),
+ checked(span.Length * Unsafe.SizeOf<T>()));
+ }
+
/// <summary>Creates a <see cref="Memory{T}"/> from a <see cref="ReadOnlyMemory{T}"/>.</summary>
- /// <param name="readOnlyMemory">The <see cref="ReadOnlyMemory{T}"/>.</param>
+ /// <param name="memory">The <see cref="ReadOnlyMemory{T}"/>.</param>
/// <returns>A <see cref="Memory{T}"/> representing the same memory as the <see cref="ReadOnlyMemory{T}"/>, but writable.</returns>
/// <remarks>
/// <see cref="AsMemory{T}(ReadOnlyMemory{T})"/> must be used with extreme caution. <see cref="ReadOnlyMemory{T}"/> is used
@@ -24,8 +70,8 @@ namespace System.Runtime.InteropServices
/// by <see cref="AsMemory{T}(ReadOnlyMemory{T})"/> should not be written to. The method exists to enable variables typed
/// as <see cref="Memory{T}"/> but only used for reading to store a <see cref="ReadOnlyMemory{T}"/>.
/// </remarks>
- public static Memory<T> AsMemory<T>(ReadOnlyMemory<T> readOnlyMemory) =>
- Unsafe.As<ReadOnlyMemory<T>, Memory<T>>(ref readOnlyMemory);
+ public static Memory<T> AsMemory<T>(ReadOnlyMemory<T> memory) =>
+ Unsafe.As<ReadOnlyMemory<T>, Memory<T>>(ref memory);
/// <summary>
/// Returns a reference to the 0th element of the Span. If the Span is empty, returns a reference to the location where the 0th element
@@ -60,12 +106,12 @@ namespace System.Runtime.InteropServices
/// <remarks>
/// Supported only for platforms that support misaligned memory access.
/// </remarks>
- /// <param name="source">The source slice, of type <typeparamref name="TFrom"/>.</param>
+ /// <param name="span">The source slice, of type <typeparamref name="TFrom"/>.</param>
/// <exception cref="System.ArgumentException">
/// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Span<TTo> Cast<TFrom, TTo>(Span<TFrom> source)
+ public static Span<TTo> Cast<TFrom, TTo>(Span<TFrom> span)
where TFrom : struct
where TTo : struct
{
@@ -78,7 +124,7 @@ namespace System.Runtime.InteropServices
// and checked casts are faster and smaller.
uint fromSize = (uint)Unsafe.SizeOf<TFrom>();
uint toSize = (uint)Unsafe.SizeOf<TTo>();
- uint fromLength = (uint)source.Length;
+ uint fromLength = (uint)span.Length;
int toLength;
if (fromSize == toSize)
{
@@ -104,7 +150,7 @@ namespace System.Runtime.InteropServices
}
return new Span<TTo>(
- ref Unsafe.As<TFrom, TTo>(ref source._pointer.Value),
+ ref Unsafe.As<TFrom, TTo>(ref span._pointer.Value),
toLength);
}
@@ -115,12 +161,12 @@ namespace System.Runtime.InteropServices
/// <remarks>
/// Supported only for platforms that support misaligned memory access.
/// </remarks>
- /// <param name="source">The source slice, of type <typeparamref name="TFrom"/>.</param>
+ /// <param name="span">The source slice, of type <typeparamref name="TFrom"/>.</param>
/// <exception cref="System.ArgumentException">
/// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers.
/// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ReadOnlySpan<TTo> Cast<TFrom, TTo>(ReadOnlySpan<TFrom> source)
+ public static ReadOnlySpan<TTo> Cast<TFrom, TTo>(ReadOnlySpan<TFrom> span)
where TFrom : struct
where TTo : struct
{
@@ -133,7 +179,7 @@ namespace System.Runtime.InteropServices
// and checked casts are faster and smaller.
uint fromSize = (uint)Unsafe.SizeOf<TFrom>();
uint toSize = (uint)Unsafe.SizeOf<TTo>();
- uint fromLength = (uint)source.Length;
+ uint fromLength = (uint)span.Length;
int toLength;
if (fromSize == toSize)
{
@@ -159,7 +205,7 @@ namespace System.Runtime.InteropServices
}
return new ReadOnlySpan<TTo>(
- ref Unsafe.As<TFrom, TTo>(ref MemoryMarshal.GetReference(source)),
+ ref Unsafe.As<TFrom, TTo>(ref MemoryMarshal.GetReference(span)),
toLength);
}
diff --git a/src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.cs b/src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.cs
index 316ce12aab..b4b17b0370 100644
--- a/src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.cs
+++ b/src/mscorlib/shared/System/Runtime/InteropServices/MemoryMarshal.cs
@@ -6,6 +6,10 @@ using System.Buffers;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
+#if !netstandard
+using Internal.Runtime.CompilerServices;
+#endif
+
namespace System.Runtime.InteropServices
{
/// <summary>
@@ -18,71 +22,71 @@ namespace System.Runtime.InteropServices
/// Get an array segment from the underlying memory.
/// If unable to get the array segment, return false with a default array segment.
/// </summary>
- public static bool TryGetArray<T>(ReadOnlyMemory<T> readOnlyMemory, out ArraySegment<T> arraySegment)
+ public static bool TryGetArray<T>(ReadOnlyMemory<T> memory, out ArraySegment<T> segment)
{
- object obj = readOnlyMemory.GetObjectStartLength(out int index, out int length);
+ object obj = memory.GetObjectStartLength(out int index, out int length);
if (index < 0)
{
- if (((OwnedMemory<T>)obj).TryGetArray(out var segment))
+ if (((OwnedMemory<T>)obj).TryGetArray(out ArraySegment<T> arraySegment))
{
- arraySegment = new ArraySegment<T>(segment.Array, segment.Offset + (index & ReadOnlyMemory<T>.RemoveOwnedFlagBitMask), length);
+ segment = new ArraySegment<T>(arraySegment.Array, arraySegment.Offset + (index & ReadOnlyMemory<T>.RemoveOwnedFlagBitMask), length);
return true;
}
}
else if (obj is T[] arr)
{
- arraySegment = new ArraySegment<T>(arr, index, length);
+ segment = new ArraySegment<T>(arr, index, length);
return true;
}
if (length == 0)
{
#if FEATURE_PORTABLE_SPAN
- arraySegment = new ArraySegment<T>(SpanHelpers.PerTypeValues<T>.EmptyArray);
+ segment = new ArraySegment<T>(SpanHelpers.PerTypeValues<T>.EmptyArray);
#else
- arraySegment = ArraySegment<T>.Empty;
+ segment = ArraySegment<T>.Empty;
#endif // FEATURE_PORTABLE_SPAN
return true;
}
- arraySegment = default;
+ segment = default;
return false;
}
/// <summary>
- /// Gets an <see cref="OwnedMemory{T}"/> from the underlying readOnlyMemory.
+ /// Gets an <see cref="OwnedMemory{T}"/> from the underlying read-only memory.
/// If unable to get the <typeparamref name="TOwner"/> type, returns false.
/// </summary>
- /// <typeparam name="T">The element type of the <paramref name="readOnlyMemory" />.</typeparam>
+ /// <typeparam name="T">The element type of the <paramref name="memory" />.</typeparam>
/// <typeparam name="TOwner">The type of <see cref="OwnedMemory{T}"/> to try and retrive.</typeparam>
- /// <param name="readOnlyMemory">The memory to get the owner for.</param>
- /// <param name="ownedMemory">The returned owner of the <see cref="ReadOnlyMemory{T}"/>.</param>
+ /// <param name="memory">The memory to get the owner for.</param>
+ /// <param name="owner">The returned owner of the <see cref="ReadOnlyMemory{T}"/>.</param>
/// <returns>A <see cref="bool"/> indicating if it was successful.</returns>
- public static bool TryGetOwnedMemory<T, TOwner>(ReadOnlyMemory<T> readOnlyMemory, out TOwner ownedMemory)
+ public static bool TryGetOwnedMemory<T, TOwner>(ReadOnlyMemory<T> memory, out TOwner owner)
where TOwner : OwnedMemory<T>
{
- TOwner owner; // Use register for null comparison rather than byref
- ownedMemory = owner = readOnlyMemory.GetObjectStartLength(out int index, out int length) as TOwner;
+ TOwner localOwner; // Use register for null comparison rather than byref
+ owner = localOwner = memory.GetObjectStartLength(out int index, out int length) as TOwner;
return !ReferenceEquals(owner, null);
}
/// <summary>
- /// Gets an <see cref="OwnedMemory{T}"/> and <paramref name="index" />, <paramref name="length" /> from the underlying memory.
+ /// Gets an <see cref="OwnedMemory{T}"/> and <paramref name="start" />, <paramref name="length" /> from the underlying read-only memory.
/// If unable to get the <typeparamref name="TOwner"/> type, returns false.
/// </summary>
- /// <typeparam name="T">The element type of the <paramref name="readOnlyMemory" />.</typeparam>
+ /// <typeparam name="T">The element type of the <paramref name="memory" />.</typeparam>
/// <typeparam name="TOwner">The type of <see cref="OwnedMemory{T}"/> to try and retrive.</typeparam>
- /// <param name="readOnlyMemory">The memory to get the owner for.</param>
- /// <param name="ownedMemory">The returned owner of the <see cref="ReadOnlyMemory{T}"/>.</param>
- /// <param name="index">The offset from the start of the <paramref name="ownedMemory" /> that the <paramref name="readOnlyMemory" /> represents.</param>
- /// <param name="length">The length of the <paramref name="ownedMemory" /> that the <paramref name="readOnlyMemory" /> represents.</param>
+ /// <param name="memory">The memory to get the owner for.</param>
+ /// <param name="owner">The returned owner of the <see cref="ReadOnlyMemory{T}"/>.</param>
+ /// <param name="start">The offset from the start of the <paramref name="owner" /> that the <paramref name="memory" /> represents.</param>
+ /// <param name="length">The length of the <paramref name="owner" /> that the <paramref name="memory" /> represents.</param>
/// <returns>A <see cref="bool"/> indicating if it was successful.</returns>
- public static bool TryGetOwnedMemory<T, TOwner>(ReadOnlyMemory<T> readOnlyMemory, out TOwner ownedMemory, out int index, out int length)
+ public static bool TryGetOwnedMemory<T, TOwner>(ReadOnlyMemory<T> memory, out TOwner owner, out int start, out int length)
where TOwner : OwnedMemory<T>
{
- TOwner owner; // Use register for null comparison rather than byref
- ownedMemory = owner = readOnlyMemory.GetObjectStartLength(out index, out length) as TOwner;
- index &= ReadOnlyMemory<T>.RemoveOwnedFlagBitMask;
+ TOwner localOwner; // Use register for null comparison rather than byref
+ owner = localOwner = memory.GetObjectStartLength(out start, out length) as TOwner;
+ start &= ReadOnlyMemory<T>.RemoveOwnedFlagBitMask;
return !ReferenceEquals(owner, null);
}
@@ -100,14 +104,14 @@ namespace System.Runtime.InteropServices
}
/// <summary>Attempts to get the underlying <see cref="string"/> from a <see cref="ReadOnlyMemory{T}"/>.</summary>
- /// <param name="readOnlyMemory">The memory that may be wrapping a <see cref="string"/> object.</param>
+ /// <param name="memory">The memory that may be wrapping a <see cref="string"/> object.</param>
/// <param name="text">The string.</param>
/// <param name="start">The starting location in <paramref name="text"/>.</param>
/// <param name="length">The number of items in <paramref name="text"/>.</param>
/// <returns></returns>
- public static bool TryGetString(ReadOnlyMemory<char> readOnlyMemory, out string text, out int start, out int length)
+ public static bool TryGetString(ReadOnlyMemory<char> memory, out string text, out int start, out int length)
{
- if (readOnlyMemory.GetObjectStartLength(out int offset, out int count) is string s)
+ if (memory.GetObjectStartLength(out int offset, out int count) is string s)
{
text = s;
start = offset;
@@ -122,5 +126,110 @@ namespace System.Runtime.InteropServices
return false;
}
}
+
+ /// <summary>
+ /// Reads a structure of type T out of a read-only span of bytes.
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static T Read<T>(ReadOnlySpan<byte> source)
+ where T : struct
+ {
+#if netstandard
+ if (SpanHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T));
+ }
+#else
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
+ }
+#endif
+ if (Unsafe.SizeOf<T>() > source.Length)
+ {
+ ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length);
+ }
+ return Unsafe.ReadUnaligned<T>(ref GetReference(source));
+ }
+
+ /// <summary>
+ /// Reads a structure of type T out of a span of bytes.
+ /// <returns>If the span is too small to contain the type T, return false.</returns>
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool TryRead<T>(ReadOnlySpan<byte> source, out T value)
+ where T : struct
+ {
+#if netstandard
+ if (SpanHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T));
+ }
+#else
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
+ }
+#endif
+ if (Unsafe.SizeOf<T>() > (uint)source.Length)
+ {
+ value = default;
+ return false;
+ }
+ value = Unsafe.ReadUnaligned<T>(ref GetReference(source));
+ return true;
+ }
+
+ /// <summary>
+ /// Writes a structure of type T into a span of bytes.
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void Write<T>(Span<byte> destination, ref T value)
+ where T : struct
+ {
+#if netstandard
+ if (SpanHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T));
+ }
+#else
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
+ }
+#endif
+ if ((uint)Unsafe.SizeOf<T>() > (uint)destination.Length)
+ {
+ ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length);
+ }
+ Unsafe.WriteUnaligned<T>(ref GetReference(destination), value);
+ }
+
+ /// <summary>
+ /// Writes a structure of type T into a span of bytes.
+ /// <returns>If the span is too small to contain the type T, return false.</returns>
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool TryWrite<T>(Span<byte> destination, ref T value)
+ where T : struct
+ {
+#if netstandard
+ if (SpanHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T));
+ }
+#else
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
+ }
+#endif
+ if (Unsafe.SizeOf<T>() > (uint)destination.Length)
+ {
+ return false;
+ }
+ Unsafe.WriteUnaligned<T>(ref GetReference(destination), value);
+ return true;
+ }
}
}
diff --git a/src/mscorlib/shared/System/Span.cs b/src/mscorlib/shared/System/Span.cs
index 78733515cd..81288a7627 100644
--- a/src/mscorlib/shared/System/Span.cs
+++ b/src/mscorlib/shared/System/Span.cs
@@ -89,8 +89,8 @@ namespace System
/// <summary>
/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="Span{T}"/>
/// </summary>
- public static implicit operator Span<T>(ArraySegment<T> arraySegment)
- => new Span<T>(arraySegment.Array, arraySegment.Offset, arraySegment.Count);
+ public static implicit operator Span<T>(ArraySegment<T> segment)
+ => new Span<T>(segment.Array, segment.Offset, segment.Count);
/// <summary>
/// Returns an empty <see cref="Span{T}"/>
diff --git a/src/mscorlib/shared/System/SpanHelpers.Byte.cs b/src/mscorlib/shared/System/SpanHelpers.Byte.cs
index b47a0521a4..2b91b640e2 100644
--- a/src/mscorlib/shared/System/SpanHelpers.Byte.cs
+++ b/src/mscorlib/shared/System/SpanHelpers.Byte.cs
@@ -108,16 +108,13 @@ namespace System
Debug.Assert(length >= 0);
uint uValue = value; // Use uint for comparisons to avoid unnecessary 8->32 extensions
- IntPtr index = (IntPtr)0; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
- IntPtr nLength = (IntPtr)(uint)length;
+ IntPtr index = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr nLength = (IntPtr)length;
#if !netstandard11
if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
{
- unchecked
- {
- int unaligned = (int)(byte*)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
- nLength = (IntPtr)(uint)((Vector<byte>.Count - unaligned) & (Vector<byte>.Count - 1));
- }
+ int unaligned = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
+ nLength = (IntPtr)((Vector<byte>.Count - unaligned) & (Vector<byte>.Count - 1));
}
SequentialScan:
#endif
@@ -125,21 +122,21 @@ namespace System
{
nLength -= 8;
- if (uValue == Unsafe.Add(ref searchSpace, index))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index))
goto Found;
- if (uValue == Unsafe.Add(ref searchSpace, index + 1))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 1))
goto Found1;
- if (uValue == Unsafe.Add(ref searchSpace, index + 2))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 2))
goto Found2;
- if (uValue == Unsafe.Add(ref searchSpace, index + 3))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 3))
goto Found3;
- if (uValue == Unsafe.Add(ref searchSpace, index + 4))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 4))
goto Found4;
- if (uValue == Unsafe.Add(ref searchSpace, index + 5))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 5))
goto Found5;
- if (uValue == Unsafe.Add(ref searchSpace, index + 6))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 6))
goto Found6;
- if (uValue == Unsafe.Add(ref searchSpace, index + 7))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 7))
goto Found7;
index += 8;
@@ -149,13 +146,13 @@ namespace System
{
nLength -= 4;
- if (uValue == Unsafe.Add(ref searchSpace, index))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index))
goto Found;
- if (uValue == Unsafe.Add(ref searchSpace, index + 1))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 1))
goto Found1;
- if (uValue == Unsafe.Add(ref searchSpace, index + 2))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 2))
goto Found2;
- if (uValue == Unsafe.Add(ref searchSpace, index + 3))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 3))
goto Found3;
index += 4;
@@ -165,7 +162,7 @@ namespace System
{
nLength -= 1;
- if (uValue == Unsafe.Add(ref searchSpace, index))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index))
goto Found;
index += 1;
@@ -173,9 +170,11 @@ namespace System
#if !netstandard11
if (Vector.IsHardwareAccelerated && ((int)(byte*)index < length))
{
- nLength = (IntPtr)(uint)((length - (uint)index) & ~(Vector<byte>.Count - 1));
+ nLength = (IntPtr)((length - (int)(byte*)index) & ~(Vector<byte>.Count - 1));
+
// Get comparison Vector
Vector<byte> vComparison = GetVector(value);
+
while ((byte*)nLength > (byte*)index)
{
var vMatches = Vector.Equals(vComparison, Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref searchSpace, index)));
@@ -190,10 +189,7 @@ namespace System
if ((int)(byte*)index < length)
{
- unchecked
- {
- nLength = (IntPtr)(length - (int)(byte*)index);
- }
+ nLength = (IntPtr)(length - (int)(byte*)index);
goto SequentialScan;
}
}
@@ -256,16 +252,13 @@ namespace System
Debug.Assert(length >= 0);
uint uValue = value; // Use uint for comparisons to avoid unnecessary 8->32 extensions
- IntPtr index = (IntPtr)(uint)length; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
- IntPtr nLength = (IntPtr)(uint)length;
+ IntPtr index = (IntPtr)length; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr nLength = (IntPtr)length;
#if !netstandard11
if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
{
- unchecked
- {
- int unaligned = (int)(byte*)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
- nLength = (IntPtr)(((length & (Vector<byte>.Count - 1)) + unaligned) & (Vector<byte>.Count - 1));
- }
+ int unaligned = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
+ nLength = (IntPtr)(((length & (Vector<byte>.Count - 1)) + unaligned) & (Vector<byte>.Count - 1));
}
SequentialScan:
#endif
@@ -274,21 +267,21 @@ namespace System
nLength -= 8;
index -= 8;
- if (uValue == Unsafe.Add(ref searchSpace, index + 7))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 7))
goto Found7;
- if (uValue == Unsafe.Add(ref searchSpace, index + 6))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 6))
goto Found6;
- if (uValue == Unsafe.Add(ref searchSpace, index + 5))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 5))
goto Found5;
- if (uValue == Unsafe.Add(ref searchSpace, index + 4))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 4))
goto Found4;
- if (uValue == Unsafe.Add(ref searchSpace, index + 3))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 3))
goto Found3;
- if (uValue == Unsafe.Add(ref searchSpace, index + 2))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 2))
goto Found2;
- if (uValue == Unsafe.Add(ref searchSpace, index + 1))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 1))
goto Found1;
- if (uValue == Unsafe.Add(ref searchSpace, index))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index))
goto Found;
}
@@ -297,13 +290,13 @@ namespace System
nLength -= 4;
index -= 4;
- if (uValue == Unsafe.Add(ref searchSpace, index + 3))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 3))
goto Found3;
- if (uValue == Unsafe.Add(ref searchSpace, index + 2))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 2))
goto Found2;
- if (uValue == Unsafe.Add(ref searchSpace, index + 1))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 1))
goto Found1;
- if (uValue == Unsafe.Add(ref searchSpace, index))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index))
goto Found;
}
@@ -312,16 +305,17 @@ namespace System
nLength -= 1;
index -= 1;
- if (uValue == Unsafe.Add(ref searchSpace, index))
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index))
goto Found;
}
#if !netstandard11
- if (Vector.IsHardwareAccelerated && ((int)(byte*)index > 0))
+ if (Vector.IsHardwareAccelerated && ((byte*)index > (byte*)0))
{
- nLength = (IntPtr)(uint)((uint)index & ~(Vector<byte>.Count - 1));
+ nLength = (IntPtr)((int)(byte*)index & ~(Vector<byte>.Count - 1));
// Get comparison Vector
Vector<byte> vComparison = GetVector(value);
+
while ((byte*)nLength > (byte*)(Vector<byte>.Count - 1))
{
var vMatches = Vector.Equals(vComparison, Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref searchSpace, index - Vector<byte>.Count)));
@@ -332,9 +326,9 @@ namespace System
continue;
}
// Find offset of first match
- return (int)(byte*)(index) - Vector<byte>.Count + LocateLastFoundByte(vMatches);
+ return (int)(index) - Vector<byte>.Count + LocateLastFoundByte(vMatches);
}
- if ((int)(byte*)index > 0)
+ if ((byte*)index > (byte*)0)
{
nLength = index;
goto SequentialScan;
@@ -366,16 +360,13 @@ namespace System
uint uValue0 = value0; // Use uint for comparisons to avoid unnecessary 8->32 extensions
uint uValue1 = value1; // Use uint for comparisons to avoid unnecessary 8->32 extensions
- IntPtr index = (IntPtr)0; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
- IntPtr nLength = (IntPtr)(uint)length;
+ IntPtr index = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr nLength = (IntPtr)length;
#if !netstandard11
if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
{
- unchecked
- {
- int unaligned = (int)(byte*)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
- nLength = (IntPtr)(uint)((Vector<byte>.Count - unaligned) & (Vector<byte>.Count - 1));
- }
+ int unaligned = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
+ nLength = (IntPtr)((Vector<byte>.Count - unaligned) & (Vector<byte>.Count - 1));
}
SequentialScan:
#endif
@@ -384,28 +375,28 @@ namespace System
{
nLength -= 8;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found;
- lookUp = Unsafe.Add(ref searchSpace, index + 1);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 1);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found1;
- lookUp = Unsafe.Add(ref searchSpace, index + 2);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 2);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found2;
- lookUp = Unsafe.Add(ref searchSpace, index + 3);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 3);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found3;
- lookUp = Unsafe.Add(ref searchSpace, index + 4);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 4);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found4;
- lookUp = Unsafe.Add(ref searchSpace, index + 5);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 5);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found5;
- lookUp = Unsafe.Add(ref searchSpace, index + 6);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 6);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found6;
- lookUp = Unsafe.Add(ref searchSpace, index + 7);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 7);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found7;
@@ -416,16 +407,16 @@ namespace System
{
nLength -= 4;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found;
- lookUp = Unsafe.Add(ref searchSpace, index + 1);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 1);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found1;
- lookUp = Unsafe.Add(ref searchSpace, index + 2);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 2);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found2;
- lookUp = Unsafe.Add(ref searchSpace, index + 3);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 3);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found3;
@@ -436,7 +427,7 @@ namespace System
{
nLength -= 1;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found;
@@ -445,7 +436,8 @@ namespace System
#if !netstandard11
if (Vector.IsHardwareAccelerated && ((int)(byte*)index < length))
{
- nLength = (IntPtr)(uint)((length - (uint)index) & ~(Vector<byte>.Count - 1));
+ nLength = (IntPtr)((length - (int)(byte*)index) & ~(Vector<byte>.Count - 1));
+
// Get comparison Vector
Vector<byte> values0 = GetVector(value0);
Vector<byte> values1 = GetVector(value1);
@@ -467,10 +459,7 @@ namespace System
if ((int)(byte*)index < length)
{
- unchecked
- {
- nLength = (IntPtr)(length - (int)(byte*)index);
- }
+ nLength = (IntPtr)(length - (int)(byte*)index);
goto SequentialScan;
}
}
@@ -501,16 +490,13 @@ namespace System
uint uValue0 = value0; // Use uint for comparisons to avoid unnecessary 8->32 extensions
uint uValue1 = value1; // Use uint for comparisons to avoid unnecessary 8->32 extensions
uint uValue2 = value2; // Use uint for comparisons to avoid unnecessary 8->32 extensions
- IntPtr index = (IntPtr)0; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
- IntPtr nLength = (IntPtr)(uint)length;
+ IntPtr index = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr nLength = (IntPtr)length;
#if !netstandard11
if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
{
- unchecked
- {
- int unaligned = (int)(byte*)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
- nLength = (IntPtr)(uint)((Vector<byte>.Count - unaligned) & (Vector<byte>.Count - 1));
- }
+ int unaligned = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
+ nLength = (IntPtr)((Vector<byte>.Count - unaligned) & (Vector<byte>.Count - 1));
}
SequentialScan:
#endif
@@ -519,28 +505,28 @@ namespace System
{
nLength -= 8;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found;
- lookUp = Unsafe.Add(ref searchSpace, index + 1);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 1);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found1;
- lookUp = Unsafe.Add(ref searchSpace, index + 2);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 2);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found2;
- lookUp = Unsafe.Add(ref searchSpace, index + 3);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 3);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found3;
- lookUp = Unsafe.Add(ref searchSpace, index + 4);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 4);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found4;
- lookUp = Unsafe.Add(ref searchSpace, index + 5);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 5);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found5;
- lookUp = Unsafe.Add(ref searchSpace, index + 6);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 6);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found6;
- lookUp = Unsafe.Add(ref searchSpace, index + 7);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 7);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found7;
@@ -551,16 +537,16 @@ namespace System
{
nLength -= 4;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found;
- lookUp = Unsafe.Add(ref searchSpace, index + 1);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 1);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found1;
- lookUp = Unsafe.Add(ref searchSpace, index + 2);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 2);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found2;
- lookUp = Unsafe.Add(ref searchSpace, index + 3);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 3);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found3;
@@ -571,7 +557,7 @@ namespace System
{
nLength -= 1;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found;
@@ -580,11 +566,13 @@ namespace System
#if !netstandard11
if (Vector.IsHardwareAccelerated && ((int)(byte*)index < length))
{
- nLength = (IntPtr)(uint)((length - (uint)index) & ~(Vector<byte>.Count - 1));
+ nLength = (IntPtr)((length - (int)(byte*)index) & ~(Vector<byte>.Count - 1));
+
// Get comparison Vector
Vector<byte> values0 = GetVector(value0);
Vector<byte> values1 = GetVector(value1);
Vector<byte> values2 = GetVector(value2);
+
while ((byte*)nLength > (byte*)index)
{
Vector<byte> vData = Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref searchSpace, index));
@@ -606,10 +594,7 @@ namespace System
if ((int)(byte*)index < length)
{
- unchecked
- {
- nLength = (IntPtr)(length - (int)(byte*)index);
- }
+ nLength = (IntPtr)(length - (int)(byte*)index);
goto SequentialScan;
}
}
@@ -639,16 +624,13 @@ namespace System
uint uValue0 = value0; // Use uint for comparisons to avoid unnecessary 8->32 extensions
uint uValue1 = value1; // Use uint for comparisons to avoid unnecessary 8->32 extensions
- IntPtr index = (IntPtr)(uint)length; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
- IntPtr nLength = (IntPtr)(uint)length;
+ IntPtr index = (IntPtr)length; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr nLength = (IntPtr)length;
#if !netstandard11
if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
{
- unchecked
- {
- int unaligned = (int)(byte*)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
- nLength = (IntPtr)(((length & (Vector<byte>.Count - 1)) + unaligned) & (Vector<byte>.Count - 1));
- }
+ int unaligned = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
+ nLength = (IntPtr)(((length & (Vector<byte>.Count - 1)) + unaligned) & (Vector<byte>.Count - 1));
}
SequentialScan:
#endif
@@ -658,28 +640,28 @@ namespace System
nLength -= 8;
index -= 8;
- lookUp = Unsafe.Add(ref searchSpace, index + 7);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 7);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found7;
- lookUp = Unsafe.Add(ref searchSpace, index + 6);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 6);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found6;
- lookUp = Unsafe.Add(ref searchSpace, index + 5);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 5);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found5;
- lookUp = Unsafe.Add(ref searchSpace, index + 4);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 4);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found4;
- lookUp = Unsafe.Add(ref searchSpace, index + 3);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 3);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found3;
- lookUp = Unsafe.Add(ref searchSpace, index + 2);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 2);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found2;
- lookUp = Unsafe.Add(ref searchSpace, index + 1);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 1);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found1;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found;
}
@@ -689,16 +671,16 @@ namespace System
nLength -= 4;
index -= 4;
- lookUp = Unsafe.Add(ref searchSpace, index + 3);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 3);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found3;
- lookUp = Unsafe.Add(ref searchSpace, index + 2);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 2);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found2;
- lookUp = Unsafe.Add(ref searchSpace, index + 1);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 1);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found1;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found;
}
@@ -708,14 +690,15 @@ namespace System
nLength -= 1;
index -= 1;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp)
goto Found;
}
#if !netstandard11
- if (Vector.IsHardwareAccelerated && ((int)(byte*)index > 0))
+ if (Vector.IsHardwareAccelerated && ((byte*)index > (byte*)0))
{
- nLength = (IntPtr)(uint)((uint)index & ~(Vector<byte>.Count - 1));
+ nLength = (IntPtr)((int)(byte*)index & ~(Vector<byte>.Count - 1));
+
// Get comparison Vector
Vector<byte> values0 = GetVector(value0);
Vector<byte> values1 = GetVector(value1);
@@ -733,10 +716,10 @@ namespace System
continue;
}
// Find offset of first match
- return (int)(byte*)(index) - Vector<byte>.Count + LocateLastFoundByte(vMatches);
+ return (int)(index) - Vector<byte>.Count + LocateLastFoundByte(vMatches);
}
- if ((int)(byte*)index > 0)
+ if ((byte*)index > (byte*)0)
{
nLength = index;
goto SequentialScan;
@@ -769,16 +752,13 @@ namespace System
uint uValue0 = value0; // Use uint for comparisons to avoid unnecessary 8->32 extensions
uint uValue1 = value1; // Use uint for comparisons to avoid unnecessary 8->32 extensions
uint uValue2 = value2; // Use uint for comparisons to avoid unnecessary 8->32 extensions
- IntPtr index = (IntPtr)(uint)length; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
- IntPtr nLength = (IntPtr)(uint)length;
+ IntPtr index = (IntPtr)length; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr nLength = (IntPtr)length;
#if !netstandard11
if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
{
- unchecked
- {
- int unaligned = (int)(byte*)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
- nLength = (IntPtr)(((length & (Vector<byte>.Count - 1)) + unaligned) & (Vector<byte>.Count - 1));
- }
+ int unaligned = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
+ nLength = (IntPtr)(((length & (Vector<byte>.Count - 1)) + unaligned) & (Vector<byte>.Count - 1));
}
SequentialScan:
#endif
@@ -788,28 +768,28 @@ namespace System
nLength -= 8;
index -= 8;
- lookUp = Unsafe.Add(ref searchSpace, index + 7);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 7);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found7;
- lookUp = Unsafe.Add(ref searchSpace, index + 6);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 6);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found6;
- lookUp = Unsafe.Add(ref searchSpace, index + 5);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 5);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found5;
- lookUp = Unsafe.Add(ref searchSpace, index + 4);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 4);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found4;
- lookUp = Unsafe.Add(ref searchSpace, index + 3);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 3);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found3;
- lookUp = Unsafe.Add(ref searchSpace, index + 2);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 2);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found2;
- lookUp = Unsafe.Add(ref searchSpace, index + 1);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 1);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found1;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found;
}
@@ -819,16 +799,16 @@ namespace System
nLength -= 4;
index -= 4;
- lookUp = Unsafe.Add(ref searchSpace, index + 3);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 3);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found3;
- lookUp = Unsafe.Add(ref searchSpace, index + 2);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 2);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found2;
- lookUp = Unsafe.Add(ref searchSpace, index + 1);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index + 1);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found1;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found;
}
@@ -838,18 +818,20 @@ namespace System
nLength -= 1;
index -= 1;
- lookUp = Unsafe.Add(ref searchSpace, index);
+ lookUp = Unsafe.AddByteOffset(ref searchSpace, index);
if (uValue0 == lookUp || uValue1 == lookUp || uValue2 == lookUp)
goto Found;
}
#if !netstandard11
- if (Vector.IsHardwareAccelerated && ((int)(byte*)index > 0))
+ if (Vector.IsHardwareAccelerated && ((byte*)index > (byte*)0))
{
- nLength = (IntPtr)(uint)((uint)index & ~(Vector<byte>.Count - 1));
+ nLength = (IntPtr)((int)(byte*)index & ~(Vector<byte>.Count - 1));
+
// Get comparison Vector
Vector<byte> values0 = GetVector(value0);
Vector<byte> values1 = GetVector(value1);
Vector<byte> values2 = GetVector(value2);
+
while ((byte*)nLength > (byte*)(Vector<byte>.Count - 1))
{
Vector<byte> vData = Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref searchSpace, index - Vector<byte>.Count));
@@ -867,10 +849,10 @@ namespace System
continue;
}
// Find offset of first match
- return (int)(byte*)(index) - Vector<byte>.Count + LocateLastFoundByte(vMatches);
+ return (int)(index) - Vector<byte>.Count + LocateLastFoundByte(vMatches);
}
- if ((int)(byte*)index > 0)
+ if ((byte*)index > (byte*)0)
{
nLength = index;
goto SequentialScan;
@@ -903,46 +885,46 @@ namespace System
if (Unsafe.AreSame(ref first, ref second))
goto Equal;
- nuint i = (nuint)0; // Explicit conversion required for netfx (NUInt)
- nuint n = length;
+ IntPtr i = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr n = (IntPtr)(void*)length;
#if !netstandard11
- if (Vector.IsHardwareAccelerated && n >= (nuint)Vector<byte>.Count)
+ if (Vector.IsHardwareAccelerated && (byte*)n >= (byte*)Vector<byte>.Count)
{
- n -= (nuint)Vector<byte>.Count;
- while (n > i)
+ n -= Vector<byte>.Count;
+ while ((byte*)n > (byte*)i)
{
- if (Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref first, (IntPtr)i)) !=
- Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref second, (IntPtr)i)))
+ if (Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref first, i)) !=
+ Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref second, i)))
{
goto NotEqual;
}
- i += (nuint)Vector<byte>.Count;
+ i += Vector<byte>.Count;
}
- return Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref first, (IntPtr)n)) ==
- Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref second, (IntPtr)n));
+ return Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref first, n)) ==
+ Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref second, n));
}
#endif
- if (n >= (nuint)sizeof(UIntPtr))
+ if ((byte*)n >= (byte*)sizeof(UIntPtr))
{
- n -= (nuint)sizeof(UIntPtr);
- while (n > i)
+ n -= sizeof(UIntPtr);
+ while ((byte*)n > (byte*)i)
{
- if (Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref first, (IntPtr)i)) !=
- Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref second, (IntPtr)i)))
+ if (Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref first, i)) !=
+ Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref second, i)))
{
goto NotEqual;
}
- i += (nuint)sizeof(UIntPtr);
+ i += sizeof(UIntPtr);
}
- return Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref first, (IntPtr)n)) ==
- Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref second, (IntPtr)n));
+ return Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref first, n)) ==
+ Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref second, n));
}
- while (n > i)
+ while ((byte*)n > (byte*)i)
{
- if (Unsafe.AddByteOffset(ref first, (IntPtr)i) != Unsafe.AddByteOffset(ref second, (IntPtr)i))
+ if (Unsafe.AddByteOffset(ref first, i) != Unsafe.AddByteOffset(ref second, i))
goto NotEqual;
i += 1;
}
@@ -985,47 +967,46 @@ namespace System
if (Unsafe.AreSame(ref first, ref second))
goto Equal;
- nuint minLength = (nuint)firstLength;
- if (minLength > (nuint)secondLength) minLength = (nuint)secondLength;
+ IntPtr minLength = (IntPtr)((firstLength < secondLength) ? firstLength : secondLength);
- nuint i = (nuint)0; // Explicit conversion required for netfx (NUInt)
- nuint n = minLength;
+ IntPtr i = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr n = (IntPtr)(void*)minLength;
#if !netstandard11
- if (Vector.IsHardwareAccelerated && n > (nuint)Vector<byte>.Count)
+ if (Vector.IsHardwareAccelerated && (byte*)n > (byte*)Vector<byte>.Count)
{
- n -= (nuint)Vector<byte>.Count;
- while (n > i)
+ n -= Vector<byte>.Count;
+ while ((byte*)n > (byte*)i)
{
- if (Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref first, (IntPtr)i)) !=
- Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref second, (IntPtr)i)))
+ if (Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref first, i)) !=
+ Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref second, i)))
{
goto NotEqual;
}
- i += (nuint)Vector<byte>.Count;
+ i += Vector<byte>.Count;
}
goto NotEqual;
}
#endif
- if (n > (nuint)sizeof(UIntPtr))
+ if ((byte*)n > (byte*)sizeof(UIntPtr))
{
- n -= (nuint)sizeof(UIntPtr);
- while (n > i)
+ n -= sizeof(UIntPtr);
+ while ((byte*)n > (byte*)i)
{
- if (Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref first, (IntPtr)i)) !=
- Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref second, (IntPtr)i)))
+ if (Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref first, i)) !=
+ Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.AddByteOffset(ref second, i)))
{
goto NotEqual;
}
- i += (nuint)sizeof(UIntPtr);
+ i += sizeof(UIntPtr);
}
}
NotEqual: // Workaround for https://github.com/dotnet/coreclr/issues/13549
- while (minLength > i)
+ while ((byte*)minLength > (byte*)i)
{
- int result = Unsafe.AddByteOffset(ref first, (IntPtr)i).CompareTo(Unsafe.AddByteOffset(ref second, (IntPtr)i));
+ int result = Unsafe.AddByteOffset(ref first, i).CompareTo(Unsafe.AddByteOffset(ref second, i));
if (result != 0) return result;
i += 1;
}
@@ -1061,13 +1042,10 @@ namespace System
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int LocateFirstFoundByte(ulong match)
{
- unchecked
- {
- // Flag least significant power of two bit
- var powerOfTwoFlag = match ^ (match - 1);
- // Shift all powers of two into the high byte and extract
- return (int)((powerOfTwoFlag * XorPowerOfTwoToHighByte) >> 57);
- }
+ // Flag least significant power of two bit
+ var powerOfTwoFlag = match ^ (match - 1);
+ // Shift all powers of two into the high byte and extract
+ return (int)((powerOfTwoFlag * XorPowerOfTwoToHighByte) >> 57);
}
#endif
diff --git a/src/mscorlib/shared/System/SpanHelpers.Char.cs b/src/mscorlib/shared/System/SpanHelpers.Char.cs
new file mode 100644
index 0000000000..47e83b7b26
--- /dev/null
+++ b/src/mscorlib/shared/System/SpanHelpers.Char.cs
@@ -0,0 +1,209 @@
+// 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;
+
+#if !netstandard
+using Internal.Runtime.CompilerServices;
+#endif
+
+#if !netstandard11
+using System.Numerics;
+#endif
+
+namespace System
+{
+ internal static partial class SpanHelpers
+ {
+ public static unsafe int SequenceCompareTo(ref char first, int firstLength, ref char second, int secondLength)
+ {
+ Debug.Assert(firstLength >= 0);
+ Debug.Assert(secondLength >= 0);
+
+ int lengthDelta = firstLength - secondLength;
+
+ if (Unsafe.AreSame(ref first, ref second))
+ goto Equal;
+
+ IntPtr minLength = (IntPtr)((firstLength < secondLength) ? firstLength : secondLength);
+ IntPtr i = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+
+ if ((byte*)minLength >= (byte*)(sizeof(UIntPtr) / sizeof(char)))
+ {
+#if !netstandard11
+ if (Vector.IsHardwareAccelerated && (byte*)minLength >= (byte*)Vector<ushort>.Count)
+ {
+ IntPtr nLength = minLength - Vector<ushort>.Count;
+ do
+ {
+ if (Unsafe.ReadUnaligned<Vector<ushort>>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, i))) !=
+ Unsafe.ReadUnaligned<Vector<ushort>>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, i))))
+ {
+ break;
+ }
+ i += Vector<ushort>.Count;
+ }
+ while ((byte*)nLength >= (byte*)i);
+ }
+#endif
+
+ while ((byte*)minLength >= (byte*)(i + sizeof(UIntPtr) / sizeof(char)))
+ {
+ if (Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, i))) !=
+ Unsafe.ReadUnaligned<UIntPtr>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, i))))
+ {
+ break;
+ }
+ i += sizeof(UIntPtr) / sizeof(char);
+ }
+ }
+
+ if (sizeof(UIntPtr) > sizeof(int) && (byte*)minLength >= (byte*)(i + sizeof(int) / sizeof(char)))
+ {
+ if (Unsafe.ReadUnaligned<int>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, i))) ==
+ Unsafe.ReadUnaligned<int>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, i))))
+ {
+ i += sizeof(int) / sizeof(char);
+ }
+ }
+
+ while ((byte*)i < (byte*)minLength)
+ {
+ int result = Unsafe.Add(ref first, i).CompareTo(Unsafe.Add(ref second, i));
+ if (result != 0) return result;
+ i += 1;
+ }
+
+ Equal:
+ return lengthDelta;
+ }
+
+ public static unsafe int IndexOf(ref char searchSpace, char value, int length)
+ {
+ Debug.Assert(length >= 0);
+
+ fixed (char* pChars = &searchSpace)
+ {
+ char* pCh = pChars;
+ char* pEndCh = pCh + length;
+
+#if !netstandard11
+ if (Vector.IsHardwareAccelerated && length >= Vector<ushort>.Count * 2)
+ {
+ const int elementsPerByte = sizeof(ushort) / sizeof(byte);
+ int unaligned = ((int)pCh & (Unsafe.SizeOf<Vector<ushort>>() - 1)) / elementsPerByte;
+ length = ((Vector<ushort>.Count - unaligned) & (Vector<ushort>.Count - 1));
+ }
+ SequentialScan:
+#endif
+ while (length >= 4)
+ {
+ length -= 4;
+
+ if (*pCh == value)
+ goto Found;
+ if (*(pCh + 1) == value)
+ goto Found1;
+ if (*(pCh + 2) == value)
+ goto Found2;
+ if (*(pCh + 3) == value)
+ goto Found3;
+
+ pCh += 4;
+ }
+
+ while (length > 0)
+ {
+ length -= 1;
+
+ if (*pCh == value)
+ goto Found;
+
+ pCh += 1;
+ }
+#if !netstandard11
+ // We get past SequentialScan only if IsHardwareAccelerated is true. However, we still have the redundant check to allow
+ // the JIT to see that the code is unreachable and eliminate it when the platform does not have hardware accelerated.
+ if (Vector.IsHardwareAccelerated && pCh < pEndCh)
+ {
+ length = (int)((pEndCh - pCh) & ~(Vector<ushort>.Count - 1));
+
+ // Get comparison Vector
+ Vector<ushort> vComparison = new Vector<ushort>(value);
+
+ while (length > 0)
+ {
+ // Using Unsafe.Read instead of ReadUnaligned since the search space is pinned and pCh is always vector aligned
+ Debug.Assert(((int)pCh & (Unsafe.SizeOf<Vector<ushort>>() - 1)) == 0);
+ Vector<ushort> vMatches = Vector.Equals(vComparison, Unsafe.Read<Vector<ushort>>(pCh));
+ if (Vector<ushort>.Zero.Equals(vMatches))
+ {
+ pCh += Vector<ushort>.Count;
+ length -= Vector<ushort>.Count;
+ continue;
+ }
+ // Find offset of first match
+ return (int)(pCh - pChars) + LocateFirstFoundChar(vMatches);
+ }
+
+ if (pCh < pEndCh)
+ {
+ length = (int)(pEndCh - pCh);
+ goto SequentialScan;
+ }
+ }
+#endif
+ return -1;
+ Found3:
+ pCh++;
+ Found2:
+ pCh++;
+ Found1:
+ pCh++;
+ Found:
+ return (int)(pCh - pChars);
+ }
+ }
+
+#if !netstandard11
+ // Vector sub-search adapted from https://github.com/aspnet/KestrelHttpServer/pull/1138
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static int LocateFirstFoundChar(Vector<ushort> match)
+ {
+ var vector64 = Vector.AsVectorUInt64(match);
+ ulong candidate = 0;
+ int i = 0;
+ // Pattern unrolled by jit https://github.com/dotnet/coreclr/pull/8001
+ for (; i < Vector<ulong>.Count; i++)
+ {
+ candidate = vector64[i];
+ if (candidate != 0)
+ {
+ break;
+ }
+ }
+
+ // Single LEA instruction with jitted const (using function result)
+ return i * 4 + LocateFirstFoundChar(candidate);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static int LocateFirstFoundChar(ulong match)
+ {
+ unchecked
+ {
+ // Flag least significant power of two bit
+ var powerOfTwoFlag = match ^ (match - 1);
+ // Shift all powers of two into the high byte and extract
+ return (int)((powerOfTwoFlag * XorPowerOfTwoToHighChar) >> 49);
+ }
+ }
+
+ private const ulong XorPowerOfTwoToHighChar = (0x03ul |
+ 0x02ul << 16 |
+ 0x01ul << 32) + 1;
+#endif
+ }
+}
diff --git a/src/mscorlib/shared/System/SpanHelpers.T.cs b/src/mscorlib/shared/System/SpanHelpers.T.cs
index 88938ac903..4567deddb9 100644
--- a/src/mscorlib/shared/System/SpanHelpers.T.cs
+++ b/src/mscorlib/shared/System/SpanHelpers.T.cs
@@ -3,11 +3,14 @@
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
+using System.Runtime.CompilerServices;
#if !netstandard
using Internal.Runtime.CompilerServices;
-#else
-using System.Runtime.CompilerServices;
+#endif
+
+#if !netstandard11
+using System.Numerics;
#endif
namespace System
diff --git a/src/mscorlib/src/System/String.Comparison.cs b/src/mscorlib/shared/System/String.Comparison.cs
index 6dfea0b847..2a8be32d3f 100644
--- a/src/mscorlib/src/System/String.Comparison.cs
+++ b/src/mscorlib/shared/System/String.Comparison.cs
@@ -2,11 +2,9 @@
// 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.Collections;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;
@@ -21,11 +19,7 @@ namespace System
{
public partial class String
{
- //
- //Native Static Methods
- //
-
- private static unsafe int CompareOrdinalIgnoreCaseHelper(String strA, String strB)
+ private static unsafe int CompareOrdinalIgnoreCaseHelper(string strA, string strB)
{
Debug.Assert(strA != null);
Debug.Assert(strB != null);
@@ -61,83 +55,36 @@ namespace System
}
}
- // native call to COMString::CompareOrdinalEx
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern int CompareOrdinalHelper(String strA, int indexA, int countA, String strB, int indexB, int countB);
-
- //This will not work in case-insensitive mode for any character greater than 0x7F.
- //We'll throw an ArgumentException.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern unsafe int nativeCompareOrdinalIgnoreCaseWC(String strA, sbyte* strBBytes);
-
- //
- //
- // NATIVE INSTANCE METHODS
- //
- //
-
//
// Search/Query methods
//
- private static unsafe bool EqualsHelper(String strA, String strB)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static bool EqualsHelper(string strA, string strB)
{
Debug.Assert(strA != null);
Debug.Assert(strB != null);
Debug.Assert(strA.Length == strB.Length);
- int length = strA.Length;
-
- fixed (char* ap = &strA._firstChar) fixed (char* bp = &strB._firstChar)
- {
- char* a = ap;
- char* b = bp;
-
-#if BIT64
- // Single int read aligns pointers for the following long reads
- // PERF: No length check needed as there is always an int32 worth of string allocated
- // This read can also include the null terminator which both strings will have
- if (*(int*)a != *(int*)b) return false;
- length -= 2; a += 2; b += 2;
-
- // for AMD64 bit platform we unroll by 12 and
- // check 3 qword at a time. This is less code
- // than the 32 bit case and is a shorter path length.
-
- while (length >= 12)
- {
- if (*(long*)a != *(long*)b) return false;
- if (*(long*)(a + 4) != *(long*)(b + 4)) return false;
- if (*(long*)(a + 8) != *(long*)(b + 8)) return false;
- length -= 12; a += 12; b += 12;
- }
-#else
- while (length >= 10)
- {
- if (*(int*)a != *(int*)b) return false;
- if (*(int*)(a + 2) != *(int*)(b + 2)) return false;
- if (*(int*)(a + 4) != *(int*)(b + 4)) return false;
- if (*(int*)(a + 6) != *(int*)(b + 6)) return false;
- if (*(int*)(a + 8) != *(int*)(b + 8)) return false;
- length -= 10; a += 10; b += 10;
- }
-#endif
+ return SpanHelpers.SequenceEqual(
+ ref Unsafe.As<char, byte>(ref strA.GetRawStringData()),
+ ref Unsafe.As<char, byte>(ref strB.GetRawStringData()),
+ ((nuint)strA.Length) * 2);
+ }
- // This depends on the fact that the String objects are
- // always zero terminated and that the terminating zero is not included
- // in the length. For odd string sizes, the last compare will include
- // the zero terminator.
- while (length > 0)
- {
- if (*(int*)a != *(int*)b) return false;
- length -= 2; a += 2; b += 2;
- }
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ private static int CompareOrdinalHelper(string strA, int indexA, int countA, string strB, int indexB, int countB)
+ {
+ Debug.Assert(strA != null);
+ Debug.Assert(strB != null);
+ Debug.Assert(indexA >= 0 && indexB >= 0);
+ Debug.Assert(countA >= 0 && countB >= 0);
+ Debug.Assert(indexA + countA <= strA.Length && indexB + countB <= strB.Length);
- return true;
- }
+ return SpanHelpers.SequenceCompareTo(ref Unsafe.Add(ref strA.GetRawStringData(), indexA), countA, ref Unsafe.Add(ref strB.GetRawStringData(), indexB), countB);
}
- private static unsafe bool EqualsIgnoreCaseAsciiHelper(String strA, String strB)
+ private static unsafe bool EqualsIgnoreCaseAsciiHelper(string strA, string strB)
{
Debug.Assert(strA != null);
Debug.Assert(strB != null);
@@ -175,71 +122,7 @@ namespace System
}
}
- private static unsafe bool StartsWithOrdinalHelper(String str, String startsWith)
- {
- Debug.Assert(str != null);
- Debug.Assert(startsWith != null);
- Debug.Assert(str.Length >= startsWith.Length);
-
- int length = startsWith.Length;
-
- fixed (char* ap = &str._firstChar)
- fixed (char* bp = &startsWith._firstChar)
- {
- char* a = ap;
- char* b = bp;
-
-#if BIT64
- // Single int read aligns pointers for the following long reads
- // No length check needed as this method is called when length >= 2
- Debug.Assert(length >= 2);
- if (*(int*)a != *(int*)b)
- return false;
- length -= 2;
- a += 2;
- b += 2;
-
- while (length >= 12)
- {
- if (*(long*)a != *(long*)b)
- return false;
- if (*(long*)(a + 4) != *(long*)(b + 4))
- return false;
- if (*(long*)(a + 8) != *(long*)(b + 8))
- return false;
- length -= 12;
- a += 12;
- b += 12;
- }
-#else
- while (length >= 10)
- {
- if (*(int*)a != *(int*)b) return false;
- if (*(int*)(a+2) != *(int*)(b+2)) return false;
- if (*(int*)(a+4) != *(int*)(b+4)) return false;
- if (*(int*)(a+6) != *(int*)(b+6)) return false;
- if (*(int*)(a+8) != *(int*)(b+8)) return false;
- length -= 10; a += 10; b += 10;
- }
-#endif
-
- while (length >= 2)
- {
- if (*(int*)a != *(int*)b)
- return false;
- length -= 2;
- a += 2;
- b += 2;
- }
-
- // PERF: This depends on the fact that the String objects are always zero terminated
- // and that the terminating zero is not included in the length. For even string sizes
- // this compare can include the zero terminator. Bitwise OR avoids a branch.
- return length == 0 | *a == *b;
- }
- }
-
- private static unsafe int CompareOrdinalHelper(String strA, String strB)
+ private static unsafe int CompareOrdinalHelper(string strA, string strB)
{
Debug.Assert(strA != null);
Debug.Assert(strB != null);
@@ -267,9 +150,8 @@ namespace System
// and 64-bit (16 bytes) platforms.
// For empty strings, the second char will be null due to padding.
- // The start of the string (not including sync block pointer)
- // is the method table pointer + string length, which takes up
- // 8 bytes on 32-bit, 12 on x64. For empty strings the null
+ // The start of the string is the type pointer + string length, which
+ // takes up 8 bytes on 32-bit, 12 on x64. For empty strings the null
// terminator immediately follows, leaving us with an object
// 10/14 bytes in size. Since everything needs to be a multiple
// of 4/8, this will get padded and zeroed out.
@@ -363,7 +245,7 @@ namespace System
// to determine whether it is lexicographically less, equal, or greater, and then returns
// either a negative integer, 0, or a positive integer; respectively.
//
- public static int Compare(String strA, String strB)
+ public static int Compare(string strA, string strB)
{
return Compare(strA, strB, StringComparison.CurrentCulture);
}
@@ -374,16 +256,16 @@ namespace System
// negative integer, 0, or a positive integer is returned; respectively.
// The case-sensitive option is set by ignoreCase
//
- public static int Compare(String strA, String strB, bool ignoreCase)
+ public static int Compare(string strA, string strB, bool ignoreCase)
{
var comparisonType = ignoreCase ? StringComparison.CurrentCultureIgnoreCase : StringComparison.CurrentCulture;
return Compare(strA, strB, comparisonType);
}
- // Provides a more flexible function for string comparision. See StringComparison
+ // Provides a more flexible function for string comparison. See StringComparison
// for meaning of different comparisonType.
- public static int Compare(String strA, String strB, StringComparison comparisonType)
+ public static int Compare(string strA, string strB, StringComparison comparisonType)
{
if (object.ReferenceEquals(strA, strB))
{
@@ -428,13 +310,14 @@ namespace System
return CompareOrdinalHelper(strA, strB);
case StringComparison.OrdinalIgnoreCase:
+#if CORECLR
// If both strings are ASCII strings, we can take the fast path.
if (strA.IsAscii() && strB.IsAscii())
{
- return (CompareOrdinalIgnoreCaseHelper(strA, strB));
+ return CompareOrdinalIgnoreCaseHelper(strA, strB);
}
-
- return CompareInfo.CompareOrdinalIgnoreCase(strA, 0, strA.Length, strB, 0, strB.Length);
+#endif
+ return CompareInfo.CompareOrdinalIgnoreCase(strA, strB);
default:
throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
@@ -446,7 +329,7 @@ namespace System
// to determine whether it is lexicographically less, equal, or greater, and then a
// negative integer, 0, or a positive integer is returned; respectively.
//
- public static int Compare(String strA, String strB, CultureInfo culture, CompareOptions options)
+ public static int Compare(string strA, string strB, CultureInfo culture, CompareOptions options)
{
if (culture == null)
{
@@ -464,17 +347,17 @@ namespace System
// The case-sensitive option is set by ignoreCase, and the culture is set
// by culture
//
- public static int Compare(String strA, String strB, bool ignoreCase, CultureInfo culture)
+ public static int Compare(string strA, string strB, bool ignoreCase, CultureInfo culture)
{
var options = ignoreCase ? CompareOptions.IgnoreCase : CompareOptions.None;
return Compare(strA, strB, culture, options);
}
// Determines whether two string regions match. The substring of strA beginning
- // at indexA of length count is compared with the substring of strB
+ // at indexA of given length is compared with the substring of strB
// beginning at indexB of the same length.
//
- public static int Compare(String strA, int indexA, String strB, int indexB, int length)
+ public static int Compare(string strA, int indexA, string strB, int indexB, int length)
{
// NOTE: It's important we call the boolean overload, and not the StringComparison
// one. The two have some subtly different behavior (see notes in the former).
@@ -482,10 +365,10 @@ namespace System
}
// Determines whether two string regions match. The substring of strA beginning
- // at indexA of length count is compared with the substring of strB
+ // at indexA of given length is compared with the substring of strB
// beginning at indexB of the same length. Case sensitivity is determined by the ignoreCase boolean.
//
- public static int Compare(String strA, int indexA, String strB, int indexB, int length, bool ignoreCase)
+ public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase)
{
// Ideally we would just forward to the string.Compare overload that takes
// a StringComparison parameter, and just pass in CurrentCulture/CurrentCultureIgnoreCase.
@@ -523,7 +406,7 @@ namespace System
// beginning at indexB of the same length. Case sensitivity is determined by the ignoreCase boolean,
// and the culture is set by culture.
//
- public static int Compare(String strA, int indexA, String strB, int indexB, int length, bool ignoreCase, CultureInfo culture)
+ public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, CultureInfo culture)
{
var options = ignoreCase ? CompareOptions.IgnoreCase : CompareOptions.None;
return Compare(strA, indexA, strB, indexB, length, culture, options);
@@ -534,7 +417,7 @@ namespace System
// at indexA of length length is compared with the substring of strB
// beginning at indexB of the same length.
//
- public static int Compare(String strA, int indexA, String strB, int indexB, int length, CultureInfo culture, CompareOptions options)
+ public static int Compare(string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options)
{
if (culture == null)
{
@@ -557,7 +440,7 @@ namespace System
return culture.CompareInfo.Compare(strA, indexA, lengthA, strB, indexB, lengthB, options);
}
- public static int Compare(String strA, int indexA, String strB, int indexB, int length, StringComparison comparisonType)
+ public static int Compare(string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType)
{
CheckStringComparison(comparisonType);
@@ -616,7 +499,7 @@ namespace System
return CompareOrdinalHelper(strA, indexA, lengthA, strB, indexB, lengthB);
case StringComparison.OrdinalIgnoreCase:
- return (CompareInfo.CompareOrdinalIgnoreCase(strA, indexA, lengthA, strB, indexB, lengthB));
+ return CompareInfo.CompareOrdinalIgnoreCase(strA, indexA, lengthA, strB, indexB, lengthB);
default:
throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
@@ -625,7 +508,7 @@ namespace System
// Compares strA and strB using an ordinal (code-point) comparison.
//
- public static int CompareOrdinal(String strA, String strB)
+ public static int CompareOrdinal(string strA, string strB)
{
if (object.ReferenceEquals(strA, strB))
{
@@ -652,44 +535,13 @@ namespace System
return CompareOrdinalHelper(strA, strB);
}
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static int CompareOrdinal(ReadOnlySpan<char> strA, ReadOnlySpan<char> strB)
- {
- // TODO: Add a vectorized code path, similar to SequenceEqual
- // https://github.com/dotnet/corefx/blob/master/src/System.Memory/src/System/SpanHelpers.byte.cs#L900
-
- int minLength = Math.Min(strA.Length, strB.Length);
- ref char first = ref MemoryMarshal.GetReference(strA);
- ref char second = ref MemoryMarshal.GetReference(strB);
-
- int i = 0;
- if (minLength >= sizeof(nuint) / sizeof(char))
- {
- while (i < minLength - sizeof(nuint) / sizeof(char))
- {
- if (Unsafe.ReadUnaligned<nuint>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, i))) !=
- Unsafe.ReadUnaligned<nuint>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, i))))
- {
- break;
- }
- i += sizeof(nuint) / sizeof(char);
- }
- }
- while (i < minLength)
- {
- char a = Unsafe.Add(ref first, i);
- char b = Unsafe.Add(ref second, i);
- if (a != b)
- {
- return a - b;
- }
- i++;
- }
- return strA.Length - strB.Length;
- }
+ => SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(strA), strA.Length, ref MemoryMarshal.GetReference(strB), strB.Length);
// Compares strA and strB using an ordinal (code-point) comparison.
//
- public static int CompareOrdinal(String strA, int indexA, String strB, int indexB, int length)
+ public static int CompareOrdinal(string strA, int indexA, string strB, int indexB, int length)
{
if (strA == null || strB == null)
{
@@ -737,7 +589,7 @@ namespace System
// indicates the relationship. This method returns a value less than 0 if this is less than value, 0
// if this is equal to value, or a value greater than 0 if this is greater than value.
//
- public int CompareTo(Object value)
+ public int CompareTo(object value)
{
if (value == null)
{
@@ -756,7 +608,7 @@ namespace System
// Determines the sorting relation of StrB to the current instance.
//
- public int CompareTo(String strB)
+ public int CompareTo(string strB)
{
return string.Compare(this, strB, StringComparison.CurrentCulture);
}
@@ -766,19 +618,19 @@ namespace System
// The case-sensitive and culture-sensitive option is set by options,
// and the default culture is used.
//
- public Boolean EndsWith(String value)
+ public bool EndsWith(string value)
{
return EndsWith(value, StringComparison.CurrentCulture);
}
- public Boolean EndsWith(String value, StringComparison comparisonType)
+ public bool EndsWith(string value, StringComparison comparisonType)
{
- if ((Object)value == null)
+ if ((object)value == null)
{
throw new ArgumentNullException(nameof(value));
}
- if ((Object)this == (Object)value)
+ if ((object)this == (object)value)
{
CheckStringComparison(comparisonType);
return true;
@@ -815,7 +667,7 @@ namespace System
}
}
- public Boolean EndsWith(String value, Boolean ignoreCase, CultureInfo culture)
+ public bool EndsWith(string value, bool ignoreCase, CultureInfo culture)
{
if (null == value)
{
@@ -838,7 +690,7 @@ namespace System
}
// Determines whether two strings match.
- public override bool Equals(Object obj)
+ public override bool Equals(object obj)
{
if (object.ReferenceEquals(this, obj))
return true;
@@ -854,7 +706,7 @@ namespace System
}
// Determines whether two strings match.
- public bool Equals(String value)
+ public bool Equals(string value)
{
if (object.ReferenceEquals(this, value))
return true;
@@ -872,15 +724,15 @@ namespace System
return EqualsHelper(this, value);
}
- public bool Equals(String value, StringComparison comparisonType)
+ public bool Equals(string value, StringComparison comparisonType)
{
- if ((Object)this == (Object)value)
+ if ((object)this == (object)value)
{
CheckStringComparison(comparisonType);
return true;
}
- if ((Object)value == null)
+ if ((object)value == null)
{
CheckStringComparison(comparisonType);
return false;
@@ -908,13 +760,13 @@ namespace System
case StringComparison.OrdinalIgnoreCase:
if (this.Length != value.Length)
return false;
-
+#if CORECLR
// If both strings are ASCII strings, we can take the fast path.
if (this.IsAscii() && value.IsAscii())
{
return EqualsIgnoreCaseAsciiHelper(this, value);
}
-
+#endif
return (CompareInfo.CompareOrdinalIgnoreCase(this, 0, this.Length, value, 0, value.Length) == 0);
default:
@@ -924,14 +776,14 @@ namespace System
// Determines whether two Strings match.
- public static bool Equals(String a, String b)
+ public static bool Equals(string a, string b)
{
- if ((Object)a == (Object)b)
+ if ((object)a == (object)b)
{
return true;
}
- if ((Object)a == null || (Object)b == null || a.Length != b.Length)
+ if ((object)a == null || (object)b == null || a.Length != b.Length)
{
return false;
}
@@ -939,15 +791,15 @@ namespace System
return EqualsHelper(a, b);
}
- public static bool Equals(String a, String b, StringComparison comparisonType)
+ public static bool Equals(string a, string b, StringComparison comparisonType)
{
- if ((Object)a == (Object)b)
+ if ((object)a == (object)b)
{
CheckStringComparison(comparisonType);
return true;
}
- if ((Object)a == null || (Object)b == null)
+ if ((object)a == null || (object)b == null)
{
CheckStringComparison(comparisonType);
return false;
@@ -970,51 +822,44 @@ namespace System
case StringComparison.Ordinal:
if (a.Length != b.Length)
return false;
-
return EqualsHelper(a, b);
case StringComparison.OrdinalIgnoreCase:
if (a.Length != b.Length)
return false;
- else
+#if CORECLR
+ // If both strings are ASCII strings, we can take the fast path.
+ if (a.IsAscii() && b.IsAscii())
{
- // If both strings are ASCII strings, we can take the fast path.
- if (a.IsAscii() && b.IsAscii())
- {
- return EqualsIgnoreCaseAsciiHelper(a, b);
- }
- // Take the slow path.
-
- return (CompareInfo.CompareOrdinalIgnoreCase(a, 0, a.Length, b, 0, b.Length) == 0);
+ return EqualsIgnoreCaseAsciiHelper(a, b);
}
+#endif
+ return (CompareInfo.CompareOrdinalIgnoreCase(a, 0, a.Length, b, 0, b.Length) == 0);
default:
throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
- public static bool operator ==(String a, String b)
+ public static bool operator ==(string a, string b)
{
- return String.Equals(a, b);
+ return string.Equals(a, b);
}
- public static bool operator !=(String a, String b)
+ public static bool operator !=(string a, string b)
{
- return !String.Equals(a, b);
+ return !string.Equals(a, b);
}
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern int InternalMarvin32HashString(string s);
-
// Gets a hash code for this string. If strings A and B are such that A.Equals(B), then
// they will return the same hash code.
public override int GetHashCode()
{
- return InternalMarvin32HashString(this);
+ return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref _firstChar), _stringLength * 2, Marvin.DefaultSeed);
}
- // Gets a hash code for this string and this comparison. If strings A and B and comparition C are such
- // that String.Equals(A, B, C), then they will return the same hash code with this comparison C.
+ // Gets a hash code for this string and this comparison. If strings A and B and comparison C are such
+ // that string.Equals(A, B, C), then they will return the same hash code with this comparison C.
public int GetHashCode(StringComparison comparisonType) => StringComparer.FromComparison(comparisonType).GetHashCode(this);
// Use this if and only if you need the hashcode to not change across app domains (e.g. you have an app domain agile
@@ -1063,13 +908,6 @@ namespace System
hash1 = ((hash1 << 5) + hash1 + (hash1 >> 27)) ^ pint[0];
}
#endif
-#if DEBUG
- // We want to ensure we can change our hash function daily.
- // This is perfectly fine as long as you don't persist the
- // value from GetHashCode to disk or count on String A
- // hashing before string B. Those are bugs in your code.
- hash1 ^= ThisAssembly.DailyBuildNumber;
-#endif
return hash1 + (hash2 * 1566083941);
}
}
@@ -1077,23 +915,23 @@ namespace System
// Determines whether a specified string is a prefix of the current instance
//
- public Boolean StartsWith(String value)
+ public bool StartsWith(string value)
{
- if ((Object)value == null)
+ if ((object)value == null)
{
throw new ArgumentNullException(nameof(value));
}
return StartsWith(value, StringComparison.CurrentCulture);
}
- public Boolean StartsWith(String value, StringComparison comparisonType)
+ public bool StartsWith(string value, StringComparison comparisonType)
{
- if ((Object)value == null)
+ if ((object)value == null)
{
throw new ArgumentNullException(nameof(value));
}
- if ((Object)this == (Object)value)
+ if ((object)this == (object)value)
{
CheckStringComparison(comparisonType);
return true;
@@ -1126,7 +964,10 @@ namespace System
}
return (value.Length == 1) ?
true : // First char is the same and thats all there is to compare
- StartsWithOrdinalHelper(this, value);
+ SpanHelpers.SequenceEqual(
+ ref Unsafe.As<char, byte>(ref this.GetRawStringData()),
+ ref Unsafe.As<char, byte>(ref value.GetRawStringData()),
+ ((nuint)value.Length) * 2);
case StringComparison.OrdinalIgnoreCase:
if (this.Length < value.Length)
@@ -1140,7 +981,7 @@ namespace System
}
}
- public Boolean StartsWith(String value, Boolean ignoreCase, CultureInfo culture)
+ public bool StartsWith(string value, bool ignoreCase, CultureInfo culture)
{
if (null == value)
{
diff --git a/src/mscorlib/shared/System/String.Manipulation.cs b/src/mscorlib/shared/System/String.Manipulation.cs
index d2aac0d431..69609aacfb 100644
--- a/src/mscorlib/shared/System/String.Manipulation.cs
+++ b/src/mscorlib/shared/System/String.Manipulation.cs
@@ -1541,7 +1541,7 @@ namespace System
if (this[i] == separator[0] && currentSepLength <= Length - i)
{
if (currentSepLength == 1
- || CompareOrdinal(this, i, separator, 0, currentSepLength) == 0)
+ || this.AsSpan(i, currentSepLength).SequenceEqual(separator))
{
sepListBuilder.Append(i);
i += currentSepLength - 1;
@@ -1575,7 +1575,7 @@ namespace System
if (this[i] == separator[0] && currentSepLength <= Length - i)
{
if (currentSepLength == 1
- || CompareOrdinal(this, i, separator, 0, currentSepLength) == 0)
+ || this.AsSpan(i, currentSepLength).SequenceEqual(separator))
{
sepListBuilder.Append(i);
lengthListBuilder.Append(currentSepLength);
diff --git a/src/mscorlib/shared/System/String.Searching.cs b/src/mscorlib/shared/System/String.Searching.cs
index cc6e218d8d..a4e5bbb62e 100644
--- a/src/mscorlib/shared/System/String.Searching.cs
+++ b/src/mscorlib/shared/System/String.Searching.cs
@@ -35,10 +35,7 @@ namespace System
// Returns the index of the first occurrence of a specified character in the current instance.
// The search starts at startIndex and runs thorough the next count characters.
//
- public int IndexOf(char value)
- {
- return IndexOf(value, 0, this.Length);
- }
+ public int IndexOf(char value) => SpanHelpers.IndexOf(ref _firstChar, value, Length);
public int IndexOf(char value, int startIndex)
{
@@ -74,122 +71,19 @@ namespace System
public unsafe int IndexOf(char value, int startIndex, int count)
{
+ // These bounds checks are redundant since AsSpan does them already, but are required
+ // so that the correct parameter name is thrown as part of the exception.
if ((uint)startIndex > (uint)Length)
throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
if ((uint)count > (uint)(Length - startIndex))
throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
- fixed (char* pChars = &_firstChar)
- {
- char* pCh = pChars + startIndex;
- char* pEndCh = pCh + count;
-
- if (Vector.IsHardwareAccelerated && count >= Vector<ushort>.Count * 2)
- {
- unchecked
- {
- const int elementsPerByte = sizeof(ushort) / sizeof(byte);
- int unaligned = ((int)pCh & (Vector<byte>.Count - 1)) / elementsPerByte;
- count = ((Vector<ushort>.Count - unaligned) & (Vector<ushort>.Count - 1));
- }
- }
- SequentialScan:
- while (count >= 4)
- {
- if (*pCh == value) goto ReturnIndex;
- if (*(pCh + 1) == value) goto ReturnIndex1;
- if (*(pCh + 2) == value) goto ReturnIndex2;
- if (*(pCh + 3) == value) goto ReturnIndex3;
-
- count -= 4;
- pCh += 4;
- }
-
- while (count > 0)
- {
- if (*pCh == value)
- goto ReturnIndex;
-
- count--;
- pCh++;
- }
-
- if (pCh < pEndCh)
- {
- count = (int)((pEndCh - pCh) & ~(Vector<ushort>.Count - 1));
- // Get comparison Vector
- Vector<ushort> vComparison = new Vector<ushort>(value);
- while (count > 0)
- {
- var vMatches = Vector.Equals(vComparison, Unsafe.ReadUnaligned<Vector<ushort>>(pCh));
- if (Vector<ushort>.Zero.Equals(vMatches))
- {
- pCh += Vector<ushort>.Count;
- count -= Vector<ushort>.Count;
- continue;
- }
- // Find offset of first match
- return (int)(pCh - pChars) + LocateFirstFoundChar(vMatches);
- }
-
- if (pCh < pEndCh)
- {
- unchecked
- {
- count = (int)(pEndCh - pCh);
- }
- goto SequentialScan;
- }
- }
-
- return -1;
+ int result = SpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, startIndex), value, count);
- ReturnIndex3: pCh++;
- ReturnIndex2: pCh++;
- ReturnIndex1: pCh++;
- ReturnIndex:
- return (int)(pCh - pChars);
- }
+ return result == -1 ? result : result + startIndex;
}
- // Vector sub-search adapted from https://github.com/aspnet/KestrelHttpServer/pull/1138
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static int LocateFirstFoundChar(Vector<ushort> match)
- {
- var vector64 = Vector.AsVectorUInt64(match);
- ulong candidate = 0;
- int i = 0;
- // Pattern unrolled by jit https://github.com/dotnet/coreclr/pull/8001
- for (; i < Vector<ulong>.Count; i++)
- {
- candidate = vector64[i];
- if (candidate != 0)
- {
- break;
- }
- }
-
- // Single LEA instruction with jitted const (using function result)
- return i * 4 + LocateFirstFoundChar(candidate);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static int LocateFirstFoundChar(ulong match)
- {
- unchecked
- {
- // Flag least significant power of two bit
- var powerOfTwoFlag = match ^ (match - 1);
- // Shift all powers of two into the high byte and extract
- return (int)((powerOfTwoFlag * XorPowerOfTwoToHighChar) >> 49);
- }
- }
-
- private const ulong XorPowerOfTwoToHighChar = (0x03ul |
- 0x02ul << 16 |
- 0x01ul << 32) + 1;
-
// Returns the index of the first occurrence of any specified character in the current instance.
// The search starts at startIndex and runs to startIndex + count - 1.
//
diff --git a/src/mscorlib/shared/System/Text/StringBuilder.Debug.cs b/src/mscorlib/shared/System/Text/StringBuilder.Debug.cs
new file mode 100644
index 0000000000..a62c4777ad
--- /dev/null
+++ b/src/mscorlib/shared/System/Text/StringBuilder.Debug.cs
@@ -0,0 +1,37 @@
+// 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;
+
+namespace System.Text
+{
+ public sealed partial class StringBuilder
+ {
+ private void ShowChunks(int maxChunksToShow = 10)
+ {
+ int count = 0;
+ StringBuilder head = this, current = this;
+ while (current != null)
+ {
+ if (count < maxChunksToShow)
+ {
+ count++;
+ }
+ else
+ {
+ head = head.m_ChunkPrevious;
+ }
+ current = current.m_ChunkPrevious;
+ }
+ current = head;
+ string[] chunks = new string[count];
+ for (int i = count; i > 0; i--)
+ {
+ chunks[i - 1] = new string(current.m_ChunkChars).Replace('\0', '.');
+ current = current.m_ChunkPrevious;
+ }
+ Debug.WriteLine('|' + string.Join('|', chunks) + '|');
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Text/StringBuilder.cs b/src/mscorlib/shared/System/Text/StringBuilder.cs
index 185e5a46ee..8c1e045216 100644
--- a/src/mscorlib/shared/System/Text/StringBuilder.cs
+++ b/src/mscorlib/shared/System/Text/StringBuilder.cs
@@ -462,13 +462,10 @@ namespace System.Text
throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity);
}
- int originalCapacity = Capacity;
-
if (value == 0 && m_ChunkPrevious == null)
{
m_ChunkLength = 0;
m_ChunkOffset = 0;
- Debug.Assert(Capacity >= originalCapacity);
return;
}
@@ -483,22 +480,32 @@ namespace System.Text
StringBuilder chunk = FindChunkForIndex(value);
if (chunk != this)
{
- // We crossed a chunk boundary when reducing the Length. We must replace this middle-chunk with a new larger chunk,
- // to ensure the original capacity is preserved.
- int newLen = originalCapacity - chunk.m_ChunkOffset;
- char[] newArray = new char[newLen];
-
- Debug.Assert(newLen > chunk.m_ChunkChars.Length, "The new chunk should be larger than the one it is replacing.");
- Array.Copy(chunk.m_ChunkChars, 0, newArray, 0, chunk.m_ChunkLength);
+ // Avoid possible infinite capacity growth. See https://github.com/dotnet/coreclr/pull/16926
+ int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length));
+ int newLen = capacityToPreserve - chunk.m_ChunkOffset;
+ if (newLen > chunk.m_ChunkChars.Length)
+ {
+ // We crossed a chunk boundary when reducing the Length. We must replace this middle-chunk with a new larger chunk,
+ // to ensure the capacity we want is preserved.
+ char[] newArray = new char[newLen];
+ Array.Copy(chunk.m_ChunkChars, 0, newArray, 0, chunk.m_ChunkLength);
+ m_ChunkChars = newArray;
+ }
+ else
+ {
+ // Special case where the capacity we want to keep corresponds exactly to the size of the content.
+ // Just take ownership of the array.
+ Debug.Assert(newLen == chunk.m_ChunkChars.Length, "The new chunk should be larger or equal to the one it is replacing.");
+ m_ChunkChars = chunk.m_ChunkChars;
+ }
- m_ChunkChars = newArray;
m_ChunkPrevious = chunk.m_ChunkPrevious;
m_ChunkOffset = chunk.m_ChunkOffset;
}
m_ChunkLength = value - chunk.m_ChunkOffset;
AssertInvariants();
}
- Debug.Assert(Capacity >= originalCapacity);
+ Debug.Assert(Length == value, "Something went wrong setting Length.");
}
}
@@ -1680,10 +1687,10 @@ namespace System.Text
/// <summary>
/// Determines if the contents of this builder are equal to the contents of ReadOnlySpan<char>.
/// </summary>
- /// <param name="value">The ReadOnlySpan{char}.</param>
- public bool Equals(ReadOnlySpan<char> value)
+ /// <param name="span">The ReadOnlySpan{char}.</param>
+ public bool Equals(ReadOnlySpan<char> span)
{
- if (value.Length != Length)
+ if (span.Length != Length)
return false;
StringBuilder sbChunk = this;
@@ -1696,7 +1703,7 @@ namespace System.Text
ReadOnlySpan<char> chunk = new ReadOnlySpan<char>(sbChunk.m_ChunkChars, 0, chunk_length);
- if (!chunk.EqualsOrdinal(value.Slice(value.Length - offset, chunk_length)))
+ if (!chunk.EqualsOrdinal(span.Slice(span.Length - offset, chunk_length)))
return false;
sbChunk = sbChunk.m_ChunkPrevious;
diff --git a/src/mscorlib/shared/System/Text/ValueStringBuilder.cs b/src/mscorlib/shared/System/Text/ValueStringBuilder.cs
index b1abdd59bc..d41bea0be9 100644
--- a/src/mscorlib/shared/System/Text/ValueStringBuilder.cs
+++ b/src/mscorlib/shared/System/Text/ValueStringBuilder.cs
@@ -27,6 +27,7 @@ namespace System.Text
get => _pos;
set
{
+ Debug.Assert(value >= 0);
Debug.Assert(value <= _chars.Length);
_pos = value;
}
@@ -70,6 +71,9 @@ namespace System.Text
return s;
}
+ /// <summary>Returns the underlying storage of the builder.</summary>
+ public Span<char> RawChars => _chars;
+
/// <summary>
/// Returns a span around the contents of the builder.
/// </summary>
diff --git a/src/mscorlib/shared/System/Threading/ExecutionContext.cs b/src/mscorlib/shared/System/Threading/ExecutionContext.cs
index 9f27c6dcb4..a840aa71fd 100644
--- a/src/mscorlib/shared/System/Threading/ExecutionContext.cs
+++ b/src/mscorlib/shared/System/Threading/ExecutionContext.cs
@@ -24,6 +24,7 @@ namespace System.Threading
public sealed class ExecutionContext : IDisposable, ISerializable
{
internal static readonly ExecutionContext Default = new ExecutionContext(isDefault: true);
+ internal static readonly ExecutionContext DefaultFlowSuppressed = new ExecutionContext(AsyncLocalValueMap.Empty, Array.Empty<IAsyncLocal>(), isFlowSuppressed: true);
private readonly IAsyncLocalValueMap m_localValues;
private readonly IAsyncLocal[] m_localChangeNotifications;
@@ -63,15 +64,15 @@ namespace System.Threading
{
Debug.Assert(isFlowSuppressed != m_isFlowSuppressed);
- if (!isFlowSuppressed &&
- (m_localValues == null ||
- m_localValues.GetType() == typeof(AsyncLocalValueMap.EmptyAsyncLocalValueMap))
- )
+ if (m_localValues == null ||
+ m_localValues.GetType() == typeof(AsyncLocalValueMap.EmptyAsyncLocalValueMap))
{
- return null; // implies the default context
+ return isFlowSuppressed ?
+ DefaultFlowSuppressed :
+ null; // implies the default context
}
- // Flow suppressing a Default context will have null values, set them to Empty
- return new ExecutionContext(m_localValues ?? AsyncLocalValueMap.Empty, m_localChangeNotifications ?? Array.Empty<IAsyncLocal>(), isFlowSuppressed);
+
+ return new ExecutionContext(m_localValues, m_localChangeNotifications, isFlowSuppressed);
}
public static AsyncFlowControl SuppressFlow()
diff --git a/src/mscorlib/shared/System/UIntPtr.cs b/src/mscorlib/shared/System/UIntPtr.cs
index 5907226682..8b2568fde1 100644
--- a/src/mscorlib/shared/System/UIntPtr.cs
+++ b/src/mscorlib/shared/System/UIntPtr.cs
@@ -77,9 +77,9 @@ namespace System
return false;
}
- unsafe bool IEquatable<UIntPtr>.Equals(UIntPtr value)
+ unsafe bool IEquatable<UIntPtr>.Equals(UIntPtr other)
{
- return _value == value._value;
+ return _value == other._value;
}
public unsafe override int GetHashCode()
diff --git a/src/mscorlib/shared/System/UnitySerializationHolder.cs b/src/mscorlib/shared/System/UnitySerializationHolder.cs
index 2f30356709..53323c32bc 100644
--- a/src/mscorlib/shared/System/UnitySerializationHolder.cs
+++ b/src/mscorlib/shared/System/UnitySerializationHolder.cs
@@ -11,12 +11,8 @@ namespace System
/// This only exists for compatibility with .NET Framework.
/// </summary>
[Serializable]
-#if CORERT
- public
-#else
- internal
-#endif
- sealed class UnitySerializationHolder : ISerializable, IObjectReference
+ // Needs to be public to support binary serialization compatibility
+ public sealed class UnitySerializationHolder : ISerializable, IObjectReference
{
internal const int NullUnity = 0x0002;
private readonly int _unityType;
diff --git a/src/mscorlib/src/System/Collections/Generic/Comparer.cs b/src/mscorlib/src/System/Collections/Generic/Comparer.cs
index d3ec0ddce8..d5d2e9165f 100644
--- a/src/mscorlib/src/System/Collections/Generic/Comparer.cs
+++ b/src/mscorlib/src/System/Collections/Generic/Comparer.cs
@@ -45,7 +45,8 @@ namespace System.Collections.Generic
// for value types.
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- internal sealed class GenericComparer<T> : Comparer<T> where T : IComparable<T>
+ // Needs to be public to support binary serialization compatibility
+ public sealed class GenericComparer<T> : Comparer<T> where T : IComparable<T>
{
public override int Compare(T x, T y)
{
@@ -68,7 +69,8 @@ namespace System.Collections.Generic
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- internal sealed class NullableComparer<T> : Comparer<T?> where T : struct, IComparable<T>
+ // Needs to be public to support binary serialization compatibility
+ public sealed class NullableComparer<T> : Comparer<T?> where T : struct, IComparable<T>
{
public override int Compare(T? x, T? y)
{
@@ -91,7 +93,8 @@ namespace System.Collections.Generic
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- internal sealed class ObjectComparer<T> : Comparer<T>
+ // Needs to be public to support binary serialization compatibility
+ public sealed class ObjectComparer<T> : Comparer<T>
{
public override int Compare(T x, T y)
{
diff --git a/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs b/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs
index 567a22d496..4c7a70553e 100644
--- a/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs
+++ b/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs
@@ -68,7 +68,8 @@ namespace System.Collections.Generic
// to Equal bind to IEquatable<T>.Equals(T) instead of Object.Equals(Object)
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- internal sealed class GenericEqualityComparer<T> : EqualityComparer<T> where T : IEquatable<T>
+ // Needs to be public to support binary serialization compatibility
+ public sealed class GenericEqualityComparer<T> : EqualityComparer<T> where T : IEquatable<T>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(T x, T y)
@@ -137,7 +138,8 @@ namespace System.Collections.Generic
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- internal sealed class NullableEqualityComparer<T> : EqualityComparer<T?> where T : struct, IEquatable<T>
+ // Needs to be public to support binary serialization compatibility
+ public sealed class NullableEqualityComparer<T> : EqualityComparer<T?> where T : struct, IEquatable<T>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(T? x, T? y)
@@ -204,7 +206,8 @@ namespace System.Collections.Generic
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- internal sealed class ObjectEqualityComparer<T> : EqualityComparer<T>
+ // Needs to be public to support binary serialization compatibility
+ public sealed class ObjectEqualityComparer<T> : EqualityComparer<T>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(T x, T y)
@@ -273,7 +276,8 @@ namespace System.Collections.Generic
// We will call the C runtime function memchr, which is optimized.
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- internal sealed class ByteEqualityComparer : EqualityComparer<byte>
+ // Needs to be public to support binary serialization compatibility
+ public sealed class ByteEqualityComparer : EqualityComparer<byte>
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(byte x, byte y)
@@ -310,7 +314,8 @@ namespace System.Collections.Generic
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
- internal sealed class EnumEqualityComparer<T> : EqualityComparer<T>, ISerializable where T : struct
+ // Needs to be public to support binary serialization compatibility
+ public sealed class EnumEqualityComparer<T> : EqualityComparer<T>, ISerializable where T : struct
{
internal EnumEqualityComparer() { }
diff --git a/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs b/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs
index 790620c601..e12bb5141f 100644
--- a/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs
+++ b/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs
@@ -147,12 +147,8 @@ namespace System.Diagnostics.Contracts
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-#if CORERT
- public // On CoreRT this must be public to support binary serialization with type forwarding.
-#else
- internal
-#endif
- sealed class ContractException : Exception
+ // Needs to be public to support binary serialization compatibility
+ public sealed class ContractException : Exception
{
private readonly ContractFailureKind _kind;
private readonly string _userMessage;
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs
index 57c3b8f7c5..58091be27f 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventPipe.cs
@@ -175,6 +175,6 @@ namespace System.Diagnostics.Tracing
internal static extern unsafe void WriteEvent(IntPtr eventHandle, uint eventID, void* pData, uint length, Guid* activityId, Guid* relatedActivityId);
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- internal static extern unsafe void WriteEventData(IntPtr eventHandle, uint eventID, EventProvider.EventData** pEventData, uint dataCount, Guid* activityId, Guid* relatedActivityId);
+ internal static extern unsafe void WriteEventData(IntPtr eventHandle, uint eventID, EventProvider.EventData* pEventData, uint dataCount, Guid* activityId, Guid* relatedActivityId);
}
}
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs
index adda1b6702..42061df043 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs
@@ -75,7 +75,7 @@ namespace System.Diagnostics.Tracing
userDataCount = userDataCount - 3;
Debug.Assert(userDataCount >= 0);
}
- EventPipeInternal.WriteEventData(eventHandle, eventID, &userData, (uint) userDataCount, activityId, relatedActivityId);
+ EventPipeInternal.WriteEventData(eventHandle, eventID, userData, (uint) userDataCount, activityId, relatedActivityId);
}
return 0;
}
diff --git a/src/mscorlib/src/System/IO/Stream.cs b/src/mscorlib/src/System/IO/Stream.cs
index ec29dc2e0d..4cf8435f2b 100644
--- a/src/mscorlib/src/System/IO/Stream.cs
+++ b/src/mscorlib/src/System/IO/Stream.cs
@@ -374,16 +374,16 @@ namespace System.IO
: BeginEndReadAsync(buffer, offset, count);
}
- public virtual ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
- if (MemoryMarshal.TryGetArray(destination, out ArraySegment<byte> array))
+ if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array))
{
return new ValueTask<int>(ReadAsync(array.Array, array.Offset, array.Count, cancellationToken));
}
else
{
- byte[] buffer = ArrayPool<byte>.Shared.Rent(destination.Length);
- return FinishReadAsync(ReadAsync(buffer, 0, destination.Length, cancellationToken), buffer, destination);
+ byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length);
+ return FinishReadAsync(ReadAsync(sharedBuffer, 0, buffer.Length, cancellationToken), sharedBuffer, buffer);
async ValueTask<int> FinishReadAsync(Task<int> readTask, byte[] localBuffer, Memory<byte> localDestination)
{
@@ -683,17 +683,17 @@ namespace System.IO
: BeginEndWriteAsync(buffer, offset, count);
}
- public virtual ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
- if (MemoryMarshal.TryGetArray(source, out ArraySegment<byte> array))
+ if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array))
{
return new ValueTask(WriteAsync(array.Array, array.Offset, array.Count, cancellationToken));
}
else
{
- byte[] buffer = ArrayPool<byte>.Shared.Rent(source.Length);
- source.Span.CopyTo(buffer);
- return new ValueTask(FinishWriteAsync(WriteAsync(buffer, 0, source.Length, cancellationToken), buffer));
+ byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length);
+ buffer.Span.CopyTo(sharedBuffer);
+ return new ValueTask(FinishWriteAsync(WriteAsync(sharedBuffer, 0, buffer.Length, cancellationToken), sharedBuffer));
}
}
@@ -738,20 +738,20 @@ namespace System.IO
public abstract int Read(byte[] buffer, int offset, int count);
- public virtual int Read(Span<byte> destination)
+ public virtual int Read(Span<byte> buffer)
{
- byte[] buffer = ArrayPool<byte>.Shared.Rent(destination.Length);
+ byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length);
try
{
- int numRead = Read(buffer, 0, destination.Length);
- if ((uint)numRead > destination.Length)
+ int numRead = Read(sharedBuffer, 0, buffer.Length);
+ if ((uint)numRead > buffer.Length)
{
throw new IOException(SR.IO_StreamTooLong);
}
- new Span<byte>(buffer, 0, numRead).CopyTo(destination);
+ new Span<byte>(sharedBuffer, 0, numRead).CopyTo(buffer);
return numRead;
}
- finally { ArrayPool<byte>.Shared.Return(buffer); }
+ finally { ArrayPool<byte>.Shared.Return(sharedBuffer); }
}
// Reads one byte from the stream by calling Read(byte[], int, int).
@@ -771,15 +771,15 @@ namespace System.IO
public abstract void Write(byte[] buffer, int offset, int count);
- public virtual void Write(ReadOnlySpan<byte> source)
+ public virtual void Write(ReadOnlySpan<byte> buffer)
{
- byte[] buffer = ArrayPool<byte>.Shared.Rent(source.Length);
+ byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length);
try
{
- source.CopyTo(buffer);
- Write(buffer, 0, source.Length);
+ buffer.CopyTo(sharedBuffer);
+ Write(sharedBuffer, 0, buffer.Length);
}
- finally { ArrayPool<byte>.Shared.Return(buffer); }
+ finally { ArrayPool<byte>.Shared.Return(sharedBuffer); }
}
// Writes one byte from the stream by calling Write(byte[], int, int).
@@ -972,7 +972,7 @@ namespace System.IO
return 0;
}
- public override int Read(Span<byte> destination)
+ public override int Read(Span<byte> buffer)
{
return 0;
}
@@ -982,7 +982,7 @@ namespace System.IO
return AsyncTaskMethodBuilder<int>.s_defaultResultTask;
}
- public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
return new ValueTask<int>(0);
}
@@ -996,7 +996,7 @@ namespace System.IO
{
}
- public override void Write(ReadOnlySpan<byte> source)
+ public override void Write(ReadOnlySpan<byte> buffer)
{
}
@@ -1007,7 +1007,7 @@ namespace System.IO
Task.CompletedTask;
}
- public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
+ public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{
return cancellationToken.IsCancellationRequested ?
new ValueTask(Task.FromCanceled(cancellationToken)) :
@@ -1256,10 +1256,10 @@ namespace System.IO
return _stream.Read(bytes, offset, count);
}
- public override int Read(Span<byte> destination)
+ public override int Read(Span<byte> buffer)
{
lock (_stream)
- return _stream.Read(destination);
+ return _stream.Read(buffer);
}
public override int ReadByte()
@@ -1313,10 +1313,10 @@ namespace System.IO
_stream.Write(bytes, offset, count);
}
- public override void Write(ReadOnlySpan<byte> source)
+ public override void Write(ReadOnlySpan<byte> buffer)
{
lock (_stream)
- _stream.Write(source);
+ _stream.Write(buffer);
}
public override void WriteByte(byte b)
diff --git a/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs b/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs
index 8e444ef416..a1cee10ba3 100644
--- a/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs
@@ -1170,9 +1170,7 @@ namespace System.Reflection.Emit
private static Type GetConsoleType()
{
- return Type.GetType(
- "System.Console, System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=" + AssemblyRef.MicrosoftPublicKeyToken,
- throwOnError: true);
+ return Type.GetType("System.Console, System.Console", throwOnError: true);
}
public virtual void EmitWriteLine(String value)
diff --git a/src/mscorlib/src/System/Resources/ResourceManager.cs b/src/mscorlib/src/System/Resources/ResourceManager.cs
index d166fcde1c..f17dc753aa 100644
--- a/src/mscorlib/src/System/Resources/ResourceManager.cs
+++ b/src/mscorlib/src/System/Resources/ResourceManager.cs
@@ -771,7 +771,7 @@ namespace System.Resources
// we can do very little with WinRT in mscorlib.
internal static WindowsRuntimeResourceManagerBase GetWinRTResourceManager()
{
- Type WinRTResourceManagerType = Type.GetType("System.Resources.WindowsRuntimeResourceManager, " + AssemblyRef.SystemRuntimeWindowsRuntime, true);
+ Type WinRTResourceManagerType = Type.GetType("System.Resources.WindowsRuntimeResourceManager, System.Runtime.WindowsRuntime", throwOnError: true);
return (WindowsRuntimeResourceManagerBase)Activator.CreateInstance(WinRTResourceManagerType, true);
}
#endif
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs b/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
index effa176376..1d518b16e4 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
@@ -1718,11 +1718,7 @@ namespace System.Runtime.InteropServices
//========================================================================
private static IntPtr LoadLicenseManager()
{
- Assembly sys = Assembly.Load("System, Version=" + ThisAssembly.Version +
- ", Culture=neutral, PublicKeyToken=" + AssemblyRef.EcmaPublicKeyToken);
- Type t = sys.GetType("System.ComponentModel.LicenseManager");
- if (t == null || !t.IsVisible)
- return IntPtr.Zero;
+ Type t = Type.GetType("System.ComponentModel.LicenseManager, System", throwOnError: true);
return t.TypeHandle.Value;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs
index ccbb1f10b5..9e1a9f39e5 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs
@@ -224,9 +224,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// For creating instances of Windows Runtime's IReference<T> and IReferenceArray<T>.
internal static class IReferenceFactory
{
- internal static readonly Type s_pointType = Type.GetType("Windows.Foundation.Point, " + AssemblyRef.SystemRuntimeWindowsRuntime);
- internal static readonly Type s_rectType = Type.GetType("Windows.Foundation.Rect, " + AssemblyRef.SystemRuntimeWindowsRuntime);
- internal static readonly Type s_sizeType = Type.GetType("Windows.Foundation.Size, " + AssemblyRef.SystemRuntimeWindowsRuntime);
+ internal static readonly Type s_pointType = Type.GetType("Windows.Foundation.Point, System.Runtime.WindowsRuntime");
+ internal static readonly Type s_rectType = Type.GetType("Windows.Foundation.Rect, System.Runtime.WindowsRuntime");
+ internal static readonly Type s_sizeType = Type.GetType("Windows.Foundation.Size, System.Runtime.WindowsRuntime");
internal static Object CreateIReference(Object obj)
{
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationToken.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationToken.cs
index e2b53277eb..2aeeb44beb 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationToken.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationToken.cs
@@ -11,7 +11,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// Event registration tokens are 64 bit opaque structures returned from WinRT style event adders, in order
// to signify a registration of a particular delegate to an event. The token's only real use is to
// unregister the same delgate from the event at a later time.
- public struct EventRegistrationToken
+ public struct EventRegistrationToken : IEquatable<EventRegistrationToken>
{
internal ulong m_value;
@@ -49,5 +49,15 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
return m_value.GetHashCode();
}
+
+ bool IEquatable<EventRegistrationToken>.Equals(EventRegistrationToken other)
+ {
+ return Equals(other);
+ }
+
+ private bool Equals(EventRegistrationToken other)
+ {
+ return other.m_value == m_value;
+ }
}
}
diff --git a/src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs b/src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs
index ca8314bed7..1fd61ec3e1 100644
--- a/src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs
+++ b/src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs
@@ -1234,26 +1234,5 @@ namespace System.Runtime.Intrinsics.X86
/// VXORPS ymm, ymm, ymm/m256
/// </summary>
public static Vector256<double> Xor(Vector256<double> left, Vector256<double> right) { throw new PlatformNotSupportedException(); }
-
- /// <summary>
- /// void _mm256_zeroall (void)
- /// VZEROALL
- /// </summary>
- public static void ZeroAll() { throw new PlatformNotSupportedException(); }
- /// <summary>
- /// void _mm256_zeroupper (void)
- /// VZEROUPPER
- /// </summary>
- public static void ZeroUpper() { throw new PlatformNotSupportedException(); }
-
- /// <summary>
- /// __m256d _mm256_zextpd128_pd256 (__m128d a)
- /// HELPER - No Codegen
- /// __m256 _mm256_zextps128_ps256 (__m128 a)
- /// HELPER - No Codegen
- /// __m256i _mm256_zextsi128_si256 (__m128i a)
- /// HELPER - No Codegen
- /// </summary>
- public static Vector256<T> ZeroExtendToVector256<T>(Vector128<T> value) where T : struct { throw new PlatformNotSupportedException(); }
}
}
diff --git a/src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.cs b/src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.cs
index 23f4127691..fdb349b120 100644
--- a/src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.cs
+++ b/src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.cs
@@ -239,17 +239,14 @@ namespace System.Runtime.Intrinsics.X86
/// __int8 _mm256_extract_epi8 (__m256i a, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte Extract(Vector256<sbyte> value, byte index)
{
- index &= 0x1F; // the instructions only need the lowest 5 bits.
- if (index > 15)
+ unsafe
{
- return Sse41.Extract(ExtractVector128(value, 1), (byte)(index - 16));
- }
- else
- {
- return Sse41.Extract(GetLowerHalf(value), index);
+ index &= 0x1F;
+ sbyte* buffer = stackalloc sbyte[32];
+ Store(buffer, value);
+ return buffer[index];
}
}
@@ -257,17 +254,14 @@ namespace System.Runtime.Intrinsics.X86
/// __int8 _mm256_extract_epi8 (__m256i a, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte Extract(Vector256<byte> value, byte index)
{
- index &= 0x1F; // the instructions only need the lowest 5 bits.
- if (index > 15)
+ unsafe
{
- return Sse41.Extract(ExtractVector128(value, 1), (byte)(index - 16));
- }
- else
- {
- return Sse41.Extract(GetLowerHalf(value), index);
+ index &= 0x1F;
+ byte* buffer = stackalloc byte[32];
+ Store(buffer, value);
+ return buffer[index];
}
}
@@ -275,35 +269,29 @@ namespace System.Runtime.Intrinsics.X86
/// __int16 _mm256_extract_epi16 (__m256i a, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static short Extract(Vector256<short> value, byte index)
{
- index &= 0xF; // the instructions only need the lowest 4 bits.
- if (index > 7)
+ unsafe
{
- return Sse2.Extract(ExtractVector128(value, 1), (byte)(index - 8));
- }
- else
- {
- return Sse2.Extract(GetLowerHalf(value), index);
- }
+ index &= 0xF;
+ short* buffer = stackalloc short[16];
+ Store(buffer, value);
+ return buffer[index];
+ }
}
/// <summary>
/// __int16 _mm256_extract_epi16 (__m256i a, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ushort Extract(Vector256<ushort> value, byte index)
{
- index &= 0xF; // the instructions only need the lowest 4 bits.
- if (index > 7)
- {
- return Sse2.Extract(ExtractVector128(value, 1), (byte)(index - 8));
- }
- else
+ unsafe
{
- return Sse2.Extract(GetLowerHalf(value), index);
+ index &= 0xF;
+ ushort* buffer = stackalloc ushort[16];
+ Store(buffer, value);
+ return buffer[index];
}
}
@@ -311,17 +299,14 @@ namespace System.Runtime.Intrinsics.X86
/// __int32 _mm256_extract_epi32 (__m256i a, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Extract(Vector256<int> value, byte index)
{
- index &= 0x7; // the instructions only need the lowest 3 bits.
- if (index > 3)
+ unsafe
{
- return Sse41.Extract(ExtractVector128(value, 1), (byte)(index - 4));
- }
- else
- {
- return Sse41.Extract(GetLowerHalf(value), index);
+ index &= 0x7;
+ int* buffer = stackalloc int[8];
+ Store(buffer, value);
+ return buffer[index];
}
}
@@ -329,17 +314,14 @@ namespace System.Runtime.Intrinsics.X86
/// __int32 _mm256_extract_epi32 (__m256i a, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint Extract(Vector256<uint> value, byte index)
{
- index &= 0x7; // the instructions only need the lowest 3 bits.
- if (index > 3)
- {
- return Sse41.Extract(ExtractVector128(value, 1), (byte)(index - 4));
- }
- else
+ unsafe
{
- return Sse41.Extract(GetLowerHalf(value), index);
+ index &= 0x7;
+ uint* buffer = stackalloc uint[8];
+ Store(buffer, value);
+ return buffer[index];
}
}
@@ -347,17 +329,18 @@ namespace System.Runtime.Intrinsics.X86
/// __int64 _mm256_extract_epi64 (__m256i a, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static long Extract(Vector256<long> value, byte index)
{
- index &= 0x3; // the instructions only need the lowest 2 bits.
- if (index > 1)
+ if (IntPtr.Size != 8)
{
- return Sse41.Extract(ExtractVector128(value, 1), (byte)(index - 2));
+ throw new PlatformNotSupportedException();
}
- else
+ unsafe
{
- return Sse41.Extract(GetLowerHalf(value), index);
+ index &= 0x3;
+ long* buffer = stackalloc long[4];
+ Store(buffer, value);
+ return buffer[index];
}
}
@@ -365,17 +348,18 @@ namespace System.Runtime.Intrinsics.X86
/// __int64 _mm256_extract_epi64 (__m256i a, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ulong Extract(Vector256<ulong> value, byte index)
{
- index &= 0x3; // the instructions only need the lowest 2 bits.
- if (index > 1)
+ if (IntPtr.Size != 8)
{
- return Sse41.Extract(ExtractVector128(value, 1), (byte)(index - 2));
+ throw new PlatformNotSupportedException();
}
- else
+ unsafe
{
- return Sse41.Extract(GetLowerHalf(value), index);
+ index &= 0x3;
+ ulong* buffer = stackalloc ulong[4];
+ Store(buffer, value);
+ return buffer[index];
}
}
@@ -506,20 +490,15 @@ namespace System.Runtime.Intrinsics.X86
/// __m256i _mm256_insert_epi8 (__m256i a, __int8 i, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<sbyte> Insert(Vector256<sbyte> value, sbyte data, byte index)
{
- index &= 0x1F; // the instructions only need the lowest 5 bits.
- if (index > 15)
+ unsafe
{
- Vector128<sbyte> half = ExtractVector128(value, 1);
- half = Sse41.Insert(half, data, (byte)(index - 16));
- return InsertVector128(value, half, 1);
- }
- else
- {
- Vector128<sbyte> half = Sse41.Insert(GetLowerHalf(value), data, index);
- return StaticCast<float, sbyte>(Blend(StaticCast<sbyte, float>(value), StaticCast<sbyte, float>(ExtendToVector256(half)), 15));
+ index &= 0x1F;
+ sbyte* buffer = stackalloc sbyte[32];
+ Store(buffer, value);
+ buffer[index] = data;
+ return LoadVector256(buffer);
}
}
@@ -527,20 +506,15 @@ namespace System.Runtime.Intrinsics.X86
/// __m256i _mm256_insert_epi8 (__m256i a, __int8 i, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<byte> Insert(Vector256<byte> value, byte data, byte index)
{
- index &= 0x1F; // the instructions only need the lowest 5 bits.
- if (index > 15)
- {
- Vector128<byte> half = ExtractVector128(value, 1);
- half = Sse41.Insert(half, data, (byte)(index - 16));
- return InsertVector128(value, half, 1);
- }
- else
+ unsafe
{
- Vector128<byte> half = Sse41.Insert(GetLowerHalf(value), data, index);
- return StaticCast<float, byte>(Blend(StaticCast<byte, float>(value), StaticCast<byte, float>(ExtendToVector256(half)), 15));
+ index &= 0x1F;
+ byte* buffer = stackalloc byte[32];
+ Store(buffer, value);
+ buffer[index] = data;
+ return LoadVector256(buffer);
}
}
@@ -548,20 +522,15 @@ namespace System.Runtime.Intrinsics.X86
/// __m256i _mm256_insert_epi16 (__m256i a, __int16 i, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<short> Insert(Vector256<short> value, short data, byte index)
{
- index &= 0xF; // the instructions only need the lowest 4 bits.
- if (index > 7)
+ unsafe
{
- Vector128<short> half = ExtractVector128(value, 1);
- half = Sse2.Insert(half, data, (byte)(index - 8));
- return InsertVector128(value, half, 1);
- }
- else
- {
- Vector128<short> half = Sse2.Insert(GetLowerHalf(value), data, index);
- return StaticCast<float, short>(Blend(StaticCast<short, float>(value), StaticCast<short, float>(ExtendToVector256(half)), 15));
+ index &= 0xF;
+ short* buffer = stackalloc short[16];
+ Store(buffer, value);
+ buffer[index] = data;
+ return LoadVector256(buffer);
}
}
@@ -569,20 +538,15 @@ namespace System.Runtime.Intrinsics.X86
/// __m256i _mm256_insert_epi16 (__m256i a, __int16 i, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<ushort> Insert(Vector256<ushort> value, ushort data, byte index)
{
- index &= 0xF; // the instructions only need the lowest 4 bits.
- if (index > 7)
+ unsafe
{
- Vector128<ushort> half = ExtractVector128(value, 1);
- half = Sse2.Insert(half, data, (byte)(index - 8));
- return InsertVector128(value, half, 1);
- }
- else
- {
- Vector128<ushort> half = Sse2.Insert(GetLowerHalf(value), data, index);
- return StaticCast<float, ushort>(Blend(StaticCast<ushort, float>(value), StaticCast<ushort, float>(ExtendToVector256(half)), 15));
+ index &= 0xF;
+ ushort* buffer = stackalloc ushort[16];
+ Store(buffer, value);
+ buffer[index] = data;
+ return LoadVector256(buffer);
}
}
@@ -590,20 +554,15 @@ namespace System.Runtime.Intrinsics.X86
/// __m256i _mm256_insert_epi32 (__m256i a, __int32 i, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<int> Insert(Vector256<int> value, int data, byte index)
{
- index &= 0x7; // the instructions only need the lowest 3 bits.
- if (index > 3)
+ unsafe
{
- Vector128<int> half = ExtractVector128(value, 1);
- half = Sse41.Insert(half, data, (byte)(index - 4));
- return InsertVector128(value, half, 1);
- }
- else
- {
- Vector128<int> half = Sse41.Insert(GetLowerHalf(value), data, index);
- return StaticCast<float, int>(Blend(StaticCast<int, float>(value), StaticCast<int, float>(ExtendToVector256(half)), 15));
+ index &= 0x7;
+ int* buffer = stackalloc int[8];
+ Store(buffer, value);
+ buffer[index] = data;
+ return LoadVector256(buffer);
}
}
@@ -611,20 +570,15 @@ namespace System.Runtime.Intrinsics.X86
/// __m256i _mm256_insert_epi32 (__m256i a, __int32 i, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<uint> Insert(Vector256<uint> value, uint data, byte index)
{
- index &= 0x7; // the instructions only need the lowest 3 bits.
- if (index > 3)
- {
- Vector128<uint> half = ExtractVector128(value, 1);
- half = Sse41.Insert(half, data, (byte)(index - 4));
- return InsertVector128(value, half, 1);
- }
- else
+ unsafe
{
- Vector128<uint> half = Sse41.Insert(GetLowerHalf(value), data, index);
- return StaticCast<float, uint>(Blend(StaticCast<uint, float>(value), StaticCast<uint, float>(ExtendToVector256(half)), 15));
+ index &= 0x7;
+ uint* buffer = stackalloc uint[8];
+ Store(buffer, value);
+ buffer[index] = data;
+ return LoadVector256(buffer);
}
}
@@ -632,20 +586,15 @@ namespace System.Runtime.Intrinsics.X86
/// __m256i _mm256_insert_epi64 (__m256i a, __int64 i, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<long> Insert(Vector256<long> value, long data, byte index)
{
- index &= 0x3; // the instructions only need the lowest 2 bits.
- if (index > 1)
+ unsafe
{
- Vector128<long> half = ExtractVector128(value, 1);
- half = Sse41.Insert(half, data, (byte)(index - 2));
- return InsertVector128(value, half, 1);
- }
- else
- {
- Vector128<long> half = Sse41.Insert(GetLowerHalf(value), data, index);
- return StaticCast<float, long>(Blend(StaticCast<long, float>(value), StaticCast<long, float>(ExtendToVector256(half)), 15));
+ index &= 0x3;
+ long* buffer = stackalloc long[4];
+ Store(buffer, value);
+ buffer[index] = data;
+ return LoadVector256(buffer);
}
}
@@ -653,20 +602,15 @@ namespace System.Runtime.Intrinsics.X86
/// __m256i _mm256_insert_epi64 (__m256i a, __int64 i, const int index)
/// HELPER
/// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<ulong> Insert(Vector256<ulong> value, ulong data, byte index)
{
- index &= 0x3; // the instructions only need the lowest 2 bits.
- if (index > 1)
- {
- Vector128<ulong> half = ExtractVector128(value, 1);
- half = Sse41.Insert(half, data, (byte)(index - 2));
- return InsertVector128(value, half, 1);
- }
- else
+ unsafe
{
- Vector128<ulong> half = Sse41.Insert(GetLowerHalf(value), data, index);
- return StaticCast<float, ulong>(Blend(StaticCast<ulong, float>(value), StaticCast<ulong, float>(ExtendToVector256(half)), 15));
+ index &= 0x3;
+ ulong* buffer = stackalloc ulong[4];
+ Store(buffer, value);
+ buffer[index] = data;
+ return LoadVector256(buffer);
}
}
@@ -1501,16 +1445,5 @@ namespace System.Runtime.Intrinsics.X86
/// VXORPS ymm, ymm, ymm/m256
/// </summary>
public static Vector256<double> Xor(Vector256<double> left, Vector256<double> right) => Xor(left, right);
-
- /// <summary>
- /// void _mm256_zeroall (void)
- /// VZEROALL
- /// </summary>
- public static void ZeroAll() => ZeroAll();
- /// <summary>
- /// void _mm256_zeroupper (void)
- /// VZEROUPPER
- /// </summary>
- public static void ZeroUpper() => ZeroUpper();
}
}
diff --git a/src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs b/src/mscorlib/src/System/Text/CodePageDataItem.Unix.cs
index ccf9993453..249457f0c1 100644
--- a/src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs
+++ b/src/mscorlib/src/System/Text/CodePageDataItem.Unix.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-namespace System.Globalization
+namespace System.Text
{
internal class CodePageDataItem
{
diff --git a/src/mscorlib/src/System/Globalization/EncodingDataItem.cs b/src/mscorlib/src/System/Text/CodePageDataItem.cs
index 41518596eb..6c7171a3e9 100644
--- a/src/mscorlib/src/System/Globalization/EncodingDataItem.cs
+++ b/src/mscorlib/src/System/Text/CodePageDataItem.cs
@@ -6,7 +6,7 @@ using System.Text;
using System;
using System.Security;
-namespace System.Globalization
+namespace System.Text
{
//
// Data item for EncodingTable. Along with EncodingTable, they are used by
diff --git a/src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs b/src/mscorlib/src/System/Text/EncodingTable.Unix.cs
index f9671cc684..dda6d84a84 100644
--- a/src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs
+++ b/src/mscorlib/src/System/Text/EncodingTable.Unix.cs
@@ -4,9 +4,10 @@
using System.Collections.Generic;
using System.Diagnostics;
+using System.Globalization;
using System.Text;
-namespace System.Globalization
+namespace System.Text
{
internal static class EncodingTable
{
diff --git a/src/mscorlib/src/System/Globalization/EncodingTable.cs b/src/mscorlib/src/System/Text/EncodingTable.cs
index d09b057b2d..ab9fbc0ef5 100644
--- a/src/mscorlib/src/System/Globalization/EncodingTable.cs
+++ b/src/mscorlib/src/System/Text/EncodingTable.cs
@@ -6,13 +6,14 @@ using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
+using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Threading;
-namespace System.Globalization
+namespace System.Text
{
//
// Data table for encoding classes. Used by System.Text.Encoding.
@@ -63,7 +64,7 @@ namespace System.Globalization
{
index = ((right - left) / 2) + left;
- result = String.nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[index].webName);
+ result = nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[index].webName);
if (result == 0)
{
@@ -85,7 +86,7 @@ namespace System.Globalization
//Walk the remaining elements (it'll be 3 or fewer).
for (; left <= right; left++)
{
- if (String.nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[left].webName) == 0)
+ if (nativeCompareOrdinalIgnoreCaseWC(name, encodingDataPtr[left].webName) == 0)
{
return (encodingDataPtr[left].codePage);
}
@@ -212,6 +213,11 @@ namespace System.Globalization
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern unsafe InternalCodePageDataItem* GetCodePageData();
+
+ //This will not work in case-insensitive mode for any character greater than 0x7F.
+ //We'll throw an ArgumentException.
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern unsafe int nativeCompareOrdinalIgnoreCaseWC(String strA, sbyte* strBBytes);
}
/*=================================InternalEncodingDataItem==========================
diff --git a/src/mscorlib/src/System/Threading/CancellationToken.cs b/src/mscorlib/src/System/Threading/CancellationToken.cs
index 9766ca2d1b..886210c560 100644
--- a/src/mscorlib/src/System/Threading/CancellationToken.cs
+++ b/src/mscorlib/src/System/Threading/CancellationToken.cs
@@ -130,7 +130,7 @@ namespace System.Threading
/// </remarks>
/// <param name="callback">The delegate to be executed when the <see cref="T:System.Threading.CancellationToken">CancellationToken</see> is canceled.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
public CancellationTokenRegistration Register(Action callback) =>
Register(
@@ -159,7 +159,7 @@ namespace System.Threading
/// the current <see cref="T:System.Threading.SynchronizationContext">SynchronizationContext</see> and use it
/// when invoking the <paramref name="callback"/>.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
public CancellationTokenRegistration Register(Action callback, bool useSynchronizationContext) =>
Register(
@@ -186,7 +186,7 @@ namespace System.Threading
/// <param name="callback">The delegate to be executed when the <see cref="T:System.Threading.CancellationToken">CancellationToken</see> is canceled.</param>
/// <param name="state">The state to pass to the <paramref name="callback"/> when the delegate is invoked. This may be null.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
public CancellationTokenRegistration Register(Action<object> callback, object state) =>
Register(callback, state, useSyncContext: false, useExecutionContext: true);
@@ -212,7 +212,7 @@ namespace System.Threading
/// the current <see cref="T:System.Threading.SynchronizationContext">SynchronizationContext</see> and use it
/// when invoking the <paramref name="callback"/>.</param>
/// <returns>The <see cref="T:System.Threading.CancellationTokenRegistration"/> instance that can
- /// be used to deregister the callback.</returns>
+ /// be used to unregister the callback.</returns>
/// <exception cref="T:System.ArgumentNullException"><paramref name="callback"/> is null.</exception>
/// <exception cref="T:System.ObjectDisposedException">The associated <see
/// cref="T:System.Threading.CancellationTokenSource">CancellationTokenSource</see> has been disposed.</exception>
diff --git a/src/mscorlib/src/System/Threading/CancellationTokenRegistration.cs b/src/mscorlib/src/System/Threading/CancellationTokenRegistration.cs
index 2b56bf79ed..3c964a954c 100644
--- a/src/mscorlib/src/System/Threading/CancellationTokenRegistration.cs
+++ b/src/mscorlib/src/System/Threading/CancellationTokenRegistration.cs
@@ -24,8 +24,8 @@ namespace System.Threading
/// <summary>
/// Disposes of the registration and unregisters the target callback from the associated
/// <see cref="T:System.Threading.CancellationToken">CancellationToken</see>.
- /// If the target callback is currently executing this method will wait until it completes, except
- /// in the degenerate cases where a callback method deregisters itself.
+ /// If the target callback is currently executing, this method will wait until it completes, except
+ /// in the degenerate cases where a callback method unregisters itself.
/// </summary>
public void Dispose()
{
@@ -47,7 +47,7 @@ namespace System.Threading
/// Disposes of the registration and unregisters the target callback from the associated
/// <see cref="T:System.Threading.CancellationToken">CancellationToken</see>.
/// </summary>
- internal bool TryDeregister() // corefx currently has an InternalsVisibleTo dependency on this
+ internal bool Unregister() // corefx currently has an InternalsVisibleTo dependency on this
{
CancellationTokenSource.CallbackNode node = _node;
return node != null && node.Partition.Unregister(_id, node);
@@ -62,8 +62,8 @@ namespace System.Threading
// 1. If we are called in the context of an executing callback, no need to wait (determined by tracking callback-executor threadID)
// - if the currently executing callback is this CTR, then waiting would deadlock. (We choose to return rather than deadlock)
// - if not, then this CTR cannot be the one executing, hence no need to wait
- // 2. If deregistration failed, and we are on a different thread, then the callback may be running under control of cts.Cancel()
- // => poll until cts.ExecutingCallback is not the one we are trying to deregister.
+ // 2. If unregistration failed, and we are on a different thread, then the callback may be running under control of cts.Cancel()
+ // => poll until cts.ExecutingCallback is not the one we are trying to unregister.
CancellationTokenSource source = _node.Partition.Source;
if (source.IsCancellationRequested && // Running callbacks has commenced.
!source.IsCancellationCompleted && // Running callbacks hasn't finished.
diff --git a/src/mscorlib/src/System/Threading/CancellationTokenSource.cs b/src/mscorlib/src/System/Threading/CancellationTokenSource.cs
index 07b932858b..3b47cf57cf 100644
--- a/src/mscorlib/src/System/Threading/CancellationTokenSource.cs
+++ b/src/mscorlib/src/System/Threading/CancellationTokenSource.cs
@@ -386,7 +386,7 @@ namespace System.Threading
{
if (disposing && !_disposed)
{
- // We specifically tolerate that a callback can be deregistered
+ // We specifically tolerate that a callback can be unregistered
// after the CTS has been disposed and/or concurrently with cts.Dispose().
// This is safe without locks because Dispose doesn't interact with values
// in the callback partitions, only nulling out the ref to existing partitions.
diff --git a/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs b/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs
index d2767710ec..d0a8d34d04 100644
--- a/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs
+++ b/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs
@@ -575,7 +575,7 @@ namespace System.Threading
// Now enter the lock and wait.
EnsureLockObjectCreated();
- // We must register and deregister the token outside of the lock, to avoid deadlocks.
+ // We must register and unregister the token outside of the lock, to avoid deadlocks.
using (cancellationToken.InternalRegisterWithoutEC(s_cancellationTokenCallback, this))
{
lock (m_lock)
@@ -629,7 +629,7 @@ namespace System.Threading
}
}
}
- } // automatically disposes (and deregisters) the callback
+ } // automatically disposes (and unregisters) the callback
return true; //done. The wait was satisfied.
}
diff --git a/src/mscorlib/src/System/Threading/Overlapped.cs b/src/mscorlib/src/System/Threading/Overlapped.cs
index 8df01923d3..51df27f735 100644
--- a/src/mscorlib/src/System/Threading/Overlapped.cs
+++ b/src/mscorlib/src/System/Threading/Overlapped.cs
@@ -95,7 +95,7 @@ namespace System.Threading
if (helper == null || helper._executionContext == null || helper._executionContext.IsDefault)
{
- // We got here because of UnsafePack (or) Pack with EC flow supressed
+ // We got here because of UnsafePack (or) Pack with EC flow suppressed
IOCompletionCallback callback = overlapped.UserCallback;
callback(errorCode, numBytes, pOVERLAP);
}
diff --git a/src/mscorlib/src/System/Threading/SemaphoreSlim.cs b/src/mscorlib/src/System/Threading/SemaphoreSlim.cs
index c075a6d0f0..997dbb99ec 100644
--- a/src/mscorlib/src/System/Threading/SemaphoreSlim.cs
+++ b/src/mscorlib/src/System/Threading/SemaphoreSlim.cs
@@ -342,7 +342,7 @@ namespace System.Threading
bool lockTaken = false;
//Register for cancellation outside of the main lock.
- //NOTE: Register/deregister inside the lock can deadlock as different lock acquisition orders could
+ //NOTE: Register/unregister inside the lock can deadlock as different lock acquisition orders could
// occur for (1)this.m_lockObj and (2)cts.internalLock
CancellationTokenRegistration cancellationTokenRegistration = cancellationToken.InternalRegisterWithoutEC(s_cancellationTokenCanceledEventHandler, this);
try
diff --git a/src/mscorlib/src/System/Threading/SpinLock.cs b/src/mscorlib/src/System/Threading/SpinLock.cs
index 917ece2d4d..c23cd57be5 100644
--- a/src/mscorlib/src/System/Threading/SpinLock.cs
+++ b/src/mscorlib/src/System/Threading/SpinLock.cs
@@ -84,7 +84,7 @@ namespace System.Threading
private const int ID_DISABLED_AND_ANONYMOUS_OWNED = unchecked((int)0x80000001); //1000 0000 0000 0000 0000 0000 0000 0001
// If the thread is unowned if:
- // m_owner zero and the threa tracking is enabled
+ // m_owner zero and the thread tracking is enabled
// m_owner & LOCK_ANONYMOUS_OWNED = zero and the thread tracking is disabled
private const int LOCK_UNOWNED = 0;
@@ -306,7 +306,7 @@ namespace System.Threading
// In this case there are three ways to acquire the lock
// 1- the first way the thread either tries to get the lock if it's free or updates the waiters, if the turn >= the processors count then go to 3 else go to 2
// 2- In this step the waiter threads spins and tries to acquire the lock, the number of spin iterations and spin count is dependent on the thread turn
- // the late the thread arrives the more it spins and less frequent it check the lock avilability
+ // the late the thread arrives the more it spins and less frequent it check the lock availability
// Also the spins count is increases each iteration
// If the spins iterations finished and failed to acquire the lock, go to step 3
// 3- This is the yielding step, there are two ways of yielding Thread.Yield and Sleep(1)
@@ -322,22 +322,22 @@ namespace System.Threading
{
if (CompareExchange(ref m_owner, observedOwner | 1, observedOwner, ref lockTaken) == observedOwner)
{
- // Aquired lock
+ // Acquired lock
return;
}
if (millisecondsTimeout == 0)
{
- // Did not aquire lock in CompareExchange and timeout is 0 so fail fast
+ // Did not acquire lock in CompareExchange and timeout is 0 so fail fast
return;
}
}
else if (millisecondsTimeout == 0)
{
- // Did not aquire lock as owned and timeout is 0 so fail fast
+ // Did not acquire lock as owned and timeout is 0 so fail fast
return;
}
- else //failed to acquire the lock,then try to update the waiters. If the waiters count reached the maximum, jsut break the loop to avoid overflow
+ else //failed to acquire the lock, then try to update the waiters. If the waiters count reached the maximum, just break the loop to avoid overflow
{
if ((observedOwner & WAITERS_MASK) != MAXIMUM_WAITERS)
{
@@ -362,7 +362,7 @@ namespace System.Threading
if ((observedOwner & LOCK_ANONYMOUS_OWNED) == LOCK_UNOWNED)
{
int newOwner = (observedOwner & WAITERS_MASK) == 0 ? // Gets the number of waiters, if zero
- observedOwner | 1 // don't decrement it. just set the lock bit, it is zzero because a previous call of Exit(false) ehich corrupted the waiters
+ observedOwner | 1 // don't decrement it. just set the lock bit, it is zero because a previous call of Exit(false) which corrupted the waiters
: (observedOwner - 2) | 1; // otherwise decrement the waiters and set the lock bit
Debug.Assert((newOwner & WAITERS_MASK) >= 0);
@@ -486,8 +486,8 @@ namespace System.Threading
/// </exception>
public void Exit(bool useMemoryBarrier)
{
- // This is the fast path for the thread tracking is diabled and not to use memory barrier, otherwise go to the slow path
- // The reason not to add else statement if the usememorybarrier is that it will add more barnching in the code and will prevent
+ // This is the fast path for the thread tracking is disabled and not to use memory barrier, otherwise go to the slow path
+ // The reason not to add else statement if the usememorybarrier is that it will add more branching in the code and will prevent
// method inlining, so this is optimized for useMemoryBarrier=false and Exit() overload optimized for useMemoryBarrier=true.
int tmpOwner = m_owner;
if ((tmpOwner & LOCK_ID_DISABLE_MASK) != 0 & !useMemoryBarrier)
diff --git a/src/mscorlib/src/System/Threading/SynchronizationContext.cs b/src/mscorlib/src/System/Threading/SynchronizationContext.cs
index 6ee4c831dc..f438e9a03d 100644
--- a/src/mscorlib/src/System/Threading/SynchronizationContext.cs
+++ b/src/mscorlib/src/System/Threading/SynchronizationContext.cs
@@ -206,7 +206,7 @@ namespace System.Threading
WinRTSynchronizationContextFactoryBase factory = s_winRTContextFactory;
if (factory == null)
{
- Type factoryType = Type.GetType("System.Threading.WinRTSynchronizationContextFactory, " + AssemblyRef.SystemRuntimeWindowsRuntime, true);
+ Type factoryType = Type.GetType("System.Threading.WinRTSynchronizationContextFactory, System.Runtime.WindowsRuntime", throwOnError: true);
s_winRTContextFactory = factory = (WinRTSynchronizationContextFactoryBase)Activator.CreateInstance(factoryType, true);
}
return factory;
diff --git a/src/mscorlib/src/System/Threading/Tasks/Task.cs b/src/mscorlib/src/System/Threading/Tasks/Task.cs
index e4ca132a63..6d4ddf8473 100644
--- a/src/mscorlib/src/System/Threading/Tasks/Task.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/Task.cs
@@ -275,11 +275,11 @@ namespace System.Threading.Tasks
}
/// <summary>
- /// Checks if we registered a CT callback during construction, and deregisters it.
+ /// Checks if we registered a CT callback during construction, and unregisters it.
/// This should be called when we know the registration isn't useful anymore. Specifically from Finish() if the task has completed
/// successfully or with an exception.
/// </summary>
- internal void DeregisterCancellationCallback()
+ internal void UnregisterCancellationCallback()
{
if (m_cancellationRegistration != null)
{
@@ -2160,7 +2160,7 @@ namespace System.Threading.Tasks
if (cp != null)
{
cp.SetCompleted();
- cp.DeregisterCancellationCallback();
+ cp.UnregisterCancellationCallback();
}
// ready to run continuations and notify parent.
@@ -3196,7 +3196,7 @@ namespace System.Threading.Tasks
if (cp != null)
{
cp.SetCompleted();
- cp.DeregisterCancellationCallback();
+ cp.UnregisterCancellationCallback();
}
if (AsyncCausalityTracer.LoggingOn)
diff --git a/src/mscorlib/src/System/Threading/Thread.cs b/src/mscorlib/src/System/Threading/Thread.cs
index 8778abcdd4..51bfd27cd3 100644
--- a/src/mscorlib/src/System/Threading/Thread.cs
+++ b/src/mscorlib/src/System/Threading/Thread.cs
@@ -213,7 +213,7 @@ namespace System.Threading
IntPtr thread = DONT_USE_InternalThread;
// This should never happen under normal circumstances. m_assembly is always assigned before it is handed out to the user.
- // There are ways how to create an unitialized objects through remoting, etc. Avoid AVing in the EE by throwing a nice
+ // There are ways how to create an uninitialized objects through remoting, etc. Avoid AVing in the EE by throwing a nice
// exception here.
if (thread == IntPtr.Zero)
throw new ArgumentException(null, SR.Argument_InvalidHandle);
@@ -257,7 +257,7 @@ namespace System.Threading
if (m_Delegate != null)
{
// If we reach here with a null delegate, something is broken. But we'll let the StartInternal method take care of
- // reporting an error. Just make sure we dont try to dereference a null delegate.
+ // reporting an error. Just make sure we don't try to dereference a null delegate.
ThreadHelper t = (ThreadHelper)(m_Delegate.Target);
ExecutionContext ec = ExecutionContext.Capture();
t.SetExecutionContextHelper(ec);
@@ -290,7 +290,7 @@ namespace System.Threading
/*=========================================================================
** Suspends the current thread for timeout milliseconds. If timeout == 0,
- ** forces the thread to give up the remainer of its timeslice. If timeout
+ ** forces the thread to give up the remainder of its timeslice. If timeout
** == Timeout.Infinite, no timeout will occur.
**
** Exceptions: ArgumentException if timeout < 0.
@@ -313,9 +313,9 @@ namespace System.Threading
}
- /* wait for a length of time proportial to 'iterations'. Each iteration is should
+ /* wait for a length of time proportional to 'iterations'. Each iteration is should
only take a few machine instructions. Calling this API is preferable to coding
- a explict busy loop because the hardware can be informed that it is busy waiting. */
+ a explicit busy loop because the hardware can be informed that it is busy waiting. */
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void SpinWaitInternal(int iterations);
@@ -528,7 +528,7 @@ namespace System.Threading
} // End of class Thread
// declaring a local var of this enum type and passing it by ref into a function that needs to do a
- // stack crawl will both prevent inlining of the calle and pass an ESP point to stack crawl to
+ // stack crawl will both prevent inlining of the callee and pass an ESP point to stack crawl to
// Declaring these in EH clauses is illegal; they must declared in the main method body
internal enum StackCrawlMark
{
diff --git a/src/mscorlib/src/System/Threading/ThreadPool.cs b/src/mscorlib/src/System/Threading/ThreadPool.cs
index 69c189fd37..ad70726cbe 100644
--- a/src/mscorlib/src/System/Threading/ThreadPool.cs
+++ b/src/mscorlib/src/System/Threading/ThreadPool.cs
@@ -241,7 +241,7 @@ namespace System.Threading
// And then check to see if we can fix up the indexes (if we're at
// the edge). If we can't, we just leave nulls in the array and they'll
- // get filtered out eventually (but may lead to superflous resizing).
+ // get filtered out eventually (but may lead to superfluous resizing).
if (i == m_tailIndex)
m_tailIndex -= 1;
else if (i == m_headIndex)
@@ -655,7 +655,7 @@ namespace System.Threading
}
}
- // Holds a WorkStealingQueue, and remmoves it from the list when this object is no longer referened.
+ // Holds a WorkStealingQueue, and removes it from the list when this object is no longer referenced.
internal sealed class ThreadPoolWorkQueueThreadLocals
{
[ThreadStatic]
@@ -866,7 +866,7 @@ namespace System.Threading
public delegate void WaitCallback(Object state);
- public delegate void WaitOrTimerCallback(Object state, bool timedOut); // signalled or timed out
+ public delegate void WaitOrTimerCallback(Object state, bool timedOut); // signaled or timed out
//
// This type is necessary because VS 2010's debugger looks for a method named _ThreadPoolWaitCallbacck.PerformWaitCallback
diff --git a/src/mscorlib/src/System/Threading/WaitHandle.cs b/src/mscorlib/src/System/Threading/WaitHandle.cs
index 3c3b89d1cb..2de388dc49 100644
--- a/src/mscorlib/src/System/Threading/WaitHandle.cs
+++ b/src/mscorlib/src/System/Threading/WaitHandle.cs
@@ -31,7 +31,7 @@ namespace System.Threading
private const int MAX_WAITHANDLES = 64;
#pragma warning disable 414 // Field is not used from managed.
- private IntPtr waitHandle; // !!! DO NOT MOVE THIS FIELD. (See defn of WAITHANDLEREF in object.h - has hardcoded access to this field.)
+ private IntPtr waitHandle; // !!! DO NOT MOVE THIS FIELD. (See defn of WAITHANDLEREF in object.h - has hard-coded access to this field.)
#pragma warning restore 414
internal volatile SafeWaitHandle safeWaitHandle;
@@ -228,7 +228,7 @@ namespace System.Threading
** Waits for signal from all the objects.
** timeout indicates how long to wait before the method returns.
** This method will return either when all the object have been pulsed
- ** or timeout milliseonds have elapsed.
+ ** or timeout milliseconds have elapsed.
** If exitContext is true then the synchronization domain for the context
** (if in a synchronized context) is exited before the wait and reacquired
========================================================================*/
@@ -329,7 +329,7 @@ namespace System.Threading
** Waits for notification from any of the objects.
** timeout indicates how long to wait before the method returns.
** This method will return either when either one of the object have been
- ** signalled or timeout milliseonds have elapsed.
+ ** signaled or timeout milliseconds have elapsed.
** If exitContext is true then the synchronization domain for the context
** (if in a synchronized context) is exited before the wait and reacquired
========================================================================*/
diff --git a/src/mscorlib/src/mscorlib.Friends.cs b/src/mscorlib/src/mscorlib.Friends.cs
index 709ec21191..eadba9c97c 100644
--- a/src/mscorlib/src/mscorlib.Friends.cs
+++ b/src/mscorlib/src/mscorlib.Friends.cs
@@ -4,14 +4,6 @@
using System.Runtime.CompilerServices;
-// For now we are only moving to using this file over AssemblyAttributes.cspp in CoreSys, ideally we would move away from the centralized
-// AssemblyAttributes.cspp model for the other build types at a future point in time.
-
-// Depends on things like SuppressUnmanagedCodeAttribute and WindowsRuntimeImportAttribute
+// Depends on things like WindowsRuntimeImportAttribute
[assembly: InternalsVisibleTo("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000", AllInternalsVisible = false)]
-
-// Depends on WindowsRuntimeImportAttribute
[assembly: InternalsVisibleTo("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000", AllInternalsVisible = false)]
-
-// Cross framework serialization needs access to internals
-[assembly: InternalsVisibleTo("mscorlib, PublicKey=00000000000000000400000000000000", AllInternalsVisible=false)]
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 7aadbda126..60f4a81c66 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -299,40 +299,6 @@ typedef long time_t;
#define _TIME_T_DEFINED
#endif // !PAL_STDCPP_COMPAT
-#if ENABLE_DOWNLEVEL_FOR_NLS
-#define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD )(srtid))) << 16) | \
- ((DWORD)((WORD )(lgid)))))
-#define LANGIDFROMLCID(lcid) ((WORD)(lcid))
-#define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0xf))
-
-#define LANG_NEUTRAL 0x00
-#define LANG_INVARIANT 0x7f
-#define SUBLANG_NEUTRAL 0x00 // language neutral
-#define SUBLANG_DEFAULT 0x01 // user default
-#define SORT_DEFAULT 0x0 // sorting default
-#define SUBLANG_SYS_DEFAULT 0x02 // system default
-
-#define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
-#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
-#define SUBLANGID(lgid) ((WORD )(lgid) >> 10)
-
-#define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
-#define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
-#define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
-#define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
-#define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT))
-#define LOCALE_US_ENGLISH (MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT))
-#define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT))
-
-#define SUBLANG_ENGLISH_US 0x01
-#define SUBLANG_CHINESE_TRADITIONAL 0x01 /* Chinese (Traditional) */
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-
-#define CT_CTYPE1 0x00000001 /* ctype 1 information */
-#define CT_CTYPE2 0x00000002 /* ctype 2 information */
-#define CT_CTYPE3 0x00000004 /* ctype 3 information */
#define C1_UPPER 0x0001 /* upper case */
#define C1_LOWER 0x0002 /* lower case */
#define C1_DIGIT 0x0004 /* decimal digits */
@@ -342,31 +308,6 @@ typedef long time_t;
#define C1_BLANK 0x0040 /* blank characters */
#define C1_XDIGIT 0x0080 /* other digits */
#define C1_ALPHA 0x0100 /* any linguistic character */
-#define C2_LEFTTORIGHT 0x0001 /* left to right */
-#define C2_RIGHTTOLEFT 0x0002 /* right to left */
-#define C2_EUROPENUMBER 0x0003 /* European number, digit */
-#define C2_EUROPESEPARATOR 0x0004 /* European numeric separator */
-#define C2_EUROPETERMINATOR 0x0005 /* European numeric terminator */
-#define C2_ARABICNUMBER 0x0006 /* Arabic number */
-#define C2_COMMONSEPARATOR 0x0007 /* common numeric separator */
-#define C2_BLOCKSEPARATOR 0x0008 /* block separator */
-#define C2_SEGMENTSEPARATOR 0x0009 /* segment separator */
-#define C2_WHITESPACE 0x000A /* white space */
-#define C2_OTHERNEUTRAL 0x000B /* other neutrals */
-#define C2_NOTAPPLICABLE 0x0000 /* no implicit directionality */
-#define C3_NONSPACING 0x0001 /* nonspacing character */
-#define C3_DIACRITIC 0x0002 /* diacritic mark */
-#define C3_VOWELMARK 0x0004 /* vowel mark */
-#define C3_SYMBOL 0x0008 /* symbols */
-#define C3_KATAKANA 0x0010 /* katakana character */
-#define C3_HIRAGANA 0x0020 /* hiragana character */
-#define C3_HALFWIDTH 0x0040 /* half width character */
-#define C3_FULLWIDTH 0x0080 /* full width character */
-#define C3_IDEOGRAPH 0x0100 /* ideographic character */
-#define C3_KASHIDA 0x0200 /* Arabic kashida character */
-#define C3_LEXICAL 0x0400 /* lexical character */
-#define C3_ALPHA 0x8000 /* any ling. char (C1_ALPHA) */
-#define C3_NOTAPPLICABLE 0x0000 /* ctype 3 is not applicable */
#define DLL_PROCESS_ATTACH 1
#define DLL_THREAD_ATTACH 2
@@ -2906,84 +2847,6 @@ FlushInstructionCache(
IN LPCVOID lpBaseAddress,
IN SIZE_T dwSize);
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-BOOL
-PALAPI
-GetStringTypeExW(
- IN LCID Locale,
- IN DWORD dwInfoType,
- IN LPCWSTR lpSrcStr,
- IN int cchSrc,
- OUT LPWORD lpCharType);
-
-#ifdef UNICODE
-#define GetStringTypeEx GetStringTypeExW
-#endif
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-
-#define NORM_IGNORECASE 0x00000001 // ignore case
-#define NORM_IGNOREWIDTH 0x00020000 // ignore width
-
-#define NORM_LINGUISTIC_CASING 0x08000000 // use linguistic rules for casing
-
-#ifdef __APPLE__
-#define NORM_IGNORENONSPACE 0x00000002 // ignore nonspacing chars
-#define NORM_IGNORESYMBOLS 0x00000004 // ignore symbols
-#define NORM_IGNOREKANATYPE 0x00010000 // ignore kanatype
-#define SORT_STRINGSORT 0x00001000 // use string sort method
-#endif // __APPLE__
-
-
-typedef struct nlsversioninfo {
- DWORD dwNLSVersionInfoSize;
- DWORD dwNLSVersion;
- DWORD dwDefinedVersion;
-} NLSVERSIONINFO, *LPNLSVERSIONINFO;
-
-#define CSTR_LESS_THAN 1
-#define CSTR_EQUAL 2
-#define CSTR_GREATER_THAN 3
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-
-PALIMPORT
-int
-PALAPI
-CompareStringW(
- IN LCID Locale,
- IN DWORD dwCmpFlags,
- IN LPCWSTR lpString1,
- IN int cchCount1,
- IN LPCWSTR lpString2,
- IN int cchCount2);
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-
-PALIMPORT
-int
-PALAPI
-CompareStringEx(
- IN LPCWSTR lpLocaleName,
- IN DWORD dwCmpFlags,
- IN LPCWSTR lpString1,
- IN int cchCount1,
- IN LPCWSTR lpString2,
- IN int cchCount2,
- IN LPNLSVERSIONINFO lpVersionInformation,
- IN LPVOID lpReserved,
- IN LPARAM lParam);
-
-
-#ifdef UNICODE
-#define CompareString CompareStringW
-#endif
-
#define MAX_LEADBYTES 12
#define MAX_DEFAULTCHAR 2
@@ -3054,692 +2917,6 @@ WideCharToMultiByte(
IN LPCSTR lpDefaultChar,
OUT LPBOOL lpUsedDefaultChar);
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-LANGID
-PALAPI
-GetSystemDefaultLangID(
- void);
-
-PALIMPORT
-LANGID
-PALAPI
-GetUserDefaultLangID(
- void);
-
-PALIMPORT
-BOOL
-PALAPI
-SetThreadLocale(
- IN LCID Locale);
-
-PALIMPORT
-LCID
-PALAPI
-GetThreadLocale(
- void);
-
-#endif //ENABLE_DOWNLEVEL_FOR_NLS
-
-//
-// Locale Types.
-//
-// These types are used for the GetLocaleInfo NLS API routine.
-//
-
-#ifdef __APPLE__
-
-//
-// The following LCTypes may be used in combination with any other LCTypes.
-//
-// LOCALE_NOUSEROVERRIDE is also used in GetTimeFormat and
-// GetDateFormat.
-//
-// LOCALE_RETURN_NUMBER will return the result from GetLocaleInfo as a
-// number instead of a string. This flag is only valid for the LCTypes
-// beginning with LOCALE_I.
-//
-#define LOCALE_NOUSEROVERRIDE 0x80000000 /* do not use user overrides */
-#define LOCALE_RETURN_NUMBER 0x20000000 /* return number instead of string */
-#define LOCALE_RETURN_GENITIVE_NAMES 0x10000000 //Flag to return the Genitive forms of month names
-
-#define LOCALE_SLOCALIZEDDISPLAYNAME 0x00000002 // localized name of locale, eg "German (Germany)" in UI language
-#define LOCALE_SENGLISHDISPLAYNAME 0x00000072 // Display name (language + country usually) in English, eg "German (Germany)"
-#define LOCALE_SNATIVEDISPLAYNAME 0x00000073 // Display name in native locale language, eg "Deutsch (Deutschland)
-
-#define LOCALE_SLOCALIZEDLANGUAGENAME 0x0000006f // Language Display Name for a language, eg "German" in UI language
-#define LOCALE_SENGLISHLANGUAGENAME 0x00001001 // English name of language, eg "German"
-#define LOCALE_SNATIVELANGUAGENAME 0x00000004 // native name of language, eg "Deutsch"
-
-#define LOCALE_SLOCALIZEDCOUNTRYNAME 0x00000006 // localized name of country, eg "Germany" in UI language
-#define LOCALE_SENGLISHCOUNTRYNAME 0x00001002 // English name of country, eg "Germany"
-#define LOCALE_SNATIVECOUNTRYNAME 0x00000008 // native name of country, eg "Deutschland"
-
-//
-// The following LCTypes are mutually exclusive in that they may NOT
-// be used in combination with each other.
-//
-#define LOCALE_ILANGUAGE 0x00000001 /* language id */
-#define LOCALE_SLANGUAGE 0x00000002 /* localized name of language */
-#define LOCALE_SENGLANGUAGE 0x00001001 /* English name of language */
-#define LOCALE_SABBREVLANGNAME 0x00000003 /* abbreviated language name */
-#define LOCALE_SNATIVELANGNAME 0x00000004 /* native name of language */
-#define LOCALE_ICOUNTRY 0x00000005 /* country code */
-#define LOCALE_SCOUNTRY 0x00000006 /* localized name of country */
-
-#define LOCALE_SENGCOUNTRY 0x00001002 /* English name of country */
-#define LOCALE_SABBREVCTRYNAME 0x00000007 /* abbreviated country name */
-#define LOCALE_SNATIVECTRYNAME 0x00000008 /* native name of country */
-
-#define LOCALE_SLIST 0x0000000C /* list item separator */
-#define LOCALE_IMEASURE 0x0000000D /* 0 = metric, 1 = US */
-
-#define LOCALE_SDECIMAL 0x0000000E /* decimal separator */
-#define LOCALE_STHOUSAND 0x0000000F /* thousand separator */
-#define LOCALE_SGROUPING 0x00000010 /* digit grouping */
-#define LOCALE_IDIGITS 0x00000011 /* number of fractional digits */
-#define LOCALE_ILZERO 0x00000012 /* leading zeros for decimal */
-#define LOCALE_INEGNUMBER 0x00001010 /* negative number mode */
-#define LOCALE_SNATIVEDIGITS 0x00000013 /* native ascii 0-9 */
-
-#define LOCALE_SCURRENCY 0x00000014 /* local monetary symbol */
-#define LOCALE_SINTLSYMBOL 0x00000015 /* intl monetary symbol */
-#define LOCALE_SMONDECIMALSEP 0x00000016 /* monetary decimal separator */
-#define LOCALE_SMONTHOUSANDSEP 0x00000017 /* monetary thousand separator */
-#define LOCALE_SMONGROUPING 0x00000018 /* monetary grouping */
-#define LOCALE_ICURRDIGITS 0x00000019 /* # local monetary digits */
-#define LOCALE_IINTLCURRDIGITS 0x0000001A /* # intl monetary digits */
-#define LOCALE_ICURRENCY 0x0000001B /* positive currency mode */
-#define LOCALE_INEGCURR 0x0000001C /* negative currency mode */
-
-#define LOCALE_SSHORTDATE 0x0000001F /* short date format string */
-#define LOCALE_SLONGDATE 0x00000020 /* long date format string */
-#define LOCALE_STIMEFORMAT 0x00001003 /* time format string */
-#define LOCALE_S1159 0x00000028 /* AM designator */
-#define LOCALE_S2359 0x00000029 /* PM designator */
-
-#define LOCALE_ICALENDARTYPE 0x00001009 /* type of calendar specifier */
-#define LOCALE_IFIRSTDAYOFWEEK 0x0000100C /* first day of week specifier */
-#define LOCALE_IFIRSTWEEKOFYEAR 0x0000100D /* first week of year specifier */
-
-#define LOCALE_SDAYNAME1 0x0000002A /* long name for Monday */
-#define LOCALE_SDAYNAME2 0x0000002B /* long name for Tuesday */
-#define LOCALE_SDAYNAME3 0x0000002C /* long name for Wednesday */
-#define LOCALE_SDAYNAME4 0x0000002D /* long name for Thursday */
-#define LOCALE_SDAYNAME5 0x0000002E /* long name for Friday */
-#define LOCALE_SDAYNAME6 0x0000002F /* long name for Saturday */
-#define LOCALE_SDAYNAME7 0x00000030 /* long name for Sunday */
-#define LOCALE_SABBREVDAYNAME1 0x00000031 /* abbreviated name for Monday */
-#define LOCALE_SABBREVDAYNAME2 0x00000032 /* abbreviated name for Tuesday */
-#define LOCALE_SABBREVDAYNAME3 0x00000033 /* abbreviated name for Wednesday */
-#define LOCALE_SABBREVDAYNAME4 0x00000034 /* abbreviated name for Thursday */
-#define LOCALE_SABBREVDAYNAME5 0x00000035 /* abbreviated name for Friday */
-#define LOCALE_SABBREVDAYNAME6 0x00000036 /* abbreviated name for Saturday */
-#define LOCALE_SABBREVDAYNAME7 0x00000037 /* abbreviated name for Sunday */
-#define LOCALE_SMONTHNAME1 0x00000038 /* long name for January */
-#define LOCALE_SMONTHNAME2 0x00000039 /* long name for February */
-#define LOCALE_SMONTHNAME3 0x0000003A /* long name for March */
-#define LOCALE_SMONTHNAME4 0x0000003B /* long name for April */
-#define LOCALE_SMONTHNAME5 0x0000003C /* long name for May */
-#define LOCALE_SMONTHNAME6 0x0000003D /* long name for June */
-#define LOCALE_SMONTHNAME7 0x0000003E /* long name for July */
-#define LOCALE_SMONTHNAME8 0x0000003F /* long name for August */
-#define LOCALE_SMONTHNAME9 0x00000040 /* long name for September */
-#define LOCALE_SMONTHNAME10 0x00000041 /* long name for October */
-#define LOCALE_SMONTHNAME11 0x00000042 /* long name for November */
-#define LOCALE_SMONTHNAME12 0x00000043 /* long name for December */
-#define LOCALE_SMONTHNAME13 0x0000100E /* long name for 13th month (if exists) */
-#define LOCALE_SABBREVMONTHNAME1 0x00000044 /* abbreviated name for January */
-#define LOCALE_SABBREVMONTHNAME2 0x00000045 /* abbreviated name for February */
-#define LOCALE_SABBREVMONTHNAME3 0x00000046 /* abbreviated name for March */
-#define LOCALE_SABBREVMONTHNAME4 0x00000047 /* abbreviated name for April */
-#define LOCALE_SABBREVMONTHNAME5 0x00000048 /* abbreviated name for May */
-#define LOCALE_SABBREVMONTHNAME6 0x00000049 /* abbreviated name for June */
-#define LOCALE_SABBREVMONTHNAME7 0x0000004A /* abbreviated name for July */
-#define LOCALE_SABBREVMONTHNAME8 0x0000004B /* abbreviated name for August */
-#define LOCALE_SABBREVMONTHNAME9 0x0000004C /* abbreviated name for September */
-#define LOCALE_SABBREVMONTHNAME10 0x0000004D /* abbreviated name for October */
-#define LOCALE_SABBREVMONTHNAME11 0x0000004E /* abbreviated name for November */
-#define LOCALE_SABBREVMONTHNAME12 0x0000004F /* abbreviated name for December */
-#define LOCALE_SABBREVMONTHNAME13 0x0000100F /* abbreviated name for 13th month (if exists) */
-
-#define LOCALE_SPOSITIVESIGN 0x00000050 /* positive sign */
-#define LOCALE_SNEGATIVESIGN 0x00000051 /* negative sign */
-
-#define LOCALE_FONTSIGNATURE 0x00000058 /* font signature */
-#define LOCALE_SISO639LANGNAME 0x00000059 /* ISO abbreviated language name */
-#define LOCALE_SISO3166CTRYNAME 0x0000005A /* ISO abbreviated country name */
-
-#define LOCALE_SENGCURRNAME 0x00001007 /* english name of currency */
-#define LOCALE_SNATIVECURRNAME 0x00001008 /* native name of currency */
-#define LOCALE_SYEARMONTH 0x00001006 /* year month format string */
-#define LOCALE_IDIGITSUBSTITUTION 0x00001014 /* 0 = context, 1 = none, 2 = national */
-
-#define LOCALE_SNAME 0x0000005C /* locale name <language>[-<Script>][-<REGION>[_<sort order>]] */
-#define LOCALE_SDURATION 0x0000005d /* time duration format */
-#define LOCALE_SKEYBOARDSTOINSTALL 0x0000005e /* (windows only) keyboards to install */
-#define LOCALE_SSHORTESTDAYNAME1 0x00000060 /* Shortest day name for Monday */
-#define LOCALE_SSHORTESTDAYNAME2 0x00000061 /* Shortest day name for Tuesday */
-#define LOCALE_SSHORTESTDAYNAME3 0x00000062 /* Shortest day name for Wednesday */
-#define LOCALE_SSHORTESTDAYNAME4 0x00000063 /* Shortest day name for Thursday */
-#define LOCALE_SSHORTESTDAYNAME5 0x00000064 /* Shortest day name for Friday */
-#define LOCALE_SSHORTESTDAYNAME6 0x00000065 /* Shortest day name for Saturday */
-#define LOCALE_SSHORTESTDAYNAME7 0x00000066 /* Shortest day name for Sunday */
-#define LOCALE_SISO639LANGNAME2 0x00000067 /* 3 character ISO abbreviated language name */
-#define LOCALE_SISO3166CTRYNAME2 0x00000068 /* 3 character ISO country name */
-#define LOCALE_SNAN 0x00000069 /* Not a Number */
-#define LOCALE_SPOSINFINITY 0x0000006a /* + Infinity */
-#define LOCALE_SNEGINFINITY 0x0000006b /* - Infinity */
-#define LOCALE_SSCRIPTS 0x0000006c /* Typical scripts in the locale */
-#define LOCALE_SPARENT 0x0000006d /* Fallback name for resources */
-#define LOCALE_SCONSOLEFALLBACKNAME 0x0000006e /* Fallback name for within the console */
-#define LOCALE_SLANGDISPLAYNAME 0x0000006f /* Language Display Name for a language */
-#define LOCALE_IREADINGLAYOUT 0x00000070 // Returns one of the following 4 reading layout values:
- // 0 - Left to right (eg en-US)
- // 1 - Right to left (eg arabic locales)
- // 2 - Vertical top to bottom with columns to the left and also left to right (ja-JP locales)
- // 3 - Vertical top to bottom with columns proceeding to the right
-#define LOCALE_INEUTRAL 0x00000071 // Returns 0 for specific cultures, 1 for neutral cultures.
-#define LOCALE_INEGATIVEPERCENT 0x00000074 // Returns 0-11 for the negative percent format
-#define LOCALE_IPOSITIVEPERCENT 0x00000075 // Returns 0-3 for the positive percent formatIPOSITIVEPERCENT
-#define LOCALE_SPERCENT 0x00000076 // Returns the percent symbol
-#define LOCALE_SPERMILLE 0x00000077 // Returns the permille (U+2030) symbol
-#define LOCALE_SMONTHDAY 0x00000078 // Returns the preferred month/day format
-#define LOCALE_SSHORTTIME 0x00000079 // Returns the preferred short time format (ie: no seconds, just h:mm)
-#define LOCALE_SOPENTYPELANGUAGETAG 0x0000007a // Open type language tag, eg: "latn" or "dflt"
-#define LOCALE_SSORTLOCALE 0x0000007b // Name of locale to use for sorting/collation/casing behavior.
-
-#define LCMAP_LINGUISTIC_CASING 0x01000000 /* Use linguistic casing */
-
-#define CAL_RETURN_GENITIVE_NAMES LOCALE_RETURN_GENITIVE_NAMES // return genitive forms of month names
-
-#define CAL_SSHORTESTDAYNAME1 0x00000031
-#define CAL_SSHORTESTDAYNAME2 0x00000032
-#define CAL_SSHORTESTDAYNAME3 0x00000033
-#define CAL_SSHORTESTDAYNAME4 0x00000034
-#define CAL_SSHORTESTDAYNAME5 0x00000035
-#define CAL_SSHORTESTDAYNAME6 0x00000036
-#define CAL_SSHORTESTDAYNAME7 0x00000037
-
-#define CAL_SMONTHDAY 0x00000038 // Month/day pattern (reserve for potential inclusion in a future version)
-#define CAL_SERASTRING 0x00000004 // era name for IYearOffsetRanges, eg A.D.
-#define CAL_SABBREVERASTRING 0x00000039 // Abbreviated era string (eg: AD)
-
-#define CAL_SSHORTDATE 0x00000005 /* short date format string */
-#define CAL_SLONGDATE 0x00000006 /* long date format string */
-#define CAL_SDAYNAME1 0x00000007 /* native name for Monday */
-#define CAL_SDAYNAME2 0x00000008 /* native name for Tuesday */
-#define CAL_SDAYNAME3 0x00000009 /* native name for Wednesday */
-#define CAL_SDAYNAME4 0x0000000a /* native name for Thursday */
-#define CAL_SDAYNAME5 0x0000000b /* native name for Friday */
-#define CAL_SDAYNAME6 0x0000000c /* native name for Saturday */
-#define CAL_SDAYNAME7 0x0000000d /* native name for Sunday */
-#define CAL_SABBREVDAYNAME1 0x0000000e /* abbreviated name for Monday */
-#define CAL_SABBREVDAYNAME2 0x0000000f /* abbreviated name for Tuesday */
-#define CAL_SABBREVDAYNAME3 0x00000010 /* abbreviated name for Wednesday */
-#define CAL_SABBREVDAYNAME4 0x00000011 /* abbreviated name for Thursday */
-#define CAL_SABBREVDAYNAME5 0x00000012 /* abbreviated name for Friday */
-#define CAL_SABBREVDAYNAME6 0x00000013 /* abbreviated name for Saturday */
-#define CAL_SABBREVDAYNAME7 0x00000014 /* abbreviated name for Sunday */
-#define CAL_SMONTHNAME1 0x00000015 /* native name for January */
-#define CAL_SMONTHNAME2 0x00000016 /* native name for February */
-#define CAL_SMONTHNAME3 0x00000017 /* native name for March */
-#define CAL_SMONTHNAME4 0x00000018 /* native name for April */
-#define CAL_SMONTHNAME5 0x00000019 /* native name for May */
-#define CAL_SMONTHNAME6 0x0000001a /* native name for June */
-#define CAL_SMONTHNAME7 0x0000001b /* native name for July */
-#define CAL_SMONTHNAME8 0x0000001c /* native name for August */
-#define CAL_SMONTHNAME9 0x0000001d /* native name for September */
-#define CAL_SMONTHNAME10 0x0000001e /* native name for October */
-#define CAL_SMONTHNAME11 0x0000001f /* native name for November */
-#define CAL_SMONTHNAME12 0x00000020 /* native name for December */
-#define CAL_SMONTHNAME13 0x00000021 /* native name for 13th month (if any) */
-#define CAL_SABBREVMONTHNAME1 0x00000022 /* abbreviated name for January */
-#define CAL_SABBREVMONTHNAME2 0x00000023 /* abbreviated name for February */
-#define CAL_SABBREVMONTHNAME3 0x00000024 /* abbreviated name for March */
-#define CAL_SABBREVMONTHNAME4 0x00000025 /* abbreviated name for April */
-#define CAL_SABBREVMONTHNAME5 0x00000026 /* abbreviated name for May */
-#define CAL_SABBREVMONTHNAME6 0x00000027 /* abbreviated name for June */
-#define CAL_SABBREVMONTHNAME7 0x00000028 /* abbreviated name for July */
-#define CAL_SABBREVMONTHNAME8 0x00000029 /* abbreviated name for August */
-#define CAL_SABBREVMONTHNAME9 0x0000002a /* abbreviated name for September */
-#define CAL_SABBREVMONTHNAME10 0x0000002b /* abbreviated name for October */
-#define CAL_SABBREVMONTHNAME11 0x0000002c /* abbreviated name for November */
-#define CAL_SABBREVMONTHNAME12 0x0000002d /* abbreviated name for December */
-#define CAL_SABBREVMONTHNAME13 0x0000002e /* abbreviated name for 13th month (if any) */
-#define CAL_SYEARMONTH 0x0000002f /* year month format string */
-
-
-#else // __APPLE__
-
-#define LOCALE_SDECIMAL 0x0000000E /* decimal separator */
-#define LOCALE_STHOUSAND 0x0000000F /* thousand separator */
-#define LOCALE_ILZERO 0x00000012 /* leading zeros for decimal */
-#define LOCALE_SCURRENCY 0x00000014 /* local monetary symbol */
-#define LOCALE_SMONDECIMALSEP 0x00000016 /* monetary decimal separator */
-#define LOCALE_SMONTHOUSANDSEP 0x00000017 /* monetary thousand separator */
-
-#endif // __APPLE__
-
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-int
-PALAPI
-GetLocaleInfoW(
- IN LCID Locale,
- IN LCTYPE LCType,
- OUT LPWSTR lpLCData,
- IN int cchData);
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-int
-PALAPI
-GetLocaleInfoEx(
- IN LPCWSTR lpLocaleName,
- IN LCTYPE LCType,
- OUT LPWSTR lpLCData,
- IN int cchData);
-
-
-PALIMPORT
-int
-PALAPI
-CompareStringOrdinal(
- IN LPCWSTR lpString1,
- IN int cchCount1,
- IN LPCWSTR lpString2,
- IN int cchCount2,
- IN BOOL bIgnoreCase);
-
-typedef struct _nlsversioninfoex {
- DWORD dwNLSVersionInfoSize;
- DWORD dwNLSVersion;
- DWORD dwDefinedVersion;
- DWORD dwEffectiveId;
- GUID guidCustomVersion;
- } NLSVERSIONINFOEX, *LPNLSVERSIONINFOEX;
-
-PALIMPORT
-int
-PALAPI
-FindNLSStringEx(
- IN LPCWSTR lpLocaleName,
- IN DWORD dwFindNLSStringFlags,
- IN LPCWSTR lpStringSource,
- IN int cchSource,
- IN LPCWSTR lpStringValue,
- IN int cchValue,
- OUT LPINT pcchFound,
- IN LPNLSVERSIONINFOEX lpVersionInformation,
- IN LPVOID lpReserved,
- IN LPARAM lParam );
-
-typedef enum {
- COMPARE_STRING = 0x0001,
-} NLS_FUNCTION;
-
-PALIMPORT
-BOOL
-PALAPI
-IsNLSDefinedString(
- IN NLS_FUNCTION Function,
- IN DWORD dwFlags,
- IN LPNLSVERSIONINFOEX lpVersionInfo,
- IN LPCWSTR lpString,
- IN int cchStr );
-
-
-PALIMPORT
-int
-PALAPI
-ResolveLocaleName(
- IN LPCWSTR lpNameToResolve,
- OUT LPWSTR lpLocaleName,
- IN int cchLocaleName );
-
-PALIMPORT
-BOOL
-PALAPI
-GetThreadPreferredUILanguages(
- IN DWORD dwFlags,
- OUT PULONG pulNumLanguages,
- OUT PWSTR pwszLanguagesBuffer,
- IN OUT PULONG pcchLanguagesBuffer);
-
-
-PALIMPORT
-int
-PALAPI
-GetSystemDefaultLocaleName(
- OUT LPWSTR lpLocaleName,
- IN int cchLocaleName);
-
-#ifdef UNICODE
-#define GetLocaleInfo GetLocaleInfoW
-#endif
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-PALIMPORT
-LCID
-PALAPI
-GetUserDefaultLCID(
- void);
-#endif
-
-
-PALIMPORT
-int
-PALAPI
-GetUserDefaultLocaleName(
- OUT LPWSTR lpLocaleName,
- IN int cchLocaleName);
-
-
-#define LCID_INSTALLED 0x00000001 // installed locale ids
-#define LCID_SUPPORTED 0x00000002 // supported locale ids
-#ifdef __APPLE__
-#define LCID_ALTERNATE_SORTS 0x00000004 // alternate sort locale ids
-#endif // __APPLE__
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-PALIMPORT
-BOOL
-PALAPI
-IsValidLocale(
- IN LCID Locale,
- IN DWORD dwFlags);
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-
-typedef DWORD CALID;
-typedef DWORD CALTYPE;
-
-#define CAL_ITWODIGITYEARMAX 0x00000030 // two digit year max
-#define CAL_RETURN_NUMBER 0x20000000 // return number instead of string
-
-#define CAL_GREGORIAN 1 // Gregorian (localized) calendar
-#define CAL_GREGORIAN_US 2 // Gregorian (U.S.) calendar
-#define CAL_JAPAN 3 // Japanese Emperor Era calendar
-#define CAL_TAIWAN 4 // Taiwan Era calendar
-#define CAL_KOREA 5 // Korean Tangun Era calendar
-#define CAL_HIJRI 6 // Hijri (Arabic Lunar) calendar
-#define CAL_THAI 7 // Thai calendar
-#define CAL_HEBREW 8 // Hebrew (Lunar) calendar
-#define CAL_GREGORIAN_ME_FRENCH 9 // Gregorian Middle East French calendar
-#define CAL_GREGORIAN_ARABIC 10 // Gregorian Arabic calendar
-#define CAL_GREGORIAN_XLIT_ENGLISH 11 // Gregorian Transliterated English calendar
-#define CAL_GREGORIAN_XLIT_FRENCH 12 // Gregorian Transliterated French calendar
-#define CAL_JULIAN 13
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-PALIMPORT
-int
-PALAPI
-GetCalendarInfoW(
- IN LCID Locale,
- IN CALID Calendar,
- IN CALTYPE CalType,
- OUT LPWSTR lpCalData,
- IN int cchData,
- OUT LPDWORD lpValue);
-
-#ifdef UNICODE
-#define GetCalendarInfo GetCalendarInfoW
-#endif
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-
-PALIMPORT
-int
-PALAPI
-GetCalendarInfoEx(
- IN LPCWSTR lpLocaleName,
- IN CALID Calendar,
- IN LPCWSTR lpReserved,
- IN CALTYPE CalType,
- OUT LPWSTR lpCalData,
- IN int cchData,
- OUT LPDWORD lpValue);
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-typedef BOOL (CALLBACK* LOCALE_ENUMPROCW)(LPWSTR);
-
-PALIMPORT
-BOOL
-PALAPI
-EnumSystemLocalesW(
- IN LOCALE_ENUMPROCW lpLocaleEnumProc,
- IN DWORD dwFlags);
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-#define DATE_SHORTDATE 0x00000001 // use short date picture
-#define DATE_LONGDATE 0x00000002 // use long date picture
-#define DATE_YEARMONTH 0x00000008 // use year month picture
-
-typedef BOOL (CALLBACK* DATEFMT_ENUMPROCEXW)(LPWSTR, CALID);
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-BOOL
-PALAPI
-EnumDateFormatsExW(
- IN DATEFMT_ENUMPROCEXW lpDateFmtEnumProcEx,
- IN LCID Locale,
- IN DWORD dwFlags);
-
-#else // ENABLE_DOWNLEVEL_FOR_NLS
-
-typedef BOOL (CALLBACK* DATEFMT_ENUMPROCEXEXW)(LPWSTR, CALID, LPARAM);
-
-PALIMPORT
-BOOL
-PALAPI
-EnumDateFormatsExEx(
- IN DATEFMT_ENUMPROCEXEXW lpDateFmtEnumProcEx,
- IN LPCWSTR lpLocaleName,
- IN DWORD dwFlags,
- IN LPARAM lParam);
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-typedef BOOL (CALLBACK* TIMEFMT_ENUMPROCW)(LPWSTR);
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-BOOL
-PALAPI
-EnumTimeFormatsW(
- IN TIMEFMT_ENUMPROCW lpTimeFmtEnumProc,
- IN LCID Locale,
- IN DWORD dwFlags);
-
-#else // ENABLE_DOWNLEVEL_FOR_NLS
-
-typedef BOOL (CALLBACK* TIMEFMT_ENUMPROCEXW)(LPWSTR, LPARAM);
-
-PALIMPORT
-BOOL
-PALAPI
-EnumTimeFormatsEx(
- IN TIMEFMT_ENUMPROCEXW lpTimeFmtEnumProc,
- IN LPCWSTR lpLocaleName,
- IN DWORD dwFlags,
- IN LPARAM lParam);
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-#define ENUM_ALL_CALENDARS 0xffffffff // enumerate all calendars
-#define CAL_ICALINTVALUE 0x00000001 // calendar type
-#define CAL_NOUSEROVERRIDE LOCALE_NOUSEROVERRIDE // do not use user overrides
-#define CAL_SCALNAME 0x00000002 // native name of calendar
-
-typedef BOOL (CALLBACK* CALINFO_ENUMPROCEXW)(LPWSTR,CALID);
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-BOOL
-PALAPI
-EnumCalendarInfoExW(
- IN CALINFO_ENUMPROCEXW lpCalInfoEnumProc,
- IN LCID Locale,
- IN CALID Calendar,
- IN CALTYPE CalType);
-
-#else // ENABLE_DOWNLEVEL_FOR_NLS
-
-typedef BOOL (CALLBACK* CALINFO_ENUMPROCEXEXW)(LPWSTR, CALID, LPWSTR, LPARAM);
-
-PALIMPORT
-BOOL
-PALAPI
-EnumCalendarInfoExEx(
- IN CALINFO_ENUMPROCEXEXW lpCalInfoEnumProc,
- IN LPCWSTR lpLocaleName,
- IN CALID Calendar,
- IN LPCWSTR lpReserved,
- IN CALTYPE CalType,
- IN LPARAM lParam);
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-#define LCMAP_LOWERCASE 0x00000100
-#define LCMAP_UPPERCASE 0x00000200
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-int
-PALAPI
-LCMapStringW(
- IN LCID Locale,
- IN DWORD dwMapFlags,
- IN LPCWSTR lpSrcStr,
- IN int cchSrc,
- OUT LPWSTR lpDestStr,
- IN int cchDest);
-
-#ifdef UNICODE
-#define LCMapString LCMapStringW
-#endif
-
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-
-PALIMPORT
-int
-PALAPI
-LCMapStringEx(
- IN LPCWSTR lpLocaleName,
- IN DWORD dwMapFlags,
- IN LPCWSTR lpSrcStr,
- IN int cchSrc,
- OUT LPWSTR lpDestStr,
- IN int cchDest,
- IN LPNLSVERSIONINFO lpVersionInformation,
- IN LPVOID lpReserved,
- IN LPARAM lParam );
-
-PALIMPORT
-int
-PALAPI
-PAL_LCMapCharW(
- IN LPCWSTR lpLocaleName,
- IN DWORD dwMapFlags,
- IN WCHAR srcChar,
- OUT WCHAR *destChar,
- LPNLSVERSIONINFO lpVersionInformation,
- LPVOID lpReserved,
- LPARAM lParam );
-
-PALIMPORT
-int
-PALAPI
-PAL_NormalizeStringExW(
- IN LPCWSTR lpLocaleName,
- IN DWORD dwMapFlags,
- IN LPCWSTR lpSrcStr,
- IN int cchSrc,
- OUT LPWSTR lpDestStr,
- IN int cchDest);
-
-PALIMPORT
-int
-PALAPI
-PAL_ParseDateW(
- IN LPCWSTR lpLocaleName,
- IN LPCWSTR lpFormat,
- IN LPCWSTR lpString,
- OUT LPSYSTEMTIME lpTime);
-
-PALIMPORT
-int
-PALAPI
-PAL_GetCalendar(
- IN LPCWSTR lpLocaleName,
- OUT CALID* pCalendar);
-
-#define GEOID_NOT_AVAILABLE -1
-
-#define DATE_USE_ALT_CALENDAR 0x00000004
-
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-int
-PALAPI
-GetDateFormatW(
- IN LCID Locale,
- IN DWORD dwFlags,
- IN CONST SYSTEMTIME *lpDate,
- IN LPCWSTR lpFormat,
- OUT LPWSTR lpDateStr,
- IN int cchDate);
-
-#else
-
-PALIMPORT
-int
-PALAPI
-GetDateFormatEx(
- IN LPCWSTR Locale,
- IN DWORD dwFlags,
- IN CONST SYSTEMTIME *lpDate,
- IN LPCWSTR lpFormat,
- OUT LPWSTR lpDateStr,
- IN int cchDate,
- IN LPCWSTR lpCalendar);
-
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-PALIMPORT
-int
-PALAPI
-GetDateFormatEx(
- IN LPCWSTR lpLocaleName,
- IN DWORD dwFlags,
- IN CONST SYSTEMTIME *lpDate,
- IN LPCWSTR lpFormat,
- OUT LPWSTR lpDateStr,
- IN int cchDate,
- LPCWSTR lpCalendar);
-
-
-#ifdef UNICODE
-#define GetDateFormat GetDateFormatW
-#endif
-
-
PALIMPORT
int
PALAPI
diff --git a/src/pal/inc/palprivate.h b/src/pal/inc/palprivate.h
index ce1a9a99a1..b9c9d08a2f 100644
--- a/src/pal/inc/palprivate.h
+++ b/src/pal/inc/palprivate.h
@@ -239,22 +239,6 @@ GetModuleFileNameA(
OUT LPSTR lpFileName,
IN DWORD nSize);
-#if ENABLE_DOWNLEVEL_FOR_NLS
-
-
-PALIMPORT
-int
-PALAPI
-CompareStringA(
- IN LCID Locale,
- IN DWORD dwCmpFlags,
- IN LPCSTR lpString1,
- IN int cchCount1,
- IN LPCSTR lpString2,
- IN int cchCount2);
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
PALIMPORT
LPSTR
diff --git a/src/pal/inc/rt/oleauto.h b/src/pal/inc/rt/oleauto.h
index a8499f96d5..958476f482 100644
--- a/src/pal/inc/rt/oleauto.h
+++ b/src/pal/inc/rt/oleauto.h
@@ -84,14 +84,6 @@ typedef struct {
#define VARCMP_GT 2
#define VARCMP_NULL 3
-#ifdef ENABLE_DOWNLEVEL_FOR_NLS
-STDAPI VarParseNumFromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags,
- NUMPARSE * pnumprs, BYTE * rgbDig);
-
-STDAPI VarNumFromParseNum(NUMPARSE * pnumprs, BYTE * rgbDig,
- ULONG dwVtBits, VARIANT * pvar);
-#endif
-
STDAPI VariantChangeType(VARIANTARG * pvargDest,
VARIANTARG * pvarSrc, USHORT wFlags, VARTYPE vt);
@@ -108,21 +100,6 @@ STDAPI VarCyFix(CY cyIn, LPCY pcyResult);
STDAPI VarR8FromCy(CY cyIn, DOUBLE * pdblOut);
STDAPI VarR4FromCy(CY cyIn, FLOAT * pfltOut);
-#ifdef ENABLE_DOWNLEVEL_FOR_NLS
-STDAPI VarBstrFromCy(CY cyIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
-STDAPI VarBstrFromUI1(BYTE bVal, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
-STDAPI VarBstrFromI2(SHORT iVal, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
-STDAPI VarBstrFromI4(LONG lIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
-STDAPI VarBstrFromI8(LONG64 i64In, LCID lcid, ULONG dwFlags, BSTR FAR* pbstrOut);
-STDAPI VarBstrFromR4(FLOAT fltIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
-STDAPI VarBstrFromR8(DOUBLE dblIn, LCID lcid, ULONG dwFlags, BSTR * pbstrOut);
-STDAPI VarBstrFromI1(CHAR cIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut);
-STDAPI VarBstrFromUI2(USHORT uiIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut);
-STDAPI VarBstrFromUI4(ULONG ulIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut);
-STDAPI VarBstrFromUI8(ULONG64 ui64In, LCID lcid, ULONG dwFlags, BSTR FAR* pbstrOut);
-STDAPI VarBstrFromDec(DECIMAL *pdecIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut);
-#endif
-
STDAPI VarDecFromR4(FLOAT fltIn, DECIMAL *pdecOut);
STDAPI VarDecFromR8(DOUBLE dblIn, DECIMAL *pdecOut);
STDAPI VarDecFromCy(CY cyIn, DECIMAL *pdecOut);
@@ -147,10 +124,6 @@ STDAPI VarUI4FromDec(DECIMAL *pdecIn, ULONG *pUI4In);
STDAPI VarR8FromDec(DECIMAL *pdecIn, DOUBLE *pdblOut);
STDAPI VarR4FromDec(DECIMAL *pdecIn, FLOAT *pfltOut);
-#ifdef ENABLE_DOWNLEVEL_FOR_NLS
-STDAPI VarR8FromStr(OLECHAR *strin, LCID lcid, ULONG dwFlags, DOUBLE *pdblOut);
-#endif
-
STDAPI VarI1FromR8(DOUBLE dblIn, CHAR *pcOut);
STDAPI VarI2FromR8(DOUBLE dblIn, SHORT * psOut);
STDAPI VarI4FromR8(DOUBLE dblIn, LONG * plOut);
diff --git a/src/pal/prebuilt/inc/metahost.h b/src/pal/prebuilt/inc/metahost.h
index 0714e42157..a8638683bc 100644
--- a/src/pal/prebuilt/inc/metahost.h
+++ b/src/pal/prebuilt/inc/metahost.h
@@ -1,13 +1,19 @@
-// 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.
-
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
- /* File created by MIDL compiler version 8.00.0603 */
+ /* File created by MIDL compiler version 8.01.0622 */
+/* at Mon Jan 18 19:14:07 2038
+ */
+/* Compiler settings for C:/ssd/coreclr/src/inc/metahost.idl:
+ Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622
+ protocol : dce , ms_ext, c_ext, robust
+ error checks: allocation ref bounds_check enum stub_data
+ VC __declspec() decoration level:
+ __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+ DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
/* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */
@@ -23,7 +29,7 @@
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
+#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
@@ -67,6 +73,13 @@ typedef interface ICLRDebuggingLibraryProvider ICLRDebuggingLibraryProvider;
#endif /* __ICLRDebuggingLibraryProvider_FWD_DEFINED__ */
+#ifndef __ICLRDebuggingLibraryProvider2_FWD_DEFINED__
+#define __ICLRDebuggingLibraryProvider2_FWD_DEFINED__
+typedef interface ICLRDebuggingLibraryProvider2 ICLRDebuggingLibraryProvider2;
+
+#endif /* __ICLRDebuggingLibraryProvider2_FWD_DEFINED__ */
+
+
#ifndef __ICLRDebugging_FWD_DEFINED__
#define __ICLRDebugging_FWD_DEFINED__
typedef interface ICLRDebugging ICLRDebugging;
@@ -183,6 +196,7 @@ EXTERN_GUID(CLSID_CLRDebuggingLegacy, 0xDF8395B5, 0xA4BA, 0x450b, 0xA7, 0x7C, 0x
EXTERN_GUID(CLSID_CLRProfiling, 0xbd097ed8, 0x733e, 0x43fe, 0x8e, 0xd7, 0xa9, 0x5f, 0xf9, 0xa8, 0x44, 0x8c);
EXTERN_GUID(IID_ICLRProfiling, 0xb349abe3, 0xb56f, 0x4689, 0xbf, 0xcd, 0x76, 0xbf, 0x39, 0xd8, 0x88, 0xea);
EXTERN_GUID(IID_ICLRDebuggingLibraryProvider, 0x3151c08d, 0x4d09, 0x4f9b, 0x88, 0x38, 0x28, 0x80, 0xbf, 0x18, 0xfe, 0x51);
+EXTERN_GUID(IID_ICLRDebuggingLibraryProvider2, 0xE04E2FF1, 0xDCFD, 0x45D5, 0xBC, 0xD1, 0x16, 0xFF, 0xF2, 0xFA, 0xF7, 0xBA);
typedef HRESULT ( __stdcall *CLRCreateInstanceFnPtr )(
REFCLSID clsid,
REFIID riid,
@@ -693,6 +707,92 @@ EXTERN_C const IID IID_ICLRDebuggingLibraryProvider;
#endif /* __ICLRDebuggingLibraryProvider_INTERFACE_DEFINED__ */
+#ifndef __ICLRDebuggingLibraryProvider2_INTERFACE_DEFINED__
+#define __ICLRDebuggingLibraryProvider2_INTERFACE_DEFINED__
+
+/* interface ICLRDebuggingLibraryProvider2 */
+/* [object][local][helpstring][version][uuid] */
+
+
+EXTERN_C const IID IID_ICLRDebuggingLibraryProvider2;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("E04E2FF1-DCFD-45D5-BCD1-16FFF2FAF7BA")
+ ICLRDebuggingLibraryProvider2 : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE ProvideLibrary2(
+ /* [in] */ const WCHAR *pwszFileName,
+ /* [in] */ DWORD dwTimestamp,
+ /* [in] */ DWORD dwSizeOfImage,
+ /* [out] */ LPWSTR *ppResolvedModulePath) = 0;
+
+ };
+
+
+#else /* C style interface */
+
+ typedef struct ICLRDebuggingLibraryProvider2Vtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICLRDebuggingLibraryProvider2 * This,
+ /* [in] */ REFIID riid,
+ /* [annotation][iid_is][out] */
+ _COM_Outptr_ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICLRDebuggingLibraryProvider2 * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICLRDebuggingLibraryProvider2 * This);
+
+ HRESULT ( STDMETHODCALLTYPE *ProvideLibrary2 )(
+ ICLRDebuggingLibraryProvider2 * This,
+ /* [in] */ const WCHAR *pwszFileName,
+ /* [in] */ DWORD dwTimestamp,
+ /* [in] */ DWORD dwSizeOfImage,
+ /* [out] */ LPWSTR *ppResolvedModulePath);
+
+ END_INTERFACE
+ } ICLRDebuggingLibraryProvider2Vtbl;
+
+ interface ICLRDebuggingLibraryProvider2
+ {
+ CONST_VTBL struct ICLRDebuggingLibraryProvider2Vtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICLRDebuggingLibraryProvider2_QueryInterface(This,riid,ppvObject) \
+ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
+
+#define ICLRDebuggingLibraryProvider2_AddRef(This) \
+ ( (This)->lpVtbl -> AddRef(This) )
+
+#define ICLRDebuggingLibraryProvider2_Release(This) \
+ ( (This)->lpVtbl -> Release(This) )
+
+
+#define ICLRDebuggingLibraryProvider2_ProvideLibrary2(This,pwszFileName,dwTimestamp,dwSizeOfImage,ppResolvedModulePath) \
+ ( (This)->lpVtbl -> ProvideLibrary2(This,pwszFileName,dwTimestamp,dwSizeOfImage,ppResolvedModulePath) )
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+
+#endif /* __ICLRDebuggingLibraryProvider2_INTERFACE_DEFINED__ */
+
+
#ifndef __ICLRDebugging_INTERFACE_DEFINED__
#define __ICLRDebugging_INTERFACE_DEFINED__
@@ -1745,14 +1845,14 @@ EXTERN_C const IID IID_ICLRStrongName3;
EXTERN_C const IID LIBID_CLRMetaHost;
#endif /* __CLRMetaHost_LIBRARY_DEFINED__ */
-/* interface __MIDL_itf_metahost_0000_0010 */
+/* interface __MIDL_itf_metahost_0000_0011 */
/* [local] */
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-extern RPC_IF_HANDLE __MIDL_itf_metahost_0000_0010_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_metahost_0000_0010_v0_0_s_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_metahost_0000_0011_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_metahost_0000_0011_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index a3ccd724f4..dbff63dc00 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -1,7 +1,23 @@
cmake_minimum_required(VERSION 2.8.12.2)
+if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ # On OSX, we use the libunwind that's part of the OS
+ set(CLR_CMAKE_USE_SYSTEM_LIBUNWIND 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
include_directories(SYSTEM /usr/local/include)
+add_compile_options(-fPIC)
+
+if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ include_directories(libunwind/include)
+ include_directories(libunwind/include/tdep)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR}/libunwind/include)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR}/libunwind/include/tdep)
+
+ add_subdirectory(libunwind)
+endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+
include(configure.cmake)
project(coreclrpal)
@@ -109,8 +125,6 @@ endif(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
# turn off capability to remove unused functions (which was enabled in debug build with sanitizers)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--no-gc-sections")
-add_compile_options(-fPIC)
-
set(ARCH_SOURCES
arch/${PAL_ARCH_SOURCES_DIR}/context2.S
arch/${PAL_ARCH_SOURCES_DIR}/debugbreak.S
@@ -235,11 +249,16 @@ set(SOURCES
thread/tls.cpp
)
+if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ set(LIBUNWIND_OBJECTS $<TARGET_OBJECTS:libunwind>)
+endif(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+
add_library(coreclrpal
STATIC
${SOURCES}
${ARCH_SOURCES}
${PLATFORM_SOURCES}
+ ${LIBUNWIND_OBJECTS}
)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
@@ -256,7 +275,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
- find_library(UNWIND unwind)
+ if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ find_library(UNWIND unwind)
+ endif()
find_library(INTL intl)
target_link_libraries(coreclrpal
pthread
@@ -267,18 +288,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
endif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
- if(PAL_CMAKE_PLATFORM_ARCH_ARM)
- find_library(UNWIND_ARCH NAMES unwind-arm)
- endif()
-
- if(PAL_CMAKE_PLATFORM_ARCH_ARM64)
- find_library(UNWIND_ARCH NAMES unwind-aarch64)
- endif()
-
- if(PAL_CMAKE_PLATFORM_ARCH_AMD64)
- find_library(UNWIND_ARCH NAMES unwind-x86_64)
- endif()
-
if(CLR_CMAKE_PLATFORM_ALPINE_LINUX OR CLR_CMAKE_PLATFORM_ANDROID)
find_library(INTL intl)
endif()
@@ -306,23 +315,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
${LZMA})
endif()
- find_library(UNWIND NAMES unwind)
-
- if(UNWIND STREQUAL UNWIND-NOTFOUND)
- message(FATAL_ERROR "Cannot find libunwind. Try installing libunwind8-dev and libunwind8.")
- endif(UNWIND STREQUAL UNWIND-NOTFOUND)
-
- target_link_libraries(coreclrpal ${UNWIND})
-
if(CLR_MAKE_PLATFORM_ANDROID)
find_library(ANDROID_SUPPORT NAMES android-support)
find_library(ANDROID_GLOB NAMES android-glob)
find_library(INTL NAMES intl)
- if(UNWIND_ARCH STREQUAL UNWIND_ARCH-NOTFOUND)
- message(FATAL_ERROR "Cannot find libunwind.")
- endif()
-
if(ANDROID_SUPPORT STREQUAL ANDROID_SUPPORT-NOTFOUND)
message(FATAL_ERROR "Cannot find android-support.")
endif()
@@ -336,29 +333,54 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
endif()
endif()
- find_library(UNWIND_GENERIC NAMES unwind-generic)
-
target_link_libraries(coreclrpal
dl
)
- if(NOT UNWIND_GENERIC STREQUAL UNWIND_GENERIC-NOTFOUND)
- target_link_libraries(coreclrpal ${UNWIND_GENERIC})
- endif(NOT UNWIND_GENERIC STREQUAL UNWIND_GENERIC-NOTFOUND)
-
- if(NOT UNWIND_ARCH STREQUAL UNWIND_ARCH-NOTFOUND)
- target_link_libraries(coreclrpal ${UNWIND_ARCH})
- endif(NOT UNWIND_ARCH STREQUAL UNWIND_ARCH-NOTFOUND)
-
if(NOT INTL STREQUAL INTL-NOTFOUND)
target_link_libraries(coreclrpal ${INTL})
endif(NOT INTL STREQUAL INTL-NOTFOUND)
+ if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ if(PAL_CMAKE_PLATFORM_ARCH_ARM)
+ find_library(UNWIND_ARCH NAMES unwind-arm)
+ endif()
+
+ if(PAL_CMAKE_PLATFORM_ARCH_ARM64)
+ find_library(UNWIND_ARCH NAMES unwind-aarch64)
+ endif()
+
+ if(PAL_CMAKE_PLATFORM_ARCH_AMD64)
+ find_library(UNWIND_ARCH NAMES unwind-x86_64)
+ endif()
+
+ if(NOT UNWIND_ARCH STREQUAL UNWIND_ARCH-NOTFOUND)
+ target_link_libraries(coreclrpal ${UNWIND_ARCH})
+ endif()
+
+ find_library(UNWIND_GENERIC NAMES unwind-generic)
+
+ if(NOT UNWIND_GENERIC STREQUAL UNWIND_GENERIC-NOTFOUND)
+ target_link_libraries(coreclrpal ${UNWIND_GENERIC})
+ endif()
+
+ find_library(UNWIND NAMES unwind)
+
+ if(UNWIND STREQUAL UNWIND-NOTFOUND)
+ message(FATAL_ERROR "Cannot find libunwind. Try installing libunwind8-dev or libunwind-devel.")
+ endif()
+
+ target_link_libraries(coreclrpal ${UNWIND})
+
+ endif(CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
+ if (CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ find_library(UNWIND unwind)
+ endif()
add_definitions(-D_KMEMUSER)
- find_library(UNWIND unwind)
find_library(INTL intl)
find_library(KVM kvm)
target_link_libraries(coreclrpal
diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in
index 584b28aff4..24ea14d39e 100644
--- a/src/pal/src/config.h.in
+++ b/src/pal/src/config.h.in
@@ -14,7 +14,6 @@
#cmakedefine01 HAVE_PTHREAD_NP_H
#cmakedefine01 HAVE_SYS_LWP_H
#cmakedefine01 HAVE_LWP_H
-#cmakedefine01 HAVE_LIBUNWIND_H
#cmakedefine01 HAVE_RUNETYPE_H
#cmakedefine01 HAVE_SYS_SYSCTL_H
#cmakedefine01 HAVE_GNU_LIBNAMES_H
@@ -99,6 +98,7 @@
#cmakedefine01 HAVE_BROKEN_FIFO_SELECT
#cmakedefine01 HAVE_BROKEN_FIFO_KEVENT
#cmakedefine01 HAS_FTRUNCATE_LENGTH_ISSUE
+#cmakedefine01 UNWIND_CONTEXT_IS_UCONTEXT_T
#cmakedefine01 HAVE_SCHED_GET_PRIORITY
#cmakedefine01 HAVE_SCHED_GETCPU
#cmakedefine01 HAVE_WORKING_GETTIMEOFDAY
@@ -146,7 +146,6 @@
#cmakedefine01 SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING
#cmakedefine01 ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS
#cmakedefine01 HAS_FTRUNCATE_LENGTH_ISSUE
-#cmakedefine01 UNWIND_CONTEXT_IS_UCONTEXT_T
#cmakedefine01 HAVE_FULLY_FEATURED_PTHREAD_MUTEXES
#cmakedefine01 HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES
#cmakedefine BSD_REGS_STYLE(reg, RR, rr) @BSD_REGS_STYLE@
diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake
index a6dd6f49c4..8b3fb099a4 100644
--- a/src/pal/src/configure.cmake
+++ b/src/pal/src/configure.cmake
@@ -31,7 +31,6 @@ check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(pthread_np.h HAVE_PTHREAD_NP_H)
check_include_files(sys/lwp.h HAVE_SYS_LWP_H)
check_include_files(lwp.h HAVE_LWP_H)
-check_include_files(libunwind.h HAVE_LIBUNWIND_H)
check_include_files(runetype.h HAVE_RUNETYPE_H)
check_include_files(semaphore.h HAVE_SEMAPHORE_H)
check_include_files(sys/prctl.h HAVE_PRCTL_H)
@@ -101,28 +100,6 @@ check_function_exists(semget HAS_SYSV_SEMAPHORES)
check_function_exists(pthread_mutex_init HAS_PTHREAD_MUTEXES)
check_function_exists(ttrace HAVE_TTRACE)
check_function_exists(pipe2 HAVE_PIPE2)
-set(CMAKE_REQUIRED_LIBRARIES unwind unwind-generic)
-check_cxx_source_compiles("
-#include <libunwind.h>
-
-int main(int argc, char **argv) {
- unw_cursor_t cursor;
- unw_save_loc_t saveLoc;
- int reg = UNW_REG_IP;
- unw_get_save_loc(&cursor, reg, &saveLoc);
-
- return 0;
-}" HAVE_UNW_GET_SAVE_LOC)
-check_cxx_source_compiles("
-#include <libunwind.h>
-
-int main(int argc, char **argv) {
- unw_addr_space_t as;
- unw_get_accessors(as);
-
- return 0;
-}" HAVE_UNW_GET_ACCESSORS)
-set(CMAKE_REQUIRED_LIBRARIES)
check_cxx_source_compiles("
#include <pthread_np.h>
@@ -975,24 +952,54 @@ int main()
return 1;
}" FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL)
-set(CMAKE_REQUIRED_DEFINITIONS)
set(SYNCHMGR_SUSPENSION_SAFE_CONDITION_SIGNALING 1)
set(ERROR_FUNC_FOR_GLOB_HAS_FIXED_PARAMS 1)
-check_cxx_source_compiles("
+if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ list(INSERT CMAKE_REQUIRED_INCLUDES 0 ${CMAKE_CURRENT_SOURCE_DIR}/libunwind/include ${CMAKE_CURRENT_BINARY_DIR}/libunwind/include)
+endif()
+
+set(CMAKE_REQUIRED_FLAGS "-c -Werror=implicit-function-declaration")
+
+check_c_source_compiles("
#include <libunwind.h>
#include <ucontext.h>
-
int main(int argc, char **argv)
{
unw_context_t libUnwindContext;
ucontext_t uContext;
-
libUnwindContext = uContext;
return 0;
}" UNWIND_CONTEXT_IS_UCONTEXT_T)
+check_c_source_compiles("
+#include <libunwind.h>
+
+int main(int argc, char **argv) {
+ unw_cursor_t cursor;
+ unw_save_loc_t saveLoc;
+ int reg = UNW_REG_IP;
+ unw_get_save_loc(&cursor, reg, &saveLoc);
+
+ return 0;
+}" HAVE_UNW_GET_SAVE_LOC)
+
+check_c_source_compiles("
+#include <libunwind.h>
+
+int main(int argc, char **argv) {
+ unw_addr_space_t as;
+ unw_get_accessors(as);
+
+ return 0;
+}" HAVE_UNW_GET_ACCESSORS)
+
+set(CMAKE_REQUIRED_FLAGS)
+if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ list(REMOVE_AT CMAKE_REQUIRED_INCLUDES 0 1)
+endif()
+
check_cxx_source_compiles("
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -1272,10 +1279,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(HAVE_SCHED_OTHER_ASSIGNABLE 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
- if(NOT HAVE_LIBUNWIND_H)
- unset(HAVE_LIBUNWIND_H CACHE)
- message(FATAL_ERROR "Cannot find libunwind. Try installing libunwind8 and libunwind8-dev (or the appropriate packages for your platform)")
- endif()
set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0)
set(PAL_PTRACE "ptrace((cmd), (pid), (caddr_t)(addr), (data))")
set(PAL_PT_ATTACH PT_ATTACH)
@@ -1286,10 +1289,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(BSD_REGS_STYLE "((reg).r_##rr)")
set(HAVE_SCHED_OTHER_ASSIGNABLE 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
- if(NOT HAVE_LIBUNWIND_H)
- unset(HAVE_LIBUNWIND_H CACHE)
- message(FATAL_ERROR "Cannot find libunwind. Try installing libunwind8 and libunwind8-dev (or the appropriate packages for your platform)")
- endif()
set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0)
set(PAL_PTRACE "ptrace((cmd), (pid), (void*)(addr), (data))")
set(PAL_PT_ATTACH PT_ATTACH)
@@ -1301,10 +1300,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
set(HAVE_SCHED_OTHER_ASSIGNABLE 0)
elseif(CMAKE_SYSTEM_NAME STREQUAL SunOS)
- if(NOT HAVE_LIBUNWIND_H)
- unset(HAVE_LIBUNWIND_H CACHE)
- message(FATAL_ERROR "Cannot find libunwind. Try installing libunwind8 and libunwind8-dev (or the appropriate packages for your platform)")
- endif()
set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0)
set(PAL_PTRACE "ptrace((cmd), (pid), (caddr_t)(addr), (data))")
set(PAL_PT_ATTACH PT_ATTACH)
@@ -1313,10 +1308,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL SunOS)
set(PAL_PT_WRITE_D PT_WRITE_D)
set(HAS_FTRUNCATE_LENGTH_ISSUE 0)
else() # Anything else is Linux
- if(NOT HAVE_LIBUNWIND_H)
- unset(HAVE_LIBUNWIND_H CACHE)
- message(FATAL_ERROR "Cannot find libunwind. Try installing libunwind8 and libunwind8-dev (or the appropriate packages for your platform)")
- endif()
if(NOT HAVE_LTTNG_TRACEPOINT_H AND FEATURE_EVENT_TRACE)
unset(HAVE_LTTNG_TRACEPOINT_H CACHE)
message(FATAL_ERROR "Cannot find liblttng-ust-dev. Try installing liblttng-ust-dev (or the appropriate packages for your platform)")
diff --git a/src/pal/src/exception/remote-unwind.cpp b/src/pal/src/exception/remote-unwind.cpp
index 33920eaca8..c30c463cfd 100644
--- a/src/pal/src/exception/remote-unwind.cpp
+++ b/src/pal/src/exception/remote-unwind.cpp
@@ -48,12 +48,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "pal.h"
#include <dlfcn.h>
-#if HAVE_LIBUNWIND_H
-#ifndef __linux__
#define UNW_LOCAL_ONLY
-#endif // !__linux__
+// Sub-headers included from the libunwind.h contain an empty struct
+// and clang issues a warning. Until the libunwind is fixed, disable
+// the warning.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wextern-c-compat"
#include <libunwind.h>
-#endif // HAVE_LIBUNWIND_H
+#pragma clang diagnostic pop
SET_DEFAULT_DEBUG_CHANNEL(EXCEPT);
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index b15ac34c24..2b7c9360a6 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -27,18 +27,19 @@ Abstract:
#include "pal.h"
#include <dlfcn.h>
-#if HAVE_LIBUNWIND_H
-#ifndef __linux__
#define UNW_LOCAL_ONLY
-#endif // !__linux__
+// Sub-headers included from the libunwind.h contain an empty struct
+// and clang issues a warning. Until the libunwind is fixed, disable
+// the warning.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wextern-c-compat"
#include <libunwind.h>
-#endif // HAVE_LIBUNWIND_H
+#pragma clang diagnostic pop
//----------------------------------------------------------------------
// Virtual Unwinding
//----------------------------------------------------------------------
-#if HAVE_LIBUNWIND_H
#if UNWIND_CONTEXT_IS_UCONTEXT_T
#if defined(_AMD64_)
@@ -347,10 +348,6 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
return TRUE;
}
-#else
-#error don't know how to unwind on this platform
-#endif
-
struct ExceptionRecords
{
CONTEXT ContextRecord;
diff --git a/src/pal/src/include/pal/locale.h b/src/pal/src/include/pal/locale.h
index f59ce2e174..52362e5166 100644
--- a/src/pal/src/include/pal/locale.h
+++ b/src/pal/src/include/pal/locale.h
@@ -43,10 +43,6 @@ extern "C"
#endif // HAVE_COREFOUNDATION
#if HAVE_COREFOUNDATION
-#if !ENABLE_DOWNLEVEL_FOR_NLS
-BOOL LocaleInitialize( void );
-void LocaleCleanup( void );
-#endif // !ENABLE_DOWNLEVEL_FOR_NLS
typedef
struct _CP_MAPPING
diff --git a/src/pal/src/include/pal/sharedmemory.h b/src/pal/src/include/pal/sharedmemory.h
index 2e0d9d2a79..fdc395e3c6 100644
--- a/src/pal/src/include/pal/sharedmemory.h
+++ b/src/pal/src/include/pal/sharedmemory.h
@@ -93,6 +93,7 @@ public:
class SharedMemoryHelpers
{
private:
+ static const mode_t PermissionsMask_CurrentUser_ReadWriteExecute;
static const mode_t PermissionsMask_AllUsers_ReadWrite;
static const mode_t PermissionsMask_AllUsers_ReadWriteExecute;
public:
@@ -110,7 +111,7 @@ public:
template<SIZE_T DestinationByteCount> static SIZE_T CopyString(char (&destination)[DestinationByteCount], SIZE_T destinationStartOffset, LPCSTR source, SIZE_T sourceCharCount);
template<SIZE_T DestinationByteCount> static SIZE_T AppendUInt32String(char (&destination)[DestinationByteCount], SIZE_T destinationStartOffset, UINT32 value);
- static bool EnsureDirectoryExists(const char *path, bool isGlobalLockAcquired, bool createIfNotExist = true);
+ static bool EnsureDirectoryExists(const char *path, bool isGlobalLockAcquired, bool createIfNotExist = true, bool isSystemDirectory = false);
private:
static int Open(LPCSTR path, int flags, mode_t mode = static_cast<mode_t>(0));
public:
diff --git a/src/pal/src/libunwind/.gitignore b/src/pal/src/libunwind/.gitignore
new file mode 100644
index 0000000000..7b7905f0d5
--- /dev/null
+++ b/src/pal/src/libunwind/.gitignore
@@ -0,0 +1,79 @@
+*.la
+*.a
+*.o
+*.lo
+*~
+*.pc
+
+.libs/
+.deps/
+
+.dirstamp
+Makefile
+Makefile.in
+
+INSTALL
+aclocal.m4
+autom4te.cache/
+config.log
+config.status
+config/
+configure
+libtool
+
+doc/common.tex
+
+src/[GL]cursor_i.h
+src/mk_[GL]cursor_i.s
+
+include/config.h
+include/config.h.in
+include/libunwind-common.h
+include/stamp-h1
+include/libunwind.h
+include/tdep/libunwind_i.h
+
+tests/[GL]test-bt
+tests/[GL]test-concurrent
+tests/[GL]test-dyn1
+tests/[GL]test-exc
+tests/[GL]test-init
+tests/[GL]test-resume-sig
+tests/[GL]test-resume-sig-rt
+tests/[GL]perf-simple
+tests/Ltest-nomalloc
+tests/Ltest-nocalloc
+tests/Lperf-simple
+tests/Lrs-race
+tests/Ltest-varargs
+tests/check-namespace.sh
+tests/crasher
+tests/forker
+tests/mapper
+tests/rs-race
+tests/test-async-sig
+tests/test-coredump-unwind
+tests/test-flush-cache
+tests/test-init-remote
+tests/test-mem
+tests/test-ptrace
+tests/test-setjmp
+tests/test-strerror
+tests/test-proc-info
+tests/test-ptrace-misc
+tests/test-reg-state
+tests/test-varargs
+tests/test-static-link
+tests/[GL]test-trace
+tests/[GL]perf-trace
+tests/Ltest-cxx-exceptions
+tests/Ltest-init-local-signal
+tests/Ltest-mem-validate
+tests/[GL]ia64-test-nat
+tests/[GL]ia64-test-rbs
+tests/[GL]ia64-test-readonly
+tests/[GL]ia64-test-stack
+tests/ia64-test-dyn1
+tests/ia64-test-sig
+tests/*.log
+tests/*.trs
diff --git a/src/pal/src/libunwind/.travis.yml b/src/pal/src/libunwind/.travis.yml
new file mode 100644
index 0000000000..4a74b4a1bc
--- /dev/null
+++ b/src/pal/src/libunwind/.travis.yml
@@ -0,0 +1,18 @@
+sudo: required
+language: c
+compiler: gcc
+env:
+- TARGET=x86_64-linux-gnu
+- TARGET=x86-linux-gnu
+- TARGET=arm-linux-gnueabihf
+- TARGET=aarch64-linux-gnu
+- TARGET=mipsel-unknown-linux-gnu
+# Currently experiencing build failures here
+#- TARGET=powerpc64-linux-gnu
+script:
+- ./autogen.sh
+- ./configure --target=$TARGET --host=$HOST
+- make -j32
+- sudo bash -c 'echo core.%p.%p > /proc/sys/kernel/core_pattern'
+- ulimit -c unlimited
+- if [ $TARGET == 'x86_64-linux-gnu' ]; then make check -j32; fi
diff --git a/src/pal/src/libunwind/AUTHORS b/src/pal/src/libunwind/AUTHORS
new file mode 100644
index 0000000000..719eee5c85
--- /dev/null
+++ b/src/pal/src/libunwind/AUTHORS
@@ -0,0 +1 @@
+David Mosberger <dmosberger@gmail.org>
diff --git a/src/pal/src/libunwind/CMakeLists.txt b/src/pal/src/libunwind/CMakeLists.txt
new file mode 100644
index 0000000000..b33c0ae443
--- /dev/null
+++ b/src/pal/src/libunwind/CMakeLists.txt
@@ -0,0 +1,22 @@
+add_subdirectory(src)
+
+# define variables for the configure_file below
+
+if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
+ set(arch x86_64)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+ set(arch aarch64)
+elseif(CLR_CMAKE_PLATFROM_ARCH_ARM)
+ set(arch arm)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+ set(arch x86)
+endif()
+
+set(PKG_MAJOR "1")
+set(PKG_MINOR "3")
+set(PKG_EXTRA "-rc1")
+
+configure_file(include/libunwind-common.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/libunwind-common.h)
+configure_file(include/libunwind.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/libunwind.h)
+configure_file(include/tdep/libunwind_i.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/tdep/libunwind_i.h)
+
diff --git a/src/pal/src/libunwind/COPYING b/src/pal/src/libunwind/COPYING
new file mode 100644
index 0000000000..41e7d8a6fd
--- /dev/null
+++ b/src/pal/src/libunwind/COPYING
@@ -0,0 +1,20 @@
+Copyright (c) 2002 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/pal/src/libunwind/ChangeLog b/src/pal/src/libunwind/ChangeLog
new file mode 100644
index 0000000000..dfa24b957c
--- /dev/null
+++ b/src/pal/src/libunwind/ChangeLog
@@ -0,0 +1,55 @@
+***********************************************************
+
+ Discontinued. See git log instead at
+
+ http://www.kernel.org/git/gitweb.cgi?p=libs/libunwind/libunwind.git;a=log
+
+***********************************************************
+
+2002-11-08 David Mosberger-Tang <David.Mosberger@acm.org>
+
+ * src/ia64/unwind_i.h (ia64_getfp): Change from macro to inline
+ function. Check "loc" argument for being NULL before dereferencing it.
+ (ia64_putfp): Ditto.
+ (ia64_get): Ditto.
+ (ia64_put): Ditto.
+
+2002-01-18 David Mosberger-Tang <David.Mosberger@acm.org>
+
+ * src/ia64/parser.c (__ia64_unw_create_state_record): Set
+ IA64_FLAG_HAS_HANDLER if the unwind info descriptors indicate that
+ there a handler.
+
+ * src/ia64/regs.c (__ia64_access_reg): Return zero for UNW_REG_HANDLER
+ in frames that don't have a personality routine.
+
+ * src/ia64/unwind_i.h (IA64_FLAG_HAS_HANDLER): New flag.
+
+ * src/ia64/regs.c (__ia64_access_reg): When reading UNW_REG_HANDLER,
+ account for the fact that the personality address is gp-relative.
+
+ * src/ia64/parser.c (__ia64_unw_create_state_record): Fix
+ initialization of segbase and len.
+
+2002-01-17 David Mosberger-Tang <David.Mosberger@acm.org>
+
+ * include/unwind-ia64.h: Include via "unwind.h" to ensure
+ the file is picked up from same directory.
+
+2002-01-16 David Mosberger-Tang <David.Mosberger@acm.org>
+
+ * include/unwind.h: Define UNW_ESTOPUNWIND. This error code may
+ be returned by acquire_unwind_info() to force termination of
+ unwinding. An application may want to do this when encountering a
+ call frame for dynamically generated code, for example.
+
+ * unwind.h: Pass opaque argument pointer to acquire_unwind_info()
+ and release_unwind_info() like we do for access_mem() etc.
+
+2002-01-14 David Mosberger-Tang <David.Mosberger@acm.org>
+
+ * Version 0.0 released.
+
+2002-01-11 David Mosberger-Tang <David.Mosberger@acm.org>
+
+ * ChangeLog created.
diff --git a/src/pal/src/libunwind/LICENSE b/src/pal/src/libunwind/LICENSE
new file mode 100644
index 0000000000..c9b44cb8aa
--- /dev/null
+++ b/src/pal/src/libunwind/LICENSE
@@ -0,0 +1,18 @@
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/pal/src/libunwind/Makefile.am b/src/pal/src/libunwind/Makefile.am
new file mode 100644
index 0000000000..711d9100c7
--- /dev/null
+++ b/src/pal/src/libunwind/Makefile.am
@@ -0,0 +1,106 @@
+include_HEADERS = include/libunwind-dynamic.h
+
+if BUILD_PTRACE
+include_HEADERS += include/libunwind-ptrace.h
+endif BUILD_PTRACE
+
+if BUILD_COREDUMP
+include_HEADERS += include/libunwind-coredump.h
+endif BUILD_COREDUMP
+
+if ARCH_AARCH64
+include_HEADERS += include/libunwind-aarch64.h
+endif
+if ARCH_ARM
+include_HEADERS += include/libunwind-arm.h
+endif
+if ARCH_IA64
+include_HEADERS += include/libunwind-ia64.h
+endif
+if ARCH_HPPA
+include_HEADERS += include/libunwind-hppa.h
+endif
+if ARCH_MIPS
+include_HEADERS += include/libunwind-mips.h
+endif
+if ARCH_TILEGX
+include_HEADERS += include/libunwind-tilegx.h
+endif
+if ARCH_X86
+include_HEADERS += include/libunwind-x86.h
+endif
+if ARCH_X86_64
+include_HEADERS += include/libunwind-x86_64.h
+endif
+if ARCH_PPC32
+include_HEADERS += include/libunwind-ppc32.h
+endif
+if ARCH_PPC64
+include_HEADERS += include/libunwind-ppc64.h
+endif
+if ARCH_SH
+include_HEADERS += include/libunwind-sh.h
+endif
+
+if !REMOTE_ONLY
+include_HEADERS += include/libunwind.h include/unwind.h
+endif
+
+nodist_include_HEADERS = include/libunwind-common.h
+
+SUBDIRS = src
+
+if CONFIG_TESTS
+SUBDIRS += tests
+endif
+
+if CONFIG_DOCS
+SUBDIRS += doc
+endif
+
+noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \
+ include/compiler.h include/libunwind_i.h include/mempool.h \
+ include/remote.h \
+ include/tdep-aarch64/dwarf-config.h \
+ include/tdep-aarch64/jmpbuf.h \
+ include/tdep-aarch64/libunwind_i.h \
+ include/tdep-arm/dwarf-config.h include/tdep-arm/ex_tables.h \
+ include/tdep-arm/jmpbuf.h include/tdep-arm/libunwind_i.h \
+ include/tdep-ia64/jmpbuf.h include/tdep-ia64/rse.h \
+ include/tdep-ia64/libunwind_i.h include/tdep-ia64/script.h \
+ include/tdep-hppa/libunwind_i.h \
+ include/tdep-hppa/jmpbuf.h include/tdep-hppa/dwarf-config.h \
+ include/tdep-mips/libunwind_i.h \
+ include/tdep-mips/jmpbuf.h include/tdep-mips/dwarf-config.h \
+ include/tdep-tilegx/libunwind_i.h \
+ include/tdep-tilegx/jmpbuf.h include/tdep-tilegx/dwarf-config.h \
+ include/tdep-x86/libunwind_i.h \
+ include/tdep-x86/jmpbuf.h include/tdep-x86/dwarf-config.h \
+ include/tdep-x86_64/libunwind_i.h \
+ include/tdep-x86_64/jmpbuf.h include/tdep-x86_64/dwarf-config.h \
+ include/tdep-ppc32/dwarf-config.h \
+ include/tdep-ppc32/jmpbuf.h include/tdep-ppc32/libunwind_i.h \
+ include/tdep-ppc64/dwarf-config.h \
+ include/tdep-ppc64/jmpbuf.h include/tdep-ppc64/libunwind_i.h \
+ include/tdep-sh/dwarf-config.h \
+ include/tdep-sh/jmpbuf.h include/tdep-sh/libunwind_i.h \
+ include/tdep/libunwind_i.h \
+ include/tdep/jmpbuf.h include/tdep/dwarf-config.h
+
+EXTRA_DIST = include/libunwind-common.h.in
+
+MAINTAINERCLEANFILES = \
+ Makefile.in \
+ INSTALL \
+ aclocal.m4 \
+ configure \
+ config/compile \
+ config/config.guess \
+ config/config.sub \
+ config/depcomp \
+ config/install-sh \
+ config/ltmain.sh \
+ config/missing \
+ include/config.h.in \
+ include/config.h.in~
+
diff --git a/src/pal/src/libunwind/NEWS b/src/pal/src/libunwind/NEWS
new file mode 100644
index 0000000000..ae6cbcfb0b
--- /dev/null
+++ b/src/pal/src/libunwind/NEWS
@@ -0,0 +1,247 @@
+-*-Mode: outline-*-
+
+* News for v1.3:
+
+** Iteration of unwind register states support
+ Doug Moore <dougm@rice.edu>
+** Freebsd/Armv6 support
+ Konstantin Belousov <kib@freebsd.org>
+** Many, many dwarf bugfixes
+** Mips remote unwind support
+** aarch64 ptrace support
+
+* News for v1.2:
+
+** aarch64 port
+** dwarf parsing improvements
+** Fast stacktraces for aarch64 & arm
+** tilegx port
+** powerpc64 port
+
+* News for v1.1:
+
+** coredump unwind support
+** New arch: SuperH
+** Improved support for PowerPC, ARM
+** Lots of cleanups, perf tweaks
+** pkg-config support
+
+* News for v1.0:
+
+** Fast unwind (rbp, rsp, rip only) on x86_64 with a fallback to
+ slow code path (Lassi Tuura)
+** Improved local and remote unwinding on ARM (Ken Werner)
+** Testing, stability and many fixes on x86 (Paul Pluzhnikov)
+** FreeBSD port and clean separation of OS specific bits
+ (Konstantin Belousov)
+** Thanks for all the bug reports, contributions and testing!
+
+* News for v0.99:
+
+** Greatly improved x86-64 support thanks to Arun Sharma.
+** Support for PPC64 added by Jose Flavio Aguilar Paulino.
+
+* News for v0.98.6:
+
+** Fix address-leak triggered by invalid byte-order. Fixed by Andreas Schwab.
+** On ia64, get_static_proc_name() no longer uses a weak reference to
+ _Uelf64_get_proc_name(), since that was causing problems with archive
+ libraries and no longer served any apparent purpose. Fixed by
+ Curt Wohlgemuth.
+
+* News for v0.98.5:
+
+** Fix a typo in the man-page of unw_create_addr_space().
+** Fix an off-by-1 bug in the handling of the dynamic ALIAS directive
+ for ia64. Reported by Todd L. Miller.
+** Fix a bug in libunwind-ptrace which could cause crash due to extraneous
+ munmap() calls.
+
+* News for v0.98.4:
+
+** Fix a typo in _ReadSLEB.c which caused hangs when throwing exceptions
+ from Intel ICC-compiled programs. Reported by Tommy Hoffner.
+
+* News for v0.98.3:
+
+** Make it possible to link against libunwind-ia64.a only (i.e., without
+ requiring libunwind.a as well). This keeps apps which need only
+ remote unwinding cleaner, since they logically have no dependency
+ on libunwind.a.
+** Dont link against libatomic_ops for now. Due to a packaging bug on
+ Debian, linking against this library causes libunwind.so to get
+ a dependency on libatomic_ops.so, which is not at all what we want.
+ Fortunately, we don't have to link against that library on x86 or
+ ia64 since the library is strictly needed only for platforms with
+ poor atomic operation support. Once the libatomic_ops package is fixed,
+ we can re-enable linking against libatomic_ops.
+
+* News for v0.98.2:
+
+** Fixed bug which caused _UPT_get_dyn_info_list_addr() to sometimes fail
+ needlessly. Found by Todd L. Miller.
+
+** When using GCC to build libunwind on ia64, libunwind.so had an
+ unresolved reference to __divdi3. This is undesirable since it
+ creates an implicit dependency on libgcc. This problem has been
+ fixed in the 0.98.2 release by explicitly linking against libgcc.a
+ when building libunwind.
+
+* News for v0.98.1:
+
+** Fixed a bug which caused "make install" to install libunwind-common.h.in
+ instead of libunwind-common.h.
+** Fixed a bug in the ia64 {sig,}longjmp() which showed on
+ SuSE Linux 9 because it's using a newer compiler & the EPC-based system
+ call stubs.
+** Fixed incorrect offsets in tests/ia64-test-nat-asm.S.
+ Warning: you'll need a GNU assembler dated later than 21-Sep-2004 to
+ get this file translated correctly. With an old assembler, "make check"
+ will get lots of failures when running Gia64-test-nat or Lia64-test-nat!
+** Convert tests/bt into a full-blown test-case. It's designed to
+ trigger a (rarely-encountered) bug in the GNU assembler on ia64.
+ The assembler has been fixed and once the libraries (libc etc)
+ have been rebuilt, this test will pass.
+** Added test-case tests/run-ptrace-misc which, on ia64, triggers a bug in
+ current GCC (including v3.4.2) which causes bad unwind info.
+
+* News for v0.98:
+
+** Update libunwind to be compliant with the updated/expanded
+ ia64 unwind specificiation by HJ Lu [1]. This is needed for
+ GCC 3.4 compatibility.
+
+ [1] http://www.kernel.org/pub/linux/devel/gcc/unwind/
+
+** Initial support for x86-64 has been added courtesy of Max Asbock.
+ Along with this came a bunch of DWARF2 unwinder fixes.
+
+** A new rountine unw_strerror() has been added courtesy of
+ Thomas Hallgren.
+
+** Including <libunwind.h> now defines 4 macros that can be used
+ to determine the version number of libunwind. Specifically,
+ UNW_VERSION_MAJOR, UNW_VERSION_MINOR, UNW_VERSION, and
+ UNW_VERSION_CODE are defined by the header now.
+
+** Bug fixes
+*** Fix a memory-leak in _UPT_get_dyn_info_list_addr() courtesy of Ed Connell.
+*** Fix a crash in libunwind-ptrace courtesy of Mark Young.
+*** Fix a bug in ia64-version of unw_init_remote() which prevented
+ it from working correctly for the local address space. Reported by
+ Troy Heber.
+*** Many other small and not so small fixes.
+
+* News for v0.97:
+
+** unw_get_proc_name() may now be called from signal-handler.
+
+** The ptrace-helper routines are now declared in libunwind-ptrace.h.
+ Applications which use ptrace-based unwinding should include
+ <libunwind-ptrace.h> to get the _UPT_*() routines declared.
+
+** libunwind has been split into a "local-only" and a "generic" versions.
+ The former is optimized for local unwinding (within a process) and
+ is called libunwind.so (shared version) or libunwind.a (archive
+ version). The generic version is not limited to unwinding within a
+ process and is called libunwind-generic.so (shared version)
+ libunwind-generic.a (archive version). Similarly, the ptrace()
+ support has been separated out into a convenience library called
+ libunwind-ptrace.a. For the most part, backwards-compatibility
+ is retained. However, when building an application which uses
+ libunwind, it may be necessary to change the linker command-line
+ as shown in the table below:
+
+ Application which does: Before v0.97: With v0.97:
+ ----------------------- ------------- -----------
+ local unwinding only: -lunwind -lunwind
+ remote unwinding: -lunwind -lunwind-generic
+ cross unwinding: -lunwind-PLAT -lunwind-PLAT
+ ptrace-based unwinding: -lunwind -lunwind-ptrace -lunwind-generic
+
+ The motivation for this splitting is to keep libunwind.so as minimal
+ as possible. This library will eventually be loaded by most (if not
+ all) executables and hence it is important to ensure that it can
+ be loaded as quickly as possible.
+
+** unw_getcontext() tuned on IA-64.
+
+ The unw_getcontext() routine used to be provided by (GNU) libc
+ (getcontext()). This caused unnecessary overhead (e.g., an
+ unnecessary system-call to sigprocmask()). The new
+ unw_getcontext() only does the work really needed for libunwind and
+ hence performs much better. However, this change implies that
+ programs linked against libunwind v0.97 won't be
+ backwards-compatible with earlier versions (there would be an
+ unresolved symbol for _Uia64_getcontext()).
+
+** Fix NaT-bit handling on IA-64.
+
+ New test-cases have been added to test the handling of the NaT bit
+ (and floating-point NaT values) and all discovered/known bugs have
+ been fixed.
+
+** Initial DWARF-based unwinder for x86.
+
+ There is a beginning for a DWARF-based unwinder for x86. Work for
+ x86-64-support based on this DWARF unwinder is currently underway
+ at IBM and it is expected that this support will be merged into the
+ official tree soon.
+
+
+* News for v0.96:
+
+** _Unwind_*() routines defined by the C++ ABI are now included in
+ libunwind.
+
+
+* News for v0.95:
+
+** Bigger, better, faster, or so the theory goes.
+
+
+* News for v0.93:
+
+** More bug-fixes & improved HP-UX support.
+
+
+* News for v0.92:
+
+** Bug-fix release. IA-64 unwinder can now be built with Intel compiler (ECC).
+
+
+* News for v0.91:
+
+** Lots of documentation updates
+** Some portability fixes.
+
+
+* News for v0.9:
+
+** The libunwind API is mostly feature-complete at this point (hence the
+ version jump from v0.2 to v0.9).
+
+
+* News for v0.2:
+
+** Automated configuration/build with autoconf and automake.
+** Added support for building libunwind as a shared library.
+** Added support for remote unwinding.
+** Added support for cross-building.
+** Added two new routines to the API:
+ - unw_is_fpreg()
+ - unw_get_save_loc()
+** Added multi-architecture supports (lets a single application use
+ the unwind libraries for multiple target architectures; this is useful,
+ e.g., useful for building a debugger that can support multiple targets
+ such as x86, ia64, etc.)
+
+
+* News for v0.1:
+
+** Added support for exception handling.
+
+
+* News for v0.0:
+
+** It's a brand new package.
diff --git a/src/pal/src/libunwind/README b/src/pal/src/libunwind/README
new file mode 100644
index 0000000000..694f600b06
--- /dev/null
+++ b/src/pal/src/libunwind/README
@@ -0,0 +1,207 @@
+-*- mode: Outline -*-
+
+[![Build Status](https://travis-ci.org/libunwind/libunwind.svg?branch=master)](https://travis-ci.org/libunwind/libunwind)
+
+This is version 1.3 of the unwind library. This library supports
+several architecture/operating-system combinations:
+
+ Linux/x86-64: Works well.
+ Linux/x86: Works well.
+ Linux/ARM: Works well.
+ Linux/IA-64: Works well.
+ Linux/PARISC: Works well, but C library missing unwind-info.
+ HP-UX/IA-64: Mostly works but known to have some serious limitations.
+ MIPS: Newly added.
+ Linux/AArch64: Works well.
+ Linux/PPC64: Newly added.
+ Linux/SuperH: Newly added.
+ FreeBSD/i386: Works well.
+ FreeBSD/x86-64: Newly added (FreeBSD architecture is known as amd64).
+ Linux/Tilegx: Newly added (64-bit mode only).
+
+* General Build Instructions
+
+In general, this library can be built and installed with the following
+commands:
+
+ $ ./autogen.sh # Needed only for building from git. Depends on libtool.
+ $ ./configure
+ $ make
+ $ make install prefix=PREFIX
+
+where PREFIX is the installation prefix. By default, a prefix of
+/usr/local is used, such that libunwind.a is installed in
+/usr/local/lib and unwind.h is installed in /usr/local/include. For
+testing, you may want to use a prefix of /usr/local instead.
+
+
+* Building with Intel compiler
+
+** Version 8 and later
+
+Starting with version 8, the preferred name for the IA-64 Intel
+compiler is "icc" (same name as on x86). Thus, the configure-line
+should look like this:
+
+ $ ./configure CC=icc CFLAGS="-g -O3 -ip" CXX=icc CCAS=gcc CCASFLAGS=-g \
+ LDFLAGS="-L$PWD/src/.libs"
+
+
+* Building on HP-UX
+
+For the time being, libunwind must be built with GCC on HP-UX.
+
+libunwind should be configured and installed on HP-UX like this:
+
+ $ ./configure CFLAGS="-g -O2 -mlp64" CXXFLAGS="-g -O2 -mlp64"
+
+Caveat: Unwinding of 32-bit (ILP32) binaries is not supported
+ at the moment.
+
+** Workaround for older versions of GCC
+
+GCC v3.0 and GCC v3.2 ship with a bad version of sys/types.h. The
+workaround is to issue the following commands before running
+"configure":
+
+ $ mkdir $top_dir/include/sys
+ $ cp /usr/include/sys/types.h $top_dir/include/sys
+
+GCC v3.3.2 or later have been fixed and do not require this
+workaround.
+
+* Building for PowerPC64 / Linux
+
+For building for power64 you should use:
+
+ $ ./configure CFLAGS="-g -O2 -m64" CXXFLAGS="-g -O2 -m64"
+
+If your power support altivec registers:
+ $ ./configure CFLAGS="-g -O2 -m64 -maltivec" CXXFLAGS="-g -O2 -m64 -maltivec"
+
+To check if your processor has support for vector registers (altivec):
+ cat /proc/cpuinfo | grep altivec
+and should have something like this:
+ cpu : PPC970, altivec supported
+
+If libunwind seems to not work (backtracing failing), try to compile
+it with -O0, without optimizations. There are some compiler problems
+depending on the version of your gcc.
+
+* Building on FreeBSD
+
+General building instructions apply. To build and execute several tests,
+you need libexecinfo library available in ports as devel/libexecinfo.
+
+Development of the port was done of FreeBSD 8.0-STABLE. The library
+was build with the system compiler that is modified version of gcc 4.2.1,
+as well as the gcc 4.4.3.
+
+* Regression Testing
+
+After building the library, you can run a set of regression tests with:
+
+ $ make check
+
+** Expected results on IA-64 Linux
+
+Unless you have a very recent C library and compiler installed, it is
+currently expected to have the following tests fail on IA-64 Linux:
+
+ Gtest-init (should pass starting with glibc-2.3.x/gcc-3.4)
+ Ltest-init (should pass starting with glibc-2.3.x/gcc-3.4)
+ test-ptrace (should pass starting with glibc-2.3.x/gcc-3.4)
+ run-ia64-test-dyn1 (should pass starting with glibc-2.3.x)
+
+This does not mean that libunwind cannot be used with older compilers
+or C libraries, it just means that for certain corner cases, unwinding
+will fail. Since they're corner cases, it is not likely for
+applications to trigger them.
+
+Note: If you get lots of errors in Gia64-test-nat and Lia64-test-nat, it's
+ almost certainly a sign of an old assembler. The GNU assembler used
+ to encode previous-stack-pointer-relative offsets incorrectly.
+ This bug was fixed on 21-Sep-2004 so any later assembler will be
+ fine.
+
+** Expected results on x86 Linux
+
+The following tests are expected to fail on x86 Linux:
+
+ test-ptrace
+
+** Expected results on x86-64 Linux
+
+The following tests are expected to fail on x86-64 Linux:
+
+ run-ptrace-misc (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18748
+ and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18749)
+
+** Expected results on PARISC Linux
+
+Caveat: GCC v3.4 or newer is needed on PA-RISC Linux. Earlier
+versions of the compiler failed to generate the exception-handling
+program header (GNU_EH_FRAME) needed for unwinding.
+
+The following tests are expected to fail on x86-64 Linux:
+
+ Gtest-bt (backtrace truncated at kill() due to lack of unwind-info)
+ Ltest-bt (likewise)
+ Gtest-resume-sig (Gresume.c:my_rt_sigreturn() is wrong somehow)
+ Ltest-resume-sig (likewise)
+ Gtest-init (likewise)
+ Ltest-init (likewise)
+ Gtest-dyn1 (no dynamic unwind info support yet)
+ Ltest-dyn1 (no dynamic unwind info support yet)
+ test-setjmp (longjmp() not implemented yet)
+ run-check-namespace (toolchain doesn't support HIDDEN yet)
+
+** Expected results on HP-UX
+
+"make check" is currently unsupported for HP-UX. You can try to run
+it, but most tests will fail (and some may fail to terminate). The
+only test programs that are known to work at this time are:
+
+ tests/bt
+ tests/Gperf-simple
+ tests/test-proc-info
+ tests/test-static-link
+ tests/Gtest-init
+ tests/Ltest-init
+ tests/Gtest-resume-sig
+ tests/Ltest-resume-sig
+
+** Expected results on PPC64 Linux
+
+"make check" should run with no more than 10 out of 24 tests failed.
+
+
+* Performance Testing
+
+This distribution includes a few simple performance tests which give
+some idea of the basic cost of various libunwind operations. After
+building the library, you can run these tests with the following
+commands:
+
+ $ cd tests
+ $ make perf
+
+* Contacting the Developers
+
+Please direct all questions regarding this library to:
+
+ libunwind-devel@nongnu.org
+
+You can do this by sending a mail to libunwind-request@nongnu.org with
+a body of:
+
+ subscribe libunwind-devel
+
+or you can subscribe and manage your subscription via the
+web-interface at:
+
+ https://savannah.nongnu.org/mail/?group=libunwind
+
+Or interact at the gihub page:
+
+ https://github.com/libunwind/libunwind
diff --git a/src/pal/src/libunwind/README.md b/src/pal/src/libunwind/README.md
new file mode 120000
index 0000000000..100b93820a
--- /dev/null
+++ b/src/pal/src/libunwind/README.md
@@ -0,0 +1 @@
+README \ No newline at end of file
diff --git a/src/pal/src/libunwind/TODO b/src/pal/src/libunwind/TODO
new file mode 100644
index 0000000000..8b2e0262b0
--- /dev/null
+++ b/src/pal/src/libunwind/TODO
@@ -0,0 +1,97 @@
+- Update the libunwind man page for the new/fixed cache-flushing behavior.
+ Effectively, that unw_flush_cache() doesn't have to be called by
+ applications except for extraordinary circumstances (e.g., if application
+ implements its own runtime loader).
+- document split local-only/generic libraries and separate libunwind-ptrace.a
+ convenience-library
+- document new "tdep" member in unw_proc_info_t structure
+- for DWARF 2, use a dummy CIE entry with an augmentation that
+ provides the dyn-info-list-address
+
+=== taken care of:
+
+Testing:
+ + ensure that saving r4-r7 in a stacked register properly preserves
+ the NaT bit, even in the face of register-rotation
+ + ensure that IA64_INSN_MOVE_STACKED works correctly in the face of
+ register rotation
+ + on Linux, test access to f32-f127 in a signal handler (e.g., verify
+ that fph partition gets initialized properly)
++ According to Nicholas S. Wourms <nwourms@netscape.net>, adding this to the
+ Makefile.am:
+ AUTOMAKE_OPTIONS = 1.6 subdir-objects
+ ensures that object-files are build in separate subdirectories and that
+ in turn makes it possible for source files in different directories to
+ have the same filename, thus avoiding the need for those ugly -x86, -ia64,
+ etc., postfixes.
++ Switch ia64 (and rest over) to using Debug() instead of debug()
++ implement non-local versions of dwarf_readXX()
++ consolidate mostly architecture-independent code such as
+ unw_get_accessors() into shared files
++ caching is pretty fundamentally broken, what should happen is this:
+ o On unw_init_local()/unw_init_remote(), libunwind should validate
+ that the cached information is still valid and, if not, flush the
+ cache on its own. Rationale: once unw_init_local() has been
+ called, it is clear that the unwind info for the calling thread
+ cannot change (otherwise the program would be buggy anyhow) and
+ hence it is sufficient to validate the cache at this point.
+ Similarly, once unw_init_remote() has been called, the target
+ address space must have been stopped, because the unwinding would
+ otherwise be unreliable anyhow.
+ o glibc currently lacks a feature for dl_iterate_phdr() to support
+ safe caching; I proposed on 12/16/2003 that glibc maintain two
+ atomic counters which get inremented whenever something is added
+ to/removed from the dl_iterate_phdr-list. Once we have such counters,
+ we can use them in libunwind to implement an efficient version of a
+ cache-validation routine.
+ Once this has been fixed, update the libunwind man page accordingly.
+ Effectively, what this means is that unw_flush_cache() doesn't have
+ to be called by applications except for extraordinary circumstances
+ (e.g., if application implements its own runtime loader).
++ man-page for unw_is_fpreg()
++ man-page for _U_dyn_cancel()
++ man-page for _U_dyn_register()
++ global data is not protected by a lock; causes problems if two threads
+ call ia64_init() at almost the same time
++ cache the value of *cfm_loc; each rotate_FOO() call needs it!
++ implement the remote-lookup of the dynamic registration list
++ when doing sigreturn, must restore fp regs (and perhaps other regs) the same
+ way as the (user-level) gate.S sigreturn path does!
++ unw_resume() must at least restore gp (r1)! consider restoring all
+ scratch regs (but what's the performance impact on exception handling?);
+ alternative: restore scratch regs that may be used during procedure
+ call/return (e.g., r8-r11, f8-f11)
++ implement unw_resume() for the case where the current register frame is split
+ across multiple backing stores
++ document restricions on using unw_resume():
++ implement remote cases of unw_resume()
++ test both with UNW_LOCAL_ONLY and without where this makes sense
++ allow region-length (insn_count) in unw_dyn_region_info_t to be negative
+ to indicate counting from the end of the procedure (to make it possible
+ for differently-sized procedures to share the same region list if they
+ share the same prologue/epilogue).
++ it appears that it is currently not possible to read register UNW_IA64_TP;
+ fix that => no, attempts to access r13 will result in access_reg() callbacks,
+ as desired; for local-case, access to r13 will fail though (since
+ getcontext() doesn't, and shouldn't, capture r13)
++ document the special nature of UNW_IA64_GP: read-only, but adjusted
+ automatically if the IP is changed
++ use pthread-mutexes where necessary, atomic ops where possible
++ man-page for unw_init_local()
++ man-page for unw_init_remote()
++ man-page for unw_create_addr_space()
++ man-page for unw_destroy_addr_space()
++ man-page for unw_get_proc_info()
++ man-page for unw_get_proc_name()
++ man-page for unw_get_accessors()
++ man-page for unw_regname()
++ man-page for unw_flush_cache()
++ man-page for unw_set_caching_policy()
++ man-page for unw_getcontext()
++ man-page for unw_is_signal_frame()
++ man-page for unw_step()
++ man-page for unw_get_reg()
++ man-page for unw_set_reg()
++ man-page for unw_get_fpreg()
++ man-page for unw_set_fpreg()
++ test with Intel compiler
diff --git a/src/pal/src/libunwind/acinclude.m4 b/src/pal/src/libunwind/acinclude.m4
new file mode 100644
index 0000000000..497f7c2f21
--- /dev/null
+++ b/src/pal/src/libunwind/acinclude.m4
@@ -0,0 +1,32 @@
+AC_DEFUN([LIBUNWIND___THREAD],
+[dnl Check whether the compiler supports the __thread keyword.
+if test "x$enable___thread" != xno; then
+ AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
+ [cat > conftest.c <<\EOF
+ __thread int a = 42;
+EOF
+ if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
+ libc_cv_gcc___thread=yes
+ else
+ libc_cv_gcc___thread=no
+ fi
+ rm -f conftest*])
+ if test "$libc_cv_gcc___thread" = yes; then
+ AC_DEFINE(HAVE___THREAD, 1,
+ [Define to 1 if __thread keyword is supported by the C compiler.])
+ fi
+else
+ libc_cv_gcc___thread=no
+fi])
+
+AC_DEFUN([CHECK_ATOMIC_OPS],
+[dnl Check whether the system has the atomic_ops package installed.
+ AC_CHECK_HEADERS(atomic_ops.h)
+#
+# Don't link against libatomic_ops for now. We don't want libunwind
+# to depend on libatomic_ops.so. Fortunately, none of the platforms
+# we care about so far need libatomic_ops.a (everything is done via
+# inline macros).
+#
+# AC_CHECK_LIB(atomic_ops, main)
+])
diff --git a/src/pal/src/libunwind/autogen.sh b/src/pal/src/libunwind/autogen.sh
new file mode 100755
index 0000000000..b08bc831f6
--- /dev/null
+++ b/src/pal/src/libunwind/autogen.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+ cd "$srcdir" &&
+ autoreconf --force -v --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/src/pal/src/libunwind/aux_/config.guess b/src/pal/src/libunwind/aux_/config.guess
new file mode 100644
index 0000000000..ed2e03b7f2
--- /dev/null
+++ b/src/pal/src/libunwind/aux_/config.guess
@@ -0,0 +1,1321 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-03-20'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int dummy(){}" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
+ if test $? = 0 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ rm -f $dummy.c $dummy.o $dummy.rel ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvmeppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ eval $set_cc_for_build
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ case `./$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ 2-1307)
+ UNAME_MACHINE="alphaev68"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit 0;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy
+ fi ;;
+ esac
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3D:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ x86:Interix*:3*)
+ echo i386-pc-interix3
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ rm -f $dummy.c
+ test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit 0 ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0 ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ rm -f $dummy.c
+ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/src/pal/src/libunwind/aux_/config.sub b/src/pal/src/libunwind/aux_/config.sub
new file mode 100644
index 0000000000..f3657978c7
--- /dev/null
+++ b/src/pal/src/libunwind/aux_/config.sub
@@ -0,0 +1,1443 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-03-07'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit 0;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | c4x | clipper \
+ | d10v | d30v | dsp16xx \
+ | fr30 \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | m32r | m68000 | m68k | m88k | mcore \
+ | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el | mips64vr4300 \
+ | mips64vr4300el | mips64vr5000 | mips64vr5000el \
+ | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
+ | mipsisa32 | mipsisa64 \
+ | mn10200 | mn10300 \
+ | ns16k | ns32k \
+ | openrisc | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armv*-* \
+ | avr-* \
+ | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c54x-* \
+ | clipper-* | cydra-* \
+ | d10v-* | d30v-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | m32r-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | mcore-* \
+ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
+ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
+ | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
+ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+ | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ or32 | or32-*)
+ basic_machine=or32-unknown
+ os=-coff
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i686-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3d)
+ basic_machine=alpha-cray
+ os=-unicos
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ windows32)
+ basic_machine=i386-pc
+ os=-windows32-msvcrt
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh3 | sh4 | sh3eb | sh4eb)
+ basic_machine=sh-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparc | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ c4x*)
+ basic_machine=c4x-none
+ os=-coff
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto*)
+ os=-nto-qnx
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/src/pal/src/libunwind/aux_/ltmain.sh b/src/pal/src/libunwind/aux_/ltmain.sh
new file mode 100644
index 0000000000..6fc690018e
--- /dev/null
+++ b/src/pal/src/libunwind/aux_/ltmain.sh
@@ -0,0 +1,5107 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | ${SED} 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.4.3
+TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo A|od -x` in
+ *[Cc]1*) # EBCDIC based system
+ SP2NL="tr '\100' '\n'"
+ NL2SP="tr '\r\n' '\100\100'"
+ ;;
+ *) # Assume ASCII based system
+ SP2NL="tr '\040' '\012'"
+ NL2SP="tr '\015\012' '\040\040'"
+ ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS=" "}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ echo "$modename: not configured to build any kind of library" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+ arg="$1"
+ shift
+
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ execute_dlfiles)
+ execute_dlfiles="$execute_dlfiles $arg"
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case $arg in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ exit 0
+ ;;
+
+ --config)
+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+ exit 0
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --preserve-dup-deps) duplicate_deps="yes" ;;
+
+ --quiet | --silent)
+ show=:
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+fi
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ case $nonopt in
+ *cc | *++ | gcc* | *-gcc* | g++* | xlc*)
+ mode=link
+ for arg
+ do
+ case $arg in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case $mode in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ prev=
+ lastarg=
+ srcfile="$nonopt"
+ suppress_output=
+
+ user_target=no
+ for arg
+ do
+ case $prev in
+ "") ;;
+ xcompiler)
+ # Aesthetically quote the previous argument.
+ prev=
+ lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+
+ case $arg in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ continue
+ ;;
+ esac
+
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ if test "$user_target" != "no"; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ user_target=next
+ ;;
+
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ lastarg="$lastarg $arg"
+ done
+ IFS="$save_ifs"
+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+ # Add the arguments to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ continue
+ ;;
+ esac
+
+ case $user_target in
+ next)
+ # The next one is the -o target name
+ user_target=yes
+ continue
+ ;;
+ yes)
+ # We got the output file
+ user_target=set
+ libobj="$arg"
+ continue
+ ;;
+ esac
+
+ # Accept the current argument as the source file.
+ lastarg="$srcfile"
+ srcfile="$arg"
+
+ # Aesthetically quote the previous argument.
+
+ # Backslashify any backslashes, double quotes, and dollar signs.
+ # These are the only characters that are still specially
+ # interpreted inside of double-quoted scrings.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $lastarg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ done
+
+ case $user_target in
+ set)
+ ;;
+ no)
+ # Get the name of the library object.
+ libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ *)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSfmso]'
+ case $libobj in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case $libobj in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $libobj"
+ else
+ removelist="$libobj"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit 1" 1 2 15
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit 1" 1 2 15
+ else
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $run ln "$0" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+ echo $srcfile > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ else
+ # Don't build PIC code
+ command="$base_compile $srcfile"
+ fi
+ if test "$build_old_libs" = yes; then
+ lo_libobj="$libobj"
+ dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$libobj"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+ if test -d "$dir"; then
+ $show "$rm $libobj"
+ $run $rm $libobj
+ else
+ $show "$mkdir $dir"
+ $run $mkdir $dir
+ status=$?
+ if test $status -ne 0 && test ! -d $dir; then
+ exit $status
+ fi
+ fi
+ fi
+ if test "$compiler_o_lo" = yes; then
+ output_obj="$libobj"
+ command="$command -o $output_obj"
+ elif test "$compiler_c_o" = yes; then
+ output_obj="$obj"
+ command="$command -o $output_obj"
+ fi
+
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test x"$output_obj" != x"$libobj"; then
+ $show "$mv $output_obj $libobj"
+ if $run $mv $output_obj $libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # If we have no pic_flag, then copy the object into place and finish.
+ if (test -z "$pic_flag" || test "$pic_mode" != default) &&
+ test "$build_old_libs" = yes; then
+ # Rename the .lo from within objdir to obj
+ if test -f $obj; then
+ $show $rm $obj
+ $run $rm $obj
+ fi
+
+ $show "$mv $libobj $obj"
+ if $run $mv $libobj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+ libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ # Now arrange that obj and lo_libobj become the same file
+ $show "(cd $xdir && $LN_S $baseobj $libobj)"
+ if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+ exit 0
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Allow error messages only from the first compilation.
+ suppress_output=' >/dev/null 2>&1'
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $srcfile"
+ else
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ fi
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ output_obj="$obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed
+ if test x"$output_obj" != x"$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we do not
+ # accidentally link it into a program.
+ if test "$build_libtool_libs" != yes; then
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > \$libobj" || exit $?
+ else
+ # Move the .lo from within objdir
+ $show "$mv $libobj $lo_libobj"
+ if $run $mv $libobj $lo_libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+ fi
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+
+ exit 0
+ ;;
+
+ # libtool link mode
+ link | relink)
+ modename="$modename: link"
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invokation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args="$nonopt"
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ prefer_static_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test $# -gt 0; do
+ arg="$1"
+ shift
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+ ;;
+ *) qarg=$arg ;;
+ esac
+ libtool_args="$libtool_args $qarg"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit 1
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
+ prev=
+ compile_command="$compile_command $wl$qarg"
+ finalize_command="$finalize_command $wl$qarg"
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n $prev
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: more than one -exported-symbols argument is not allowed"
+ exit 1
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | no/*-*-nonstopux*)
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+ exit 1
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "*) ;;
+ *)
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-pw32* | *-*-beos*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-mingw* | *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # in order for the loader to find any dlls it needs.
+ $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+ $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $wl$flag"
+ linker_flags="$linker_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.lo | *.$objext)
+ # A library or standard object.
+ if test "$prev" = dlfiles; then
+ # This file was specified with -dlopen.
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $arg"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+ prev=
+ else
+ case $arg in
+ *.lo) libobjs="$libobjs $arg" ;;
+ *) objs="$objs $arg" ;;
+ esac
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ dlfiles="$dlfiles $arg"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ dlprefiles="$dlprefiles $arg"
+ prev=
+ else
+ deplibs="$deplibs $arg"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done # argument parsing loop
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+ # Create the object directory.
+ if test ! -d $output_objdir; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ # Determine the type of output
+ case $output in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ specialdeplibs=
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ libs="$libs $deplib"
+ done
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
+ case $linkmode in
+ lib)
+ passes="conv link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+ for pass in $passes; do
+ if test $linkmode = prog; then
+ # Determine which files to process
+ case $pass in
+ dlopen)
+ libs="$dlfiles"
+ save_deplibs="$deplibs" # Collect dlpreopened libraries
+ deplibs=
+ ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -l*)
+ if test $linkmode = oldlib && test $linkmode = obj; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
+ continue
+ fi
+ if test $pass = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}.la"
+ if test -f "$lib"; then
+ found=yes
+ break
+ fi
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ ;; # -l
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test $pass = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+ if test $pass = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test $pass = scan; then
+ deplibs="$deplib $deplibs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ ;;
+ *)
+ $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test $pass = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+ if test $pass = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ if test "$deplibs_check_method" != pass_all; then
+ echo
+ echo "*** Warning: Trying to link with static lib archive $deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because the file extensions .$libext of this argument makes me believe"
+ echo "*** that it is just a static archive that I should not used here."
+ else
+ echo
+ echo "*** Warning: Linking the shared library $output against the"
+ echo "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
+ prog)
+ if test $pass != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ newdlfiles="$newdlfiles $deplib"
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+ if test $found = yes || test -f "$lib"; then :
+ else
+ $echo "$modename: cannot find the library \`$lib'" 1>&2
+ exit 1
+ fi
+
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variable installed.
+ installed=yes
+
+ # Read the .la file
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test $linkmode = oldlib && test $linkmode = obj; }; then
+ # Add dl[pre]opened files of deplib
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+ if test $pass = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit 1
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+ elif test $linkmode != prog && test $linkmode != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit 1
+ fi
+ continue
+ fi # $pass = conv
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit 1
+ fi
+
+ # This library was specified with -dlopen.
+ if test $pass = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit 1
+ fi
+ if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload.
+ dlprefiles="$dlprefiles $lib"
+ else
+ newdlfiles="$newdlfiles $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ $echo "$modename: warning: library \`$lib' was moved." 1>&2
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$libdir"
+ absdir="$libdir"
+ fi
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi # $installed = yes
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+ if test $pass = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit 1
+ fi
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
+ fi
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test $linkmode = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs"
+ fi
+ continue
+ fi
+
+ if test $linkmode = prog && test $pass != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+ esac
+ # Need to link against all dependency_libs?
+ if test $linkalldeplibs = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ link_static=no # Whether the deplib will be linked statically
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ # Link against this shared library
+
+ if test "$linkmode,$pass" = "prog,link" ||
+ { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ if test $linkmode = prog; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *" $absdir "*) ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
+ esac
+ fi
+ fi
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+ libname=`eval \\$echo \"$libname_spec\"`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin*)
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ soname=`echo $soroot | ${SED} -e 's/^.*\///'`
+ newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ $show "extracting exported symbol list from \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ eval cmds=\"$extract_expsyms_cmds\"
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ $show "generating import library for \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ eval cmds=\"$old_archive_from_expsyms_cmds\"
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n $old_archive_from_expsyms_cmds
+
+ if test $linkmode = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\/]*)
+ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit 1
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+ if test $linkmode = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes && \
+ test "$hardcode_minus_L" != yes && \
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test $linkmode = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ add="-l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\/]*)
+ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test $linkmode = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test $linkmode = prog; then
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+
+ # Try to link the static library
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ echo
+ echo "*** Warning: This system can not link to static lib archive $lib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ echo "*** But as you try to build a module library, libtool will still create "
+ echo "*** a static module, that should work as long as the dlopening application"
+ echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test $linkmode = lib; then
+ if test -n "$dependency_libs" &&
+ { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
+ test $link_static = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ *) temp_deplibs="$temp_deplibs $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ newlib_search_path="$newlib_search_path $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+ if test $link_all_deplibs != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$deplib" && dir="."
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if grep "^installed=no" $deplib > /dev/null; then
+ path="-L$absdir/$objdir"
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ if test "$absdir" != "$libdir"; then
+ $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+ fi
+ path="-L$absdir"
+ fi
+ ;;
+ *) continue ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$deplibs $path" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ if test $pass = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test $pass != dlopen; then
+ test $pass != scan && dependency_libs="$newdependency_libs"
+ if test $pass != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ if test "$pass" = "conv" &&
+ { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
+ libs="$deplibs" # reset libs
+ deplibs=
+ fi
+ done # for pass
+ if test $linkmode = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ objs="$objs$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+ exit 1
+ else
+ echo
+ echo "*** Warning: Linking the shared library $output against the non-libtool"
+ echo "*** objects $objs is not portable!"
+ libobjs="$libobjs $objs"
+ fi
+ fi
+
+ if test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test $# -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ libext=al
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ current="$2"
+ revision="$3"
+ age="$4"
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case $revision in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case $age in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test $age -gt $current; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ minor_current=`expr $current + 1`
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ irix | nonstopux)
+ major=`expr $current - $age + 1`
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test $loop != 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=.`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test $loop != 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ verstring="0.0"
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=""
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+ fi
+
+ if test "$mode" != relink; then
+ # Remove our outputs.
+ $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+ $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ for path in $notinst_path; do
+ lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+ deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+ dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+ done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) dlfiles="$dlfiles $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) dlprefiles="$dlprefiles $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ deplibs="$deplibs -framework System"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test $build_libtool_need_lc = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behaviour.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $CC -o conftest conftest.c $deplibs
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which I believe you do not have"
+ echo "*** because a test_compile did reveal that the linker did not use it for"
+ echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occured in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ $rm conftest
+ $CC -o conftest conftest.c $i
+ # Did it work?
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because a test_compile did reveal that the linker did not use this one"
+ echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | ${SED} 10q \
+ | egrep "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ echo "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ echo "*** with $libname and none of the candidates passed a file format test"
+ echo "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check below in file_magic test
+ if eval echo \"$potent_lib\" 2>/dev/null \
+ | ${SED} 10q \
+ | egrep "$match_pattern_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ echo "*** with $libname and none of the candidates passed a file format test"
+ echo "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
+ grep . >/dev/null; then
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ echo "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+
+ if test $allow_undefined = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+ echo "*** it was explicitly requested with -no-undefined,"
+ echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ if test $hardcode_into_libs = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ test -z "$dlname" && dlname=$soname
+
+ lib="$output_objdir/$realname"
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Ensure that we have .o objects for linkers which dislike .lo
+ # (e.g. aix) in case we are running --disable-static
+ for obj in $libobjs; do
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ if test ! -f $xdir/$oldobj; then
+ $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+ $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+ fi
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ eval cmds=\"$export_symbols_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linker_flags="$linker_flags $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ save_deplibs="$deplibs"
+ for conv in $convenience; do
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ if test "$test_deplib" != "$conv"; then
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ fi
+ done
+ deplibs="$tmp_deplibs"
+ done
+ eval cmds=\"$archive_cmds\"
+ deplibs="$save_deplibs"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+ exit 0
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case $output in
+ *.lo)
+ if test -n "$objs$old_deplibs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit 1
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ eval cmds=\"$reload_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > $libobj" || exit $?
+ exit 0
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ eval cmds=\"$reload_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ else
+ # Just create a symlink.
+ $show $rm $libobj
+ $run $rm $libobj
+ xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$libobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ $show "(cd $xdir && $LN_S $oldobj $baseobj)"
+ $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ esac
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ case $host in
+ *darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ ;;
+ esac
+ ;;
+ esac
+
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case $dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$output.exp"
+ $run $rm $export_symbols
+ $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ else
+ $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
+ $run eval 'echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test $need_relink = no || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $run $rm $output
+ # Link the executable and exit
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+ exit 0
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+ case $0 in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*) exeext=.exe ;;
+ *) exeext= ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit 1" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ echo >> $output "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $echo \"\$relink_command_output\" >&2
+ $rm \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 ${SED}
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # win32 systems need to use the prog path for dll
+ # lookup to work
+ *-*-cygwin* | *-*-pw32*)
+ $echo >> $output "\
+ exec \$progdir/\$program \${1+\"\$@\"}
+"
+ ;;
+
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ # Export the path to the program.
+ PATH=\"\$progdir:\$PATH\"
+ export PATH
+
+ exec \$program \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit 0
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ eval cmds=\"$old_archive_from_new_cmds\"
+ else
+ # Ensure that we have .o objects in place in case we decided
+ # not to build a shared library, and have fallen back to building
+ # static libs even though --disable-static was passed!
+ for oldobj in $oldobjs; do
+ if test ! -f $oldobj; then
+ xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$oldobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+ obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+ $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+ fi
+ done
+
+ eval cmds=\"$old_archive_cmds\"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdependency_libs="$newdependency_libs $libdir/$name"
+ ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+ for lib in $dlfiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdlfiles="$newdlfiles $libdir/$name"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $rm $output
+ # place dlname in correct position for cygwin
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test $need_relink = yes; then
+ $echo >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+ ;;
+ esac
+ exit 0
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg="$nonopt"
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest="$arg"
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*) ;;
+
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest="$arg"
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test $# -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ library_names=
+ old_library=
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit 1
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
+ fi
+
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ exit 1
+ fi
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$srcname $destdir/$realname"
+ $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$striplib $destdir/$realname"
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+ if test $# -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ eval cmds=\"$postinstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit 0
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin*|*mingw*)
+ wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+ notinst_deplibs=
+ relink_command=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $wrapper ;;
+ *) . ./$wrapper ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$notinst_deplibs"; then
+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+ exit 1
+ fi
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $wrapper ;;
+ *) . ./$wrapper ;;
+ esac
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+ continue
+ fi
+ file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyways
+ case $install_prog,$host in
+ /usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
+ ;;
+ esac
+ ;;
+ esac
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$old_striplib $oldlib"
+ $run eval "$old_striplib $oldlib" || exit $?
+ fi
+
+ # Do each command in the postinstall commands.
+ eval cmds=\"$old_postinstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $0 --finish$current_libdirs'
+ else
+ exit 0
+ fi
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ eval cmds=\"$finish_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = ":" && exit 0
+
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ echo " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+ echo "See any operating system documentation about shared libraries for"
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ echo "----------------------------------------------------------------------"
+ exit 0
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit 1
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit 1
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved enviroment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit 0
+ fi
+ ;;
+
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
+ rm="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) rm="$rm $arg"; rmforce=yes ;;
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ rmdirs=
+
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$objdir"
+ else
+ objdir="$dir/$objdir"
+ fi
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test $mode = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test $mode = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if (test -L "$file") >/dev/null 2>&1 \
+ || (test -h "$file") >/dev/null 2>&1 \
+ || test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $objdir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+ test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+ if test $mode = uninstall; then
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test $? != 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test $? != 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ fi
+ fi
+ ;;
+
+ *.lo)
+ if test "$build_old_libs" = yes; then
+ oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+ rmfiles="$rmfiles $dir/$oldobj"
+ fi
+ ;;
+
+ *)
+ # Do a test to see if this is a libtool program.
+ if test $mode = clean &&
+ (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$file
+
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ rmfiles="$rmfiles $objdir/lt-$name"
+ fi
+ fi
+ ;;
+ esac
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles || exit_status=1
+ done
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
+ fi
+ done
+
+ exit $exit_status
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$exec_cmd"; then
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+ eval exec $exec_cmd
+ exit 1
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --version print version information
+
+MODE must be one of the following:
+
+ clean remove files from the build directory
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+ exit 0
+ ;;
+
+clean)
+ $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/src/pal/src/libunwind/configure.ac b/src/pal/src/libunwind/configure.ac
new file mode 100644
index 0000000000..0c5125971f
--- /dev/null
+++ b/src/pal/src/libunwind/configure.ac
@@ -0,0 +1,445 @@
+define(pkg_major, 1)
+define(pkg_minor, 3)
+define(pkg_extra, -rc1)
+define(pkg_maintainer, libunwind-devel@nongnu.org)
+define(mkvers, $1.$2$3)
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT([libunwind],[mkvers(pkg_major, pkg_minor, pkg_extra)],[pkg_maintainer])
+AC_CONFIG_SRCDIR(src/mi/backtrace.c)
+AC_CONFIG_AUX_DIR(config)
+AC_CANONICAL_TARGET
+AM_INIT_AUTOMAKE([1.6 subdir-objects])
+AM_MAINTAINER_MODE
+AC_CONFIG_HEADERS([include/config.h])
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+LT_INIT
+AM_PROG_AS
+AM_PROG_CC_C_O
+
+dnl Checks for libraries.
+AC_CHECK_LIB(uca, __uc_get_grs)
+OLD_LIBS=${LIBS}
+AC_SEARCH_LIBS(dlopen, dl)
+LIBS=${OLD_LIBS}
+case "$ac_cv_search_dlopen" in
+ -l*) DLLIB=$ac_cv_search_dlopen;;
+ *) DLLIB="";;
+esac
+
+CHECK_ATOMIC_OPS
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(asm/ptrace_offsets.h endian.h sys/endian.h execinfo.h \
+ ia64intrin.h sys/uc_access.h unistd.h signal.h sys/types.h \
+ sys/procfs.h sys/ptrace.h byteswap.h elf.h sys/elf.h link.h sys/link.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_SIZE_T
+AC_CHECK_SIZEOF(off_t)
+
+CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE"
+
+AC_CHECK_MEMBERS([struct dl_phdr_info.dlpi_subs],,,[#include <link.h>])
+AC_CHECK_TYPES([struct elf_prstatus, struct prstatus], [], [],
+[$ac_includes_default
+#if HAVE_SYS_PROCFS_H
+# include <sys/procfs.h>
+#endif
+])
+
+AC_CHECK_DECLS([PTRACE_POKEUSER, PTRACE_POKEDATA, PTRACE_SETREGSET,
+PTRACE_TRACEME, PTRACE_CONT, PTRACE_SINGLESTEP,
+PTRACE_SYSCALL, PT_IO, PT_GETREGS,
+PT_GETFPREGS, PT_CONTINUE, PT_TRACE_ME,
+PT_STEP, PT_SYSCALL], [], [],
+[$ac_includes_default
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#include <sys/ptrace.h>
+])
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \
+ ttrace mincore)
+
+AC_MSG_CHECKING([if building with AltiVec])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#ifndef __ALTIVEC__
+# error choke
+#endif
+]])], [use_altivec=yes],[use_altivec=no])
+AM_CONDITIONAL(USE_ALTIVEC, [test x$use_altivec = xyes])
+AC_MSG_RESULT([$use_altivec])
+
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#ifndef __powerpc64__
+# error choke
+#endif
+]])], [ppc_bits=64], [ppc_bits=32])
+
+AC_DEFUN([SET_ARCH],[
+ AS_CASE([$1],
+ [aarch64*],[$2=aarch64],
+ [arm*],[$2=arm],
+ [i?86],[$2=x86],
+ [hppa*],[$2=hppa],
+ [mips*],[$2=mips],
+ [powerpc*],[$2=ppc$ppc_bits],
+ [sh*],[$2=sh],
+ [amd64],[$2=x86_64],
+ [tile*],[$2=tilegx],
+ [$2=$1])
+]) dnl SET_ARCH
+
+SET_ARCH([$build_cpu],[build_arch])
+SET_ARCH([$host_cpu],[host_arch])
+SET_ARCH([$target_cpu],[target_arch])
+
+# Check for Android
+AC_MSG_CHECKING([for Android])
+android="no"
+case "$host_os" in
+ *android*)
+ android="yes"
+ AC_MSG_RESULT([yes])
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+esac
+
+AC_ARG_ENABLE(coredump,
+ AS_HELP_STRING([--enable-coredump],[building libunwind-coredump library]),,
+ [AS_CASE([$host_arch], [aarch64*|arm*|mips*|sh*|x86*|tile*], [enable_coredump=yes], [enable_coredump=no])]
+)
+
+AC_MSG_CHECKING([if we should build libunwind-coredump])
+AC_MSG_RESULT([$enable_coredump])
+
+AC_ARG_ENABLE(ptrace,
+ AS_HELP_STRING([--enable-ptrace],[building libunwind-ptrace library]),,
+ [AC_CHECK_HEADER([sys/ptrace.h], [enable_ptrace=yes], [enable_ptrace=no])]
+)
+
+AC_MSG_CHECKING([if we should build libunwind-ptrace])
+AC_MSG_RESULT([$enable_ptrace])
+
+AC_ARG_ENABLE(setjmp,
+ AS_HELP_STRING([--enable-setjmp],[building libunwind-setjmp library]),,
+ [AS_IF([test x$target_arch == x$host_arch], [enable_setjmp=yes], [enable_setjmp=no])]
+)
+
+AC_ARG_ENABLE(documentation,
+ AS_HELP_STRING([--disable-documentation],[Disable generating the man pages]),,
+ [enable_documentation=yes])
+
+AC_ARG_ENABLE(tests,
+ AS_HELP_STRING([--disable-tests],[Disable tests build]),,
+ [enable_tests=yes])
+
+AC_MSG_CHECKING([if we should build libunwind-setjmp])
+AC_MSG_RESULT([$enable_setjmp])
+
+AC_MSG_CHECKING([for build architecture])
+AC_MSG_RESULT([$build_arch])
+AC_MSG_CHECKING([for host architecture])
+AC_MSG_RESULT([$host_arch])
+AC_MSG_CHECKING([for target architecture])
+AC_MSG_RESULT([$target_arch])
+AC_MSG_CHECKING([for target operating system])
+AC_MSG_RESULT([$target_os])
+
+AM_CONDITIONAL(BUILD_COREDUMP, test x$enable_coredump = xyes)
+AM_CONDITIONAL(BUILD_PTRACE, test x$enable_ptrace = xyes)
+AM_CONDITIONAL(BUILD_SETJMP, test x$enable_setjmp = xyes)
+AM_CONDITIONAL(NO_PTRACE_TEST, test x$build_arch != x$host_arch)
+AM_CONDITIONAL(REMOTE_ONLY, test x$target_arch != x$host_arch)
+AM_CONDITIONAL(ARCH_AARCH64, test x$target_arch = xaarch64)
+AM_CONDITIONAL(ARCH_ARM, test x$target_arch = xarm)
+AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64)
+AM_CONDITIONAL(ARCH_HPPA, test x$target_arch = xhppa)
+AM_CONDITIONAL(ARCH_MIPS, test x$target_arch = xmips)
+AM_CONDITIONAL(ARCH_X86, test x$target_arch = xx86)
+AM_CONDITIONAL(ARCH_X86_64, test x$target_arch = xx86_64)
+AM_CONDITIONAL(ARCH_PPC32, test x$target_arch = xppc32)
+AM_CONDITIONAL(ARCH_PPC64, test x$target_arch = xppc64)
+AM_CONDITIONAL(ARCH_SH, test x$target_arch = xsh)
+AM_CONDITIONAL(ARCH_TILEGX, test x$target_arch = xtilegx)
+AM_CONDITIONAL(OS_LINUX, expr x$target_os : xlinux >/dev/null)
+AM_CONDITIONAL(OS_HPUX, expr x$target_os : xhpux >/dev/null)
+AM_CONDITIONAL(OS_FREEBSD, expr x$target_os : xfreebsd >/dev/null)
+AM_CONDITIONAL(OS_QNX, expr x$target_os : xnto-qnx >/dev/null)
+
+AC_MSG_CHECKING([for ELF helper width])
+case "${target_arch}" in
+(arm|hppa|ppc32|x86|sh) use_elf32=yes; AC_MSG_RESULT([32]);;
+(aarch64|ia64|ppc64|x86_64|tilegx) use_elf64=yes; AC_MSG_RESULT([64]);;
+(mips) use_elfxx=yes; AC_MSG_RESULT([xx]);;
+*) AC_MSG_ERROR([Unknown ELF target: ${target_arch}])
+esac
+AM_CONDITIONAL(USE_ELF32, [test x$use_elf32 = xyes])
+AM_CONDITIONAL(USE_ELF64, [test x$use_elf64 = xyes])
+AM_CONDITIONAL(USE_ELFXX, [test x$use_elfxx = xyes])
+
+AC_MSG_CHECKING([whether to include DWARF support])
+if test x$target_arch != xia64; then
+ use_dwarf=yes
+else
+ use_dwarf=no
+fi
+AM_CONDITIONAL(USE_DWARF, [test x$use_dwarf = xyes])
+AC_MSG_RESULT([$use_dwarf])
+
+if test x$target_arch = xppc64; then
+ libdir='${exec_prefix}/lib64'
+ AC_MSG_NOTICE([PowerPC64 detected, lib will be installed ${libdir}]);
+ AC_SUBST([libdir])
+fi
+
+AC_MSG_CHECKING([whether to restrict build to remote support])
+if test x$target_arch != x$host_arch; then
+ CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY"
+ remote_only=yes
+else
+ remote_only=no
+fi
+AC_MSG_RESULT([$remote_only])
+
+AC_MSG_CHECKING([whether to enable debug support])
+AC_ARG_ENABLE(debug,
+AS_HELP_STRING([--enable-debug],[turn on debug support (slows down execution)]))
+if test x$enable_debug = xyes; then
+ CPPFLAGS="${CPPFLAGS} -DDEBUG"
+else
+ CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+fi
+AC_MSG_RESULT([$enable_debug])
+
+AC_MSG_CHECKING([whether to enable C++ exception support])
+AC_ARG_ENABLE(cxx_exceptions,
+AS_HELP_STRING([--enable-cxx-exceptions],[use libunwind to handle C++ exceptions]),,
+[
+# C++ exception handling doesn't work too well on x86
+case $target_arch in
+ x86*) enable_cxx_exceptions=no;;
+ aarch64*) enable_cxx_exceptions=no;;
+ arm*) enable_cxx_exceptions=no;;
+ mips*) enable_cxx_exceptions=no;;
+ tile*) enable_cxx_exceptions=no;;
+ *) enable_cxx_exceptions=yes;;
+esac
+])
+
+AM_CONDITIONAL([SUPPORT_CXX_EXCEPTIONS], [test x$enable_cxx_exceptions = xyes])
+AC_MSG_RESULT([$enable_cxx_exceptions])
+
+AC_MSG_CHECKING([whether to load .debug_frame sections])
+AC_ARG_ENABLE(debug_frame,
+AS_HELP_STRING([--enable-debug-frame],[Load the ".debug_frame" section if available]),, [
+case "${target_arch}" in
+ (arm) enable_debug_frame=yes;;
+ (aarch64) enable_debug_frame=yes;;
+ (*) enable_debug_frame=no;;
+esac])
+if test x$enable_debug_frame = xyes; then
+ AC_DEFINE([CONFIG_DEBUG_FRAME], [], [Enable Debug Frame])
+fi
+AC_MSG_RESULT([$enable_debug_frame])
+
+AC_MSG_CHECKING([whether to block signals during mutex ops])
+AC_ARG_ENABLE(block_signals,
+AS_HELP_STRING([--enable-block-signals],[Block signals before performing mutex operations]),,
+[enable_block_signals=yes])
+if test x$enable_block_signals = xyes; then
+ AC_DEFINE([CONFIG_BLOCK_SIGNALS], [], [Block signals before mutex operations])
+fi
+AC_MSG_RESULT([$enable_block_signals])
+
+AC_MSG_CHECKING([whether to validate memory addresses before use])
+AC_ARG_ENABLE(conservative_checks,
+AS_HELP_STRING([--enable-conservative-checks],[Validate all memory addresses before use]),,
+[enable_conservative_checks=yes])
+if test x$enable_conservative_checks = xyes; then
+ AC_DEFINE(CONSERVATIVE_CHECKS, 1,
+ [Define to 1 if you want every memory access validated])
+fi
+AC_MSG_RESULT([$enable_conservative_checks])
+
+AC_MSG_CHECKING([whether to enable msabi support])
+AC_ARG_ENABLE(msabi_support,
+AS_HELP_STRING([--enable-msabi-support],[Enables support for Microsoft ABI extensions]))
+if test x$enable_msabi_support = xyes; then
+ AC_DEFINE([CONFIG_MSABI_SUPPORT], [], [Support for Microsoft ABI extensions])
+fi
+AC_MSG_RESULT([$enable_msabi_support])
+
+LIBLZMA=
+AC_MSG_CHECKING([whether to support LZMA-compressed symbol tables])
+AC_ARG_ENABLE(minidebuginfo,
+AS_HELP_STRING([--enable-minidebuginfo], [Enables support for LZMA-compressed symbol tables]),, [enable_minidebuginfo=auto])
+AC_MSG_RESULT([$enable_minidebuginfo])
+if test x$enable_minidebuginfo != xno; then
+ AC_CHECK_LIB([lzma], [lzma_mf_is_supported],
+ [LIBLZMA=-llzma
+ AC_DEFINE([HAVE_LZMA], [1], [Define if you have liblzma])
+ enable_minidebuginfo=yes],
+ [if test x$enable_minidebuginfo = xyes; then
+ AC_MSG_FAILURE([liblzma not found])
+ fi])
+fi
+AC_SUBST([LIBLZMA])
+AM_CONDITIONAL(HAVE_LZMA, test x$enable_minidebuginfo = xyes)
+
+AC_MSG_CHECKING([whether to support UNW_CACHE_PER_THREAD])
+AC_ARG_ENABLE([per-thread-cache],
+AS_HELP_STRING([--enable-per-thread-cache], [build with support for UNW_CACHE_PER_THREAD (which imposes a hight TLS memory usage) (default: disabled)]))
+AC_MSG_RESULT([$enable_per_thread_cache])
+AS_IF([test x$enable_per_thread_cache = xyes], [
+ LIBUNWIND___THREAD
+ AS_IF([test x$libc_cv_gcc___thread = xno], [
+ AC_MSG_FAILURE([UNW_CACHE_PER_THREAD requires __thread])
+ ])
+])
+
+AC_MSG_CHECKING([for Intel compiler])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef __INTEL_COMPILER
+#error choke me
+#endif]])],[intel_compiler=yes],[intel_compiler=no])
+
+if test x$GCC = xyes -a x$intel_compiler != xyes; then
+ CFLAGS="${CFLAGS} -fexceptions -Wall -Wsign-compare"
+fi
+AC_MSG_RESULT([$intel_compiler])
+
+AC_MSG_CHECKING([for QCC compiler])
+AS_CASE([$CC], [qcc*|QCC*], [qcc_compiler=yes], [qcc_compiler=no])
+AC_MSG_RESULT([$qcc_compiler])
+
+if test x$intel_compiler = xyes; then
+ AC_MSG_CHECKING([if linker supports -static-libcxa])
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -static-libcxa"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_static_libcxa=yes],[have_static_libcxa=no])
+ LDFLAGS="$save_LDFLAGS"
+ if test "x$have_static_libcxa" = xyes; then
+ LDFLAGS_STATIC_LIBCXA="-XCClinker -static-libcxa"
+ fi
+ AC_MSG_RESULT([$have_static_libcxa])
+fi
+
+if test x$qcc_compiler = xyes; then
+ LDFLAGS_NOSTARTFILES="-XCClinker -Wc,-nostartfiles"
+else
+ LDFLAGS_NOSTARTFILES="-XCClinker -nostartfiles"
+fi
+
+if test x$GCC = xyes -a x$intel_compiler != xyes -a x$qcc_compiler != xyes -a x$android != xyes; then
+ LIBCRTS="-lgcc_s"
+fi
+
+AC_MSG_CHECKING([for __builtin___clear_cache])
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[__builtin___clear_cache(0, 0)]])],
+ [have__builtin___clear_cache=yes],
+ [have__builtin___clear_cache=no])
+if test x$have__builtin___clear_cache = xyes; then
+ AC_DEFINE([HAVE__BUILTIN___CLEAR_CACHE], [1],
+ [Defined if __builtin___clear_cache() is available])
+fi
+AC_MSG_RESULT([$have__builtin___clear_cache])
+
+AC_MSG_CHECKING([for __builtin_unreachable])
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[__builtin_unreachable()]])],
+ [have__builtin_unreachable=yes],
+ [have__builtin_unreachable=no])
+if test x$have__builtin_unreachable = xyes; then
+ AC_DEFINE([HAVE__BUILTIN_UNREACHABLE], [1],
+ [Defined if __builtin_unreachable() is available])
+fi
+AC_MSG_RESULT([$have__builtin_unreachable])
+
+AC_MSG_CHECKING([for __sync atomics])
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[
+ __sync_bool_compare_and_swap((int *)0, 0, 1);
+ __sync_fetch_and_add((int *)0, 1);
+ ]])],
+ [have_sync_atomics=yes],
+ [have_sync_atomics=no])
+if test x$have_sync_atomics = xyes; then
+ AC_DEFINE([HAVE_SYNC_ATOMICS], [1],
+ [Defined if __sync atomics are available])
+fi
+AC_MSG_RESULT([$have_sync_atomics])
+
+CCASFLAGS="${CCASFLAGS} ${CPPFLAGS}"
+
+arch="$target_arch"
+ARCH=`echo $target_arch | tr [a-z] [A-Z]`
+
+dnl create shell variables from the M4 macros:
+PKG_MAJOR=pkg_major
+PKG_MINOR=pkg_minor
+PKG_EXTRA=pkg_extra
+PKG_MAINTAINER=pkg_maintainer
+
+old_LIBS="$LIBS"
+LIBS=""
+AC_SEARCH_LIBS(backtrace, execinfo)
+LIBS="$old_LIBS"
+case "$ac_cv_search_backtrace" in
+ -l*) BACKTRACELIB=$ac_cv_search_backtrace;;
+ *) BACKTRACELIB="";;
+esac
+
+
+AC_SUBST(build_arch)
+AC_SUBST(target_os)
+AC_SUBST(arch)
+AC_SUBST(ARCH)
+AC_SUBST(LDFLAGS_STATIC_LIBCXA)
+AC_SUBST(LDFLAGS_NOSTARTFILES)
+AC_SUBST(LIBCRTS)
+AC_SUBST(PKG_MAJOR)
+AC_SUBST(PKG_MINOR)
+AC_SUBST(PKG_EXTRA)
+AC_SUBST(PKG_MAINTAINER)
+AC_SUBST(enable_cxx_exceptions)
+AC_SUBST(enable_debug_frame)
+AC_SUBST(DLLIB)
+AC_SUBST(BACKTRACELIB)
+
+AC_PATH_PROG([LATEX2MAN],[latex2man])
+if test "x$LATEX2MAN" = "x"; then
+ AC_MSG_WARN([latex2man not found. Install latex2man. Disabling docs.])
+ enable_documentation="no";
+fi
+
+AM_CONDITIONAL([CONFIG_DOCS], [test x$enable_documentation = xyes])
+if test "x$enable_documentation" = "xyes"; then
+ AC_CONFIG_FILES(doc/Makefile doc/common.tex)
+fi
+
+AM_CONDITIONAL([CONFIG_TESTS], [test x$enable_tests = xyes])
+if test "x$enable_tests" = "xyes"; then
+ AC_CONFIG_FILES(tests/Makefile tests/check-namespace.sh)
+fi
+
+AC_CONFIG_FILES(Makefile src/Makefile
+ include/libunwind-common.h
+ include/libunwind.h include/tdep/libunwind_i.h)
+AC_CONFIG_FILES(src/unwind/libunwind.pc src/coredump/libunwind-coredump.pc
+ src/ptrace/libunwind-ptrace.pc src/setjmp/libunwind-setjmp.pc
+ src/libunwind-generic.pc)
+AC_OUTPUT
diff --git a/src/pal/src/libunwind/doc/Makefile.am b/src/pal/src/libunwind/doc/Makefile.am
new file mode 100644
index 0000000000..bfe4669124
--- /dev/null
+++ b/src/pal/src/libunwind/doc/Makefile.am
@@ -0,0 +1,80 @@
+# man pages that go into section 3:
+man3_MANS = libunwind.man libunwind-dynamic.man libunwind-ia64.man \
+ libunwind-ptrace.man libunwind-setjmp.man \
+ unw_apply_reg_state.man \
+ unw_backtrace.man \
+ unw_flush_cache.man \
+ unw_get_accessors.man \
+ unw_get_proc_info.man \
+ unw_get_proc_info_by_ip.man \
+ unw_get_proc_name.man \
+ unw_get_fpreg.man \
+ unw_get_reg.man \
+ unw_getcontext.man \
+ unw_init_local.man unw_init_remote.man \
+ unw_init_local2.man \
+ unw_is_fpreg.man \
+ unw_is_signal_frame.man \
+ unw_create_addr_space.man \
+ unw_destroy_addr_space.man \
+ unw_regname.man unw_resume.man \
+ unw_reg_states_iterate.man \
+ unw_set_caching_policy.man \
+ unw_set_cache_size.man \
+ unw_set_fpreg.man \
+ unw_set_reg.man \
+ unw_step.man \
+ unw_strerror.man \
+ _U_dyn_register.man \
+ _U_dyn_cancel.man
+
+EXTRA_DIST = NOTES libunwind.trans \
+ libunwind.tex libunwind-dynamic.tex libunwind-ia64.tex \
+ libunwind-ptrace.tex libunwind-setjmp.tex \
+ unw_apply_reg_state.tex \
+ unw_backtrace.tex \
+ unw_flush_cache.tex \
+ unw_get_accessors.tex \
+ unw_get_proc_info.tex \
+ unw_get_proc_info_by_ip.tex \
+ unw_get_proc_name.tex \
+ unw_get_fpreg.tex \
+ unw_get_reg.tex \
+ unw_getcontext.tex \
+ unw_init_local.tex unw_init_remote.tex \
+ unw_is_fpreg.tex \
+ unw_is_signal_frame.tex \
+ unw_create_addr_space.tex unw_destroy_addr_space.tex \
+ unw_regname.tex unw_resume.tex unw_set_caching_policy.tex \
+ unw_reg_states_iterate.tex \
+ unw_set_cache_size.tex \
+ unw_set_fpreg.tex \
+ unw_set_reg.tex \
+ unw_step.tex \
+ unw_strerror.tex \
+ _U_dyn_register.tex \
+ _U_dyn_cancel.tex \
+ $(man3_MANS)
+
+L2M = latex2man
+L2P = pdflatex
+L2M_CMD = $(L2M) -t $(srcdir)/libunwind.trans
+L2H_CMD = $(L2M) -H -t $(srcdir)/libunwind.trans
+
+.tex.man:
+ $(L2M_CMD) $< $@
+ -cp $@ $(srcdir)/$@
+
+html:
+ for n in $(man3_MANS); do \
+ page=`basename $$n .man`; \
+ $(L2H_CMD) $(srcdir)/$$page.tex "$$page(3).raw"; \
+ done
+
+pdf:
+ for n in $(man3_MANS); do \
+ page=`basename $$n .man`; \
+ $(L2P) $(srcdir)/$$page.tex "$$page(3).pdf"; \
+ done
+
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/pal/src/libunwind/doc/NOTES b/src/pal/src/libunwind/doc/NOTES
new file mode 100644
index 0000000000..3f3caa95bb
--- /dev/null
+++ b/src/pal/src/libunwind/doc/NOTES
@@ -0,0 +1,127 @@
+The central data structure of the unwind API is the unwind cursor.
+This structure tracks the register contents. The unwind API defines a
+handful of well-known frame "registers":
+
+ - ip: the instruction pointer (pc)
+ - rp: the return pointer (rp, aka "return address" or "return link")
+ - sp: the stack pointer (memory stack pointer, in the case of ia64)
+ - fp: the frame pointer
+ - first_ip: the starting address of the current "procedure"
+ - handler: a pointer to an architecture & language-specific
+ "personality" routine
+ - lsda: a pointer to an architecture & language-specific
+ data-area
+
+The API defines no well-known preserved registers. Each architecture
+can define additional registers as needed. Of course, a portable
+application may only rely on well-known registers. The names for
+preserved registers are defined in the architecture-specific header
+file <unwind-ARCH.h>. For example, to get the IA-64-specific register
+names, an application would do:
+
+ #include <unwind-ia64.h>
+
+The API is designed to handle two primary cases: unwinding within the
+current (local) process and unwinding of another ("remote") process
+(e.g., through ptrace()). In the local case, the initial machine
+state is captured by an unwind context (currently the same as
+ucontext_t). In the remote case, the initial machine state is
+captured by an unwind accessor structure, which provides callback
+routines for reading/writing memory and registers and for obtaining
+unwind information.
+
+Once a cursor has been initialized, you can step through the call
+chain with the unw_step() routine. The frame registers and the
+preserved state can then be accessed with unw_get_reg() or modified
+with unw_set_reg(). For floating-point registers, there are separate
+unw_get_fpreg() and unw_set_fpreg() routines (on some arches, e.g.,
+Alpha, these could be just aliases for unw_{g,s}et_reg()). The
+unw_resume() routine can be used to resume execution at an arbitrary
+point in the call-chain (as identified by an unwind cursor). This is
+intended for exception handling and, at least for now, the intention
+is to support this routine only for the local case. Kevin, if you
+feel gdb could benefit from such a routine, I'd be interested to hear
+about it.
+
+Note that it is perfectly legal to make copies of the unwind cursor.
+This makes it possible, e.g., to obtain an unwind context, modify the
+state in an earlier call frame, and then resume execution at the point
+at which the unwind context was captured.
+
+Here is a quick example of how to use the unwind API to do a simple
+stack trace:
+
+ unw_cursor_t cursor;
+ unw_word_t ip, sp;
+ unw_context_t uc;
+
+ unw_getcontext(&uc);
+ unw_init_local(&cursor, &uc);
+ do
+ {
+ unw_get_reg(&cursor, UNW_REG_IP, &ip);
+ unw_get_reg(&cursor, UNW_REG_SP, &sp);
+ printf ("ip=%016lx sp=%016lx\n", ip, sp);
+ }
+ while (unw_step (&cursor) > 0);
+
+Note that this particular example should work on pretty much any
+architecture, as it doesn't rely on any arch-specific registers.
+
+* Multiarchitecture support
+
+If libunwind is configured for a target other than the local (native)
+host, the library is installed as libunwind-$ARCH, where $ARCH is
+the target architecture name (e.g., ia32, ia64, or alpha). Similarly,
+the header file is installed as libunwind-$ARCH.
+
+With this setup, an application should:
+
+ - include <libunwind.h>, and
+ - link against -lunwind
+
+if the application needs to use the unwinder of the host. An
+application wanting to use the unwinder for a different target (e.g.,
+a cross-debugger) should:
+
+ - include <libunwind-$ARCH.h>, and
+ - link against -lunwind-$ARCH
+
+The global symbols exported by -lunwind-$ARCH are unique such that the
+same application can be linked against the separate unwind libraries
+of multiple targets. However, a single compilation unit can include
+the header file for only one target. For example, foo.c might include
+<libunwind-ia64.h> and bar.c might include <libunwind.h> and the
+entire application would have to be linked against both -lunwind and
+-lunwind-ia64.
+
+Note: the unwind header files of all targets have a common dependency
+on libunwind-common.h. To avoid version conflicts, it is necessary to
+ensure that the unwind libraries for all targets were derived from the
+same release of libunwind. That is, if the unwind library for one
+target is upgraded to a newer version, the libraries for all other
+targets also need to be upgraded.
+
+Note 2: The assumption is that a cross-unwinder can handle all
+interesting flavors of a target. For example, the unwinder for the
+ia64 target is expected to be able to handle both Linux and HP-UX.
+
+* IA-64 Specific Information
+
+Apart from the normal frame-registers, the IA-64 implementation of
+libunwind provides the means to access the current value of the
+register backing store pointer (bsp). One quirk with this
+frame-register is that it corresponds to the address that would be in
+register ar.bsp after flushing the current register stack to the
+backing store (i.e., as if a "flushrs" instruction had been executed).
+Of course, given this value and the contents of the current frame
+marker (CFM), it's easy to calculate the original value of ar.bsp:
+
+ unw_word_t cfm, bsp, bsp_after_flushrs, sof;
+
+ unw_get_reg (&cursor, UNW_IA64_BSP, &bsp_after_flushrs);
+ unw_get_reg (&cursor, UNW_IA64_CFM, &cfm);
+ bsp = ia64_rse_skip_regs (bsp_after_flushrs, -(cfm & 0x7f));
+
+** Dynamic Unwind Info
+
diff --git a/src/pal/src/libunwind/doc/_U_dyn_cancel.man b/src/pal/src/libunwind/doc/_U_dyn_cancel.man
new file mode 100644
index 0000000000..a420a6deaf
--- /dev/null
+++ b/src/pal/src/libunwind/doc/_U_dyn_cancel.man
@@ -0,0 +1,66 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "\\_U\\_DYN\\_CANCEL" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+_U_dyn_cancel
+\-\- cancel unwind\-info for dynamically generated code
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+void
+_U_dyn_cancel(unw_dyn_info_t *di);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The _U_dyn_cancel()
+routine cancels the registration of the
+unwind\-info for a dynamically generated procedure. Argument di
+is the pointer to the unw_dyn_info_t
+structure that
+describes the procedure\&'s unwind\-info.
+.PP
+The _U_dyn_cancel()
+routine is guaranteed to execute in
+constant time (in the absence of contention from concurrent calls to
+_U_dyn_register()
+or _U_dyn_cancel()).
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+_U_dyn_cancel()
+is thread\-safe but \fInot\fP
+safe to use
+from a signal handler.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind\-dynamic(3),
+_U_dyn_register(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/_U_dyn_cancel.tex b/src/pal/src/libunwind/doc/_U_dyn_cancel.tex
new file mode 100644
index 0000000000..ca5a12a76e
--- /dev/null
+++ b/src/pal/src/libunwind/doc/_U_dyn_cancel.tex
@@ -0,0 +1,46 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{\_U\_dyn\_cancel}{David Mosberger-Tang}{Programming Library}{\_U\_dyn\_cancel}\_U\_dyn\_cancel -- cancel unwind-info for dynamically generated code
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{void} \Func{\_U\_dyn\_cancel}(\Type{unw\_dyn\_info\_t~*}\Var{di});\\
+
+\section{Description}
+
+The \Func{\_U\_dyn\_cancel}() routine cancels the registration of the
+unwind-info for a dynamically generated procedure. Argument \Var{di}
+is the pointer to the \Type{unw\_dyn\_info\_t} structure that
+describes the procedure's unwind-info.
+
+The \Func{\_U\_dyn\_cancel}() routine is guaranteed to execute in
+constant time (in the absence of contention from concurrent calls to
+\Func{\_U\_dyn\_register}() or \Func{\_U\_dyn\_cancel}()).
+
+
+\section{Thread and Signal Safety}
+
+\Func{\_U\_dyn\_cancel}() is thread-safe but \emph{not} safe to use
+from a signal handler.
+
+\section{See Also}
+
+\SeeAlso{libunwind-dynamic(3)}, \SeeAlso{\_U\_dyn\_register(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/_U_dyn_register.man b/src/pal/src/libunwind/doc/_U_dyn_register.man
new file mode 100644
index 0000000000..107e5fd0e1
--- /dev/null
+++ b/src/pal/src/libunwind/doc/_U_dyn_register.man
@@ -0,0 +1,68 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "\\_U\\_DYN\\_REGISTER" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+_U_dyn_register
+\-\- register unwind\-info for dynamically generated code
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+void
+_U_dyn_register(unw_dyn_info_t *di);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The _U_dyn_register()
+routine registers unwind\-info for a
+dynamically generated procedure. The procedure\&'s unwind\-info is
+described by a structure of type unw_dyn_info_t
+(see
+libunwind\-dynamic(3)).
+A pointer to this structure is
+passed in argument di\&.
+.PP
+The _U_dyn_register()
+routine is guaranteed to execute in
+constant time (in the absence of contention from concurrent calls to
+_U_dyn_register()
+or _U_dyn_cancel()).
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+_U_dyn_register()
+is thread\-safe but \fInot\fP
+safe to use
+from a signal handler.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind\-dynamic(3),
+_U_dyn_cancel(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/_U_dyn_register.tex b/src/pal/src/libunwind/doc/_U_dyn_register.tex
new file mode 100644
index 0000000000..ab23b5c621
--- /dev/null
+++ b/src/pal/src/libunwind/doc/_U_dyn_register.tex
@@ -0,0 +1,47 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{\_U\_dyn\_register}{David Mosberger-Tang}{Programming Library}{\_U\_dyn\_register}\_U\_dyn\_register -- register unwind-info for dynamically generated code
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{void} \Func{\_U\_dyn\_register}(\Type{unw\_dyn\_info\_t~*}\Var{di});\\
+
+\section{Description}
+
+The \Func{\_U\_dyn\_register}() routine registers unwind-info for a
+dynamically generated procedure. The procedure's unwind-info is
+described by a structure of type \Type{unw\_dyn\_info\_t} (see
+\SeeAlso{libunwind-dynamic(3)}). A pointer to this structure is
+passed in argument \Var{di}.
+
+The \Func{\_U\_dyn\_register}() routine is guaranteed to execute in
+constant time (in the absence of contention from concurrent calls to
+\Func{\_U\_dyn\_register}() or \Func{\_U\_dyn\_cancel}()).
+
+
+\section{Thread and Signal Safety}
+
+\Func{\_U\_dyn\_register}() is thread-safe but \emph{not} safe to use
+from a signal handler.
+
+\section{See Also}
+
+\SeeAlso{libunwind-dynamic(3)}, \SeeAlso{\_U\_dyn\_cancel(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/common.tex.in b/src/pal/src/libunwind/doc/common.tex.in
new file mode 100644
index 0000000000..91c96a9df4
--- /dev/null
+++ b/src/pal/src/libunwind/doc/common.tex.in
@@ -0,0 +1,11 @@
+\setVersion{@VERSION@}
+
+\sloppy
+
+\newcommand{\Lt}{\symbol{"3C}}
+\newcommand{\Gt}{\symbol{"3E}}
+\newcommand{\Type}[1]{\File{#1}} % see libunwind.trans
+\newcommand{\Func}[1]{\Prog{#1}} % see libunwind.trans
+\newcommand{\Var}[1]{\Prog{#1}} % see libunwind.trans
+\newcommand{\Const}[1]{\File{#1}} % see libunwind.trans
+\newcommand{\SeeAlso}[2]{\File{#1}} % see libunwind.trans
diff --git a/src/pal/src/libunwind/doc/libunwind-dynamic.man b/src/pal/src/libunwind/doc/libunwind-dynamic.man
new file mode 100644
index 0000000000..7c7507cb10
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind-dynamic.man
@@ -0,0 +1,538 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "LIBUNWIND\-DYNAMIC" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+libunwind\-dynamic
+\-\- libunwind\-support for runtime\-generated code
+.PP
+.SH INTRODUCTION
+
+.PP
+For libunwind
+to do its job, it needs to be able to reconstruct
+the \fIframe state\fP
+of each frame in a call\-chain. The frame state
+describes the subset of the machine\-state that consists of the
+\fIframe registers\fP
+(typically the instruction\-pointer and the
+stack\-pointer) and all callee\-saved registers (preserved registers).
+The frame state describes each register either by providing its
+current value (for frame registers) or by providing the location at
+which the current value is stored (callee\-saved registers).
+.PP
+For statically generated code, the compiler normally takes care of
+emitting \fIunwind\-info\fP
+which provides the minimum amount of
+information needed to reconstruct the frame\-state for each instruction
+in a procedure. For dynamically generated code, the runtime code
+generator must use the dynamic unwind\-info interface provided by
+libunwind
+to supply the equivalent information. This manual
+page describes the format of this information in detail.
+.PP
+For the purpose of this discussion, a \fIprocedure\fP
+is defined to
+be an arbitrary piece of \fIcontiguous\fP
+code. Normally, each
+procedure directly corresponds to a function in the source\-language
+but this is not strictly required. For example, a runtime
+code\-generator could translate a given function into two separate
+(discontiguous) procedures: one for frequently\-executed (hot) code and
+one for rarely\-executed (cold) code. Similarly, simple
+source\-language functions (usually leaf functions) may get translated
+into code for which the default unwind\-conventions apply and for such
+code, it is not strictly necessary to register dynamic unwind\-info.
+.PP
+A procedure logically consists of a sequence of \fIregions\fP\&.
+Regions are nested in the sense that the frame state at the end of one
+region is, by default, assumed to be the frame state for the next
+region. Each region is thought of as being divided into a
+\fIprologue\fP,
+a \fIbody\fP,
+and an \fIepilogue\fP\&.
+Each of them
+can be empty. If non\-empty, the prologue sets up the frame state for
+the body. For example, the prologue may need to allocate some space
+on the stack and save certain callee\-saved registers. The body
+performs the actual work of the procedure but does not change the
+frame state in any way. If non\-empty, the epilogue restores the
+previous frame state and as such it undoes or cancels the effect of
+the prologue. In fact, a single epilogue may undo the effect of the
+prologues of several (nested) regions.
+.PP
+We should point out that even though the prologue, body, and epilogue
+are logically separate entities, optimizing code\-generators will
+generally interleave instructions from all three entities. For this
+reason, the dynamic unwind\-info interface of libunwind
+makes no
+distinction whatsoever between prologue and body. Similarly, the
+exact set of instructions that make up an epilogue is also irrelevant.
+The only point in the epilogue that needs to be described explicitly
+by the dynamic unwind\-info is the point at which the stack\-pointer
+gets restored. The reason this point needs to be described is that
+once the stack\-pointer is restored, all values saved in the
+deallocated portion of the stack frame become invalid and hence
+libunwind
+needs to know about it. The portion of the frame
+state not saved on the stack is assume to remain valid through the end
+of the region. For this reason, there is usually no need to describe
+instructions which restore the contents of callee\-saved registers.
+.PP
+Within a region, each instruction that affects the frame state in some
+fashion needs to be described with an operation descriptor. For this
+purpose, each instruction in the region is assigned a unique index.
+Exactly how this index is derived depends on the architecture. For
+example, on RISC and EPIC\-style architecture, instructions have a
+fixed size so it\&'s possible to simply number the instructions. In
+contrast, most CISC use variable\-length instruction encodings, so it
+is usually necessary to use a byte\-offset as the index. Given the
+instruction index, the operation descriptor specifies the effect of
+the instruction in an abstract manner. For example, it might express
+that the instruction stores calle\-saved register r1
+at offset 16
+in the stack frame.
+.PP
+.SH PROCEDURES
+
+.PP
+A runtime code\-generator registers the dynamic unwind\-info of a
+procedure by setting up a structure of type unw_dyn_info_t
+and calling _U_dyn_register(),
+passing the address of the
+structure as the sole argument. The members of the
+unw_dyn_info_t
+structure are described below:
+.TP
+void *next
+ Private to libunwind\&.
+Must not be used
+by the application.
+.TP
+void *prev
+ Private to libunwind\&.
+Must not be used
+by the application.
+.TP
+unw_word_t start_ip
+ The start\-address of the
+instructions of the procedure (remember: procedure are defined to be
+contiguous pieces of code, so a single code\-range is sufficient).
+.TP
+unw_word_t end_ip
+ The end\-address of the
+instructions of the procedure (non\-inclusive, that is,
+end_ip\-start_ip
+is the size of the procedure in
+bytes).
+.TP
+unw_word_t gp
+ The global\-pointer value in use
+for this procedure. The exact meaing of the global\-pointer is
+architecture\-specific and on some architecture, it is not used at
+all.
+.TP
+int32_t format
+ The format of the unwind\-info.
+This member can be one of UNW_INFO_FORMAT_DYNAMIC,
+UNW_INFO_FORMAT_TABLE,
+or
+UNW_INFO_FORMAT_REMOTE_TABLE\&.
+.TP
+union u
+ This union contains one sub\-member
+structure for every possible unwind\-info format:
+.RS
+.TP
+unw_dyn_proc_info_t pi
+ This member is used
+for format UNW_INFO_FORMAT_DYNAMIC\&.
+.TP
+unw_dyn_table_info_t ti
+ This member is used
+for format UNW_INFO_FORMAT_TABLE\&.
+.TP
+unw_dyn_remote_table_info_t rti
+ This member
+is used for format UNW_INFO_FORMAT_REMOTE_TABLE\&.
+.RE
+.RS
+.PP
+The format of these sub\-members is described in detail below.
+.RE
+.PP
+.SS PROC\-INFO FORMAT
+.PP
+This is the preferred dynamic unwind\-info format and it is generally
+the one used by full\-blown runtime code\-generators. In this format,
+the details of a procedure are described by a structure of type
+unw_dyn_proc_info_t\&.
+This structure contains the following
+members:
+.PP
+.RE
+.TP
+unw_word_t name_ptr
+ The address of a
+(human\-readable) name of the procedure or 0 if no such name is
+available. If non\-zero, The string stored at this address must be
+ASCII NUL terminated. For source languages that use name\-mangling
+(such as C++ or Java) the string stored at this address should be
+the \fIdemangled\fP
+version of the name.
+.PP
+.TP
+unw_word_t handler
+ The address of the
+personality\-routine for this procedure. Personality\-routines are
+used in conjunction with exception handling. See the C++ ABI draft
+(http://www.codesourcery.com/cxx\-abi/) for an overview and a
+description of the personality routine. If the procedure has no
+personality routine, handler
+must be set to 0.
+.PP
+.TP
+uint32_t flags
+ A bitmask of flags. At the
+moment, no flags have been defined and this member must be
+set to 0.
+.PP
+.TP
+unw_dyn_region_info_t *regions
+ A NULL\-terminated
+linked list of region\-descriptors. See section ``Region
+descriptors\&'' below for more details.
+.PP
+.SS TABLE\-INFO FORMAT
+.PP
+This format is generally used when the dynamically generated code was
+derived from static code and the unwind\-info for the dynamic and the
+static versions is identical. For example, this format can be useful
+when loading statically\-generated code into an address\-space in a
+non\-standard fashion (i.e., through some means other than
+dlopen()).
+In this format, the details of a group of procedures
+is described by a structure of type unw_dyn_table_info\&.
+This structure contains the following members:
+.PP
+.TP
+unw_word_t name_ptr
+ The address of a
+(human\-readable) name of the procedure or 0 if no such name is
+available. If non\-zero, The string stored at this address must be
+ASCII NUL terminated. For source languages that use name\-mangling
+(such as C++ or Java) the string stored at this address should be
+the \fIdemangled\fP
+version of the name.
+.PP
+.TP
+unw_word_t segbase
+ The segment\-base value
+that needs to be added to the segment\-relative values stored in the
+unwind\-info. The exact meaning of this value is
+architecture\-specific.
+.PP
+.TP
+unw_word_t table_len
+ The length of the
+unwind\-info (table_data)
+counted in units of words
+(unw_word_t).
+.PP
+.TP
+unw_word_t table_data
+ A pointer to the actual
+data encoding the unwind\-info. The exact format is
+architecture\-specific (see architecture\-specific sections below).
+.PP
+.SS REMOTE TABLE\-INFO FORMAT
+.PP
+The remote table\-info format has the same basic purpose as the regular
+table\-info format. The only difference is that when libunwind
+uses the unwind\-info, it will keep the table data in the target
+address\-space (which may be remote). Consequently, the type of the
+table_data
+member is unw_word_t
+rather than a pointer.
+This implies that libunwind
+will have to access the table\-data
+via the address\-space\&'s access_mem()
+call\-back, rather than
+through a direct memory reference.
+.PP
+From the point of view of a runtime\-code generator, the remote
+table\-info format offers no advantage and it is expected that such
+generators will describe their procedures either with the proc\-info
+format or the normal table\-info format. The main reason that the
+remote table\-info format exists is to enable the
+address\-space\-specific find_proc_info()
+callback (see
+unw_create_addr_space(3))
+to return unwind tables whose
+data remains in remote memory. This can speed up unwinding (e.g., for
+a debugger) because it reduces the amount of data that needs to be
+loaded from remote memory.
+.PP
+.SH REGIONS DESCRIPTORS
+
+.PP
+A region descriptor is a variable length structure that describes how
+each instruction in the region affects the frame state. Of course,
+most instructions in a region usualy do not change the frame state and
+for those, nothing needs to be recorded in the region descriptor. A
+region descriptor is a structure of type
+unw_dyn_region_info_t
+and has the following members:
+.TP
+unw_dyn_region_info_t *next
+ A pointer to the
+next region. If this is the last region, next
+is NULL\&.
+.TP
+int32_t insn_count
+ The length of the region in
+instructions. Each instruction is assumed to have a fixed size (see
+architecture\-specific sections for details). The value of
+insn_count
+may be negative in the last region of a procedure
+(i.e., it may be negative only if next
+is NULL).
+A
+negative value indicates that the region covers the last \fIN\fP
+instructions of the procedure, where \fIN\fP
+is the absolute value
+of insn_count\&.
+.TP
+uint32_t op_count
+ The (allocated) length of
+the op_count
+array.
+.TP
+unw_dyn_op_t op
+ An array of dynamic unwind
+directives. See Section ``Dynamic unwind directives\&'' for a
+description of the directives.
+.PP
+A region descriptor with an insn_count
+of zero is an
+\fIempty region\fP
+and such regions are perfectly legal. In fact,
+empty regions can be useful to establish a particular frame state
+before the start of another region.
+.PP
+A single region list can be shared across multiple procedures provided
+those procedures share a common prologue and epilogue (their bodies
+may differ, of course). Normally, such procedures consist of a canned
+prologue, the body, and a canned epilogue. This could be described by
+two regions: one covering the prologue and one covering the epilogue.
+Since the body length is variable, the latter region would need to
+specify a negative value in insn_count
+such that
+libunwind
+knows that the region covers the end of the procedure
+(up to the address specified by end_ip).
+.PP
+The region descriptor is a variable length structure to make it
+possible to allocate all the necessary memory with a single
+memory\-allocation request. To facilitate the allocation of a region
+descriptors libunwind
+provides a helper routine with the
+following synopsis:
+.PP
+size_t
+_U_dyn_region_size(int
+op_count);
+.PP
+This routine returns the number of bytes needed to hold a region
+descriptor with space for op_count
+unwind directives. Note
+that the length of the op
+array does not have to match exactly
+with the number of directives in a region. Instead, it is sufficient
+if the op
+array contains at least as many entries as there are
+directives, since the end of the directives can always be indicated
+with the UNW_DYN_STOP
+directive.
+.PP
+.SH DYNAMIC UNWIND DIRECTIVES
+
+.PP
+A dynamic unwind directive describes how the frame state changes
+at a particular point within a region. The description is in
+the form of a structure of type unw_dyn_op_t\&.
+This
+structure has the following members:
+.TP
+int8_t tag
+ The operation tag. Must be one
+of the unw_dyn_operation_t
+values described below.
+.TP
+int8_t qp
+ The qualifying predicate that controls
+whether or not this directive is active. This is useful for
+predicated architecturs such as IA\-64 or ARM, where the contents of
+another (callee\-saved) register determines whether or not an
+instruction is executed (takes effect). If the directive is always
+active, this member should be set to the manifest constant
+_U_QP_TRUE
+(this constant is defined for all
+architectures, predicated or not).
+.TP
+int16_t reg
+ The number of the register affected
+by the instruction.
+.TP
+int32_t when
+ The region\-relative number of
+the instruction to which this directive applies. For example,
+a value of 0 means that the effect described by this directive
+has taken place once the first instruction in the region has
+executed.
+.TP
+unw_word_t val
+ The value to be applied by the
+operation tag. The exact meaning of this value varies by tag. See
+Section ``Operation tags\&'' below.
+.PP
+It is perfectly legitimate to specify multiple dynamic unwind
+directives with the same when
+value, if a particular instruction
+has a complex effect on the frame state.
+.PP
+Empty regions by definition contain no actual instructions and as such
+the directives are not tied to a particular instruction. By
+convention, the when
+member should be set to 0, however.
+.PP
+There is no need for the dynamic unwind directives to appear
+in order of increasing when
+values. If the directives happen to
+be sorted in that order, it may result in slightly faster execution,
+but a runtime code\-generator should not go to extra lengths just to
+ensure that the directives are sorted.
+.PP
+IMPLEMENTATION NOTE: should libunwind
+implementations for
+certain architectures prefer the list of unwind directives to be
+sorted, it is recommended that such implementations first check
+whether the list happens to be sorted already and, if not, sort the
+directives explicitly before the first use. With this approach, the
+overhead of explicit sorting is only paid when there is a real benefit
+and if the runtime code\-generator happens to generated sorted lists
+naturally, the performance penalty is limited to a simple O(N) check.
+.PP
+.SS OPERATIONS TAGS
+.PP
+The possible operation tags are defined by enumeration type
+unw_dyn_operation_t
+which defines the following
+values:
+.PP
+.TP
+UNW_DYN_STOP
+ Marks the end of the dynamic unwind
+directive list. All remaining entries in the op
+array of the
+region\-descriptor are ignored. This tag is guaranteed to have a
+value of 0.
+.PP
+.TP
+UNW_DYN_SAVE_REG
+ Marks an instruction which saves
+register reg
+to register val\&.
+.PP
+.TP
+UNW_DYN_SPILL_FP_REL
+ Marks an instruction which
+spills register reg
+to a frame\-pointer\-relative location. The
+frame\-pointer\-relative offset is given by the value stored in member
+val\&.
+See the architecture\-specific sections for a description
+of the stack frame layout.
+.PP
+.TP
+UNW_DYN_SPILL_SP_REL
+ Marks an instruction which
+spills register reg
+to a stack\-pointer\-relative location. The
+stack\-pointer\-relative offset is given by the value stored in member
+val\&.
+See the architecture\-specific sections for a description
+of the stack frame layout.
+.PP
+.TP
+UNW_DYN_ADD
+ Marks an instruction which adds
+the constant value val
+to register reg\&.
+To add subtract
+a constant value, store the two\&'s\-complement of the value in
+val\&.
+The set of registers that can be specified for this tag
+is described in the architecture\-specific sections below.
+.PP
+.TP
+UNW_DYN_POP_FRAMES
+ .PP
+.TP
+UNW_DYN_LABEL_STATE
+ .PP
+.TP
+UNW_DYN_COPY_STATE
+ .PP
+.TP
+UNW_DYN_ALIAS
+ .PP
+unw_dyn_op_t
+.PP
+_U_dyn_op_save_reg();
+_U_dyn_op_spill_fp_rel();
+_U_dyn_op_spill_sp_rel();
+_U_dyn_op_add();
+_U_dyn_op_pop_frames();
+_U_dyn_op_label_state();
+_U_dyn_op_copy_state();
+_U_dyn_op_alias();
+_U_dyn_op_stop();
+.PP
+.SH IA\-64 SPECIFICS
+
+.PP
+\- meaning of segbase member in table\-info/table\-remote\-info format
+\- format of table_data in table\-info/table\-remote\-info format
+\- instruction size: each bundle is counted as 3 instructions, regardless
+of template (MLX)
+\- describe stack\-frame layout, especially with regards to sp\-relative
+and fp\-relative addressing
+\- UNW_DYN_ADD can only add to ``sp\&'' (always a negative value); use
+POP_FRAMES otherwise
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+_U_dyn_register(3),
+_U_dyn_cancel(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/libunwind-dynamic.tex b/src/pal/src/libunwind/doc/libunwind-dynamic.tex
new file mode 100644
index 0000000000..21e895a34f
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind-dynamic.tex
@@ -0,0 +1,401 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{libunwind-dynamic}{David Mosberger-Tang}{Programming Library}{Introduction to dynamic unwind-info}libunwind-dynamic -- libunwind-support for runtime-generated code
+\end{Name}
+
+\section{Introduction}
+
+For \Prog{libunwind} to do its job, it needs to be able to reconstruct
+the \emph{frame state} of each frame in a call-chain. The frame state
+describes the subset of the machine-state that consists of the
+\emph{frame registers} (typically the instruction-pointer and the
+stack-pointer) and all callee-saved registers (preserved registers).
+The frame state describes each register either by providing its
+current value (for frame registers) or by providing the location at
+which the current value is stored (callee-saved registers).
+
+For statically generated code, the compiler normally takes care of
+emitting \emph{unwind-info} which provides the minimum amount of
+information needed to reconstruct the frame-state for each instruction
+in a procedure. For dynamically generated code, the runtime code
+generator must use the dynamic unwind-info interface provided by
+\Prog{libunwind} to supply the equivalent information. This manual
+page describes the format of this information in detail.
+
+For the purpose of this discussion, a \emph{procedure} is defined to
+be an arbitrary piece of \emph{contiguous} code. Normally, each
+procedure directly corresponds to a function in the source-language
+but this is not strictly required. For example, a runtime
+code-generator could translate a given function into two separate
+(discontiguous) procedures: one for frequently-executed (hot) code and
+one for rarely-executed (cold) code. Similarly, simple
+source-language functions (usually leaf functions) may get translated
+into code for which the default unwind-conventions apply and for such
+code, it is not strictly necessary to register dynamic unwind-info.
+
+A procedure logically consists of a sequence of \emph{regions}.
+Regions are nested in the sense that the frame state at the end of one
+region is, by default, assumed to be the frame state for the next
+region. Each region is thought of as being divided into a
+\emph{prologue}, a \emph{body}, and an \emph{epilogue}. Each of them
+can be empty. If non-empty, the prologue sets up the frame state for
+the body. For example, the prologue may need to allocate some space
+on the stack and save certain callee-saved registers. The body
+performs the actual work of the procedure but does not change the
+frame state in any way. If non-empty, the epilogue restores the
+previous frame state and as such it undoes or cancels the effect of
+the prologue. In fact, a single epilogue may undo the effect of the
+prologues of several (nested) regions.
+
+We should point out that even though the prologue, body, and epilogue
+are logically separate entities, optimizing code-generators will
+generally interleave instructions from all three entities. For this
+reason, the dynamic unwind-info interface of \Prog{libunwind} makes no
+distinction whatsoever between prologue and body. Similarly, the
+exact set of instructions that make up an epilogue is also irrelevant.
+The only point in the epilogue that needs to be described explicitly
+by the dynamic unwind-info is the point at which the stack-pointer
+gets restored. The reason this point needs to be described is that
+once the stack-pointer is restored, all values saved in the
+deallocated portion of the stack frame become invalid and hence
+\Prog{libunwind} needs to know about it. The portion of the frame
+state not saved on the stack is assume to remain valid through the end
+of the region. For this reason, there is usually no need to describe
+instructions which restore the contents of callee-saved registers.
+
+Within a region, each instruction that affects the frame state in some
+fashion needs to be described with an operation descriptor. For this
+purpose, each instruction in the region is assigned a unique index.
+Exactly how this index is derived depends on the architecture. For
+example, on RISC and EPIC-style architecture, instructions have a
+fixed size so it's possible to simply number the instructions. In
+contrast, most CISC use variable-length instruction encodings, so it
+is usually necessary to use a byte-offset as the index. Given the
+instruction index, the operation descriptor specifies the effect of
+the instruction in an abstract manner. For example, it might express
+that the instruction stores calle-saved register \Var{r1} at offset 16
+in the stack frame.
+
+\section{Procedures}
+
+A runtime code-generator registers the dynamic unwind-info of a
+procedure by setting up a structure of type \Type{unw\_dyn\_info\_t}
+and calling \Func{\_U\_dyn\_register}(), passing the address of the
+structure as the sole argument. The members of the
+\Type{unw\_dyn\_info\_t} structure are described below:
+\begin{itemize}
+\item[\Type{void~*}next] Private to \Prog{libunwind}. Must not be used
+ by the application.
+\item[\Type{void~*}prev] Private to \Prog{libunwind}. Must not be used
+ by the application.
+\item[\Type{unw\_word\_t} \Var{start\_ip}] The start-address of the
+ instructions of the procedure (remember: procedure are defined to be
+ contiguous pieces of code, so a single code-range is sufficient).
+\item[\Type{unw\_word\_t} \Var{end\_ip}] The end-address of the
+ instructions of the procedure (non-inclusive, that is,
+ \Var{end\_ip}-\Var{start\_ip} is the size of the procedure in
+ bytes).
+\item[\Type{unw\_word\_t} \Var{gp}] The global-pointer value in use
+ for this procedure. The exact meaing of the global-pointer is
+ architecture-specific and on some architecture, it is not used at
+ all.
+\item[\Type{int32\_t} \Var{format}] The format of the unwind-info.
+ This member can be one of \Const{UNW\_INFO\_FORMAT\_DYNAMIC},
+ \Const{UNW\_INFO\_FORMAT\_TABLE}, or
+ \Const{UNW\_INFO\_FORMAT\_REMOTE\_TABLE}.
+\item[\Type{union} \Var{u}] This union contains one sub-member
+ structure for every possible unwind-info format:
+ \begin{description}
+ \item[\Type{unw\_dyn\_proc\_info\_t} \Var{pi}] This member is used
+ for format \Const{UNW\_INFO\_FORMAT\_DYNAMIC}.
+ \item[\Type{unw\_dyn\_table\_info\_t} \Var{ti}] This member is used
+ for format \Const{UNW\_INFO\_FORMAT\_TABLE}.
+ \item[\Type{unw\_dyn\_remote\_table\_info\_t} \Var{rti}] This member
+ is used for format \Const{UNW\_INFO\_FORMAT\_REMOTE\_TABLE}.
+ \end{description}\
+ The format of these sub-members is described in detail below.
+\end{itemize}
+
+\subsection{Proc-info format}
+
+This is the preferred dynamic unwind-info format and it is generally
+the one used by full-blown runtime code-generators. In this format,
+the details of a procedure are described by a structure of type
+\Type{unw\_dyn\_proc\_info\_t}. This structure contains the following
+members:
+\begin{description}
+
+\item[\Type{unw\_word\_t} \Var{name\_ptr}] The address of a
+ (human-readable) name of the procedure or 0 if no such name is
+ available. If non-zero, The string stored at this address must be
+ ASCII NUL terminated. For source languages that use name-mangling
+ (such as C++ or Java) the string stored at this address should be
+ the \emph{demangled} version of the name.
+
+\item[\Type{unw\_word\_t} \Var{handler}] The address of the
+ personality-routine for this procedure. Personality-routines are
+ used in conjunction with exception handling. See the C++ ABI draft
+ (http://www.codesourcery.com/cxx-abi/) for an overview and a
+ description of the personality routine. If the procedure has no
+ personality routine, \Var{handler} must be set to 0.
+
+\item[\Type{uint32\_t} \Var{flags}] A bitmask of flags. At the
+ moment, no flags have been defined and this member must be
+ set to 0.
+
+\item[\Type{unw\_dyn\_region\_info\_t~*}\Var{regions}] A NULL-terminated
+ linked list of region-descriptors. See section ``Region
+ descriptors'' below for more details.
+
+\end{description}
+
+\subsection{Table-info format}
+
+This format is generally used when the dynamically generated code was
+derived from static code and the unwind-info for the dynamic and the
+static versions is identical. For example, this format can be useful
+when loading statically-generated code into an address-space in a
+non-standard fashion (i.e., through some means other than
+\Func{dlopen}()). In this format, the details of a group of procedures
+is described by a structure of type \Type{unw\_dyn\_table\_info}.
+This structure contains the following members:
+\begin{description}
+
+\item[\Type{unw\_word\_t} \Var{name\_ptr}] The address of a
+ (human-readable) name of the procedure or 0 if no such name is
+ available. If non-zero, The string stored at this address must be
+ ASCII NUL terminated. For source languages that use name-mangling
+ (such as C++ or Java) the string stored at this address should be
+ the \emph{demangled} version of the name.
+
+\item[\Type{unw\_word\_t} \Var{segbase}] The segment-base value
+ that needs to be added to the segment-relative values stored in the
+ unwind-info. The exact meaning of this value is
+ architecture-specific.
+
+\item[\Type{unw\_word\_t} \Var{table\_len}] The length of the
+ unwind-info (\Var{table\_data}) counted in units of words
+ (\Type{unw\_word\_t}).
+
+\item[\Type{unw\_word\_t} \Var{table\_data}] A pointer to the actual
+ data encoding the unwind-info. The exact format is
+ architecture-specific (see architecture-specific sections below).
+
+\end{description}
+
+\subsection{Remote table-info format}
+
+The remote table-info format has the same basic purpose as the regular
+table-info format. The only difference is that when \Prog{libunwind}
+uses the unwind-info, it will keep the table data in the target
+address-space (which may be remote). Consequently, the type of the
+\Var{table\_data} member is \Type{unw\_word\_t} rather than a pointer.
+This implies that \Prog{libunwind} will have to access the table-data
+via the address-space's \Func{access\_mem}() call-back, rather than
+through a direct memory reference.
+
+From the point of view of a runtime-code generator, the remote
+table-info format offers no advantage and it is expected that such
+generators will describe their procedures either with the proc-info
+format or the normal table-info format. The main reason that the
+remote table-info format exists is to enable the
+address-space-specific \Func{find\_proc\_info}() callback (see
+\SeeAlso{unw\_create\_addr\_space}(3)) to return unwind tables whose
+data remains in remote memory. This can speed up unwinding (e.g., for
+a debugger) because it reduces the amount of data that needs to be
+loaded from remote memory.
+
+\section{Regions descriptors}
+
+A region descriptor is a variable length structure that describes how
+each instruction in the region affects the frame state. Of course,
+most instructions in a region usualy do not change the frame state and
+for those, nothing needs to be recorded in the region descriptor. A
+region descriptor is a structure of type
+\Type{unw\_dyn\_region\_info\_t} and has the following members:
+\begin{description}
+\item[\Type{unw\_dyn\_region\_info\_t~*}\Var{next}] A pointer to the
+ next region. If this is the last region, \Var{next} is \Const{NULL}.
+\item[\Type{int32\_t} \Var{insn\_count}] The length of the region in
+ instructions. Each instruction is assumed to have a fixed size (see
+ architecture-specific sections for details). The value of
+ \Var{insn\_count} may be negative in the last region of a procedure
+ (i.e., it may be negative only if \Var{next} is \Const{NULL}). A
+ negative value indicates that the region covers the last \emph{N}
+ instructions of the procedure, where \emph{N} is the absolute value
+ of \Var{insn\_count}.
+\item[\Type{uint32\_t} \Var{op\_count}] The (allocated) length of
+ the \Var{op\_count} array.
+\item[\Type{unw\_dyn\_op\_t} \Var{op}] An array of dynamic unwind
+ directives. See Section ``Dynamic unwind directives'' for a
+ description of the directives.
+\end{description}
+A region descriptor with an \Var{insn\_count} of zero is an
+\emph{empty region} and such regions are perfectly legal. In fact,
+empty regions can be useful to establish a particular frame state
+before the start of another region.
+
+A single region list can be shared across multiple procedures provided
+those procedures share a common prologue and epilogue (their bodies
+may differ, of course). Normally, such procedures consist of a canned
+prologue, the body, and a canned epilogue. This could be described by
+two regions: one covering the prologue and one covering the epilogue.
+Since the body length is variable, the latter region would need to
+specify a negative value in \Var{insn\_count} such that
+\Prog{libunwind} knows that the region covers the end of the procedure
+(up to the address specified by \Var{end\_ip}).
+
+The region descriptor is a variable length structure to make it
+possible to allocate all the necessary memory with a single
+memory-allocation request. To facilitate the allocation of a region
+descriptors \Prog{libunwind} provides a helper routine with the
+following synopsis:
+
+\noindent
+\Type{size\_t} \Func{\_U\_dyn\_region\_size}(\Type{int} \Var{op\_count});
+
+This routine returns the number of bytes needed to hold a region
+descriptor with space for \Var{op\_count} unwind directives. Note
+that the length of the \Var{op} array does not have to match exactly
+with the number of directives in a region. Instead, it is sufficient
+if the \Var{op} array contains at least as many entries as there are
+directives, since the end of the directives can always be indicated
+with the \Const{UNW\_DYN\_STOP} directive.
+
+\section{Dynamic unwind directives}
+
+A dynamic unwind directive describes how the frame state changes
+at a particular point within a region. The description is in
+the form of a structure of type \Type{unw\_dyn\_op\_t}. This
+structure has the following members:
+\begin{description}
+\item[\Type{int8\_t} \Var{tag}] The operation tag. Must be one
+ of the \Type{unw\_dyn\_operation\_t} values described below.
+\item[\Type{int8\_t} \Var{qp}] The qualifying predicate that controls
+ whether or not this directive is active. This is useful for
+ predicated architecturs such as IA-64 or ARM, where the contents of
+ another (callee-saved) register determines whether or not an
+ instruction is executed (takes effect). If the directive is always
+ active, this member should be set to the manifest constant
+ \Const{\_U\_QP\_TRUE} (this constant is defined for all
+ architectures, predicated or not).
+\item[\Type{int16\_t} \Var{reg}] The number of the register affected
+ by the instruction.
+\item[\Type{int32\_t} \Var{when}] The region-relative number of
+ the instruction to which this directive applies. For example,
+ a value of 0 means that the effect described by this directive
+ has taken place once the first instruction in the region has
+ executed.
+\item[\Type{unw\_word\_t} \Var{val}] The value to be applied by the
+ operation tag. The exact meaning of this value varies by tag. See
+ Section ``Operation tags'' below.
+\end{description}
+It is perfectly legitimate to specify multiple dynamic unwind
+directives with the same \Var{when} value, if a particular instruction
+has a complex effect on the frame state.
+
+Empty regions by definition contain no actual instructions and as such
+the directives are not tied to a particular instruction. By
+convention, the \Var{when} member should be set to 0, however.
+
+There is no need for the dynamic unwind directives to appear
+in order of increasing \Var{when} values. If the directives happen to
+be sorted in that order, it may result in slightly faster execution,
+but a runtime code-generator should not go to extra lengths just to
+ensure that the directives are sorted.
+
+IMPLEMENTATION NOTE: should \Prog{libunwind} implementations for
+certain architectures prefer the list of unwind directives to be
+sorted, it is recommended that such implementations first check
+whether the list happens to be sorted already and, if not, sort the
+directives explicitly before the first use. With this approach, the
+overhead of explicit sorting is only paid when there is a real benefit
+and if the runtime code-generator happens to generated sorted lists
+naturally, the performance penalty is limited to a simple O(N) check.
+
+\subsection{Operations tags}
+
+The possible operation tags are defined by enumeration type
+\Type{unw\_dyn\_operation\_t} which defines the following
+values:
+\begin{description}
+
+\item[\Const{UNW\_DYN\_STOP}] Marks the end of the dynamic unwind
+ directive list. All remaining entries in the \Var{op} array of the
+ region-descriptor are ignored. This tag is guaranteed to have a
+ value of 0.
+
+\item[\Const{UNW\_DYN\_SAVE\_REG}] Marks an instruction which saves
+ register \Var{reg} to register \Var{val}.
+
+\item[\Const{UNW\_DYN\_SPILL\_FP\_REL}] Marks an instruction which
+ spills register \Var{reg} to a frame-pointer-relative location. The
+ frame-pointer-relative offset is given by the value stored in member
+ \Var{val}. See the architecture-specific sections for a description
+ of the stack frame layout.
+
+\item[\Const{UNW\_DYN\_SPILL\_SP\_REL}] Marks an instruction which
+ spills register \Var{reg} to a stack-pointer-relative location. The
+ stack-pointer-relative offset is given by the value stored in member
+ \Var{val}. See the architecture-specific sections for a description
+ of the stack frame layout.
+
+\item[\Const{UNW\_DYN\_ADD}] Marks an instruction which adds
+ the constant value \Var{val} to register \Var{reg}. To add subtract
+ a constant value, store the two's-complement of the value in
+ \Var{val}. The set of registers that can be specified for this tag
+ is described in the architecture-specific sections below.
+
+\item[\Const{UNW\_DYN\_POP\_FRAMES}]
+
+\item[\Const{UNW\_DYN\_LABEL\_STATE}]
+
+\item[\Const{UNW\_DYN\_COPY\_STATE}]
+
+\item[\Const{UNW\_DYN\_ALIAS}]
+
+\end{description}
+
+unw\_dyn\_op\_t
+
+\_U\_dyn\_op\_save\_reg();
+\_U\_dyn\_op\_spill\_fp\_rel();
+\_U\_dyn\_op\_spill\_sp\_rel();
+\_U\_dyn\_op\_add();
+\_U\_dyn\_op\_pop\_frames();
+\_U\_dyn\_op\_label\_state();
+\_U\_dyn\_op\_copy\_state();
+\_U\_dyn\_op\_alias();
+\_U\_dyn\_op\_stop();
+
+\section{IA-64 specifics}
+
+- meaning of segbase member in table-info/table-remote-info format
+- format of table\_data in table-info/table-remote-info format
+- instruction size: each bundle is counted as 3 instructions, regardless
+ of template (MLX)
+- describe stack-frame layout, especially with regards to sp-relative
+ and fp-relative addressing
+- UNW\_DYN\_ADD can only add to ``sp'' (always a negative value); use
+ POP\_FRAMES otherwise
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{\_U\_dyn\_register(3)},
+\SeeAlso{\_U\_dyn\_cancel(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/libunwind-ia64.man b/src/pal/src/libunwind/doc/libunwind-ia64.man
new file mode 100644
index 0000000000..06b141eb3e
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind-ia64.man
@@ -0,0 +1,314 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "LIBUNWIND\-IA64" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+libunwind\-ia64
+\-\- IA\-64\-specific support in libunwind
+.PP
+.SH INTRODUCTION
+
+.PP
+The IA\-64 version of libunwind
+uses a platform\-string of
+ia64
+and, at least in theory, should be able to support all
+operating systems adhering to the processor\-specific ABI defined for
+the Itanium Processor Family. This includes both little\-endian Linux
+and big\-endian HP\-UX. Furthermore, to make it possible for a single
+library to unwind both 32\- and 64\-bit targets, the type
+unw_word_t
+is always defined to be 64 bits wide (independent
+of the natural word\-size of the host). Having said that, the current
+implementation has been tested only with IA\-64 Linux.
+.PP
+When targeting IA\-64, the libunwind
+header file defines the
+macro UNW_TARGET_IA64
+as 1 and the macro UNW_TARGET
+as ``ia64\&'' (without the quotation marks). The former makes it
+possible for platform\-dependent unwind code to use
+conditional\-compilation to select an appropriate implementation. The
+latter is useful for stringification purposes and to construct
+target\-platform\-specific symbols.
+.PP
+One special feature of IA\-64 is the use of NaT bits to support
+speculative execution. Often, NaT bits are thought of as the ``65\-th
+bit\&'' of a general register. However, to make everything fit into
+64\-bit wide unw_word_t
+values, libunwind
+treats the
+NaT\-bits like separate boolean registers, whose 64\-bit value is either
+TRUE (non\-zero) or FALSE (zero).
+.PP
+.SH MACHINE\-STATE
+
+.PP
+The machine\-state (set of registers) that is accessible through
+libunwind
+depends on the type of stack frame that a cursor
+points to. For normal frames, all ``preserved\&'' (callee\-saved)
+registers are accessible. For signal\-trampoline frames, all registers
+(including ``scratch\&'' (caller\-saved) registers) are accessible. Most
+applications do not have to worry a\-priori about which registers are
+accessible when. In case of doubt, it is always safe to \fItry\fP
+to
+access a register (via unw_get_reg()
+or
+unw_get_fpreg())
+and if the register isn\&'t accessible, the
+call will fail with a return\-value of \-UNW_EBADREG\&.
+.PP
+As a special exception to the above general rule, scratch registers
+r15\-r18
+are always accessible, even in normal
+frames. This makes it possible to pass arguments, e.g., to exception
+handlers.
+.PP
+For a detailed description of the IA\-64 register usage convention,
+please see the ``Itanium Software Conventions and Runtime Architecture
+Guide\&'', available at:
+.ce 100
+\fBhttp://www.intel.com/design/itanium/downloads/245358.htm\fP
+.ce 0
+
+.PP
+.SH REGISTER NAMES
+
+.PP
+The IA\-64\-version of libunwind
+defines three kinds of register
+name macros: frame\-register macros, normal register macros, and
+convenience macros. Below, we describe each kind in turn:
+.PP
+.SS FRAME\-REGISTER MACROS
+.PP
+Frame\-registers are special (pseudo) registers because they always
+have a valid value, even though sometimes they do not get saved
+explicitly (e.g., if a memory stack frame is 16 bytes in size, the
+previous stack\-pointer value can be calculated simply as
+sp+16,
+so there is no need to save the stack\-pointer
+explicitly). Moreover, the set of frame register values uniquely
+identifies a stack frame. The IA\-64 architecture defines two stacks
+(a memory and a register stack). Including the instruction\-pointer
+(IP), this means there are three frame registers:
+.TP
+UNW_IA64_IP:
+ Contains the instruction pointer (IP, or
+``program counter\&'') of the current stack frame. Given this value,
+the remaining machine\-state corresponds to the register\-values that
+were present in the CPU when it was just about to execute the
+instruction pointed to by UNW_IA64_IP\&.
+Bits 0 and 1 of
+this frame\-register encode the slot number of the instruction.
+\fBNote:\fP
+Due to the way the call instruction works on IA\-64,
+the slot number is usually zero, but can be non\-zero, e.g., in the
+stack\-frame of a signal\-handler trampoline.
+.TP
+UNW_IA64_SP:
+ Contains the (memory) stack\-pointer
+value (SP).
+.TP
+UNW_IA64_BSP:
+ Contains the register backing\-store
+pointer (BSP). \fBNote:\fP
+the value in this register is equal
+to the contents of register ar.bsp
+at the time the
+instruction at UNW_IA64_IP
+was about to begin execution.
+.PP
+.SS NORMAL REGISTER MACROS
+.PP
+The following normal register name macros are available:
+.TP
+UNW_IA64_GR:
+ The base\-index for general (integer)
+registers. Add an index in the range from 0..127 to get a
+particular general register. For example, to access r4,
+the index UNW_IA64_GR+4
+should be used.
+Registers r0
+and r1
+(gp)
+are read\-only,
+and any attempt to write them will result in an error
+(\-UNW_EREADONLYREG).
+Even though r1
+is
+read\-only, libunwind
+will automatically adjust its value if
+the instruction\-pointer (UNW_IA64_IP)
+is modified. For
+example, if UNW_IA64_IP
+is set to a value inside a
+function func(),
+then reading
+UNW_IA64_GR+1
+will return the global\-pointer
+value for this function.
+.TP
+UNW_IA64_NAT:
+ The base\-index for the NaT bits of the
+general (integer) registers. A non\-zero value in these registers
+corresponds to a set NaT\-bit. Add an index in the range from 0..127
+to get a particular NaT\-bit register. For example, to access the
+NaT bit of r4,
+the index UNW_IA64_NAT+4
+should be used.
+.TP
+UNW_IA64_FR:
+ The base\-index for floating\-point
+registers. Add an index in the range from 0..127 to get a
+particular floating\-point register. For example, to access
+f2,
+the index UNW_IA64_FR+2
+should be
+used. Registers f0
+and f1
+are read\-only, and any
+attempt to write to indices UNW_IA64_FR+0
+or
+UNW_IA64_FR+1
+will result in an error
+(\-UNW_EREADONLYREG).
+.TP
+UNW_IA64_AR:
+ The base\-index for application
+registers. Add an index in the range from 0..127 to get a
+particular application register. For example, to access
+ar40,
+the index UNW_IA64_AR+40
+should be
+used. The IA\-64 architecture defines several application registers
+as ``reserved for future use\&''\&. Attempting to access such registers
+results in an error (\-UNW_EBADREG).
+.TP
+UNW_IA64_BR:
+ The base\-index for branch registers.
+Add an index in the range from 0..7 to get a particular branch
+register. For example, to access b6,
+the index
+UNW_IA64_BR+6
+should be used.
+.TP
+UNW_IA64_PR:
+ Contains the set of predicate registers.
+This 64\-bit wide register contains registers p0
+through
+p63
+in the ``broad\-side\&'' format. Just like with the
+``move predicates\&'' instruction, the registers are mapped as if
+CFM.rrb.pr
+were set to 0. Thus, in general the value of
+predicate register pN
+with N>=16 can be found
+in bit 16 + ((N\-16)+CFM.rrb.pr) % 48\&.
+.TP
+UNW_IA64_CFM:
+ Contains the current\-frame\-mask
+register.
+.PP
+.SS CONVENIENCE MACROS
+.PP
+Convenience macros are simply aliases for certain frequently used
+registers:
+.TP
+UNW_IA64_GP:
+ Alias for UNW_IA64_GR+1,
+the global\-pointer register.
+.TP
+UNW_IA64_TP:
+ Alias for UNW_IA64_GR+13,
+the thread\-pointer register.
+.TP
+UNW_IA64_AR_RSC:
+ Alias for UNW_IA64_GR+16,
+the register\-stack configuration register.
+.TP
+UNW_IA64_AR_BSP:
+ Alias for
+UNW_IA64_GR+17\&.
+This register index accesses the
+value of register ar.bsp
+as of the time it was last saved
+explicitly. This is rarely what you want. Normally, you\&'ll want to
+use UNW_IA64_BSP
+instead.
+.TP
+UNW_IA64_AR_BSPSTORE:
+ Alias for UNW_IA64_GR+18,
+the register\-backing store write pointer.
+.TP
+UNW_IA64_AR_RNAT:
+ Alias for UNW_IA64_GR+19,
+the register\-backing store NaT\-collection register.
+.TP
+UNW_IA64_AR_CCV:
+ Alias for UNW_IA64_GR+32,
+the compare\-and\-swap value register.
+.TP
+UNW_IA64_AR_CSD:
+ Alias for UNW_IA64_GR+25,
+the compare\-and\-swap\-data register (used by 16\-byte atomic operations).
+.TP
+UNW_IA64_AR_UNAT:
+ Alias for UNW_IA64_GR+36,
+the user NaT\-collection register.
+.TP
+UNW_IA64_AR_FPSR:
+ Alias for UNW_IA64_GR+40,
+the floating\-point status (and control) register.
+.TP
+UNW_IA64_AR_PFS:
+ Alias for UNW_IA64_GR+64,
+the previous frame\-state register.
+.TP
+UNW_IA64_AR_LC:
+ Alias for UNW_IA64_GR+65
+the loop\-count register.
+.TP
+UNW_IA64_AR_EC:
+ Alias for UNW_IA64_GR+66,
+the epilogue\-count register.
+.PP
+.SH THE UNWIND\-CONTEXT TYPE
+
+.PP
+On IA\-64, unw_context_t
+is simply an alias for
+ucontext_t
+(as defined by the Single UNIX Spec). This implies
+that it is possible to initialize a value of this type not just with
+unw_getcontext(),
+but also with getcontext(),
+for
+example. However, since this is an IA\-64\-specific extension to
+libunwind,
+portable code should not rely on this equivalence.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/libunwind-ia64.tex b/src/pal/src/libunwind/doc/libunwind-ia64.tex
new file mode 100644
index 0000000000..c08946dc4b
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind-ia64.tex
@@ -0,0 +1,216 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{libunwind-ia64}{David Mosberger-Tang}{Programming Library}{IA-64-specific support in libunwind}libunwind-ia64 -- IA-64-specific support in libunwind
+\end{Name}
+
+
+\section{Introduction}
+
+The IA-64 version of \Prog{libunwind} uses a platform-string of
+\texttt{ia64} and, at least in theory, should be able to support all
+operating systems adhering to the processor-specific ABI defined for
+the Itanium Processor Family. This includes both little-endian Linux
+and big-endian HP-UX. Furthermore, to make it possible for a single
+library to unwind both 32- and 64-bit targets, the type
+\Type{unw\_word\_t} is always defined to be 64 bits wide (independent
+of the natural word-size of the host). Having said that, the current
+implementation has been tested only with IA-64 Linux.
+
+When targeting IA-64, the \Prog{libunwind} header file defines the
+macro \Const{UNW\_TARGET\_IA64} as 1 and the macro \Const{UNW\_TARGET}
+as ``ia64'' (without the quotation marks). The former makes it
+possible for platform-dependent unwind code to use
+conditional-compilation to select an appropriate implementation. The
+latter is useful for stringification purposes and to construct
+target-platform-specific symbols.
+
+One special feature of IA-64 is the use of NaT bits to support
+speculative execution. Often, NaT bits are thought of as the ``65-th
+bit'' of a general register. However, to make everything fit into
+64-bit wide \Type{unw\_word\_t} values, \Prog{libunwind} treats the
+NaT-bits like separate boolean registers, whose 64-bit value is either
+TRUE (non-zero) or FALSE (zero).
+
+
+\section{Machine-State}
+
+The machine-state (set of registers) that is accessible through
+\Prog{libunwind} depends on the type of stack frame that a cursor
+points to. For normal frames, all ``preserved'' (callee-saved)
+registers are accessible. For signal-trampoline frames, all registers
+(including ``scratch'' (caller-saved) registers) are accessible. Most
+applications do not have to worry a-priori about which registers are
+accessible when. In case of doubt, it is always safe to \emph{try} to
+access a register (via \Func{unw\_get\_reg}() or
+\Func{unw\_get\_fpreg}()) and if the register isn't accessible, the
+call will fail with a return-value of \texttt{-}\Const{UNW\_EBADREG}.
+
+As a special exception to the above general rule, scratch registers
+\texttt{r15}-\texttt{r18} are always accessible, even in normal
+frames. This makes it possible to pass arguments, e.g., to exception
+handlers.
+
+For a detailed description of the IA-64 register usage convention,
+please see the ``Itanium Software Conventions and Runtime Architecture
+Guide'', available at:
+\begin{center}
+ \URL{http://www.intel.com/design/itanium/downloads/245358.htm}
+\end{center}
+
+
+\section{Register Names}
+
+The IA-64-version of \Prog{libunwind} defines three kinds of register
+name macros: frame-register macros, normal register macros, and
+convenience macros. Below, we describe each kind in turn:
+
+
+\subsection{Frame-register Macros}
+
+Frame-registers are special (pseudo) registers because they always
+have a valid value, even though sometimes they do not get saved
+explicitly (e.g., if a memory stack frame is 16 bytes in size, the
+previous stack-pointer value can be calculated simply as
+\texttt{sp+16}, so there is no need to save the stack-pointer
+explicitly). Moreover, the set of frame register values uniquely
+identifies a stack frame. The IA-64 architecture defines two stacks
+(a memory and a register stack). Including the instruction-pointer
+(IP), this means there are three frame registers:
+\begin{Description}
+\item[\Const{UNW\_IA64\_IP}:] Contains the instruction pointer (IP, or
+ ``program counter'') of the current stack frame. Given this value,
+ the remaining machine-state corresponds to the register-values that
+ were present in the CPU when it was just about to execute the
+ instruction pointed to by \Const{UNW\_IA64\_IP}. Bits 0 and 1 of
+ this frame-register encode the slot number of the instruction.
+ \textbf{Note:} Due to the way the call instruction works on IA-64,
+ the slot number is usually zero, but can be non-zero, e.g., in the
+ stack-frame of a signal-handler trampoline.
+\item[\Const{UNW\_IA64\_SP}:] Contains the (memory) stack-pointer
+ value (SP).
+\item[\Const{UNW\_IA64\_BSP}:] Contains the register backing-store
+ pointer (BSP). \textbf{Note:} the value in this register is equal
+ to the contents of register \texttt{ar.bsp} at the time the
+ instruction at \Const{UNW\_IA64\_IP} was about to begin execution.
+\end{Description}
+
+
+\subsection{Normal Register Macros}
+
+The following normal register name macros are available:
+\begin{Description}
+\item[\Const{UNW\_IA64\_GR}:] The base-index for general (integer)
+ registers. Add an index in the range from 0..127 to get a
+ particular general register. For example, to access \texttt{r4},
+ the index \Const{UNW\_IA64\_GR}\texttt{+4} should be used.
+ Registers \texttt{r0} and \texttt{r1} (\texttt{gp}) are read-only,
+ and any attempt to write them will result in an error
+ (\texttt{-}\Const{UNW\_EREADONLYREG}). Even though \texttt{r1} is
+ read-only, \Prog{libunwind} will automatically adjust its value if
+ the instruction-pointer (\Const{UNW\_IA64\_IP}) is modified. For
+ example, if \Const{UNW\_IA64\_IP} is set to a value inside a
+ function \Func{func}(), then reading
+ \Const{UNW\_IA64\_GR}\texttt{+1} will return the global-pointer
+ value for this function.
+\item[\Const{UNW\_IA64\_NAT}:] The base-index for the NaT bits of the
+ general (integer) registers. A non-zero value in these registers
+ corresponds to a set NaT-bit. Add an index in the range from 0..127
+ to get a particular NaT-bit register. For example, to access the
+ NaT bit of \texttt{r4}, the index \Const{UNW\_IA64\_NAT}\texttt{+4}
+ should be used.
+\item[\Const{UNW\_IA64\_FR}:] The base-index for floating-point
+ registers. Add an index in the range from 0..127 to get a
+ particular floating-point register. For example, to access
+ \texttt{f2}, the index \Const{UNW\_IA64\_FR}\texttt{+2} should be
+ used. Registers \texttt{f0} and \texttt{f1} are read-only, and any
+ attempt to write to indices \Const{UNW\_IA64\_FR}\texttt{+0} or
+ \Const{UNW\_IA64\_FR}\texttt{+1} will result in an error
+ (\texttt{-}\Const{UNW\_EREADONLYREG}).
+\item[\Const{UNW\_IA64\_AR}:] The base-index for application
+ registers. Add an index in the range from 0..127 to get a
+ particular application register. For example, to access
+ \texttt{ar40}, the index \Const{UNW\_IA64\_AR}\texttt{+40} should be
+ used. The IA-64 architecture defines several application registers
+ as ``reserved for future use''. Attempting to access such registers
+ results in an error (\texttt{-}\Const{UNW\_EBADREG}).
+\item[\Const{UNW\_IA64\_BR}:] The base-index for branch registers.
+ Add an index in the range from 0..7 to get a particular branch
+ register. For example, to access \texttt{b6}, the index
+ \Const{UNW\_IA64\_BR}\texttt{+6} should be used.
+\item[\Const{UNW\_IA64\_PR}:] Contains the set of predicate registers.
+ This 64-bit wide register contains registers \texttt{p0} through
+ \texttt{p63} in the ``broad-side'' format. Just like with the
+ ``move predicates'' instruction, the registers are mapped as if
+ \texttt{CFM.rrb.pr} were set to 0. Thus, in general the value of
+ predicate register \texttt{p}$N$ with $N$>=16 can be found
+ in bit \texttt{16 + (($N$-16)+CFM.rrb.pr) \% 48}.
+\item[\Const{UNW\_IA64\_CFM}:] Contains the current-frame-mask
+ register.
+\end{Description}
+
+
+\subsection{Convenience Macros}
+
+Convenience macros are simply aliases for certain frequently used
+registers:
+\begin{Description}
+\item[\Const{UNW\_IA64\_GP}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+1},
+ the global-pointer register.
+\item[\Const{UNW\_IA64\_TP}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+13},
+ the thread-pointer register.
+\item[\Const{UNW\_IA64\_AR\_RSC}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+16},
+ the register-stack configuration register.
+\item[\Const{UNW\_IA64\_AR\_BSP}:] Alias for
+ \Const{UNW\_IA64\_GR}\texttt{+17}. This register index accesses the
+ value of register \texttt{ar.bsp} as of the time it was last saved
+ explicitly. This is rarely what you want. Normally, you'll want to
+ use \Const{UNW\_IA64\_BSP} instead.
+\item[\Const{UNW\_IA64\_AR\_BSPSTORE}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+18},
+ the register-backing store write pointer.
+\item[\Const{UNW\_IA64\_AR\_RNAT}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+19},
+ the register-backing store NaT-collection register.
+\item[\Const{UNW\_IA64\_AR\_CCV}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+32},
+ the compare-and-swap value register.
+\item[\Const{UNW\_IA64\_AR\_CSD}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+25},
+ the compare-and-swap-data register (used by 16-byte atomic operations).
+\item[\Const{UNW\_IA64\_AR\_UNAT}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+36},
+ the user NaT-collection register.
+\item[\Const{UNW\_IA64\_AR\_FPSR}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+40},
+ the floating-point status (and control) register.
+\item[\Const{UNW\_IA64\_AR\_PFS}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+64},
+ the previous frame-state register.
+\item[\Const{UNW\_IA64\_AR\_LC}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+65}
+ the loop-count register.
+\item[\Const{UNW\_IA64\_AR\_EC}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+66},
+ the epilogue-count register.
+\end{Description}
+
+
+\section{The Unwind-Context Type}
+
+On IA-64, \Type{unw\_context\_t} is simply an alias for
+\Type{ucontext\_t} (as defined by the Single UNIX Spec). This implies
+that it is possible to initialize a value of this type not just with
+\Func{unw\_getcontext}(), but also with \Func{getcontext}(), for
+example. However, since this is an IA-64-specific extension to
+\Prog{libunwind}, portable code should not rely on this equivalence.
+
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/libunwind-ptrace.man b/src/pal/src/libunwind/doc/libunwind-ptrace.man
new file mode 100644
index 0000000000..985fcae275
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind-ptrace.man
@@ -0,0 +1,220 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "LIBUNWIND\-PTRACE" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+libunwind\-ptrace
+\-\- ptrace() support in libunwind
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind\-ptrace.h>
+.br
+.PP
+unw_accessors_t
+_UPT_accessors;
+.br
+.PP
+void *_UPT_create(pid_t);
+.br
+void
+_UPT_destroy(void *);
+.br
+.PP
+int
+_UPT_find_proc_info(unw_addr_space_t,
+unw_word_t,
+unw_proc_info_t *,
+int,
+void *);
+.br
+void
+_UPT_put_unwind_info(unw_addr_space_t,
+unw_proc_info_t *,
+void *);
+.br
+int
+_UPT_get_dyn_info_list_addr(unw_addr_space_t,
+unw_word_t *,
+void *);
+.br
+int
+_UPT_access_mem(unw_addr_space_t,
+unw_word_t,
+unw_word_t *,
+int,
+void *);
+.br
+int
+_UPT_access_reg(unw_addr_space_t,
+unw_regnum_t,
+unw_word_t *,
+int,
+void *);
+.br
+int
+_UPT_access_fpreg(unw_addr_space_t,
+unw_regnum_t,
+unw_fpreg_t *,
+int,
+void *);
+.br
+int
+_UPT_get_proc_name(unw_addr_space_t,
+unw_word_t,
+char *,
+size_t,
+unw_word_t *,
+void *);
+.br
+int
+_UPT_resume(unw_addr_space_t,
+unw_cursor_t *,
+void *);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The ptrace(2)
+system\-call makes it possible for a process to
+gain access to the machine\-state and virtual memory of \fIanother\fP
+process. With the right set of call\-back routines, it is therefore
+possible to hook up libunwind
+to another process via
+ptrace(2).
+While it\&'s not very difficult to do so directly,
+libunwind
+further facilitates this task by providing
+ready\-to\-use callbacks for this purpose. The routines and variables
+implementing this facility use a name\-prefix of _UPT,
+which is
+stands for ``unwind\-via\-ptrace\&''\&.
+.PP
+An application that wants to use the _UPT\-facility
+first needs
+to create a new libunwind
+address\-space that represents the
+target process. This is done by calling
+unw_create_addr_space().
+In many cases, the application
+will simply want to pass the address of _UPT_accessors
+as the
+first argument to this routine. Doing so will ensure that
+libunwind
+will be able to properly unwind the target process.
+However, in special circumstances, an application may prefer to use
+only portions of the _UPT\-facility.
+For this reason, the
+individual callback routines (_UPT_find_proc_info(),
+_UPT_put_unwind_info(),
+etc.) are also available for direct
+use. Of course, the addresses of these routines could also be picked
+up from _UPT_accessors,
+but doing so would prevent static
+initialization. Also, when using _UPT_accessors,
+\fIall\fP
+the callback routines will be linked into the application, even if
+they are never actually called.
+.PP
+Next, the application can turn on ptrace\-mode on the target process,
+either by forking a new process, invoking PTRACE_TRACEME,
+and
+then starting the target program (via execve(2)),
+or by
+directly attaching to an already running process (via
+PTRACE_ATTACH).
+Either way, once the process\-ID (pid) of the
+target process is known, a _UPT\-info\-structure
+can be created
+by calling _UPT_create(),
+passing the pid of the target process
+as the only argument. The returned void\-pointer then needs to be
+passed as the ``argument\&'' pointer (third argument) to
+unw_init_remote().
+.PP
+The _UPT_resume()
+routine can be used to resume execution of
+the target process. It simply invokes ptrace(2)
+with a command
+value of PTRACE_CONT\&.
+.PP
+When the application is done using libunwind
+on the target
+process, _UPT_destroy()
+needs to be called, passing it the
+void\-pointer that was returned by the corresponding call to
+_UPT_create().
+This ensures that all memory and other
+resources are freed up.
+.PP
+.SH AVAILABILITY
+
+.PP
+Since ptrace(2)
+works within a single machine only, the
+_UPT\-facility
+by definition is not available in
+libunwind\-versions
+configured for cross\-unwinding.
+.PP
+.SH THREAD SAFETY
+
+.PP
+The _UPT\-facility
+assumes that a single _UPT\-info
+structure is never shared between threads. Because of this, no
+explicit locking is used. As long as only one thread uses
+a _UPT\-info
+structure at any given time, this facility
+is thread\-safe.
+.PP
+.SH RETURN VALUE
+
+.PP
+_UPT_create()
+may return a NULL
+pointer if it fails
+to create the _UPT\-info\-structure
+for any reason. For the
+current implementation, the only reason this call may fail is when the
+system is out of memory.
+.PP
+.SH FILES
+
+.PP
+.TP
+libunwind\-ptrace.h
+ Headerfile to include when using the
+interface defined by this library.
+.TP
+\fB\-l\fPunwind\-ptrace \fB\-l\fPunwind\-generic
+ Linker\-switches to add when building a program that uses the
+functions defined by this library.
+.PP
+.SH SEE ALSO
+
+.PP
+execve(2),
+libunwind(3),
+ptrace(2)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/libunwind-ptrace.tex b/src/pal/src/libunwind/doc/libunwind-ptrace.tex
new file mode 100644
index 0000000000..fe074d8619
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind-ptrace.tex
@@ -0,0 +1,134 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{libunwind-ptrace}{David Mosberger-Tang}{Programming Library}{ptrace() support in libunwind}libunwind-ptrace -- ptrace() support in libunwind
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind-ptrace.h$>$}\\
+
+\noindent
+\Type{unw\_accessors\_t} \Var{\_UPT\_accessors};\\
+
+\Type{void~*}\Func{\_UPT\_create}(\Type{pid\_t});\\
+\noindent
+\Type{void} \Func{\_UPT\_destroy}(\Type{void~*});\\
+
+\noindent
+\Type{int} \Func{\_UPT\_find\_proc\_info}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t}, \Type{unw\_proc\_info\_t~*}, \Type{int}, \Type{void~*});\\
+\noindent
+\Type{void} \Func{\_UPT\_put\_unwind\_info}(\Type{unw\_addr\_space\_t}, \Type{unw\_proc\_info\_t~*}, \Type{void~*});\\
+\noindent
+\Type{int} \Func{\_UPT\_get\_dyn\_info\_list\_addr}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t~*}, \Type{void~*});\\
+\noindent
+\Type{int} \Func{\_UPT\_access\_mem}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t}, \Type{unw\_word\_t~*}, \Type{int}, \Type{void~*});\\
+\noindent
+\Type{int} \Func{\_UPT\_access\_reg}(\Type{unw\_addr\_space\_t}, \Type{unw\_regnum\_t}, \Type{unw\_word\_t~*}, \Type{int}, \Type{void~*});\\
+\noindent
+\Type{int} \Func{\_UPT\_access\_fpreg}(\Type{unw\_addr\_space\_t}, \Type{unw\_regnum\_t}, \Type{unw\_fpreg\_t~*}, \Type{int}, \Type{void~*});\\
+\noindent
+\Type{int} \Func{\_UPT\_get\_proc\_name}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t}, \Type{char~*}, \Type{size\_t}, \Type{unw\_word\_t~*}, \Type{void~*});\\
+\noindent
+\Type{int} \Func{\_UPT\_resume}(\Type{unw\_addr\_space\_t}, \Type{unw\_cursor\_t~*}, \Type{void~*});\\
+
+\section{Description}
+
+The \Func{ptrace}(2) system-call makes it possible for a process to
+gain access to the machine-state and virtual memory of \emph{another}
+process. With the right set of call-back routines, it is therefore
+possible to hook up \Prog{libunwind} to another process via
+\Func{ptrace}(2). While it's not very difficult to do so directly,
+\Prog{libunwind} further facilitates this task by providing
+ready-to-use callbacks for this purpose. The routines and variables
+implementing this facility use a name-prefix of \Func{\_UPT}, which is
+stands for ``unwind-via-ptrace''.
+
+An application that wants to use the \Func{\_UPT}-facility first needs
+to create a new \Prog{libunwind} address-space that represents the
+target process. This is done by calling
+\Func{unw\_create\_addr\_space}(). In many cases, the application
+will simply want to pass the address of \Var{\_UPT\_accessors} as the
+first argument to this routine. Doing so will ensure that
+\Prog{libunwind} will be able to properly unwind the target process.
+However, in special circumstances, an application may prefer to use
+only portions of the \Prog{\_UPT}-facility. For this reason, the
+individual callback routines (\Func{\_UPT\_find\_proc\_info}(),
+\Func{\_UPT\_put\_unwind\_info}(), etc.) are also available for direct
+use. Of course, the addresses of these routines could also be picked
+up from \Var{\_UPT\_accessors}, but doing so would prevent static
+initialization. Also, when using \Var{\_UPT\_accessors}, \emph{all}
+the callback routines will be linked into the application, even if
+they are never actually called.
+
+Next, the application can turn on ptrace-mode on the target process,
+either by forking a new process, invoking \Const{PTRACE\_TRACEME}, and
+then starting the target program (via \Func{execve}(2)), or by
+directly attaching to an already running process (via
+\Const{PTRACE\_ATTACH}). Either way, once the process-ID (pid) of the
+target process is known, a \Prog{\_UPT}-info-structure can be created
+by calling \Func{\_UPT\_create}(), passing the pid of the target process
+as the only argument. The returned void-pointer then needs to be
+passed as the ``argument'' pointer (third argument) to
+\Func{unw\_init\_remote}().
+
+The \Func{\_UPT\_resume}() routine can be used to resume execution of
+the target process. It simply invokes \Func{ptrace}(2) with a command
+value of \Const{PTRACE\_CONT}.
+
+When the application is done using \Prog{libunwind} on the target
+process, \Func{\_UPT\_destroy}() needs to be called, passing it the
+void-pointer that was returned by the corresponding call to
+\Func{\_UPT\_create}(). This ensures that all memory and other
+resources are freed up.
+
+\section{Availability}
+
+Since \Func{ptrace}(2) works within a single machine only, the
+\Prog{\_UPT}-facility by definition is not available in
+\Prog{libunwind}-versions configured for cross-unwinding.
+
+\section{Thread Safety}
+
+The \Prog{\_UPT}-facility assumes that a single \Prog{\_UPT}-info
+structure is never shared between threads. Because of this, no
+explicit locking is used. As long as only one thread uses
+a \Prog{\_UPT}-info structure at any given time, this facility
+is thread-safe.
+
+\section{Return Value}
+
+\Func{\_UPT\_create}() may return a \Const{NULL} pointer if it fails
+to create the \Prog{\_UPT}-info-structure for any reason. For the
+current implementation, the only reason this call may fail is when the
+system is out of memory.
+
+\section{Files}
+
+\begin{Description}
+\item[\File{libunwind-ptrace.h}] Headerfile to include when using the
+ interface defined by this library.
+\item[\Opt{-l}\File{unwind-ptrace} \Opt{-l}\File{unwind-generic}]
+ Linker-switches to add when building a program that uses the
+ functions defined by this library.
+\end{Description}
+
+\section{See Also}
+
+execve(2),
+\SeeAlso{libunwind(3)},
+ptrace(2)
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/libunwind-setjmp.man b/src/pal/src/libunwind/doc/libunwind-setjmp.man
new file mode 100644
index 0000000000..1faa38e475
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind-setjmp.man
@@ -0,0 +1,132 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "LIBUNWIND\-SETJMP" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+libunwind\-setjmp
+\-\- libunwind\-based non\-local gotos
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <setjmp.h>
+.br
+.PP
+int
+setjmp(jmp_buf env);
+.br
+void
+longjmp(jmp_buf env,
+int val);
+.br
+int
+_setjmp(jmp_buf env);
+.br
+void
+_longjmp(jmp_buf env,
+int val);
+.br
+int
+sigsetjmp(sigjmp_buf env,
+int savemask);
+.br
+void
+siglongjmp(sigjmp_buf env,
+int val);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unwind\-setjmp
+library offers a libunwind\-based
+implementation of non\-local gotos. This implementation is intended to
+be a drop\-in replacement for the normal, system\-provided routines of
+the same name. The main advantage of using the unwind\-setjmp
+library is that setting up a non\-local goto via one of the
+setjmp()
+routines is very fast. Typically, just 2 or 3 words
+need to be saved in the jump\-buffer (plus one call to
+sigprocmask(2),
+in the case of sigsetjmp).
+On the
+other hand, executing a non\-local goto by calling one of the
+longjmp()
+routines tends to be much slower than with the
+system\-provided routines. In fact, the time spent on a
+longjmp()
+will be proportional to the number of call frames
+that exist between the points where setjmp()
+and
+longjmp()
+were called. For this reason, the
+unwind\-setjmp
+library is beneficial primarily in applications
+that frequently call setjmp()
+but only rarely call
+longjmp().
+.PP
+.SH CAVEATS
+
+.PP
+.TP
+.B *
+The correct operation of this library depends on the presence of
+correct unwind information. On newer platforms, this is rarely an
+issue. On older platforms, care needs to be taken to
+ensure that each of the functions whose stack frames may have to be
+unwound during a longjmp()
+have correct unwind information
+(on those platforms, there is usually a compiler\-switch, such as
+\fB\-funwind\-tables\fP,
+to request the generation of unwind
+information).
+.TP
+.B *
+The contents of jmp_buf and sigjmp_buf as setup
+and used by these routines is completely different from the ones
+used by the system\-provided routines. Thus, a jump\-buffer created
+by the libunwind\-based setjmp()/_setjmp
+may only be
+used in a call to the libunwind\-based
+longjmp()/_longjmp().
+The analogous applies for
+sigjmp_buf
+with sigsetjmp()
+and siglongjmp().
+.PP
+.SH FILES
+
+.PP
+.TP
+\fB\-l\fPunwind\-setjmp
+ The library an application should
+be linked against to ensure it uses the libunwind\-based non\-local
+goto routines.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+setjmp(3), longjmp(3),
+_setjmp(3), _longjmp(3),
+sigsetjmp(3), siglongjmp(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/libunwind-setjmp.tex b/src/pal/src/libunwind/doc/libunwind-setjmp.tex
new file mode 100644
index 0000000000..17ce073186
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind-setjmp.tex
@@ -0,0 +1,87 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{libunwind-setjmp}{David Mosberger-Tang}{Programming Library}{libunwind-based non-local gotos}libunwind-setjmp -- libunwind-based non-local gotos
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$setjmp.h$>$}\\
+
+\noindent
+\Type{int} \Func{setjmp}(\Type{jmp\_buf}~\Var{env});\\
+\Type{void} \Func{longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\
+\Type{int} \Func{\_setjmp}(\Type{jmp\_buf}~\Var{env});\\
+\Type{void} \Func{\_longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\
+\Type{int} \Func{sigsetjmp}(\Type{sigjmp\_buf}~\Var{env}, \Type{int}~\Var{savemask});\\
+\Type{void} \Func{siglongjmp}(\Type{sigjmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\
+
+\section{Description}
+
+The \Prog{unwind-setjmp} library offers a \Prog{libunwind}-based
+implementation of non-local gotos. This implementation is intended to
+be a drop-in replacement for the normal, system-provided routines of
+the same name. The main advantage of using the \Prog{unwind-setjmp}
+library is that setting up a non-local goto via one of the
+\Func{setjmp}() routines is very fast. Typically, just 2 or 3 words
+need to be saved in the jump-buffer (plus one call to
+\Func{sigprocmask}(2), in the case of \Func{sigsetjmp}). On the
+other hand, executing a non-local goto by calling one of the
+\Func{longjmp}() routines tends to be much slower than with the
+system-provided routines. In fact, the time spent on a
+\Func{longjmp}() will be proportional to the number of call frames
+that exist between the points where \Func{setjmp}() and
+\Func{longjmp}() were called. For this reason, the
+\Prog{unwind-setjmp} library is beneficial primarily in applications
+that frequently call \Func{setjmp}() but only rarely call
+\Func{longjmp}().
+
+\section{Caveats}
+
+\begin{itemize}
+\item The correct operation of this library depends on the presence of
+ correct unwind information. On newer platforms, this is rarely an
+ issue. On older platforms, care needs to be taken to
+ ensure that each of the functions whose stack frames may have to be
+ unwound during a \Func{longjmp}() have correct unwind information
+ (on those platforms, there is usually a compiler-switch, such as
+ \Opt{-funwind-tables}, to request the generation of unwind
+ information).
+\item The contents of \Type{jmp\_buf} and \Type{sigjmp\_buf} as setup
+ and used by these routines is completely different from the ones
+ used by the system-provided routines. Thus, a jump-buffer created
+ by the libunwind-based \Func{setjmp}()/\Func{\_setjmp} may only be
+ used in a call to the libunwind-based
+ \Func{longjmp}()/\Func{\_longjmp}(). The analogous applies for
+ \Type{sigjmp\_buf} with \Func{sigsetjmp}() and \Func{siglongjmp}().
+\end{itemize}
+
+\section{Files}
+
+\begin{Description}
+\item[\Opt{-l}\File{unwind-setjmp}] The library an application should
+ be linked against to ensure it uses the libunwind-based non-local
+ goto routines.
+\end{Description}
+
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+setjmp(3), longjmp(3),
+\_setjmp(3), \_longjmp(3),
+sigsetjmp(3), siglongjmp(3)
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/libunwind.man b/src/pal/src/libunwind/doc/libunwind.man
new file mode 100644
index 0000000000..02ab6b8937
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind.man
@@ -0,0 +1,508 @@
+'\" t
+.\" Manual page created with latex2man on Thu Jan 12 06:50:29 PST 2017
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "LIBUNWIND" "3" "12 January 2017" "Programming Library " "Programming Library "
+.SH NAME
+libunwind
+\-\- a (mostly) platform\-independent unwind API
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_getcontext(unw_context_t *);
+.br
+int
+unw_init_local(unw_cursor_t *,
+unw_context_t *);
+.br
+int
+unw_init_remote(unw_cursor_t *,
+unw_addr_space_t,
+void *);
+.br
+int
+unw_step(unw_cursor_t *);
+.br
+int
+unw_get_reg(unw_cursor_t *,
+unw_regnum_t,
+unw_word_t *);
+.br
+int
+unw_get_fpreg(unw_cursor_t *,
+unw_regnum_t,
+unw_fpreg_t *);
+.br
+int
+unw_set_reg(unw_cursor_t *,
+unw_regnum_t,
+unw_word_t);
+.br
+int
+unw_set_fpreg(unw_cursor_t *,
+unw_regnum_t,
+unw_fpreg_t);
+.br
+int
+unw_resume(unw_cursor_t *);
+.br
+.PP
+unw_addr_space_t
+unw_local_addr_space;
+.br
+unw_addr_space_t
+unw_create_addr_space(unw_accessors_t,
+int);
+.br
+void
+unw_destroy_addr_space(unw_addr_space_t);
+.br
+unw_accessors_t
+unw_get_accessors(unw_addr_space_t);
+.br
+void
+unw_flush_cache(unw_addr_space_t,
+unw_word_t,
+unw_word_t);
+.br
+int
+unw_set_caching_policy(unw_addr_space_t,
+unw_caching_policy_t);
+.br
+int
+unw_set_cache_size(unw_addr_space_t,
+size_t,
+int);
+.br
+.PP
+const char *unw_regname(unw_regnum_t);
+.br
+int
+unw_get_proc_info(unw_cursor_t *,
+unw_proc_info_t *);
+.br
+int
+unw_get_save_loc(unw_cursor_t *,
+int,
+unw_save_loc_t *);
+.br
+int
+unw_is_fpreg(unw_regnum_t);
+.br
+int
+unw_is_signal_frame(unw_cursor_t *);
+.br
+int
+unw_get_proc_name(unw_cursor_t *,
+char *,
+size_t,
+unw_word_t *);
+.br
+.PP
+void
+_U_dyn_register(unw_dyn_info_t *);
+.br
+void
+_U_dyn_cancel(unw_dyn_info_t *);
+.br
+.PP
+.SH LOCAL UNWINDING
+
+.PP
+Libunwind
+is very easy to use when unwinding a stack from
+within a running program. This is called \fIlocal\fP
+unwinding. Say
+you want to unwind the stack while executing in some function
+F().
+In this function, you would call unw_getcontext()
+to get a snapshot of the CPU registers (machine\-state). Then you
+initialize an \fIunwind cursor\fP
+based on this snapshot. This is
+done with a call to unw_init_local().
+The cursor now points
+to the current frame, that is, the stack frame that corresponds to the
+current activation of function F().
+The unwind cursor can then
+be moved ``up\&'' (towards earlier stack frames) by calling
+unw_step().
+By repeatedly calling this routine, you can
+uncover the entire call\-chain that led to the activation of function
+F().
+A positive return value from unw_step()
+indicates
+that there are more frames in the chain, zero indicates that the end
+of the chain has been reached, and any negative value indicates that
+some sort of error has occurred.
+.PP
+While it is not possible to directly move the unwind cursor in the
+``down\&'' direction (towards newer stack frames), this effect can be
+achieved by making copies of an unwind cursor. For example, a program
+that sometimes has to move ``down\&'' by one stack frame could maintain
+two cursor variables: ``curr\&''
+and ``prev\&''\&.
+The former
+would be used as the current cursor and prev
+would be maintained
+as the ``previous frame\&'' cursor by copying the contents of curr
+to prev
+right before calling unw_step().
+With this
+approach, the program could move one step ``down\&'' simply by copying
+back prev
+to curr
+whenever that is necessary. In the most
+extreme case, a program could maintain a separate cursor for each call
+frame and that way it could move up and down the callframe\-chain at
+will.
+.PP
+Given an unwind cursor, it is possible to read and write the CPU
+registers that were preserved for the current stack frame (as
+identified by the cursor). Libunwind
+provides several routines
+for this purpose: unw_get_reg()
+reads an integer (general)
+register, unw_get_fpreg()
+reads a floating\-point register,
+unw_set_reg()
+writes an integer register, and
+unw_set_fpreg()
+writes a floating\-point register. Note that,
+by definition, only the \fIpreserved\fP
+machine state can be accessed
+during an unwind operation. Normally, this state consists of the
+\fIcallee\-saved\fP
+(``preserved\&'') registers. However, in some
+special circumstances (e.g., in a signal handler trampoline), even the
+\fIcaller\-saved\fP
+(``scratch\&'') registers are preserved in the stack
+frame and, in those cases, libunwind
+will grant access to them
+as well. The exact set of registers that can be accessed via the
+cursor depends, of course, on the platform. However, there are two
+registers that can be read on all platforms: the instruction pointer
+(IP), sometimes also known as the ``program counter\&'', and the stack
+pointer (SP). In libunwind,
+these registers are identified by
+the macros UNW_REG_IP
+and UNW_REG_SP,
+respectively.
+.PP
+Besides just moving the unwind cursor and reading/writing saved
+registers, libunwind
+also provides the ability to resume
+execution at an arbitrary stack frame. As you might guess, this is
+useful for implementing non\-local gotos and the exception handling
+needed by some high\-level languages such as Java. Resuming execution
+with a particular stack frame simply requires calling
+unw_resume()
+and passing the cursor identifying the target
+frame as the only argument.
+.PP
+Normally, libunwind
+supports both local and remote unwinding
+(the latter will be explained in the next section). However, if you
+tell libunwind that your program only needs local unwinding, then a
+special implementation can be selected which may run much faster than
+the generic implementation which supports both kinds of unwinding. To
+select this optimized version, simply define the macro
+UNW_LOCAL_ONLY
+before including the headerfile
+<libunwind.h>\&.
+It is perfectly OK for a single program to
+employ both local\-only and generic unwinding. That is, whether or not
+UNW_LOCAL_ONLY
+is defined is a choice that each source\-file
+(compilation\-unit) can make on its own. Independent of the setting(s)
+of UNW_LOCAL_ONLY,
+you\&'ll always link the same library into
+the program (normally \fB\-l\fPunwind).
+Furthermore, the
+portion of libunwind
+that manages unwind\-info for dynamically
+generated code is not affected by the setting of
+UNW_LOCAL_ONLY\&.
+.PP
+If we put all of the above together, here is how we could use
+libunwind
+to write a function ``show_backtrace()\&''
+which prints a classic stack trace:
+.PP
+.Vb
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+
+void show_backtrace (void) {
+ unw_cursor_t cursor; unw_context_t uc;
+ unw_word_t ip, sp;
+
+ unw_getcontext(&uc);
+ unw_init_local(&cursor, &uc);
+ while (unw_step(&cursor) > 0) {
+ unw_get_reg(&cursor, UNW_REG_IP, &ip);
+ unw_get_reg(&cursor, UNW_REG_SP, &sp);
+ printf ("ip = %lx, sp = %lx\\n", (long) ip, (long) sp);
+ }
+}
+.Ve
+.PP
+.SH REMOTE UNWINDING
+
+.PP
+Libunwind
+can also be used to unwind a stack in a ``remote\&''
+process. Here, ``remote\&'' may mean another process on the same
+machine or even a process on a completely different machine from the
+one that is running libunwind\&.
+Remote unwinding is typically
+used by debuggers and instruction\-set simulators, for example.
+.PP
+Before you can unwind a remote process, you need to create a new
+address\-space object for that process. This is achieved with the
+unw_create_addr_space()
+routine. The routine takes two
+arguments: a pointer to a set of \fIaccessor\fP
+routines and an
+integer that specifies the byte\-order of the target process. The
+accessor routines provide libunwind
+with the means to
+communicate with the remote process. In particular, there are
+callbacks to read and write the process\&'s memory, its registers, and
+to access unwind information which may be needed by libunwind\&.
+.PP
+With the address space created, unwinding can be initiated by a call
+to unw_init_remote().
+This routine is very similar to
+unw_init_local(),
+except that it takes an address\-space
+object and an opaque pointer as arguments. The routine uses these
+arguments to fetch the initial machine state. Libunwind
+never
+uses the opaque pointer on its own, but instead just passes it on to
+the accessor (callback) routines. Typically, this pointer is used to
+select, e.g., the thread within a process that is to be unwound.
+.PP
+Once a cursor has been initialized with unw_init_remote(),
+unwinding works exactly like in the local case. That is, you can use
+unw_step()
+to move ``up\&'' in the call\-chain, read and write
+registers, or resume execution at a particular stack frame by calling
+unw_resume\&.
+.PP
+.SH CROSS\-PLATFORM AND MULTI\-PLATFORM UNWINDING
+
+.PP
+Libunwind
+has been designed to enable unwinding across
+platforms (architectures). Indeed, a single program can use
+libunwind
+to unwind an arbitrary number of target platforms,
+all at the same time!
+.PP
+We call the machine that is running libunwind
+the \fIhost\fP
+and the machine that is running the process being unwound the
+\fItarget\fP\&.
+If the host and the target platform are the same, we
+call it \fInative\fP
+unwinding. If they differ, we call it
+\fIcross\-platform\fP
+unwinding.
+.PP
+The principle behind supporting native, cross\-platform, and
+multi\-platform unwinding is very simple: for native unwinding, a
+program includes <libunwind.h>
+and uses the linker switch
+\fB\-l\fPunwind\&.
+For cross\-platform unwinding, a program
+includes <libunwind\-PLAT\&.h>
+and uses the linker
+switch \fB\-l\fPunwind\-PLAT,
+where PLAT
+is the name
+of the target platform (e.g., ia64
+for IA\-64, hppa\-elf
+for ELF\-based HP PA\-RISC, or x86
+for 80386). Multi\-platform
+unwinding works exactly like cross\-platform unwinding, the only
+limitation is that a single source file (compilation unit) can include
+at most one libunwind
+header file. In other words, the
+platform\-specific support for each supported target needs to be
+isolated in separate source files\-\-\-a limitation that shouldn\&'t be an
+issue in practice.
+.PP
+Note that, by definition, local unwinding is possible only for the
+native case. Attempting to call, e.g., unw_local_init()
+when
+targeting a cross\-platform will result in a link\-time error
+(unresolved references).
+.PP
+.SH THREAD\- AND SIGNAL\-SAFETY
+
+.PP
+All libunwind
+routines are thread\-safe. What this means is
+that multiple threads may use libunwind
+simulatenously.
+However, any given cursor may be accessed by only one thread at
+any given time.
+.PP
+To ensure thread\-safety, some libunwind
+routines may have to
+use locking. Such routines \fImust not\fP
+be called from signal
+handlers (directly or indirectly) and are therefore \fInot\fP
+signal\-safe. The manual page for each libunwind
+routine
+identifies whether or not it is signal\-safe, but as a general rule,
+any routine that may be needed for \fIlocal\fP
+unwinding is
+signal\-safe (e.g., unw_step()
+for local unwinding is
+signal\-safe). For remote\-unwinding, \fInone\fP
+of the
+libunwind
+routines are guaranteed to be signal\-safe.
+.PP
+.SH UNWINDING THROUGH DYNAMICALLY GENERATED CODE
+
+.PP
+Libunwind
+provides the routines _U_dyn_register()
+and
+_U_dyn_cancel()
+to register/cancel the information required to
+unwind through code that has been generated at runtime (e.g., by a
+just\-in\-time (JIT) compiler). It is important to register the
+information for \fIall\fP
+dynamically generated code because
+otherwise, a debugger may not be able to function properly or
+high\-level language exception handling may not work as expected.
+.PP
+The interface for registering and canceling dynamic unwind info has
+been designed for maximum efficiency, so as to minimize the
+performance impact on JIT\-compilers. In particular, both routines are
+guaranteed to execute in ``constant time\&'' (O(1)) and the
+data\-structure encapsulating the dynamic unwind info has been designed
+to facilitate sharing, such that similar procedures can share much of
+the underlying information.
+.PP
+For more information on the libunwind
+support for dynamically
+generated code, see libunwind\-dynamic(3)\&.
+.PP
+.SH CACHING OF UNWIND INFO
+
+.PP
+To speed up execution, libunwind
+may aggressively cache the
+information it needs to perform unwinding. If a process changes
+during its lifetime, this creates a risk of libunwind
+using
+stale data. For example, this would happen if libunwind
+were
+to cache information about a shared library which later on gets
+unloaded (e.g., via \fIdlclose\fP(3)).
+.PP
+To prevent the risk of using stale data, libunwind
+provides two
+facilities: first, it is possible to flush the cached information
+associated with a specific address range in the target process (or the
+entire address space, if desired). This functionality is provided by
+unw_flush_cache().
+The second facility is provided by
+unw_set_caching_policy(),
+which lets a program
+select the exact caching policy in use for a given address\-space
+object. In particular, by selecting the policy
+UNW_CACHE_NONE,
+it is possible to turn off caching
+completely, therefore eliminating the risk of stale data alltogether
+(at the cost of slower execution). By default, caching is enabled for
+local unwinding only. The cache size can be dynamically changed with
+unw_set_cache_size(),
+which also fluches the current cache.
+.PP
+.SH FILES
+
+.PP
+.TP
+libunwind.h
+ Headerfile to include for native (same
+platform) unwinding.
+.TP
+libunwind\-PLAT\&.h
+ Headerfile to include when
+the unwind target runs on platform PLAT\&.
+For example, to unwind
+an IA\-64 program, the header file libunwind\-ia64.h
+should be
+included.
+.TP
+\fB\-l\fPunwind
+ Linker\-switch to add when building a
+program that does native (same platform) unwinding.
+.TP
+\fB\-l\fPunwind\-PLAT
+ Linker\-switch to add when
+building a program that unwinds a program on platform PLAT\&.
+For example, to (cross\-)unwind an IA\-64 program, the linker switch
+\-lunwind\-ia64
+should be added. Note: multiple such switches
+may need to be specified for programs that can unwind programs on
+multiple platforms.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind\-dynamic(3),
+libunwind\-ia64(3),
+libunwind\-ptrace(3),
+libunwind\-setjmp(3),
+unw_create_addr_space(3),
+unw_destroy_addr_space(3),
+unw_flush_cache(3),
+unw_get_accessors(3),
+unw_get_fpreg(3),
+unw_get_proc_info(3),
+unw_get_proc_name(3),
+unw_get_reg(3),
+unw_getcontext(3),
+unw_init_local(3),
+unw_init_remote(3),
+unw_is_fpreg(3),
+unw_is_signal_frame(3),
+unw_regname(3),
+unw_resume(3),
+unw_set_caching_policy(3),
+unw_set_cache_size(3),
+unw_set_fpreg(3),
+unw_set_reg(3),
+unw_step(3),
+unw_strerror(3),
+_U_dyn_register(3),
+_U_dyn_cancel(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/libunwind.tex b/src/pal/src/libunwind/doc/libunwind.tex
new file mode 100644
index 0000000000..6cbb476633
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind.tex
@@ -0,0 +1,359 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{libunwind}{David Mosberger-Tang}{Programming Library}{Introduction to libunwind}libunwind -- a (mostly) platform-independent unwind API
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\noindent
+\Type{int} \Func{unw\_getcontext}(\Type{unw\_context\_t~*});\\
+\noindent
+\Type{int} \Func{unw\_init\_local}(\Type{unw\_cursor\_t~*}, \Type{unw\_context\_t~*});\\
+\noindent
+\Type{int} \Func{unw\_init\_remote}(\Type{unw\_cursor\_t~*}, \Type{unw\_addr\_space\_t}, \Type{void~*});\\
+\noindent
+\Type{int} \Func{unw\_step}(\Type{unw\_cursor\_t~*});\\
+\noindent
+\Type{int} \Func{unw\_get\_reg}(\Type{unw\_cursor\_t~*}, \Type{unw\_regnum\_t}, \Type{unw\_word\_t~*});\\
+\noindent
+\Type{int} \Func{unw\_get\_fpreg}(\Type{unw\_cursor\_t~*}, \Type{unw\_regnum\_t}, \Type{unw\_fpreg\_t~*});\\
+\noindent
+\Type{int} \Func{unw\_set\_reg}(\Type{unw\_cursor\_t~*}, \Type{unw\_regnum\_t}, \Type{unw\_word\_t});\\
+\noindent
+\Type{int} \Func{unw\_set\_fpreg}(\Type{unw\_cursor\_t~*}, \Type{unw\_regnum\_t}, \Type{unw\_fpreg\_t});\\
+\noindent
+\Type{int} \Func{unw\_resume}(\Type{unw\_cursor\_t~*});\\
+
+\noindent
+\Type{unw\_addr\_space\_t} \Var{unw\_local\_addr\_space};\\
+\noindent
+\Type{unw\_addr\_space\_t} \Func{unw\_create\_addr\_space}(\Type{unw\_accessors\_t}, \Type{int});\\
+\noindent
+\Type{void} \Func{unw\_destroy\_addr\_space}(\Type{unw\_addr\_space\_t});\\
+\noindent
+\Type{unw\_accessors\_t} \Func{unw\_get\_accessors}(\Type{unw\_addr\_space\_t});\\
+\noindent
+\Type{void} \Func{unw\_flush\_cache}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t}, \Type{unw\_word\_t});\\
+\noindent
+\Type{int} \Func{unw\_set\_caching\_policy}(\Type{unw\_addr\_space\_t}, \Type{unw\_caching\_policy\_t});\\
+\noindent
+\Type{int} \Func{unw\_set\_cache\_size}(\Type{unw\_addr\_space\_t}, \Type{size\_t}, \Type{int});\\
+
+\noindent
+\Type{const char *}\Func{unw\_regname}(\Type{unw\_regnum\_t});\\
+\noindent
+\Type{int} \Func{unw\_get\_proc\_info}(\Type{unw\_cursor\_t~*}, \Type{unw\_proc\_info\_t~*});\\
+\noindent
+\Type{int} \Func{unw\_get\_save\_loc}(\Type{unw\_cursor\_t~*}, \Type{int}, \Type{unw\_save\_loc\_t~*});\\
+\noindent
+\Type{int} \Func{unw\_is\_fpreg}(\Type{unw\_regnum\_t});\\
+\Type{int} \Func{unw\_is\_signal\_frame}(\Type{unw\_cursor\_t~*});\\
+\noindent
+\Type{int} \Func{unw\_get\_proc\_name}(\Type{unw\_cursor\_t~*}, \Type{char~*}, \Type{size\_t}, \Type{unw\_word\_t~*});\\
+
+\noindent
+\Type{void} \Func{\_U\_dyn\_register}(\Type{unw\_dyn\_info\_t~*});\\
+\noindent
+\Type{void} \Func{\_U\_dyn\_cancel}(\Type{unw\_dyn\_info\_t~*});\\
+
+\section{Local Unwinding}
+
+\Prog{Libunwind} is very easy to use when unwinding a stack from
+within a running program. This is called \emph{local} unwinding. Say
+you want to unwind the stack while executing in some function
+\Func{F}(). In this function, you would call \Func{unw\_getcontext}()
+to get a snapshot of the CPU registers (machine-state). Then you
+initialize an \emph{unwind~cursor} based on this snapshot. This is
+done with a call to \Func{unw\_init\_local}(). The cursor now points
+to the current frame, that is, the stack frame that corresponds to the
+current activation of function \Func{F}(). The unwind cursor can then
+be moved ``up'' (towards earlier stack frames) by calling
+\Func{unw\_step}(). By repeatedly calling this routine, you can
+uncover the entire call-chain that led to the activation of function
+\Func{F}(). A positive return value from \Func{unw\_step}() indicates
+that there are more frames in the chain, zero indicates that the end
+of the chain has been reached, and any negative value indicates that
+some sort of error has occurred.
+
+While it is not possible to directly move the unwind cursor in the
+``down'' direction (towards newer stack frames), this effect can be
+achieved by making copies of an unwind cursor. For example, a program
+that sometimes has to move ``down'' by one stack frame could maintain
+two cursor variables: ``\Var{curr}'' and ``\Var{prev}''. The former
+would be used as the current cursor and \Var{prev} would be maintained
+as the ``previous frame'' cursor by copying the contents of \Var{curr}
+to \Var{prev} right before calling \Func{unw\_step}(). With this
+approach, the program could move one step ``down'' simply by copying
+back \Var{prev} to \Var{curr} whenever that is necessary. In the most
+extreme case, a program could maintain a separate cursor for each call
+frame and that way it could move up and down the callframe-chain at
+will.
+
+Given an unwind cursor, it is possible to read and write the CPU
+registers that were preserved for the current stack frame (as
+identified by the cursor). \Prog{Libunwind} provides several routines
+for this purpose: \Func{unw\_get\_reg}() reads an integer (general)
+register, \Func{unw\_get\_fpreg}() reads a floating-point register,
+\Func{unw\_set\_reg}() writes an integer register, and
+\Func{unw\_set\_fpreg}() writes a floating-point register. Note that,
+by definition, only the \emph{preserved} machine state can be accessed
+during an unwind operation. Normally, this state consists of the
+\emph{callee-saved} (``preserved'') registers. However, in some
+special circumstances (e.g., in a signal handler trampoline), even the
+\emph{caller-saved} (``scratch'') registers are preserved in the stack
+frame and, in those cases, \Prog{libunwind} will grant access to them
+as well. The exact set of registers that can be accessed via the
+cursor depends, of course, on the platform. However, there are two
+registers that can be read on all platforms: the instruction pointer
+(IP), sometimes also known as the ``program counter'', and the stack
+pointer (SP). In \Prog{libunwind}, these registers are identified by
+the macros \Const{UNW\_REG\_IP} and \Const{UNW\_REG\_SP},
+respectively.
+
+Besides just moving the unwind cursor and reading/writing saved
+registers, \Prog{libunwind} also provides the ability to resume
+execution at an arbitrary stack frame. As you might guess, this is
+useful for implementing non-local gotos and the exception handling
+needed by some high-level languages such as Java. Resuming execution
+with a particular stack frame simply requires calling
+\Func{unw\_resume}() and passing the cursor identifying the target
+frame as the only argument.
+
+Normally, \Prog{libunwind} supports both local and remote unwinding
+(the latter will be explained in the next section). However, if you
+tell libunwind that your program only needs local unwinding, then a
+special implementation can be selected which may run much faster than
+the generic implementation which supports both kinds of unwinding. To
+select this optimized version, simply define the macro
+\Const{UNW\_LOCAL\_ONLY} before including the headerfile
+\File{$<$libunwind.h$>$}. It is perfectly OK for a single program to
+employ both local-only and generic unwinding. That is, whether or not
+\Const{UNW\_LOCAL\_ONLY} is defined is a choice that each source-file
+(compilation-unit) can make on its own. Independent of the setting(s)
+of \Const{UNW\_LOCAL\_ONLY}, you'll always link the same library into
+the program (normally \Opt{-l}\File{unwind}). Furthermore, the
+portion of \Prog{libunwind} that manages unwind-info for dynamically
+generated code is not affected by the setting of
+\Const{UNW\_LOCAL\_ONLY}.
+
+If we put all of the above together, here is how we could use
+\Prog{libunwind} to write a function ``\Func{show\_backtrace}()''
+which prints a classic stack trace:
+
+\begin{verbatim}
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+
+void show_backtrace (void) {
+ unw_cursor_t cursor; unw_context_t uc;
+ unw_word_t ip, sp;
+
+ unw_getcontext(&uc);
+ unw_init_local(&cursor, &uc);
+ while (unw_step(&cursor) > 0) {
+ unw_get_reg(&cursor, UNW_REG_IP, &ip);
+ unw_get_reg(&cursor, UNW_REG_SP, &sp);
+ printf ("ip = %lx, sp = %lx\n", (long) ip, (long) sp);
+ }
+}
+\end{verbatim}
+
+
+\section{Remote Unwinding}
+
+\Prog{Libunwind} can also be used to unwind a stack in a ``remote''
+process. Here, ``remote'' may mean another process on the same
+machine or even a process on a completely different machine from the
+one that is running \Prog{libunwind}. Remote unwinding is typically
+used by debuggers and instruction-set simulators, for example.
+
+Before you can unwind a remote process, you need to create a new
+address-space object for that process. This is achieved with the
+\Func{unw\_create\_addr\_space}() routine. The routine takes two
+arguments: a pointer to a set of \emph{accessor} routines and an
+integer that specifies the byte-order of the target process. The
+accessor routines provide \Func{libunwind} with the means to
+communicate with the remote process. In particular, there are
+callbacks to read and write the process's memory, its registers, and
+to access unwind information which may be needed by \Func{libunwind}.
+
+With the address space created, unwinding can be initiated by a call
+to \Func{unw\_init\_remote}(). This routine is very similar to
+\Func{unw\_init\_local}(), except that it takes an address-space
+object and an opaque pointer as arguments. The routine uses these
+arguments to fetch the initial machine state. \Prog{Libunwind} never
+uses the opaque pointer on its own, but instead just passes it on to
+the accessor (callback) routines. Typically, this pointer is used to
+select, e.g., the thread within a process that is to be unwound.
+
+Once a cursor has been initialized with \Func{unw\_init\_remote}(),
+unwinding works exactly like in the local case. That is, you can use
+\Func{unw\_step}() to move ``up'' in the call-chain, read and write
+registers, or resume execution at a particular stack frame by calling
+\Func{unw\_resume}.
+
+
+\section{Cross-platform and Multi-platform Unwinding}
+
+\Prog{Libunwind} has been designed to enable unwinding across
+platforms (architectures). Indeed, a single program can use
+\Prog{libunwind} to unwind an arbitrary number of target platforms,
+all at the same time!
+
+We call the machine that is running \Prog{libunwind} the \emph{host}
+and the machine that is running the process being unwound the
+\emph{target}. If the host and the target platform are the same, we
+call it \emph{native} unwinding. If they differ, we call it
+\emph{cross-platform} unwinding.
+
+The principle behind supporting native, cross-platform, and
+multi-platform unwinding is very simple: for native unwinding, a
+program includes \File{$<$libunwind.h$>$} and uses the linker switch
+\Opt{-l}\File{unwind}. For cross-platform unwinding, a program
+includes \File{$<$libunwind-}\Var{PLAT}\File{.h$>$} and uses the linker
+switch \Opt{-l}\File{unwind-}\Var{PLAT}, where \Var{PLAT} is the name
+of the target platform (e.g., \File{ia64} for IA-64, \File{hppa-elf}
+for ELF-based HP PA-RISC, or \File{x86} for 80386). Multi-platform
+unwinding works exactly like cross-platform unwinding, the only
+limitation is that a single source file (compilation unit) can include
+at most one \Prog{libunwind} header file. In other words, the
+platform-specific support for each supported target needs to be
+isolated in separate source files---a limitation that shouldn't be an
+issue in practice.
+
+Note that, by definition, local unwinding is possible only for the
+native case. Attempting to call, e.g., \Func{unw\_local\_init}() when
+targeting a cross-platform will result in a link-time error
+(unresolved references).
+
+
+\section{Thread- and Signal-Safety}
+
+
+All \Prog{libunwind} routines are thread-safe. What this means is
+that multiple threads may use \Prog{libunwind} simulatenously.
+However, any given cursor may be accessed by only one thread at
+any given time.
+
+To ensure thread-safety, some \Prog{libunwind} routines may have to
+use locking. Such routines \emph{must~not} be called from signal
+handlers (directly or indirectly) and are therefore \emph{not}
+signal-safe. The manual page for each \Prog{libunwind} routine
+identifies whether or not it is signal-safe, but as a general rule,
+any routine that may be needed for \emph{local} unwinding is
+signal-safe (e.g., \Func{unw\_step}() for local unwinding is
+signal-safe). For remote-unwinding, \emph{none} of the
+\Prog{libunwind} routines are guaranteed to be signal-safe.
+
+
+\section{Unwinding Through Dynamically Generated Code}
+
+\Func{Libunwind} provides the routines \Func{\_U\_dyn\_register}() and
+\Func{\_U\_dyn\_cancel}() to register/cancel the information required to
+unwind through code that has been generated at runtime (e.g., by a
+just-in-time (JIT) compiler). It is important to register the
+information for \emph{all} dynamically generated code because
+otherwise, a debugger may not be able to function properly or
+high-level language exception handling may not work as expected.
+
+The interface for registering and canceling dynamic unwind info has
+been designed for maximum efficiency, so as to minimize the
+performance impact on JIT-compilers. In particular, both routines are
+guaranteed to execute in ``constant time'' (O(1)) and the
+data-structure encapsulating the dynamic unwind info has been designed
+to facilitate sharing, such that similar procedures can share much of
+the underlying information.
+
+For more information on the \Prog{libunwind} support for dynamically
+generated code, see \SeeAlso{libunwind-dynamic(3)}.
+
+
+\section{Caching of Unwind Info}
+
+To speed up execution, \Prog{libunwind} may aggressively cache the
+information it needs to perform unwinding. If a process changes
+during its lifetime, this creates a risk of \Prog{libunwind} using
+stale data. For example, this would happen if \Prog{libunwind} were
+to cache information about a shared library which later on gets
+unloaded (e.g., via \Cmd{dlclose}{3}).
+
+To prevent the risk of using stale data, \Prog{libunwind} provides two
+facilities: first, it is possible to flush the cached information
+associated with a specific address range in the target process (or the
+entire address space, if desired). This functionality is provided by
+\Func{unw\_flush\_cache}(). The second facility is provided by
+\Func{unw\_set\_caching\_policy}(), which lets a program
+select the exact caching policy in use for a given address-space
+object. In particular, by selecting the policy
+\Const{UNW\_CACHE\_NONE}, it is possible to turn off caching
+completely, therefore eliminating the risk of stale data alltogether
+(at the cost of slower execution). By default, caching is enabled for
+local unwinding only. The cache size can be dynamically changed with
+\Func{unw\_set\_cache\_size}(), which also fluches the current cache.
+
+
+\section{Files}
+
+\begin{Description}
+\item[\File{libunwind.h}] Headerfile to include for native (same
+ platform) unwinding.
+\item[\File{libunwind-}\Var{PLAT}\File{.h}] Headerfile to include when
+ the unwind target runs on platform \Var{PLAT}. For example, to unwind
+ an IA-64 program, the header file \File{libunwind-ia64.h} should be
+ included.
+\item[\Opt{-l}\File{unwind}] Linker-switch to add when building a
+ program that does native (same platform) unwinding.
+\item[\Opt{-l}\File{unwind-}\Var{PLAT}] Linker-switch to add when
+ building a program that unwinds a program on platform \Var{PLAT}.
+ For example, to (cross-)unwind an IA-64 program, the linker switch
+ \File{-lunwind-ia64} should be added. Note: multiple such switches
+ may need to be specified for programs that can unwind programs on
+ multiple platforms.
+\end{Description}
+
+\section{See Also}
+
+\SeeAlso{libunwind-dynamic(3)},
+\SeeAlso{libunwind-ia64(3)},
+\SeeAlso{libunwind-ptrace(3)},
+\SeeAlso{libunwind-setjmp(3)},
+\SeeAlso{unw\_create\_addr\_space(3)},
+\SeeAlso{unw\_destroy\_addr\_space(3)},
+\SeeAlso{unw\_flush\_cache(3)},
+\SeeAlso{unw\_get\_accessors(3)},
+\SeeAlso{unw\_get\_fpreg(3)},
+\SeeAlso{unw\_get\_proc\_info(3)},
+\SeeAlso{unw\_get\_proc\_name(3)},
+\SeeAlso{unw\_get\_reg(3)},
+\SeeAlso{unw\_getcontext(3)},
+\SeeAlso{unw\_init\_local(3)},
+\SeeAlso{unw\_init\_remote(3)},
+\SeeAlso{unw\_is\_fpreg(3)},
+\SeeAlso{unw\_is\_signal\_frame(3)},
+\SeeAlso{unw\_regname(3)},
+\SeeAlso{unw\_resume(3)},
+\SeeAlso{unw\_set\_caching\_policy(3)},
+\SeeAlso{unw\_set\_cache\_size(3)},
+\SeeAlso{unw\_set\_fpreg(3)},
+\SeeAlso{unw\_set\_reg(3)},
+\SeeAlso{unw\_step(3)},
+\SeeAlso{unw\_strerror(3)},
+\SeeAlso{\_U\_dyn\_register(3)},
+\SeeAlso{\_U\_dyn\_cancel(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/libunwind.trans b/src/pal/src/libunwind/doc/libunwind.trans
new file mode 100644
index 0000000000..a514e5a081
--- /dev/null
+++ b/src/pal/src/libunwind/doc/libunwind.trans
@@ -0,0 +1,34 @@
+$manMacro1a{'Type'} = $manMacro1a{File};
+ $manMacro1b{'Type'} = $manMacro1b{File};
+$htmlMacro1a{'Type'} = $htmlMacro1a{File};
+ $htmlMacro1b{'Type'} = $htmlMacro1b{File};
+$texiMacro1a{'Type'} = $texiMacro1a{File};
+ $texiMacro1b{'Type'} = $texiMacro1b{File};
+$manMacro1a{'Func'} = $manMacro1a{Prog};
+ $manMacro1b{'Func'} = $manMacro1b{Prog};
+$htmlMacro1a{'Func'} = $htmlMacro1a{Arg};
+ $htmlMacro1b{'Func'} = $htmlMacro1b{Arg};
+$texiMacro1a{'Func'} = $texiMacro1a{Prog};
+ $texiMacro1b{'Func'} = $texiMacro1b{Prog};
+$manMacro1a{'Var'} = $manMacro1a{Prog};
+ $manMacro1b{'Var'} = $manMacro1b{Prog};
+$htmlMacro1a{'Var'} = $htmlMacro1a{Prog};
+ $htmlMacro1b{'Var'} = $htmlMacro1b{Prog};
+$texiMacro1a{'Var'} = $texiMacro1a{Prog};
+ $texiMacro1b{'Var'} = $texiMacro1b{Prog};
+$manMacro1a{'Const'} = $manMacro1a{File};
+ $manMacro1b{'Const'} = $manMacro1b{File};
+$htmlMacro1a{'Const'} = $htmlMacro1a{File};
+ $htmlMacro1b{'Const'} = $htmlMacro1b{File};
+$texiMacro1a{'Const'} = $texiMacro1a{File};
+ $texiMacro1b{'Const'} = $texiMacro1b{File};
+
+$manMacro1a{'SeeAlso'} = $manMacro1a{File};
+ $manMacro1b{'SeeAlso'} = $manMacro1b{File};
+# special handling of SeeAlso in latex2man, so that argument gets doubled:
+$htmlMacro2a{'SeeAlso'} = "<a href=\"";
+ $htmlMacro2b{'SeeAlso'} = ".html\">$htmlMacro1a{File}";
+ $htmlMacro2c{'SeeAlso'} = "$htmlMacro1b{File}</a>";
+$texiMacro1a{'SeeAlso'} = $texiMacro1a{File};
+ $texiMacro1b{'SeeAlso'} = $texiMacro1b{File};
+
diff --git a/src/pal/src/libunwind/doc/unw_apply_reg_state.man b/src/pal/src/libunwind/doc/unw_apply_reg_state.man
new file mode 100644
index 0000000000..457f0c4dd1
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_apply_reg_state.man
@@ -0,0 +1,90 @@
+'\" t
+.\" Manual page created with latex2man on Wed Aug 16 11:09:44 PDT 2017
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_APPLY\\_REG\\_STATE" "3" "16 August 2017" "Programming Library " "Programming Library "
+.SH NAME
+unw_apply_reg_state
+\-\- apply a register state update to a cursor
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_apply_reg_state(unw_cursor_t *cp,
+void *reg_states_data);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_apply_reg_state()
+routine updates the register values
+of a cursor according to the instructions in reg_states_data,
+which have been obtained by calling unw_reg_states_iterate\&.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_apply_reg_state()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_apply_reg_state()
+is thread\-safe. If cursor cp
+is
+in the local address\-space, this routine is also safe to use from a
+signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_ENOINFO
+ Libunwind
+was unable to locate
+unwind\-info for the procedure.
+.TP
+UNW_EBADVERSION
+ The unwind\-info for the procedure has
+version or format that is not understood by libunwind\&.
+.PP
+In addition, unw_apply_reg_state()
+may return any error
+returned by the access_mem()
+call\-back (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_reg_states_iterate(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_apply_reg_state.tex b/src/pal/src/libunwind/doc/unw_apply_reg_state.tex
new file mode 100644
index 0000000000..c67cc3ebfa
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_apply_reg_state.tex
@@ -0,0 +1,63 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_apply\_reg\_state}{David Mosberger-Tang}{Programming Library}{unw\_apply\_reg\_state}unw\_apply\_reg\_state -- apply a register state update to a cursor
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int}
+\Func{unw\_apply\_reg\_state}(\Type{unw\_cursor\_t~*}\Var{cp},
+\Type{void~*}\Var{reg\_states\_data});\\
+
+\section{Description}
+
+The \Func{unw\_apply\_reg\_state}() routine updates the register values
+of a cursor according to the instructions in \Var{reg\_states\_data},
+which have been obtained by calling \Var{unw\_reg\_states\_iterate}.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_apply\_reg\_state}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_apply\_reg\_state}() is thread-safe. If cursor \Var{cp} is
+in the local address-space, this routine is also safe to use from a
+signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to locate
+ unwind-info for the procedure.
+\item[\Const{UNW\_EBADVERSION}] The unwind-info for the procedure has
+ version or format that is not understood by \Prog{libunwind}.
+\end{Description}
+In addition, \Func{unw\_apply\_reg\_state}() may return any error
+returned by the \Func{access\_mem}() call-back (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_reg\_states\_iterate(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_backtrace.man b/src/pal/src/libunwind/doc/unw_backtrace.man
new file mode 100644
index 0000000000..5699bbfe28
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_backtrace.man
@@ -0,0 +1,86 @@
+'\" t
+.\" Manual page created with latex2man on Fri Aug 31 13:39:04 EEST 2012
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_BACKTRACE" "3" "31 August 2012" "Programming Library " "Programming Library "
+.SH NAME
+unw_backtrace
+\-\- return backtrace for the calling program
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_backtrace(void **buffer,
+int size);
+.br
+.PP
+#include <execinfo.h>
+.br
+.PP
+int
+backtrace(void **buffer,
+int size);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+unw_backtrace()
+is a convenient routine for obtaining the backtrace for
+the calling program. The routine fills up to size
+addresses in the array
+pointed by buffer\&.
+The routine is only available for local unwinding.
+.PP
+Note that many (but not all) systems provide practically identical function
+called backtrace().
+The prototype for this function is usually obtained
+by including the <execinfo.h>
+header file \-\- a prototype for
+backtrace()
+is not provided by libunwind\&.
+libunwind
+weakly
+aliases backtrace()
+to unw_backtrace(),
+so when a program
+calling backtrace()
+is linked against libunwind,
+it may end up
+calling unw_backtrace().
+.PP
+.SH RETURN VALUE
+
+.PP
+The routine returns the number of addresses stored in the array pointed by
+buffer\&.
+The return value may be zero to indicate that no addresses were
+stored.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_step(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_backtrace.tex b/src/pal/src/libunwind/doc/unw_backtrace.tex
new file mode 100644
index 0000000000..c383eeb37a
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_backtrace.tex
@@ -0,0 +1,54 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_backtrace}{David Mosberger-Tang}{Programming Library}{unw\_backtrace}unw\_backtrace -- return backtrace for the calling program
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_backtrace}(\Type{void~**}\Var{buffer}, \Type{int}~\Var{size});\\
+
+\File{\#include $<$execinfo.h$>$}\\
+
+\Type{int} \Func{backtrace}(\Type{void~**}\Var{buffer}, \Type{int}~\Var{size});\\
+
+\section{Description}
+
+\Func{unw\_backtrace}() is a convenient routine for obtaining the backtrace for
+the calling program. The routine fills up to \Var{size} addresses in the array
+pointed by \Var{buffer}. The routine is only available for local unwinding.
+
+Note that many (but not all) systems provide practically identical function
+called \Func{backtrace}(). The prototype for this function is usually obtained
+by including the \File{$<$execinfo.h$>$} header file -- a prototype for
+\Func{backtrace}() is not provided by \Prog{libunwind}. \Prog{libunwind} weakly
+aliases \Func{backtrace}() to \Func{unw\_backtrace}(), so when a program
+calling \Func{backtrace}() is linked against \Prog{libunwind}, it may end up
+calling \Func{unw\_backtrace}().
+
+\section{Return Value}
+
+The routine returns the number of addresses stored in the array pointed by
+\Var{buffer}. The return value may be zero to indicate that no addresses were
+stored.
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_step(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_create_addr_space.man b/src/pal/src/libunwind/doc/unw_create_addr_space.man
new file mode 100644
index 0000000000..4aca13ecd8
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_create_addr_space.man
@@ -0,0 +1,457 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_CREATE\\_ADDR\\_SPACE" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_create_addr_space
+\-\- create address space for remote unwinding
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+unw_addr_space_t
+unw_create_addr_space(unw_accessors_t *ap,
+int
+byteorder);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_create_addr_space()
+routine creates a new unwind
+address\-space and initializes it based on the call\-back routines
+passed via the ap
+pointer and the specified byteorder\&.
+The call\-back routines are described in detail below. The
+byteorder
+can be set to 0 to request the default byte\-order of
+the unwind target. To request a particular byte\-order,
+byteorder
+can be set to any constant defined by
+<endian.h>\&.
+In particular, __LITTLE_ENDIAN
+would
+request little\-endian byte\-order and __BIG_ENDIAN
+would
+request big\-endian byte\-order. Whether or not a particular byte\-order
+is supported depends on the target platform.
+.PP
+.SH CALL\-BACK ROUTINES
+
+.PP
+Libunwind
+uses a set of call\-back routines to access the
+information it needs to unwind a chain of stack\-frames. These
+routines are specified via the ap
+argument, which points to a
+variable of type unw_accessors_t\&.
+The contents of this
+variable is copied into the newly\-created address space, so the
+variable must remain valid only for the duration of the call to
+unw_create_addr_space().
+.PP
+The first argument to every call\-back routine is an address\-space
+identifier (as)
+and the last argument is an arbitrary,
+application\-specified void\-pointer (arg).
+When invoking a
+call\-back routine, libunwind
+sets the as
+argument to the
+address\-space on whose behalf the invocation is made and the arg
+argument to the value that was specified when
+unw_init_remote(3)
+was called.
+.PP
+The synopsis and a detailed description of every call\-back routine
+follows below.
+.PP
+.SS CALL\-BACK ROUTINE SYNOPSIS
+.PP
+int
+find_proc_info(unw_addr_space_t
+as,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_word_t
+ip,
+unw_proc_info_t *pip,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPint
+need_unwind_info,
+void *arg);
+.br
+void
+put_unwind_info(unw_addr_space_t
+as,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_proc_info_t *pip,
+void *arg);
+.br
+int
+get_dyn_info_list_addr(unw_addr_space_t
+as,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_word_t *dilap,
+void *arg);
+.br
+int
+access_mem(unw_addr_space_t
+as,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_word_t
+addr,
+unw_word_t *valp,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPint
+write,
+void *arg);
+.br
+int
+access_reg(unw_addr_space_t
+as,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_regnum_t
+regnum,
+unw_word_t *valp,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPint
+write,
+void *arg);
+.br
+int
+access_fpreg(unw_addr_space_t
+as,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_regnum_t
+regnum,
+unw_fpreg_t *fpvalp,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPint
+write,
+void *arg);
+.br
+int
+resume(unw_addr_space_t
+as,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_cursor_t *cp,
+void *arg);
+.br
+int
+get_proc_name(unw_addr_space_t
+as,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_word_t
+addr,
+char *bufp,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPsize_t
+buf_len,
+unw_word_t *offp,
+.br
+\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPvoid *arg);
+.br
+.PP
+.SS FIND_PROC_INFO
+.PP
+Libunwind
+invokes the find_proc_info()
+call\-back to
+locate the information need to unwind a particular procedure. The
+ip
+argument is an instruction\-address inside the procedure whose
+information is needed. The pip
+argument is a pointer to the
+variable used to return the desired information. The type of this
+variable is unw_proc_info_t\&.
+See
+unw_get_proc_info(3)
+for details. Argument
+need_unwind_info
+is zero if the call\-back does not need to
+provide values for the following members in the
+unw_proc_info_t
+structure: format,
+unwind_info_size,
+and unwind_info\&.
+If
+need_unwind_info
+is non\-zero, valid values need to be returned
+in these members. Furthermore, the contents of the memory addressed
+by the unwind_info
+member must remain valid until the info is
+released via the put_unwind_info
+call\-back (see below).
+.PP
+On successful completion, the find_proc_info()
+call\-back must
+return zero. Otherwise, the negative value of one of the
+unw_error_t
+error\-codes may be returned. In particular, this
+call\-back may return \-UNW_ESTOPUNWIND
+to signal the end of
+the frame\-chain.
+.PP
+.SS PUT_UNWIND_INFO
+.PP
+Libunwind
+invokes the put_unwind_info()
+call\-back to
+release the resources (such as memory) allocated by a previous call to
+find_proc_info()
+with the need_unwind_info
+argument
+set to a non\-zero value. The pip
+argument has the same value as
+the argument of the same name in the previous matching call to
+find_proc_info().
+Note that libunwind
+does \fInot\fP
+invoke put_unwind_info
+for calls to find_proc_info()
+with a zero need_unwind_info
+argument.
+.PP
+.SS GET_DYN_INFO_LIST_ADDR
+.PP
+Libunwind
+invokes the get_dyn_info_list_addr()
+call\-back to obtain the address of the head of the dynamic unwind\-info
+registration list. The variable stored at the returned address must
+have a type of unw_dyn_info_list_t
+(see
+_U_dyn_register(3)).
+The dliap
+argument is a pointer
+to a variable of type unw_word_t
+which is used to return the
+address of the dynamic unwind\-info registration list. If no dynamic
+unwind\-info registration list exist, the value pointed to by
+dliap
+must be cleared to zero. Libunwind
+will cache the
+value returned by get_dyn_info_list_addr()
+if caching is
+enabled for the given address\-space. The cache can be cleared with a
+call to unw_flush_cache().
+.PP
+On successful completion, the get_dyn_info_list_addr()
+call\-back must return zero. Otherwise, the negative value of one of
+the unw_error_t
+error\-codes may be returned.
+.PP
+.SS ACCESS_MEM
+.PP
+Libunwind
+invokes the access_mem()
+call\-back to read
+from or write to a word of memory in the target address\-space. The
+address of the word to be accessed is passed in argument addr\&.
+To read memory, libunwind
+sets argument write
+to zero and
+valp
+to point to the word that receives the read value. To
+write memory, libunwind
+sets argument write
+to a non\-zero
+value and valp
+to point to the word that contains the value to
+be written. The word that valp
+points to is always in the
+byte\-order of the host\-platform, regardless of the byte\-order of the
+target. In other words, it is the responsibility of the call\-back
+routine to convert between the target\&'s and the host\&'s byte\-order, if
+necessary.
+.PP
+On successful completion, the access_mem()
+call\-back must return zero. Otherwise, the negative value of one of
+the unw_error_t
+error\-codes may be returned.
+.PP
+.SS ACCESS_REG
+.PP
+Libunwind
+invokes the access_reg()
+call\-back to read
+from or write to a scalar (non\-floating\-point) CPU register. The
+index of the register to be accessed is passed in argument
+regnum\&.
+To read a register, libunwind
+sets argument
+write
+to zero and valp
+to point to the word that receives
+the read value. To write a register, libunwind
+sets argument
+write
+to a non\-zero value and valp
+to point to the word
+that contains the value to be written. The word that valp
+points to is always in the byte\-order of the host\-platform, regardless
+of the byte\-order of the target. In other words, it is the
+responsibility of the call\-back routine to convert between the
+target\&'s and the host\&'s byte\-order, if necessary.
+.PP
+On successful completion, the access_reg()
+call\-back must
+return zero. Otherwise, the negative value of one of the
+unw_error_t
+error\-codes may be returned.
+.PP
+.SS ACCESS_FPREG
+.PP
+Libunwind
+invokes the access_fpreg()
+call\-back to read
+from or write to a floating\-point CPU register. The index of the
+register to be accessed is passed in argument regnum\&.
+To read a
+register, libunwind
+sets argument write
+to zero and
+fpvalp
+to point to a variable of type unw_fpreg_t
+that
+receives the read value. To write a register, libunwind
+sets
+argument write
+to a non\-zero value and fpvalp
+to point to
+the variable of type unw_fpreg_t
+that contains the value to
+be written. The word that fpvalp
+points to is always in the
+byte\-order of the host\-platform, regardless of the byte\-order of the
+target. In other words, it is the responsibility of the call\-back
+routine to convert between the target\&'s and the host\&'s byte\-order, if
+necessary.
+.PP
+On successful completion, the access_fpreg()
+call\-back must
+return zero. Otherwise, the negative value of one of the
+unw_error_t
+error\-codes may be returned.
+.PP
+.SS RESUME
+.PP
+Libunwind
+invokes the resume()
+call\-back to resume
+execution in the target address space. Argument cp
+is the
+unwind\-cursor that identifies the stack\-frame in which execution
+should resume. By the time libunwind
+invokes the resume
+call\-back, it has already established the desired machine\- and
+memory\-state via calls to the access_reg(),
+access_fpreg,
+and access_mem()
+call\-backs. Thus, all
+the call\-back needs to do is perform whatever action is needed to
+actually resume execution.
+.PP
+The resume
+call\-back is invoked only in response to a call to
+unw_resume(3),
+so applications which never invoke
+unw_resume(3)
+need not define the resume
+callback.
+.PP
+On successful completion, the resume()
+call\-back must return
+zero. Otherwise, the negative value of one of the
+unw_error_t
+error\-codes may be returned. As a special case,
+when resuming execution in the local address space, the call\-back will
+not return on success.
+.PP
+.SS GET_PROC_NAME
+.PP
+Libunwind
+invokes the get_proc_name()
+call\-back to
+obtain the procedure\-name of a static (not dynamically generated)
+procedure. Argument addr
+is an instruction\-address within the
+procedure whose name is to be obtained. The bufp
+argument is a
+pointer to a character\-buffer used to return the procedure name. The
+size of this buffer is specified in argument buf_len\&.
+The
+returned name must be terminated by a NUL character. If the
+procedure\&'s name is longer than buf_len
+bytes, it must be
+truncated to buf_len\-1
+bytes, with the last byte in the
+buffer set to the NUL character and \-UNW_ENOMEM
+must be
+returned. Argument offp
+is a pointer to a word which is used to
+return the byte\-offset relative to the start of the procedure whose
+name is being returned. For example, if procedure foo()
+starts
+at address 0x40003000, then invoking get_proc_name()
+with
+addr
+set to 0x40003080 should return a value of 0x80 in the word
+pointed to by offp
+(assuming the procedure is at least 0x80
+bytes long).
+.PP
+On successful completion, the get_proc_name()
+call\-back must
+return zero. Otherwise, the negative value of one of the
+unw_error_t
+error\-codes may be returned.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_create_addr_space()
+returns a
+non\-NULL
+value that represents the newly created
+address\-space. Otherwise, NULL
+is returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_create_addr_space()
+is thread\-safe but \fInot\fP
+safe to use from a signal handler.
+.PP
+.SH SEE ALSO
+
+.PP
+_U_dyn_register(3),
+libunwind(3),
+unw_destroy_addr_space(3),
+unw_get_proc_info(3),
+unw_init_remote(3),
+unw_resume(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_create_addr_space.tex b/src/pal/src/libunwind/doc/unw_create_addr_space.tex
new file mode 100644
index 0000000000..8de0691f3a
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_create_addr_space.tex
@@ -0,0 +1,265 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_create\_addr\_space}{David Mosberger-Tang}{Programming Library}{unw\_create\_addr\_space}unw\_create\_addr\_space -- create address space for remote unwinding
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{unw\_addr\_space\_t} \Func{unw\_create\_addr\_space}(\Type{unw\_accessors\_t~*}\Var{ap}, \Type{int} \Var{byteorder});\\
+
+\section{Description}
+
+The \Func{unw\_create\_addr\_space}() routine creates a new unwind
+address-space and initializes it based on the call-back routines
+passed via the \Var{ap} pointer and the specified \Var{byteorder}.
+The call-back routines are described in detail below. The
+\Var{byteorder} can be set to 0 to request the default byte-order of
+the unwind target. To request a particular byte-order,
+\Var{byteorder} can be set to any constant defined by
+\File{$<$endian.h$>$}. In particular, \Const{\_\_LITTLE\_ENDIAN} would
+request little-endian byte-order and \Const{\_\_BIG\_ENDIAN} would
+request big-endian byte-order. Whether or not a particular byte-order
+is supported depends on the target platform.
+
+\section{Call-back Routines}
+
+\Prog{Libunwind} uses a set of call-back routines to access the
+information it needs to unwind a chain of stack-frames. These
+routines are specified via the \Var{ap} argument, which points to a
+variable of type \Type{unw\_accessors\_t}. The contents of this
+variable is copied into the newly-created address space, so the
+variable must remain valid only for the duration of the call to
+\Func{unw\_create\_addr\_space}().
+
+The first argument to every call-back routine is an address-space
+identifier (\Var{as}) and the last argument is an arbitrary,
+application-specified void-pointer (\Var{arg}). When invoking a
+call-back routine, \Prog{libunwind} sets the \Var{as} argument to the
+address-space on whose behalf the invocation is made and the \Var{arg}
+argument to the value that was specified when
+\Func{unw\_init\_remote}(3) was called.
+
+The synopsis and a detailed description of every call-back routine
+follows below.
+
+\subsection{Call-back Routine Synopsis}
+
+\Type{int} \Func{find\_proc\_info}(\Type{unw\_addr\_space\_t} \Var{as},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_word\_t} \Var{ip}, \Type{unw\_proc\_info\_t~*}\Var{pip},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{int} \Var{need\_unwind\_info}, \Type{void~*}arg);\\
+\Type{void} \Func{put\_unwind\_info}(\Type{unw\_addr\_space\_t} \Var{as},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_proc\_info\_t~*}pip, \Type{void~*}\Var{arg});\\
+\Type{int} \Func{get\_dyn\_info\_list\_addr}(\Type{unw\_addr\_space\_t} \Var{as},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_word\_t~*}\Var{dilap}, \Type{void~*}\Var{arg});\\
+\Type{int} \Func{access\_mem}(\Var{unw\_addr\_space\_t} \Var{as},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_word\_t} \Var{addr}, \Type{unw\_word\_t~*}\Var{valp},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{int} \Var{write}, \Type{void~*}\Var{arg});\\
+\Type{int} \Func{access\_reg}(\Var{unw\_addr\_space\_t} \Var{as},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_regnum\_t} \Var{regnum}, \Type{unw\_word\_t~*}\Var{valp},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{int} \Var{write}, \Type{void~*}\Var{arg});\\
+\Type{int} \Func{access\_fpreg}(\Var{unw\_addr\_space\_t} \Var{as},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_regnum\_t} \Var{regnum}, \Type{unw\_fpreg\_t~*}\Var{fpvalp},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{int} \Var{write}, \Type{void~*}\Var{arg});\\
+\Type{int} \Func{resume}(\Var{unw\_addr\_space\_t} \Var{as},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_cursor\_t~*}\Var{cp}, \Type{void~*}\Var{arg});\\
+\Type{int} \Func{get\_proc\_name}(\Type{unw\_addr\_space\_t} \Var{as},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_word\_t} \Var{addr}, \Type{char~*}\Var{bufp},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{size\_t} \Var{buf\_len}, \Type{unw\_word\_t~*}\Var{offp},\\
+\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{void~*}\Var{arg});\\
+
+\subsection{find\_proc\_info}
+
+\Prog{Libunwind} invokes the \Func{find\_proc\_info}() call-back to
+locate the information need to unwind a particular procedure. The
+\Var{ip} argument is an instruction-address inside the procedure whose
+information is needed. The \Var{pip} argument is a pointer to the
+variable used to return the desired information. The type of this
+variable is \Type{unw\_proc\_info\_t}. See
+\Func{unw\_get\_proc\_info(3)} for details. Argument
+\Var{need\_unwind\_info} is zero if the call-back does not need to
+provide values for the following members in the
+\Type{unw\_proc\_info\_t} structure: \Var{format},
+\Var{unwind\_info\_size}, and \Var{unwind\_info}. If
+\Var{need\_unwind\_info} is non-zero, valid values need to be returned
+in these members. Furthermore, the contents of the memory addressed
+by the \Var{unwind\_info} member must remain valid until the info is
+released via the \Func{put\_unwind\_info} call-back (see below).
+
+On successful completion, the \Func{find\_proc\_info}() call-back must
+return zero. Otherwise, the negative value of one of the
+\Type{unw\_error\_t} error-codes may be returned. In particular, this
+call-back may return -\Const{UNW\_ESTOPUNWIND} to signal the end of
+the frame-chain.
+
+\subsection{put\_unwind\_info}
+
+\Prog{Libunwind} invokes the \Func{put\_unwind\_info}() call-back to
+release the resources (such as memory) allocated by a previous call to
+\Func{find\_proc\_info}() with the \Var{need\_unwind\_info} argument
+set to a non-zero value. The \Var{pip} argument has the same value as
+the argument of the same name in the previous matching call to
+\Func{find\_proc\_info}(). Note that \Prog{libunwind} does \emph{not}
+invoke \Func{put\_unwind\_info} for calls to \Func{find\_proc\_info}()
+with a zero \Var{need\_unwind\_info} argument.
+
+
+\subsection{get\_dyn\_info\_list\_addr}
+
+\Prog{Libunwind} invokes the \Func{get\_dyn\_info\_list\_addr}()
+call-back to obtain the address of the head of the dynamic unwind-info
+registration list. The variable stored at the returned address must
+have a type of \Type{unw\_dyn\_info\_list\_t} (see
+\Func{\_U\_dyn\_register}(3)). The \Var{dliap} argument is a pointer
+to a variable of type \Type{unw\_word\_t} which is used to return the
+address of the dynamic unwind-info registration list. If no dynamic
+unwind-info registration list exist, the value pointed to by
+\Var{dliap} must be cleared to zero. \Prog{Libunwind} will cache the
+value returned by \Func{get\_dyn\_info\_list\_addr}() if caching is
+enabled for the given address-space. The cache can be cleared with a
+call to \Func{unw\_flush\_cache}().
+
+On successful completion, the \Func{get\_dyn\_info\_list\_addr}()
+call-back must return zero. Otherwise, the negative value of one of
+the \Type{unw\_error\_t} error-codes may be returned.
+
+\subsection{access\_mem}
+
+\Prog{Libunwind} invokes the \Func{access\_mem}() call-back to read
+from or write to a word of memory in the target address-space. The
+address of the word to be accessed is passed in argument \Var{addr}.
+To read memory, \Prog{libunwind} sets argument \Var{write} to zero and
+\Var{valp} to point to the word that receives the read value. To
+write memory, \Prog{libunwind} sets argument \Var{write} to a non-zero
+value and \Var{valp} to point to the word that contains the value to
+be written. The word that \Var{valp} points to is always in the
+byte-order of the host-platform, regardless of the byte-order of the
+target. In other words, it is the responsibility of the call-back
+routine to convert between the target's and the host's byte-order, if
+necessary.
+
+On successful completion, the \Func{access\_mem}()
+call-back must return zero. Otherwise, the negative value of one of
+the \Type{unw\_error\_t} error-codes may be returned.
+
+\subsection{access\_reg}
+
+\Prog{Libunwind} invokes the \Func{access\_reg}() call-back to read
+from or write to a scalar (non-floating-point) CPU register. The
+index of the register to be accessed is passed in argument
+\Var{regnum}. To read a register, \Prog{libunwind} sets argument
+\Var{write} to zero and \Var{valp} to point to the word that receives
+the read value. To write a register, \Prog{libunwind} sets argument
+\Var{write} to a non-zero value and \Var{valp} to point to the word
+that contains the value to be written. The word that \Var{valp}
+points to is always in the byte-order of the host-platform, regardless
+of the byte-order of the target. In other words, it is the
+responsibility of the call-back routine to convert between the
+target's and the host's byte-order, if necessary.
+
+On successful completion, the \Func{access\_reg}() call-back must
+return zero. Otherwise, the negative value of one of the
+\Type{unw\_error\_t} error-codes may be returned.
+
+\subsection{access\_fpreg}
+
+\Prog{Libunwind} invokes the \Func{access\_fpreg}() call-back to read
+from or write to a floating-point CPU register. The index of the
+register to be accessed is passed in argument \Var{regnum}. To read a
+register, \Prog{libunwind} sets argument \Var{write} to zero and
+\Var{fpvalp} to point to a variable of type \Type{unw\_fpreg\_t} that
+receives the read value. To write a register, \Prog{libunwind} sets
+argument \Var{write} to a non-zero value and \Var{fpvalp} to point to
+the variable of type \Type{unw\_fpreg\_t} that contains the value to
+be written. The word that \Var{fpvalp} points to is always in the
+byte-order of the host-platform, regardless of the byte-order of the
+target. In other words, it is the responsibility of the call-back
+routine to convert between the target's and the host's byte-order, if
+necessary.
+
+On successful completion, the \Func{access\_fpreg}() call-back must
+return zero. Otherwise, the negative value of one of the
+\Type{unw\_error\_t} error-codes may be returned.
+
+\subsection{resume}
+
+\Prog{Libunwind} invokes the \Func{resume}() call-back to resume
+execution in the target address space. Argument \Var{cp} is the
+unwind-cursor that identifies the stack-frame in which execution
+should resume. By the time \Prog{libunwind} invokes the \Func{resume}
+call-back, it has already established the desired machine- and
+memory-state via calls to the \Func{access\_reg}(),
+\Func{access\_fpreg}, and \Func{access\_mem}() call-backs. Thus, all
+the call-back needs to do is perform whatever action is needed to
+actually resume execution.
+
+The \Func{resume} call-back is invoked only in response to a call to
+\Func{unw\_resume}(3), so applications which never invoke
+\Func{unw\_resume}(3) need not define the \Func{resume} callback.
+
+On successful completion, the \Func{resume}() call-back must return
+zero. Otherwise, the negative value of one of the
+\Type{unw\_error\_t} error-codes may be returned. As a special case,
+when resuming execution in the local address space, the call-back will
+not return on success.
+
+\subsection{get\_proc\_name}
+
+\Prog{Libunwind} invokes the \Func{get\_proc\_name}() call-back to
+obtain the procedure-name of a static (not dynamically generated)
+procedure. Argument \Var{addr} is an instruction-address within the
+procedure whose name is to be obtained. The \Var{bufp} argument is a
+pointer to a character-buffer used to return the procedure name. The
+size of this buffer is specified in argument \Var{buf\_len}. The
+returned name must be terminated by a NUL character. If the
+procedure's name is longer than \Var{buf\_len} bytes, it must be
+truncated to \Var{buf\_len}\Prog{-1} bytes, with the last byte in the
+buffer set to the NUL character and -\Const{UNW\_ENOMEM} must be
+returned. Argument \Var{offp} is a pointer to a word which is used to
+return the byte-offset relative to the start of the procedure whose
+name is being returned. For example, if procedure \Func{foo}() starts
+at address 0x40003000, then invoking \Func{get\_proc\_name}() with
+\Var{addr} set to 0x40003080 should return a value of 0x80 in the word
+pointed to by \Var{offp} (assuming the procedure is at least 0x80
+bytes long).
+
+On successful completion, the \Func{get\_proc\_name}() call-back must
+return zero. Otherwise, the negative value of one of the
+\Type{unw\_error\_t} error-codes may be returned.
+
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_create\_addr\_space}() returns a
+non-\Const{NULL} value that represents the newly created
+address-space. Otherwise, \Const{NULL} is returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_create\_addr\_space}() is thread-safe but \emph{not}
+safe to use from a signal handler.
+
+\section{See Also}
+
+\SeeAlso{\_U\_dyn\_register(3)},
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_destroy\_addr\_space(3)},
+\SeeAlso{unw\_get\_proc\_info(3)},
+\SeeAlso{unw\_init\_remote(3)},
+\SeeAlso{unw\_resume(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_destroy_addr_space.man b/src/pal/src/libunwind/doc/unw_destroy_addr_space.man
new file mode 100644
index 0000000000..90c9777efb
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_destroy_addr_space.man
@@ -0,0 +1,57 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_DESTROY\\_ADDR\\_SPACE" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_destroy_addr_space
+\-\- destroy unwind address space
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+void
+unw_destroy_addr_space(unw_addr_space_t
+as);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_destroy_addr_space()
+routine destroys the
+address space specified by argument as
+and thereby releases
+all associated resources (such as memory).
+.PP
+Applications must not destroy the local address space
+unw_local_addr_space\&.
+Attempting to do so results in
+undefined behavior (e.g., the application may crash).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_create_addr_space(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_destroy_addr_space.tex b/src/pal/src/libunwind/doc/unw_destroy_addr_space.tex
new file mode 100644
index 0000000000..a66b10b4b0
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_destroy_addr_space.tex
@@ -0,0 +1,40 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_destroy\_addr\_space}{David Mosberger-Tang}{Programming Library}{unw\_destroy\_addr\_space}unw\_destroy\_addr\_space -- destroy unwind address space
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{void} \Func{unw\_destroy\_addr\_space}(\Type{unw\_addr\_space\_t} \Var{as});\\
+
+\section{Description}
+
+The \Func{unw\_destroy\_addr\_space}() routine destroys the
+address space specified by argument \Var{as} and thereby releases
+all associated resources (such as memory).
+
+Applications must not destroy the local address space
+\Var{unw\_local\_addr\_space}. Attempting to do so results in
+undefined behavior (e.g., the application may crash).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_create\_addr\_space(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_flush_cache.man b/src/pal/src/libunwind/doc/unw_flush_cache.man
new file mode 100644
index 0000000000..627449effe
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_flush_cache.man
@@ -0,0 +1,93 @@
+'\" t
+.\" Manual page created with latex2man on Fri Dec 2 16:09:33 PST 2016
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_FLUSH\\_CACHE" "3" "02 December 2016" "Programming Library " "Programming Library "
+.SH NAME
+unw_flush_cache
+\-\- flush cached info
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+void
+unw_flush_cache(unw_addr_space_t
+as,
+unw_word_t
+lo,
+unw_word_t
+hi);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_flush_cache()
+routine flushes all cached info as it
+relates to address\-range lo
+to hi
+(non\-inclusive) in the
+target address\-space as\&.
+In addition, all info cached for
+address\-space as
+that is not tied to a particular code\-range is
+also flushed. For example, the address of the dynamic registration
+list is not tied to a code\-range and its cached value (if any) is
+flushed by a call to this routine. The address range specified by
+lo
+and hi
+should be understood as a hint:
+unw_flush_cache()
+may flush more information than requested,
+but \fInever\fP
+less. In other words, unw_flush_cache()
+may
+overflush, but not underflush.
+.PP
+As a special case, if arguments lo
+and hi
+are both 0, all
+information cached on behalf of address space as
+is flushed.
+.PP
+.SH RETURN VALUE
+
+.PP
+The unw_flush_cache()
+routine cannot fail and does not
+return a value.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+The unw_flush_cache()
+routine is thread\-safe as well as safe to
+use from a signal handler.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_set_caching_policy(3)
+unw_set_cache_size(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_flush_cache.tex b/src/pal/src/libunwind/doc/unw_flush_cache.tex
new file mode 100644
index 0000000000..32319db5d1
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_flush_cache.tex
@@ -0,0 +1,58 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_flush\_cache}{David Mosberger-Tang}{Programming Library}{unw\_flush\_cache}unw\_flush\_cache -- flush cached info
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{void} \Func{unw\_flush\_cache}(\Type{unw\_addr\_space\_t} \Var{as}, \Type{unw\_word\_t} \Var{lo}, \Type{unw\_word\_t} \Var{hi});\\
+
+\section{Description}
+
+The \Func{unw\_flush\_cache}() routine flushes all cached info as it
+relates to address-range \Var{lo} to \Var{hi} (non-inclusive) in the
+target address-space \Var{as}. In addition, all info cached for
+address-space \Var{as} that is not tied to a particular code-range is
+also flushed. For example, the address of the dynamic registration
+list is not tied to a code-range and its cached value (if any) is
+flushed by a call to this routine. The address range specified by
+\Var{lo} and \Var{hi} should be understood as a hint:
+\Func{unw\_flush\_cache}() may flush more information than requested,
+but \emph{never} less. In other words, \Func{unw\_flush\_cache}() may
+overflush, but not underflush.
+
+As a special case, if arguments \Var{lo} and \Var{hi} are both 0, all
+information cached on behalf of address space \Var{as} is flushed.
+
+\section{Return Value}
+
+The \Func{unw\_flush\_cache}() routine cannot fail and does not
+return a value.
+
+\section{Thread and Signal Safety}
+
+The \Func{unw\_flush\_cache}() routine is thread-safe as well as safe to
+use from a signal handler.
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_set\_caching\_policy(3)}
+\SeeAlso{unw\_set\_cache\_size(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_get_accessors.man b/src/pal/src/libunwind/doc/unw_get_accessors.man
new file mode 100644
index 0000000000..83fe4fcea6
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_accessors.man
@@ -0,0 +1,79 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_GET\\_ACCESSORS" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_get_accessors
+\-\- get pointer to accessor call\-backs
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+unw_accessors_t *unw_get_accessors(unw_addr_space_t as);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_get_accessors()
+routine returns a pointer to a
+unw_accessors_t
+structure, which contains the call\-back
+routines that were specified when address space as
+was created
+(see unw_create_addr_space(3)).
+The returned pointer is
+guaranteed to remain valid until address space as
+is destroyed
+by a call to unw_destroy_addr_space(3).
+.PP
+Note that unw_get_accessors()
+can be used to retrieve the
+call\-back routines for the local address space
+unw_local_addr_space\&.
+.PP
+.SH RETURN VALUE
+
+.PP
+The unw_get_accessors()
+routine cannot fail and always
+returns a valid (non\-NULL)
+pointer to an
+unw_accessors_t
+structure.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+The unw_get_accessors()
+routine is thread\-safe as well as
+safe to use from a signal handler.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_create_addr_space(3),
+unw_destroy_addr_space(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_get_accessors.tex b/src/pal/src/libunwind/doc/unw_get_accessors.tex
new file mode 100644
index 0000000000..bf344a32de
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_accessors.tex
@@ -0,0 +1,55 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_get\_accessors}{David Mosberger-Tang}{Programming Library}{unw\_get\_accessors}unw\_get\_accessors -- get pointer to accessor call-backs
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{unw\_accessors\_t~*}\Func{unw\_get\_accessors}(\Type{unw\_addr\_space\_t~}\Var{as});\\
+
+\section{Description}
+
+The \Func{unw\_get\_accessors}() routine returns a pointer to a
+\Type{unw\_accessors\_t} structure, which contains the call-back
+routines that were specified when address space \Var{as} was created
+(see \Func{unw\_create\_addr\_space}(3)). The returned pointer is
+guaranteed to remain valid until address space \Var{as} is destroyed
+by a call to \Func{unw\_destroy\_addr\_space}(3).
+
+Note that \Func{unw\_get\_accessors}() can be used to retrieve the
+call-back routines for the local address space
+\Var{unw\_local\_addr\_space}.
+
+\section{Return Value}
+
+The \Func{unw\_get\_accessors}() routine cannot fail and always
+returns a valid (non-\Const{NULL}) pointer to an
+\Type{unw\_accessors\_t} structure.
+
+\section{Thread and Signal Safety}
+
+The \Func{unw\_get\_accessors}() routine is thread-safe as well as
+safe to use from a signal handler.
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_create\_addr\_space(3)},
+\SeeAlso{unw\_destroy\_addr\_space(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_get_fpreg.man b/src/pal/src/libunwind/doc/unw_get_fpreg.man
new file mode 100644
index 0000000000..5e54ca13d3
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_fpreg.man
@@ -0,0 +1,111 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_GET\\_FPREG" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_get_fpreg
+\-\- get contents of floating\-point register
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_get_fpreg(unw_cursor_t *cp,
+unw_regnum_t
+reg,
+unw_fpreg_t *valp);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_get_fpreg()
+routine reads the value of floating\-point
+register reg
+in the stack frame identified by cursor cp
+and stores the value in the variable pointed to by valp\&.
+.PP
+The register numbering is target\-dependent and described in separate
+manual pages (e.g., libunwind\-ia64(3) for the IA\-64 target).
+Furthermore, the exact set of accessible registers may depend on the
+type of frame that cp
+is referring to. For ordinary stack
+frames, it is normally possible to access only the preserved
+(``callee\-saved\&'') registers and frame\-related registers (such as the
+stack\-pointer). However, for signal frames (see
+unw_is_signal_frame(3)),
+it is usually possible to access
+all registers.
+.PP
+Note that unw_get_fpreg()
+can only read the contents of
+floating\-point registers. See unw_get_fpreg(3)
+for a way to
+read registers which fit in a single word.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_get_fpreg()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_get_fpreg()
+is thread\-safe as well as safe to use
+from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_EBADREG
+ An attempt was made to read a register
+that is either invalid or not accessible in the current frame.
+.PP
+In addition, unw_get_fpreg()
+may return any error returned by
+the access_mem(),
+access_reg(),
+and
+access_fpreg()
+call\-backs (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+libunwind\-ia64(3),
+unw_get_reg(3),
+unw_is_fpreg(3),
+unw_is_signal_frame(3),
+unw_set_fpreg(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_get_fpreg.tex b/src/pal/src/libunwind/doc/unw_get_fpreg.tex
new file mode 100644
index 0000000000..dd679adc06
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_fpreg.tex
@@ -0,0 +1,77 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_get\_fpreg}{David Mosberger-Tang}{Programming Library}{unw\_get\_fpreg}unw\_get\_fpreg -- get contents of floating-point register
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_get\_fpreg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_fpreg\_t~*}\Var{valp});\\
+
+\section{Description}
+
+The \Func{unw\_get\_fpreg}() routine reads the value of floating-point
+register \Var{reg} in the stack frame identified by cursor \Var{cp}
+and stores the value in the variable pointed to by \Var{valp}.
+
+The register numbering is target-dependent and described in separate
+manual pages (e.g., libunwind-ia64(3) for the IA-64 target).
+Furthermore, the exact set of accessible registers may depend on the
+type of frame that \Var{cp} is referring to. For ordinary stack
+frames, it is normally possible to access only the preserved
+(``callee-saved'') registers and frame-related registers (such as the
+stack-pointer). However, for signal frames (see
+\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access
+all registers.
+
+Note that \Func{unw\_get\_fpreg}() can only read the contents of
+floating-point registers. See \Func{unw\_get\_fpreg}(3) for a way to
+read registers which fit in a single word.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_get\_fpreg}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_get\_fpreg}() is thread-safe as well as safe to use
+from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_EBADREG}] An attempt was made to read a register
+ that is either invalid or not accessible in the current frame.
+\end{Description}
+In addition, \Func{unw\_get\_fpreg}() may return any error returned by
+the \Func{access\_mem}(), \Func{access\_reg}(), and
+\Func{access\_fpreg}() call-backs (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{libunwind-ia64(3)},
+\SeeAlso{unw\_get\_reg(3)},
+\SeeAlso{unw\_is\_fpreg(3)},
+\SeeAlso{unw\_is\_signal\_frame(3)},
+\SeeAlso{unw\_set\_fpreg(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_get_proc_info.man b/src/pal/src/libunwind/doc/unw_get_proc_info.man
new file mode 100644
index 0000000000..09eadee27a
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_proc_info.man
@@ -0,0 +1,203 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_GET\\_PROC\\_INFO" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_get_proc_info
+\-\- get info on current procedure
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_get_proc_info(unw_cursor_t *cp,
+unw_proc_info_t *pip);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_get_proc_info()
+routine returns auxiliary
+information about the procedure that created the stack frame
+identified by argument cp\&.
+The pip
+argument is a pointer
+to a structure of type unw_proc_info_t
+which is used to
+return the information. The unw_proc_info_t
+has the
+following members:
+.TP
+unw_word_t start_ip
+ The address of the first
+instruction of the procedure. If this address cannot be determined
+(e.g., due to lack of unwind information), the start_ip
+member is cleared to 0.
+.br
+.TP
+unw_word_t end_ip
+ The address of the first
+instruction \fIbeyond\fP
+the end of the procedure. If this address
+cannot be determined (e.g., due to lack of unwind information),
+the end_ip
+member is cleared to 0.
+.br
+.TP
+unw_word_t lsda
+ The address of the
+language\-specific data\-area (LSDA). This area normally contains
+language\-specific information needed during exception handling. If
+the procedure has no such area, this member is cleared to 0.
+.br
+.TP
+unw_word_t handler
+ The address of the exception
+handler routine. This is sometimes called the \fIpersonality\fP
+routine. If the procedure does not define
+a personality routine, the handler
+member is cleared to 0.
+.br
+.TP
+unw_word_t gp
+ The global\-pointer of the
+procedure. On platforms that do not use a global pointer, this
+member may contain an undefined value. On all other platforms, it
+must be set either to the correct global\-pointer value of the
+procedure or to 0 if the proper global\-pointer cannot be
+obtained for some reason.
+.br
+.TP
+unw_word_t flags
+ A set of flags. There are
+currently no target\-independent flags. For the IA\-64 target, the
+flag UNW_PI_FLAG_IA64_RBS_SWITCH
+is set if the
+procedure may switch the register\-backing store.
+.br
+.TP
+int format
+ The format of the unwind\-info for this
+procedure. If the unwind\-info consists of dynamic procedure info,
+format
+is equal to UNW_INFO_FORMAT_DYNAMIC\&.
+If the
+unwind\-info consists of a (target\-specific) unwind table, it is
+equal to to UNW_INFO_FORMAT_TABLE\&.
+All other values are
+reserved for future use by libunwind\&.
+This member exists
+for use by the find_proc_info()
+call\-back (see
+unw_create_addr_space(3)).
+The
+unw_get_proc_info()
+routine
+may return an undefined value in this member.
+.br
+.TP
+int unwind_info_size
+ The size of the unwind\-info
+in bytes. This member exists for use by the
+find_proc_info()
+call\-back (see
+unw_create_addr_space(3)).
+The
+unw_get_proc_info()
+routine
+may return an undefined value in this member.
+.br
+.TP
+void *unwind_info
+ The pointer to the unwind\-info.
+If no unwind info is available, this member must be set to
+NULL\&.
+This member exists for use by the
+find_proc_info()
+call\-back (see
+unw_create_addr_space(3)).
+The
+unw_get_proc_info()
+routine
+may return an undefined value in this member.
+.br
+.PP
+Note that for the purposes of libunwind,
+the code of a
+procedure is assumed to occupy a single, contiguous range of
+addresses. For this reason, it is alwas possible to describe the
+extent of a procedure with the start_ip
+and end_ip
+members. If a single function/routine is split into multiple,
+discontiguous pieces, libunwind
+will treat each piece as a
+separate procedure.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_get_proc_info()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_get_proc_info()
+is thread\-safe. If cursor cp
+is
+in the local address\-space, this routine is also safe to use from a
+signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_ENOINFO
+ Libunwind
+was unable to locate
+unwind\-info for the procedure.
+.TP
+UNW_EBADVERSION
+ The unwind\-info for the procedure has
+version or format that is not understood by libunwind\&.
+.PP
+In addition, unw_get_proc_info()
+may return any error
+returned by the access_mem()
+call\-back (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_create_addr_space(3),
+unw_get_proc_name(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_get_proc_info.tex b/src/pal/src/libunwind/doc/unw_get_proc_info.tex
new file mode 100644
index 0000000000..72621f1a65
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_proc_info.tex
@@ -0,0 +1,123 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_get\_proc\_info}{David Mosberger-Tang}{Programming Library}{unw\_get\_proc\_info}unw\_get\_proc\_info -- get info on current procedure
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_get\_proc\_info}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_proc\_info\_t~*}\Var{pip});\\
+
+\section{Description}
+
+The \Func{unw\_get\_proc\_info}() routine returns auxiliary
+information about the procedure that created the stack frame
+identified by argument \Var{cp}. The \Var{pip} argument is a pointer
+to a structure of type \Type{unw\_proc\_info\_t} which is used to
+return the information. The \Type{unw\_proc\_info\_t} has the
+following members:
+\begin{description}
+\item[\Type{unw\_word\_t} \Var{start\_ip}] The address of the first
+ instruction of the procedure. If this address cannot be determined
+ (e.g., due to lack of unwind information), the \Var{start\_ip}
+ member is cleared to 0. \\
+\item[\Type{unw\_word\_t} \Var{end\_ip}] The address of the first
+ instruction \emph{beyond} the end of the procedure. If this address
+ cannot be determined (e.g., due to lack of unwind information),
+ the \Var{end\_ip} member is cleared to 0. \\
+\item[\Type{unw\_word\_t} \Var{lsda}] The address of the
+ language-specific data-area (LSDA). This area normally contains
+ language-specific information needed during exception handling. If
+ the procedure has no such area, this member is cleared to 0. \\
+\item[\Type{unw\_word\_t} \Var{handler}] The address of the exception
+ handler routine. This is sometimes called the \emph{personality}
+ routine. If the procedure does not define
+ a personality routine, the \Var{handler} member is cleared to 0. \\
+\item[\Type{unw\_word\_t} \Var{gp}] The global-pointer of the
+ procedure. On platforms that do not use a global pointer, this
+ member may contain an undefined value. On all other platforms, it
+ must be set either to the correct global-pointer value of the
+ procedure or to 0 if the proper global-pointer cannot be
+ obtained for some reason. \\
+\item[\Type{unw\_word\_t} \Var{flags}] A set of flags. There are
+ currently no target-independent flags. For the IA-64 target, the
+ flag \Const{UNW\_PI\_FLAG\_IA64\_RBS\_SWITCH} is set if the
+ procedure may switch the register-backing store.\\
+\item[\Type{int} \Var{format}] The format of the unwind-info for this
+ procedure. If the unwind-info consists of dynamic procedure info,
+ \Var{format} is equal to \Const{UNW\_INFO\_FORMAT\_DYNAMIC}. If the
+ unwind-info consists of a (target-specific) unwind table, it is
+ equal to to \Const{UNW\_INFO\_FORMAT\_TABLE}. All other values are
+ reserved for future use by \Prog{libunwind}. This member exists
+ for use by the \Func{find\_proc\_info}() call-back (see
+ \Func{unw\_create\_addr\_space}(3)). The
+ \Func{unw\_get\_proc\_info}() routine
+ may return an undefined value in this member. \\
+\item[\Type{int} \Var{unwind\_info\_size}] The size of the unwind-info
+ in bytes. This member exists for use by the
+ \Func{find\_proc\_info}() call-back (see
+ \Func{unw\_create\_addr\_space}(3)). The
+ \Func{unw\_get\_proc\_info}() routine
+ may return an undefined value in this member.\\
+\item[\Type{void~*}\Var{unwind\_info}] The pointer to the unwind-info.
+ If no unwind info is available, this member must be set to
+ \Const{NULL}. This member exists for use by the
+ \Func{find\_proc\_info}() call-back (see
+ \Func{unw\_create\_addr\_space}(3)). The
+ \Func{unw\_get\_proc\_info}() routine
+ may return an undefined value in this member.\\
+\end{description}
+Note that for the purposes of \Prog{libunwind}, the code of a
+procedure is assumed to occupy a single, contiguous range of
+addresses. For this reason, it is alwas possible to describe the
+extent of a procedure with the \Var{start\_ip} and \Var{end\_ip}
+members. If a single function/routine is split into multiple,
+discontiguous pieces, \Prog{libunwind} will treat each piece as a
+separate procedure.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_get\_proc\_info}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_get\_proc\_info}() is thread-safe. If cursor \Var{cp} is
+in the local address-space, this routine is also safe to use from a
+signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to locate
+ unwind-info for the procedure.
+\item[\Const{UNW\_EBADVERSION}] The unwind-info for the procedure has
+ version or format that is not understood by \Prog{libunwind}.
+\end{Description}
+In addition, \Func{unw\_get\_proc\_info}() may return any error
+returned by the \Func{access\_mem}() call-back (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_create\_addr\_space(3)},
+\SeeAlso{unw\_get\_proc\_name(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_get_proc_info_by_ip.man b/src/pal/src/libunwind/doc/unw_get_proc_info_by_ip.man
new file mode 100644
index 0000000000..a347a1d008
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_proc_info_by_ip.man
@@ -0,0 +1,134 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_GET\\_PROC\\_INFO\\_BY\\_IP" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_get_proc_info_by_ip
+\-\- get procedure info by IP
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_get_proc_info_by_ip(unw_addr_space_t as,
+unw_word_t ip,
+unw_proc_info_t *pip,
+void *arg);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_get_proc_info_by_ip()
+routine returns the same
+kind of auxiliary information about a procedure as
+unw_get_proc_info(),
+except that the info is looked up by
+instruction\-pointer (IP) instead of a cursor. This is more flexible
+because it is possible to look up the info for an arbitrary procedure,
+even if it is not part of the current call\-chain. However, since it
+is more flexible, it also tends to run slower (and often much slower)
+than unw_get_proc_info().
+.PP
+The routine expects the followins arguments: as
+is the
+address\-space in which the instruction\-pointer should be looked up.
+For a look\-up in the local address\-space,
+unw_local_addr_space
+can be passed for this argument.
+Argument ip
+is the instruction\-pointer for which the procedure
+info should be looked up and pip
+is a pointer to a structure of
+type unw_proc_info_t
+which is used to return the info.
+Lastly, arg
+is the address\-space argument that should be used
+when accessing the address\-space. It has the same purpose as the
+argument of the same name for unw_init_remote().
+When
+accessing the local address\-space (first argument is
+unw_local_addr_space),
+NULL
+must be passed for this
+argument.
+.PP
+Note that for the purposes of libunwind,
+the code of a
+procedure is assumed to occupy a single, contiguous range of
+addresses. For this reason, it is alwas possible to describe the
+extent of a procedure with the start_ip
+and end_ip
+members. If a single function/routine is split into multiple,
+discontiguous pieces, libunwind
+will treat each piece as a
+separate procedure.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_get_proc_info_by_ip()
+returns 0. Otherwise the negative value of one of the error\-codes
+below is returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_get_proc_info()
+is thread\-safe. If the local
+address\-space is passed in argument as,
+this routine is also
+safe to use from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_ENOINFO
+ Libunwind
+was unable to locate
+unwind\-info for the procedure.
+.TP
+UNW_EBADVERSION
+ The unwind\-info for the procedure has
+version or format that is not understood by libunwind\&.
+.PP
+In addition, unw_get_proc_info()
+may return any error
+returned by the access_mem()
+call\-back (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_create_addr_space(3),
+unw_get_proc_name(3),
+unw_get_proc_info(3),
+unw_init_remote(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_get_proc_info_by_ip.tex b/src/pal/src/libunwind/doc/unw_get_proc_info_by_ip.tex
new file mode 100644
index 0000000000..5e1d5d247e
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_proc_info_by_ip.tex
@@ -0,0 +1,91 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_get\_proc\_info\_by\_ip}{David Mosberger-Tang}{Programming Library}{unw\_get\_proc\_info\_by\_ip}unw\_get\_proc\_info\_by\_ip -- get procedure info by IP
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_get\_proc\_info\_by\_ip}(\Type{unw\_addr\_space\_t~}\Var{as}, \Type{unw\_word\_t~}\Var{ip}, \Type{unw\_proc\_info\_t~*}\Var{pip}, \Type{void~*}\Var{arg});\\
+
+\section{Description}
+
+The \Func{unw\_get\_proc\_info\_by\_ip}() routine returns the same
+kind of auxiliary information about a procedure as
+\Func{unw\_get\_proc\_info}(), except that the info is looked up by
+instruction-pointer (IP) instead of a cursor. This is more flexible
+because it is possible to look up the info for an arbitrary procedure,
+even if it is not part of the current call-chain. However, since it
+is more flexible, it also tends to run slower (and often much slower)
+than \Func{unw\_get\_proc\_info}().
+
+The routine expects the followins arguments: \Var{as} is the
+address-space in which the instruction-pointer should be looked up.
+For a look-up in the local address-space,
+\Var{unw\_local\_addr\_space} can be passed for this argument.
+Argument \Var{ip} is the instruction-pointer for which the procedure
+info should be looked up and \Var{pip} is a pointer to a structure of
+type \Type{unw\_proc\_info\_t} which is used to return the info.
+Lastly, \Var{arg} is the address-space argument that should be used
+when accessing the address-space. It has the same purpose as the
+argument of the same name for \Func{unw\_init\_remote}(). When
+accessing the local address-space (first argument is
+\Var{unw\_local\_addr\_space}), \Const{NULL} must be passed for this
+argument.
+
+Note that for the purposes of \Prog{libunwind}, the code of a
+procedure is assumed to occupy a single, contiguous range of
+addresses. For this reason, it is alwas possible to describe the
+extent of a procedure with the \Var{start\_ip} and \Var{end\_ip}
+members. If a single function/routine is split into multiple,
+discontiguous pieces, \Prog{libunwind} will treat each piece as a
+separate procedure.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_get\_proc\_info\_by\_ip}()
+returns 0. Otherwise the negative value of one of the error-codes
+below is returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_get\_proc\_info}() is thread-safe. If the local
+address-space is passed in argument \Var{as}, this routine is also
+safe to use from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to locate
+ unwind-info for the procedure.
+\item[\Const{UNW\_EBADVERSION}] The unwind-info for the procedure has
+ version or format that is not understood by \Prog{libunwind}.
+\end{Description}
+In addition, \Func{unw\_get\_proc\_info}() may return any error
+returned by the \Func{access\_mem}() call-back (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_create\_addr\_space(3)},
+\SeeAlso{unw\_get\_proc\_name(3)},
+\SeeAlso{unw\_get\_proc\_info(3)},
+\SeeAlso{unw\_init\_remote(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_get_proc_name.man b/src/pal/src/libunwind/doc/unw_get_proc_name.man
new file mode 100644
index 0000000000..8b2bd06eaf
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_proc_name.man
@@ -0,0 +1,123 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_GET\\_PROC\\_NAME" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_get_proc_name
+\-\- get name of current procedure
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_get_proc_name(unw_cursor_t *cp,
+char *bufp,
+size_t
+len,
+unw_word_t *offp);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_get_proc_name()
+routine returns the name of the
+procedure that created the stack frame identified by argument
+cp\&.
+The bufp
+argument is a pointer to a character buffer
+that is at least len
+bytes long. This buffer is used to return
+the name of the procedure. The offp
+argument is a pointer to a
+word that is used to return the byte\-offset of the instruction\-pointer
+saved in the stack frame identified by cp,
+relative to the start
+of the procedure. For example, if procedure foo()
+starts at
+address 0x40003000, then invoking unw_get_proc_name()
+on a
+stack frame with an instruction\-pointer value of 0x40003080 would
+return a value of 0x80 in the word pointed to by offp
+(assuming
+the procedure is at least 0x80 bytes long).
+.PP
+Note that on some platforms there is no reliable way to distinguish
+between procedure names and ordinary labels. Furthermore, if symbol
+information has been stripped from a program, procedure names may be
+completely unavailable or may be limited to those exported via a
+dynamic symbol table. In such cases, unw_get_proc_name()
+may return the name of a label or a preceeding (nearby) procedure.
+However, the offset returned through offp
+is always relative to
+the returned name, which ensures that the value (address) of the
+returned name plus the returned offset will always be equal to the
+instruction\-pointer of the stack frame identified by cp\&.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_get_proc_name()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_get_proc_name()
+is thread\-safe. If cursor cp
+is
+in the local address\-space, this routine is also safe to use from a
+signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_ENOINFO
+ Libunwind
+was unable to determine
+the name of the procedure.
+.TP
+UNW_ENOMEM
+ The procedure name is too long to fit
+in the buffer provided. A truncated version of the name has been
+returned.
+.PP
+In addition, unw_get_proc_name()
+may return any error
+returned by the access_mem()
+call\-back (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_get_proc_info(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_get_proc_name.tex b/src/pal/src/libunwind/doc/unw_get_proc_name.tex
new file mode 100644
index 0000000000..c413990880
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_proc_name.tex
@@ -0,0 +1,82 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_get\_proc\_name}{David Mosberger-Tang}{Programming Library}{unw\_get\_proc\_name}unw\_get\_proc\_name -- get name of current procedure
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_get\_proc\_name}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{char~*}\Var{bufp}, \Type{size\_t} \Var{len}, \Type{unw\_word\_t~*}\Var{offp});\\
+
+\section{Description}
+
+The \Func{unw\_get\_proc\_name}() routine returns the name of the
+procedure that created the stack frame identified by argument
+\Var{cp}. The \Var{bufp} argument is a pointer to a character buffer
+that is at least \Var{len} bytes long. This buffer is used to return
+the name of the procedure. The \Var{offp} argument is a pointer to a
+word that is used to return the byte-offset of the instruction-pointer
+saved in the stack frame identified by \Var{cp}, relative to the start
+of the procedure. For example, if procedure \Func{foo}() starts at
+address 0x40003000, then invoking \Func{unw\_get\_proc\_name}() on a
+stack frame with an instruction-pointer value of 0x40003080 would
+return a value of 0x80 in the word pointed to by \Var{offp} (assuming
+the procedure is at least 0x80 bytes long).
+
+Note that on some platforms there is no reliable way to distinguish
+between procedure names and ordinary labels. Furthermore, if symbol
+information has been stripped from a program, procedure names may be
+completely unavailable or may be limited to those exported via a
+dynamic symbol table. In such cases, \Func{unw\_get\_proc\_name}()
+may return the name of a label or a preceeding (nearby) procedure.
+However, the offset returned through \Var{offp} is always relative to
+the returned name, which ensures that the value (address) of the
+returned name plus the returned offset will always be equal to the
+instruction-pointer of the stack frame identified by \Var{cp}.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_get\_proc\_name}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_get\_proc\_name}() is thread-safe. If cursor \Var{cp} is
+in the local address-space, this routine is also safe to use from a
+signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to determine
+ the name of the procedure.
+\item[\Const{UNW\_ENOMEM}] The procedure name is too long to fit
+ in the buffer provided. A truncated version of the name has been
+ returned.
+\end{Description}
+In addition, \Func{unw\_get\_proc\_name}() may return any error
+returned by the \Func{access\_mem}() call-back (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_get\_proc\_info(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_get_reg.man b/src/pal/src/libunwind/doc/unw_get_reg.man
new file mode 100644
index 0000000000..83e8bb43b6
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_reg.man
@@ -0,0 +1,112 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_GET\\_REG" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_get_reg
+\-\- get register contents
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_get_reg(unw_cursor_t *cp,
+unw_regnum_t
+reg,
+unw_word_t *valp);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_get_reg()
+routine reads the value of register
+reg
+in the stack frame identified by cursor cp
+and stores
+the value in the word pointed to by valp\&.
+.PP
+The register numbering is target\-dependent and described in separate
+manual pages (e.g., libunwind\-ia64(3) for the IA\-64 target).
+Furthermore, the exact set of accessible registers may depend on the
+type of frame that cp
+is referring to. For ordinary stack
+frames, it is normally possible to access only the preserved
+(``callee\-saved\&'') registers and frame\-related registers (such as the
+stack\-pointer). However, for signal frames (see
+unw_is_signal_frame(3)),
+it is usually possible to access
+all registers.
+.PP
+Note that unw_get_reg()
+can only read the contents of
+registers whose values fit in a single word. See
+unw_get_fpreg(3)
+for a way to read registers which do not fit
+this constraint.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_get_reg()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_get_reg()
+is thread\-safe as well as safe to use
+from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_EBADREG
+ An attempt was made to read a register
+that is either invalid or not accessible in the current frame.
+.PP
+In addition, unw_get_reg()
+may return any error returned by
+the access_mem(),
+access_reg(),
+and
+access_fpreg()
+call\-backs (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+libunwind\-ia64(3),
+unw_get_fpreg(3),
+unw_is_signal_frame(3),
+unw_set_reg(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_get_reg.tex b/src/pal/src/libunwind/doc/unw_get_reg.tex
new file mode 100644
index 0000000000..b66e8c0dbb
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_get_reg.tex
@@ -0,0 +1,77 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_get\_reg}{David Mosberger-Tang}{Programming Library}{unw\_get\_reg}unw\_get\_reg -- get register contents
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_get\_reg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_word\_t~*}\Var{valp});\\
+
+\section{Description}
+
+The \Func{unw\_get\_reg}() routine reads the value of register
+\Var{reg} in the stack frame identified by cursor \Var{cp} and stores
+the value in the word pointed to by \Var{valp}.
+
+The register numbering is target-dependent and described in separate
+manual pages (e.g., libunwind-ia64(3) for the IA-64 target).
+Furthermore, the exact set of accessible registers may depend on the
+type of frame that \Var{cp} is referring to. For ordinary stack
+frames, it is normally possible to access only the preserved
+(``callee-saved'') registers and frame-related registers (such as the
+stack-pointer). However, for signal frames (see
+\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access
+all registers.
+
+Note that \Func{unw\_get\_reg}() can only read the contents of
+registers whose values fit in a single word. See
+\Func{unw\_get\_fpreg}(3) for a way to read registers which do not fit
+this constraint.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_get\_reg}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_get\_reg}() is thread-safe as well as safe to use
+from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_EBADREG}] An attempt was made to read a register
+ that is either invalid or not accessible in the current frame.
+\end{Description}
+In addition, \Func{unw\_get\_reg}() may return any error returned by
+the \Func{access\_mem}(), \Func{access\_reg}(), and
+\Func{access\_fpreg}() call-backs (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{libunwind-ia64(3)},
+\SeeAlso{unw\_get\_fpreg(3)},
+\SeeAlso{unw\_is\_signal\_frame(3)},
+\SeeAlso{unw\_set\_reg(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_getcontext.man b/src/pal/src/libunwind/doc/unw_getcontext.man
new file mode 100644
index 0000000000..13725df957
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_getcontext.man
@@ -0,0 +1,93 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_GETCONTEXT" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_getcontext
+\-\- get initial machine\-state
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_getcontext(unw_context_t *ucp);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_getcontext()
+routine initializes the context structure
+pointed to by ucp
+with the machine\-state of the call\-site. The
+exact set of registers stored by unw_getcontext()
+is
+platform\-specific, but, in general, at least all preserved
+(``callee\-saved\&'') and all frame\-related registers, such as the
+stack\-pointer, will be stored.
+.PP
+This routine is normally implemented as a macro and applications
+should not attempt to take its address.
+.PP
+.SH PLATFORM\-SPECIFIC NOTES
+
+.PP
+On IA\-64, unw_context_t
+has a layout that is compatible with
+that of ucontext_t
+and such structures can be initialized with
+getcontext()
+instead of unw_getcontext().
+However, the
+reverse is \fInot\fP
+true and it is \fInot\fP
+safe to use structures
+initialized by unw_getcontext()
+in places where a structure
+initialized by getcontext()
+is expected. The reason for this
+asymmetry is that unw_getcontext()
+is optimized for maximum
+performance and does not, for example, save the signal mask.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_getcontext()
+returns 0.
+Otherwise, a value of \-1 is returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_getcontext()
+is thread\-safe as well as safe to use
+from a signal handler.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_init_local(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_getcontext.tex b/src/pal/src/libunwind/doc/unw_getcontext.tex
new file mode 100644
index 0000000000..fa3eb814b3
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_getcontext.tex
@@ -0,0 +1,63 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_getcontext}{David Mosberger-Tang}{Programming Library}{unw\_getcontext}unw\_getcontext -- get initial machine-state
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_getcontext}(\Type{unw\_context\_t~*}\Var{ucp});\\
+
+\section{Description}
+
+The \Func{unw\_getcontext}() routine initializes the context structure
+pointed to by \Var{ucp} with the machine-state of the call-site. The
+exact set of registers stored by \Func{unw\_getcontext}() is
+platform-specific, but, in general, at least all preserved
+(``callee-saved'') and all frame-related registers, such as the
+stack-pointer, will be stored.
+
+This routine is normally implemented as a macro and applications
+should not attempt to take its address.
+
+\section{Platform-specific Notes}
+
+On IA-64, \Type{unw\_context\_t} has a layout that is compatible with
+that of \Type{ucontext\_t} and such structures can be initialized with
+\Func{getcontext}() instead of \Func{unw\_getcontext}(). However, the
+reverse is \emph{not} true and it is \emph{not} safe to use structures
+initialized by \Func{unw\_getcontext()} in places where a structure
+initialized by \Func{getcontext()} is expected. The reason for this
+asymmetry is that \Func{unw\_getcontext()} is optimized for maximum
+performance and does not, for example, save the signal mask.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_getcontext}() returns 0.
+Otherwise, a value of -1 is returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_getcontext}() is thread-safe as well as safe to use
+from a signal handler.
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_init\_local(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_init_local.man b/src/pal/src/libunwind/doc/unw_init_local.man
new file mode 100644
index 0000000000..301dd6f93b
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_init_local.man
@@ -0,0 +1,124 @@
+'\" t
+.\" Manual page created with latex2man on Wed Aug 16 12:11:05 PDT 2017
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_INIT\\_LOCAL" "3" "16 August 2017" "Programming Library " "Programming Library "
+.SH NAME
+unw_init_local
+\-\- initialize cursor for local unwinding
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_init_local(unw_cursor_t *c,
+unw_context_t *ctxt);
+.br
+int
+unw_init_local2(unw_cursor_t *c,
+unw_context_t *ctxt,
+int
+flag);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_init_local()
+routine initializes the unwind cursor
+pointed to by c
+with the machine\-state in the context structure
+pointed to by ctxt\&.
+As such, the machine\-state pointed to by
+ctxt
+identifies the initial stack frame at which unwinding
+starts. The machine\-state is expected to be one provided by a call to
+unw_getcontext; as such, the instruction pointer may point to the
+instruction after the last instruction of a function, and libunwind
+will back\-up the instruction pointer before beginning a walk up the
+call stack. The machine\-state must remain valid for the duration for
+which the cursor c
+is in use.
+.PP
+The unw_init_local()
+routine can be used only for unwinding in
+the address space of the current process (i.e., for local unwinding).
+For all other cases, unw_init_remote()
+must be used instead.
+However, unwind performance may be better when using
+unw_init_local().
+Also, unw_init_local()
+is
+available even when UNW_LOCAL_ONLY
+has been defined before
+including <libunwind.h>,
+whereas unw_init_remote()
+is not.
+.PP
+If the unw_context_t is known to be a signal frame (i.e., from the
+third argument in a sigaction handler on linux),
+unw_init_local2()
+should be used for correct initialization
+on some platforms, passing the UNW_INIT_SIGNAL_FRAME flag.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_init_local()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_init_local()
+is thread\-safe as well as safe to use from a
+signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EINVAL
+ unw_init_local()
+was called in a
+version of libunwind
+which supports remote unwinding only
+(this normally happens when calling unw_init_local()
+for a
+cross\-platform version of libunwind).
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_EBADREG
+ A register needed by unw_init_local()
+wasn\&'t accessible.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_init_remote(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_init_local.tex b/src/pal/src/libunwind/doc/unw_init_local.tex
new file mode 100644
index 0000000000..ff0d03bc77
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_init_local.tex
@@ -0,0 +1,80 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_init\_local}{David Mosberger-Tang}{Programming Library}{unw\_init\_local}unw\_init\_local -- initialize cursor for local unwinding
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_init\_local}(\Type{unw\_cursor\_t~*}\Var{c}, \Type{unw\_context\_t~*}\Var{ctxt});\\
+\Type{int} \Func{unw\_init\_local2}(\Type{unw\_cursor\_t~*}\Var{c}, \Type{unw\_context\_t~*}\Var{ctxt}, \Type{int} \Var{flag});\\
+
+\section{Description}
+
+The \Func{unw\_init\_local}() routine initializes the unwind cursor
+pointed to by \Var{c} with the machine-state in the context structure
+pointed to by \Var{ctxt}. As such, the machine-state pointed to by
+\Var{ctxt} identifies the initial stack frame at which unwinding
+starts. The machine-state is expected to be one provided by a call to
+unw_getcontext; as such, the instruction pointer may point to the
+instruction after the last instruction of a function, and libunwind
+will back-up the instruction pointer before beginning a walk up the
+call stack. The machine-state must remain valid for the duration for
+which the cursor \Var{c} is in use.
+
+The \Func{unw\_init\_local}() routine can be used only for unwinding in
+the address space of the current process (i.e., for local unwinding).
+For all other cases, \Func{unw\_init\_remote}() must be used instead.
+However, unwind performance may be better when using
+\Func{unw\_init\_local}(). Also, \Func{unw\_init\_local}() is
+available even when \Const{UNW\_LOCAL\_ONLY} has been defined before
+including \File{$<$libunwind.h$>$}, whereas \Func{unw\_init\_remote}()
+is not.
+
+If the unw_context_t is known to be a signal frame (i.e., from the
+third argument in a sigaction handler on linux),
+\Func{unw\_init\_local2}() should be used for correct initialization
+on some platforms, passing the UNW_INIT_SIGNAL_FRAME flag.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_init\_local}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_init\_local}() is thread-safe as well as safe to use from a
+signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EINVAL}] \Func{unw\_init\_local}() was called in a
+ version of \Prog{libunwind} which supports remote unwinding only
+ (this normally happens when calling \Func{unw\_init\_local}() for a
+ cross-platform version of \Prog{libunwind}).
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_init\_local}()
+ wasn't accessible.
+\end{Description}
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)}, \SeeAlso{unw\_init\_remote(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_init_local2.man b/src/pal/src/libunwind/doc/unw_init_local2.man
new file mode 100644
index 0000000000..6cbbf008ab
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_init_local2.man
@@ -0,0 +1 @@
+.so man3/unw_init_local.3
diff --git a/src/pal/src/libunwind/doc/unw_init_remote.man b/src/pal/src/libunwind/doc/unw_init_remote.man
new file mode 100644
index 0000000000..0acdac9617
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_init_remote.man
@@ -0,0 +1,123 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_INIT\\_REMOTE" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_init_remote
+\-\- initialize cursor for remote unwinding
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_init_remote(unw_cursor_t *c,
+unw_addr_space_t as,
+void *arg);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_init_remote()
+routine initializes the unwind cursor
+pointed to by c
+for unwinding in the address space identified by
+as\&.
+The as
+argument can either be set to
+unw_local_addr_space
+(local address space) or to an arbitrary
+address space created with unw_create_addr_space().
+.PP
+The arg
+void\-pointer tells the address space exactly what entity
+should be unwound. For example, if unw_local_addr_space
+is
+passed in as,
+then arg
+needs to be a pointer to a context
+structure containing the machine\-state of the initial stack frame.
+However, other address\-spaces may instead expect a process\-id, a
+thread\-id, or a pointer to an arbitrary structure which identifies the
+stack\-frame chain to be unwound. In other words, the interpretation
+of arg
+is entirely dependent on the address\-space in use;
+libunwind
+never interprets the argument in any way on its own.
+.PP
+Note that unw_init_remote()
+can be used to initiate unwinding
+in \fIany\fP
+process, including the local process in which the
+unwinder itself is running. However, for local unwinding, it is
+generally preferable to use unw_init_local()
+instead, because
+it is easier to use and because it may perform better.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_init_remote()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_init_remote()
+is thread\-safe. If the local address\-space
+is passed in argument as,
+this routine is also safe to use from
+a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EINVAL
+ unw_init_remote()
+was called in a
+version of libunwind
+which supports local unwinding only
+(this normally happens when defining UNW_LOCAL_ONLY
+before
+including <libunwind.h>
+and then calling
+unw_init_remote()).
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_EBADREG
+ A register needed by unw_init_remote()
+wasn\&'t accessible.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_create_addr_space(3),
+unw_init_local(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_init_remote.tex b/src/pal/src/libunwind/doc/unw_init_remote.tex
new file mode 100644
index 0000000000..9b4dc7997a
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_init_remote.tex
@@ -0,0 +1,79 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_init\_remote}{David Mosberger-Tang}{Programming Library}{unw\_init\_remote}unw\_init\_remote -- initialize cursor for remote unwinding
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_init\_remote}(\Type{unw\_cursor\_t~*}\Var{c}, \Type{unw\_addr\_space\_t~}\Var{as}, \Type{void~*}\Var{arg});\\
+
+\section{Description}
+
+The \Func{unw\_init\_remote}() routine initializes the unwind cursor
+pointed to by \Var{c} for unwinding in the address space identified by
+\Var{as}. The \Var{as} argument can either be set to
+\Var{unw\_local\_addr\_space} (local address space) or to an arbitrary
+address space created with \Func{unw\_create\_addr\_space}().
+
+The \Var{arg} void-pointer tells the address space exactly what entity
+should be unwound. For example, if \Var{unw\_local\_addr\_space} is
+passed in \Var{as}, then \Var{arg} needs to be a pointer to a context
+structure containing the machine-state of the initial stack frame.
+However, other address-spaces may instead expect a process-id, a
+thread-id, or a pointer to an arbitrary structure which identifies the
+stack-frame chain to be unwound. In other words, the interpretation
+of \Var{arg} is entirely dependent on the address-space in use;
+\Prog{libunwind} never interprets the argument in any way on its own.
+
+Note that \Func{unw\_init\_remote}() can be used to initiate unwinding
+in \emph{any} process, including the local process in which the
+unwinder itself is running. However, for local unwinding, it is
+generally preferable to use \Func{unw\_init\_local}() instead, because
+it is easier to use and because it may perform better.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_init\_remote}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_init\_remote}() is thread-safe. If the local address-space
+is passed in argument \Var{as}, this routine is also safe to use from
+a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EINVAL}] \Func{unw\_init\_remote}() was called in a
+ version of \Prog{libunwind} which supports local unwinding only
+ (this normally happens when defining \Const{UNW\_LOCAL\_ONLY} before
+ including \File{$<$libunwind.h$>$} and then calling
+ \Func{unw\_init\_remote}()).
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_init\_remote}()
+ wasn't accessible.
+\end{Description}
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)}, \SeeAlso{unw\_create\_addr\_space(3)},
+\SeeAlso{unw\_init\_local(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_is_fpreg.man b/src/pal/src/libunwind/doc/unw_is_fpreg.man
new file mode 100644
index 0000000000..0c26ec1bc7
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_is_fpreg.man
@@ -0,0 +1,73 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_IS\\_FPREG" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_is_fpreg
+\-\- check if a register is a floating\-point register
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_is_fpreg(unw_regnum_t
+reg);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_is_fpreg()
+routine checks whether register number
+reg
+is a floating\-point register.
+.PP
+This routine is normally implemented as a macro and applications
+should not attempt to take its address.
+.PP
+.SH RETURN VALUE
+
+.PP
+The unw_is_fpreg()
+routine returns a non\-zero value if
+reg
+is a floating\-point register. Otherwise, it returns a value
+of 0.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_is_fpreg()
+is thread\-safe as well as safe to use
+from a signal handler.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_get_reg(3),
+unw_set_reg(3),
+unw_get_fpreg(3),
+unw_set_fpreg(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_is_fpreg.tex b/src/pal/src/libunwind/doc/unw_is_fpreg.tex
new file mode 100644
index 0000000000..c28cdc9be4
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_is_fpreg.tex
@@ -0,0 +1,52 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_is\_fpreg}{David Mosberger-Tang}{Programming Library}{unw\_is\_fpreg}unw\_is\_fpreg -- check if a register is a floating-point register
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_is\_fpreg}(\Type{unw\_regnum\_t} \Var{reg});\\
+
+\section{Description}
+
+The \Func{unw\_is\_fpreg}() routine checks whether register number
+\Var{reg} is a floating-point register.
+
+This routine is normally implemented as a macro and applications
+should not attempt to take its address.
+
+\section{Return Value}
+
+The \Func{unw\_is\_fpreg}() routine returns a non-zero value if
+\Var{reg} is a floating-point register. Otherwise, it returns a value
+of 0.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_is\_fpreg}() is thread-safe as well as safe to use
+from a signal handler.
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_get\_reg(3)},
+\SeeAlso{unw\_set\_reg(3)},
+\SeeAlso{unw\_get\_fpreg(3)},
+\SeeAlso{unw\_set\_fpreg(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_is_signal_frame.man b/src/pal/src/libunwind/doc/unw_is_signal_frame.man
new file mode 100644
index 0000000000..d9a7cda7b5
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_is_signal_frame.man
@@ -0,0 +1,88 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_IS\\_SIGNAL\\_FRAME" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_is_signal_frame
+\-\- check if current frame is a signal frame
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_is_signal_frame(unw_cursor_t *cp);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_is_signal_frame()
+routine returns a positive value
+if the current frame identified by cp
+is a signal frame, and a
+value of 0 otherwise. For the purpose of this discussion, a signal
+frame is a frame that was created in response to a potentially
+asynchronous interruption. For UNIX and UNIX\-like platforms, such
+frames are normally created by the kernel when delivering a signal.
+In a kernel\-environment, a signal frame might, for example, correspond
+to a frame created in response to a device interrupt.
+.PP
+Signal frames are somewhat unusual because the asynchronous nature of
+the events that create them require storing the contents of registers
+that are normally treated as scratch (``caller\-saved\&'') registers.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_is_signal_frame()
+returns a
+positive value if the current frame is a signal frame, or 0 if it is
+not. Otherwise, a negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_is_signal_frame()
+is thread\-safe as well as safe to use
+from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_ENOINFO
+ Libunwind
+is unable to determine
+whether or not the current frame is a signal frame.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_get_reg(3),
+unw_set_reg(3),
+unw_get_fpreg(3),
+unw_set_fpreg(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_is_signal_frame.tex b/src/pal/src/libunwind/doc/unw_is_signal_frame.tex
new file mode 100644
index 0000000000..f262e5600c
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_is_signal_frame.tex
@@ -0,0 +1,67 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_is\_signal\_frame}{David Mosberger-Tang}{Programming Library}{unw\_is\_signal\_frame}unw\_is\_signal\_frame -- check if current frame is a signal frame
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_is\_signal\_frame}(\Type{unw\_cursor\_t~*}\Var{cp});\\
+
+\section{Description}
+
+The \Func{unw\_is\_signal\_frame}() routine returns a positive value
+if the current frame identified by \Var{cp} is a signal frame, and a
+value of 0 otherwise. For the purpose of this discussion, a signal
+frame is a frame that was created in response to a potentially
+asynchronous interruption. For UNIX and UNIX-like platforms, such
+frames are normally created by the kernel when delivering a signal.
+In a kernel-environment, a signal frame might, for example, correspond
+to a frame created in response to a device interrupt.
+
+Signal frames are somewhat unusual because the asynchronous nature of
+the events that create them require storing the contents of registers
+that are normally treated as scratch (``caller-saved'') registers.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_is\_signal\_frame}() returns a
+positive value if the current frame is a signal frame, or 0 if it is
+not. Otherwise, a negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_is\_signal\_frame}() is thread-safe as well as safe to use
+from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} is unable to determine
+ whether or not the current frame is a signal frame.
+\end{Description}
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_get\_reg(3)},
+\SeeAlso{unw\_set\_reg(3)},
+\SeeAlso{unw\_get\_fpreg(3)},
+\SeeAlso{unw\_set\_fpreg(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_reg_states_iterate.man b/src/pal/src/libunwind/doc/unw_reg_states_iterate.man
new file mode 100644
index 0000000000..e328ad2e38
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_reg_states_iterate.man
@@ -0,0 +1,137 @@
+'\" t
+.\" Manual page created with latex2man on Wed Aug 16 11:09:44 PDT 2017
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_REG\\_STATES\\_ITERATE" "3" "16 August 2017" "Programming Library " "Programming Library "
+.SH NAME
+unw_reg_states_iterate
+\-\- get register state info on current procedure
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_reg_states_iterate(unw_cursor_t *cp,
+unw_reg_states_callbackcb,
+void *token);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_reg_states_iterate()
+routine provides
+information about the procedure that created the stack frame
+identified by argument cp\&.
+The cb
+argument is a pointer
+to a function of type unw_reg_states_callback
+which is used to
+return the information. The function unw_reg_states_callback
+has the
+following definition:
+.PP
+int
+( *unw_reg_states_callback)(void *token,
+void *reg_states_data,
+size_t
+reg_states_data_size,
+unw_word_t
+start_ip,
+unw_word_t
+end_ip);
+.PP
+The callback function may be invoked several times for each call of unw_reg_states_iterate\&.
+Each call is associcated with a instruction address range and a set of instructions on how to update register values when returning from the procedure in that address range. For each invocation, the arguments to the callback function are:
+.TP
+void * token
+ The token value passed to unw_reg_states_callback\&.
+.br
+.TP
+void * reg_states_data
+ A pointer to data about
+updating register values. This data, or a copy of it, can be passed
+to unw_apply_reg_state\&.
+.br
+.TP
+int reg_states_data_size
+ The size of the register update data.
+.br
+.TP
+unw_word_t start_ip
+ The address of the first
+instruction of the address range.
+.br
+.TP
+unw_word_t end_ip
+ The address of the first
+instruction \fIbeyond\fP
+the end of the address range.
+.br
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_reg_states_iterate()
+returns
+0. If the callback function returns a nonzero value, that indicates
+failure and the function returns immediately. Otherwise the negative
+value of one of the error\-codes below is returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_reg_states_iterate()
+is thread\-safe. If cursor cp
+is
+in the local address\-space, this routine is also safe to use from a
+signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_ENOINFO
+ Libunwind
+was unable to locate
+unwind\-info for the procedure.
+.TP
+UNW_EBADVERSION
+ The unwind\-info for the procedure has
+version or format that is not understood by libunwind\&.
+.PP
+In addition, unw_reg_states_iterate()
+may return any error
+returned by the access_mem()
+call\-back (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_apply_reg_state(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_reg_states_iterate.tex b/src/pal/src/libunwind/doc/unw_reg_states_iterate.tex
new file mode 100644
index 0000000000..36c9b548a2
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_reg_states_iterate.tex
@@ -0,0 +1,83 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_reg\_states\_iterate}{David Mosberger-Tang}{Programming Library}{unw\_reg\_states\_iterate}unw\_reg\_states\_iterate -- get register state info on current procedure
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_reg\_states\_iterate}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_reg\_states\_callback}\Var{cb}, \Type{void~*}\Var{token});\\
+
+\section{Description}
+
+The \Func{unw\_reg\_states\_iterate}() routine provides
+information about the procedure that created the stack frame
+identified by argument \Var{cp}. The \Var{cb} argument is a pointer
+to a function of type \Type{unw\_reg\_states\_callback} which is used to
+return the information. The function \Type{unw\_reg\_states\_callback} has the
+following definition:
+
+\Type{int} (~*\Var{unw\_reg\_states\_callback})(\Type{void~*}\Var{token},
+ \Type{void~*}\Var{reg\_states\_data},
+ \Type{size\_t} \Var{reg\_states\_data\_size},
+ \Type{unw\_word\_t} \Var{start\_ip}, \Type{unw\_word\_t} \Var{end\_ip});
+
+The callback function may be invoked several times for each call of \Func{unw\_reg\_states\_iterate}. Each call is associcated with a instruction address range and a set of instructions on how to update register values when returning from the procedure in that address range. For each invocation, the arguments to the callback function are:
+\begin{description}
+\item[\Type{void~*} \Var{token}] The token value passed to \Var{unw\_reg\_states\_callback}. \\
+\item[\Type{void~*} \Var{reg\_states\_data}] A pointer to data about
+ updating register values. This data, or a copy of it, can be passed
+ to \Var{unw\_apply\_reg\_state}.\\
+\item[\Type{int} \Var{reg\_states\_data\_size}] The size of the register update data. \\
+\item[\Type{unw\_word\_t} \Var{start\_ip}] The address of the first
+ instruction of the address range. \\
+\item[\Type{unw\_word\_t} \Var{end\_ip}] The address of the first
+ instruction \emph{beyond} the end of the address range. \\
+\end{description}
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_reg\_states\_iterate}() returns
+0. If the callback function returns a nonzero value, that indicates
+failure and the function returns immediately. Otherwise the negative
+value of one of the error-codes below is returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_reg\_states\_iterate}() is thread-safe. If cursor \Var{cp} is
+in the local address-space, this routine is also safe to use from a
+signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to locate
+ unwind-info for the procedure.
+\item[\Const{UNW\_EBADVERSION}] The unwind-info for the procedure has
+ version or format that is not understood by \Prog{libunwind}.
+\end{Description}
+In addition, \Func{unw\_reg\_states\_iterate}() may return any error
+returned by the \Func{access\_mem}() call-back (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_apply\_reg\_state(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_regname.man b/src/pal/src/libunwind/doc/unw_regname.man
new file mode 100644
index 0000000000..1e3e2dbc6e
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_regname.man
@@ -0,0 +1,68 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_REGNAME" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_regname
+\-\- get register name
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+const char *unw_regname(unw_regnum_t
+regnum);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_regname()
+routine returns a printable name for
+register regnum\&.
+If regnum
+is an invalid or otherwise
+unrecognized register number, a string consisting of three question
+marks is returned. The returned string is statically allocated and
+therefore guaranteed to remain valid until the application terminates.
+.PP
+.SH RETURN VALUE
+
+.PP
+The unw_regname()
+routine cannot fail and always returns a
+valid (non\-NULL)
+string.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+The unw_regname()
+routine is thread\-safe as well as safe to
+use from a signal handler.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_regname.tex b/src/pal/src/libunwind/doc/unw_regname.tex
new file mode 100644
index 0000000000..94b6434194
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_regname.tex
@@ -0,0 +1,47 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_regname}{David Mosberger-Tang}{Programming Library}{unw\_regname}unw\_regname -- get register name
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{const char~*}\Func{unw\_regname}(\Type{unw\_regnum\_t} \Var{regnum});\\
+
+\section{Description}
+
+The \Func{unw\_regname}() routine returns a printable name for
+register \Var{regnum}. If \Var{regnum} is an invalid or otherwise
+unrecognized register number, a string consisting of three question
+marks is returned. The returned string is statically allocated and
+therefore guaranteed to remain valid until the application terminates.
+
+\section{Return Value}
+
+The \Func{unw\_regname}() routine cannot fail and always returns a
+valid (non-\Const{NULL}) string.
+
+\section{Thread and Signal Safety}
+
+The \Func{unw\_regname}() routine is thread-safe as well as safe to
+use from a signal handler.
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_resume.man b/src/pal/src/libunwind/doc/unw_resume.man
new file mode 100644
index 0000000000..1bf38327bf
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_resume.man
@@ -0,0 +1,146 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_RESUME" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_resume
+\-\- resume execution in a particular stack frame
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_resume(unw_cursor_t *cp);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_resume()
+routine resumes execution at the stack frame
+identified by cp\&.
+The behavior of this routine differs
+slightly for local and remote unwinding.
+.PP
+For local unwinding, unw_resume()
+restores the machine state
+and then directly resumes execution in the target stack frame. Thus
+unw_resume()
+does not return in this case. Restoring the
+machine state normally involves restoring the ``preserved\&''
+(callee\-saved) registers. However, if execution in any of the stack
+frames younger (more deeply nested) than the one identified by
+cp
+was interrupted by a signal, then unw_resume()
+will
+restore all registers as well as the signal mask. Attempting to call
+unw_resume()
+on a cursor which identifies the stack frame of
+another thread results in undefined behavior (e.g., the program may
+crash).
+.PP
+For remote unwinding, unw_resume()
+installs the machine state
+identified by the cursor by calling the access_reg
+and
+access_fpreg
+accessor callbacks as needed. Once that is
+accomplished, the resume
+accessor callback is invoked. The
+unw_resume
+routine then returns normally (that is, unlikely
+for local unwinding, unw_resume
+will always return for remote
+unwinding).
+.PP
+Most platforms reserve some registers to pass arguments to exception
+handlers (e.g., IA\-64 uses r15\-r18
+for this
+purpose). These registers are normally treated like ``scratch\&''
+registers. However, if libunwind
+is used to set an exception
+argument register to a particular value (e.g., via
+unw_set_reg()),
+then unw_resume()
+will install this
+value as the contents of the register. In other words, the exception
+handling arguments are installed even in cases where normally only the
+``preserved\&'' registers are restored.
+.PP
+Note that unw_resume()
+does \fInot\fP
+invoke any unwind
+handlers (aka, ``personality routines\&''). If a program needs this, it
+will have to do so on its own by obtaining the unw_proc_info_t
+of each unwound frame and appropriately processing its unwind handler
+and language\-specific data area (lsda). These steps are generally
+dependent on the target\-platform and are regulated by the
+processor\-specific ABI (application\-binary interface).
+.PP
+.SH RETURN VALUE
+
+.PP
+For local unwinding, unw_resume()
+does not return on success.
+For remote unwinding, it returns 0 on success. On failure, the
+negative value of one of the errors below is returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_resume()
+is thread\-safe. If cursor cp
+is in the
+local address\-space, this routine is also safe to use from a signal
+handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_EBADREG
+ A register needed by unw_resume()
+wasn\&'t
+accessible.
+.TP
+UNW_EINVALIDIP
+ The instruction pointer identified by
+cp
+is not valid.
+.TP
+UNW_BADFRAME
+ The stack frame identified by
+cp
+is not valid.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_set_reg(3),
+sigprocmask(2)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_resume.tex b/src/pal/src/libunwind/doc/unw_resume.tex
new file mode 100644
index 0000000000..38b18248ab
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_resume.tex
@@ -0,0 +1,99 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_resume}{David Mosberger-Tang}{Programming Library}{unw\_resume}unw\_resume -- resume execution in a particular stack frame
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_resume}(\Type{unw\_cursor\_t~*}\Var{cp});\\
+
+\section{Description}
+
+The \Func{unw\_resume}() routine resumes execution at the stack frame
+identified by \Var{cp}. The behavior of this routine differs
+slightly for local and remote unwinding.
+
+For local unwinding, \Func{unw\_resume}() restores the machine state
+and then directly resumes execution in the target stack frame. Thus
+\Func{unw\_resume}() does not return in this case. Restoring the
+machine state normally involves restoring the ``preserved''
+(callee-saved) registers. However, if execution in any of the stack
+frames younger (more deeply nested) than the one identified by
+\Var{cp} was interrupted by a signal, then \Func{unw\_resume}() will
+restore all registers as well as the signal mask. Attempting to call
+\Func{unw\_resume}() on a cursor which identifies the stack frame of
+another thread results in undefined behavior (e.g., the program may
+crash).
+
+For remote unwinding, \Func{unw\_resume}() installs the machine state
+identified by the cursor by calling the \Func{access\_reg} and
+\Func{access\_fpreg} accessor callbacks as needed. Once that is
+accomplished, the \Func{resume} accessor callback is invoked. The
+\Func{unw\_resume} routine then returns normally (that is, unlikely
+for local unwinding, \Func{unw\_resume} will always return for remote
+unwinding).
+
+Most platforms reserve some registers to pass arguments to exception
+handlers (e.g., IA-64 uses \texttt{r15}-\texttt{r18} for this
+purpose). These registers are normally treated like ``scratch''
+registers. However, if \Prog{libunwind} is used to set an exception
+argument register to a particular value (e.g., via
+\Func{unw\_set\_reg}()), then \Func{unw\_resume}() will install this
+value as the contents of the register. In other words, the exception
+handling arguments are installed even in cases where normally only the
+``preserved'' registers are restored.
+
+Note that \Func{unw\_resume}() does \emph{not} invoke any unwind
+handlers (aka, ``personality routines''). If a program needs this, it
+will have to do so on its own by obtaining the \Type{unw\_proc\_info\_t}
+of each unwound frame and appropriately processing its unwind handler
+and language-specific data area (lsda). These steps are generally
+dependent on the target-platform and are regulated by the
+processor-specific ABI (application-binary interface).
+
+\section{Return Value}
+
+For local unwinding, \Func{unw\_resume}() does not return on success.
+For remote unwinding, it returns 0 on success. On failure, the
+negative value of one of the errors below is returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_resume}() is thread-safe. If cursor \Var{cp} is in the
+local address-space, this routine is also safe to use from a signal
+handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_resume}() wasn't
+ accessible.
+\item[\Const{UNW\_EINVALIDIP}] The instruction pointer identified by
+ \Var{cp} is not valid.
+\item[\Const{UNW\_BADFRAME}] The stack frame identified by
+ \Var{cp} is not valid.
+\end{Description}
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_set\_reg(3)},
+sigprocmask(2)
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_set_cache_size.man b/src/pal/src/libunwind/doc/unw_set_cache_size.man
new file mode 100644
index 0000000000..34bbc53961
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_set_cache_size.man
@@ -0,0 +1,88 @@
+'\" t
+.\" Manual page created with latex2man on Fri Jan 13 08:33:21 PST 2017
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_SET\\_CACHE\\_SIZE" "3" "13 January 2017" "Programming Library " "Programming Library "
+.SH NAME
+unw_set_cache_size
+\-\- set unwind cache size
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_set_cache_size(unw_addr_space_t
+as,
+size_t
+size,
+int
+flag);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_set_cache_size()
+routine sets the cache size of
+address space as
+to hold at least as many items as given by
+argument size\&.
+It may hold more items as determined by the
+implementation. To disable caching, call
+unw_set_caching_policy)
+with a policy of
+UNW_CACHE_NONE\&.
+Flag is currently unused and must be 0.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_set_cache_size()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_set_cache_size()
+is thread\-safe but \fInot\fP
+safe
+to use from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_ENOMEM
+ The desired cache size could not be
+established because the application is out of memory.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_create_addr_space(3),
+unw_set_caching_policy(3),
+unw_flush_cache(3)
+.PP
+.SH AUTHOR
+
+.PP
+Dave Watson
+.br
+Email: \fBdade.watson@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_set_cache_size.tex b/src/pal/src/libunwind/doc/unw_set_cache_size.tex
new file mode 100644
index 0000000000..1bd7e00df7
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_set_cache_size.tex
@@ -0,0 +1,59 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_set\_cache\_size}{Dave Watson}{Programming Library}{unw\_set\_cache\_size}unw\_set\_cache\_size -- set unwind cache size
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_set\_cache\_size}(\Type{unw\_addr\_space\_t} \Var{as}, \Type{size\_t} \Var{size}, \Type{int} \Var{flag});\\
+
+\section{Description}
+
+The \Func{unw\_set\_cache\_size}() routine sets the cache size of
+address space \Var{as} to hold at least as many items as given by
+argument \Var{size}. It may hold more items as determined by the
+implementation. To disable caching, call
+\Func{unw\_set\_caching\_policy}) with a policy of
+\Const{UNW\_CACHE\_NONE}. Flag is currently unused and must be 0.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_set\_cache\_size}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_set\_cache\_size}() is thread-safe but \emph{not} safe
+to use from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_ENOMEM}] The desired cache size could not be
+ established because the application is out of memory.
+\end{Description}
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_create\_addr\_space(3)},
+\SeeAlso{unw\_set\_caching\_policy(3)},
+\SeeAlso{unw\_flush\_cache(3)}
+
+\section{Author}
+
+\noindent
+Dave Watson\\
+Email: \Email{dade.watson@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_set_caching_policy.man b/src/pal/src/libunwind/doc/unw_set_caching_policy.man
new file mode 100644
index 0000000000..4862ea545e
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_set_caching_policy.man
@@ -0,0 +1,119 @@
+'\" t
+.\" Manual page created with latex2man on Fri Dec 2 16:09:33 PST 2016
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_SET\\_CACHING\\_POLICY" "3" "02 December 2016" "Programming Library " "Programming Library "
+.SH NAME
+unw_set_caching_policy
+\-\- set unwind caching policy
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_set_caching_policy(unw_addr_space_t
+as,
+unw_caching_policy_t
+policy);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_set_caching_policy()
+routine sets the caching policy
+of address space as
+to the policy specified by argument
+policy\&.
+The policy
+argument can take one of three
+possible values:
+.TP
+UNW_CACHE_NONE
+ Turns off caching completely. This
+also implicitly flushes the contents of all caches as if
+unw_flush_cache()
+had been called.
+.TP
+UNW_CACHE_GLOBAL
+ Enables caching using a global cache
+that is shared by all threads. If global caching is unavailable or
+unsupported, libunwind
+may fall back on using a per\-thread
+cache, as if UNW_CACHE_PER_THREAD
+had been specified.
+.TP
+UNW_CACHE_PER_THREAD
+ Enables caching using
+thread\-local caches. If a thread\-local caching are unavailable or
+unsupported, libunwind
+may fall back on using a global cache,
+as if UNW_CACHE_GLOBAL
+had been specified.
+.PP
+If caching is enabled, an application must be prepared to make
+appropriate calls to unw_flush_cache()
+whenever the target
+changes in a way that could affect the validity of cached information.
+For example, after unloading (removing) a shared library,
+unw_flush_cache()
+would have to be called (at least) for the
+address\-range that was covered by the shared library.
+.PP
+For address spaces created via unw_create_addr_space(3),
+caching is turned off by default. For the local address space
+unw_local_addr_space,
+caching is turned on by default.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_set_caching_policy()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_set_caching_policy()
+is thread\-safe but \fInot\fP
+safe
+to use from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_ENOMEM
+ The desired caching policy could not be
+established because the application is out of memory.
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_create_addr_space(3),
+unw_set_cache_size(3),
+unw_flush_cache(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_set_caching_policy.tex b/src/pal/src/libunwind/doc/unw_set_caching_policy.tex
new file mode 100644
index 0000000000..3a4b07e84a
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_set_caching_policy.tex
@@ -0,0 +1,81 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_set\_caching\_policy}{David Mosberger-Tang}{Programming Library}{unw\_set\_caching\_policy}unw\_set\_caching\_policy -- set unwind caching policy
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_set\_caching\_policy}(\Type{unw\_addr\_space\_t} \Var{as}, \Type{unw\_caching\_policy\_t} \Var{policy});\\
+
+\section{Description}
+
+The \Func{unw\_set\_caching\_policy}() routine sets the caching policy
+of address space \Var{as} to the policy specified by argument
+\Var{policy}. The \Var{policy} argument can take one of three
+possible values:
+\begin{description}
+\item[\Const{UNW\_CACHE\_NONE}] Turns off caching completely. This
+ also implicitly flushes the contents of all caches as if
+ \Func{unw\_flush\_cache}() had been called.
+\item[\Const{UNW\_CACHE\_GLOBAL}] Enables caching using a global cache
+ that is shared by all threads. If global caching is unavailable or
+ unsupported, \Prog{libunwind} may fall back on using a per-thread
+ cache, as if \Const{UNW\_CACHE\_PER\_THREAD} had been specified.
+\item[\Const{UNW\_CACHE\_PER\_THREAD}] Enables caching using
+ thread-local caches. If a thread-local caching are unavailable or
+ unsupported, \Prog{libunwind} may fall back on using a global cache,
+ as if \Const{UNW\_CACHE\_GLOBAL} had been specified.
+\end{description}
+
+If caching is enabled, an application must be prepared to make
+appropriate calls to \Func{unw\_flush\_cache}() whenever the target
+changes in a way that could affect the validity of cached information.
+For example, after unloading (removing) a shared library,
+\Func{unw\_flush\_cache}() would have to be called (at least) for the
+address-range that was covered by the shared library.
+
+For address spaces created via \Func{unw\_create\_addr\_space}(3),
+caching is turned off by default. For the local address space
+\Func{unw\_local\_addr\_space}, caching is turned on by default.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_set\_caching\_policy}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_set\_caching\_policy}() is thread-safe but \emph{not} safe
+to use from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_ENOMEM}] The desired caching policy could not be
+ established because the application is out of memory.
+\end{Description}
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_create\_addr\_space(3)},
+\SeeAlso{unw\_set\_cache\_size(3)},
+\SeeAlso{unw\_flush\_cache(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_set_fpreg.man b/src/pal/src/libunwind/doc/unw_set_fpreg.man
new file mode 100644
index 0000000000..6cefa54623
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_set_fpreg.man
@@ -0,0 +1,117 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_SET\\_FPREG" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_set_fpreg
+\-\- set contents of floating\-point register
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_set_fpreg(unw_cursor_t *cp,
+unw_regnum_t
+reg,
+unw_fpreg_t
+val);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_set_fpreg()
+routine sets the value of register
+reg
+in the stack frame identified by cursor cp
+to the
+value passed in val\&.
+.PP
+The register numbering is target\-dependent and described in separate
+manual pages (e.g., libunwind\-ia64(3) for the IA\-64 target).
+Furthermore, the exact set of accessible registers may depend on the
+type of frame that cp
+is referring to. For ordinary stack
+frames, it is normally possible to access only the preserved
+(``callee\-saved\&'') registers and frame\-related registers (such as the
+stack\-pointer). However, for signal frames (see
+unw_is_signal_frame(3)),
+it is usually possible to access
+all registers.
+.PP
+Note that unw_set_fpreg()
+can only write the contents of
+floating\-point registers. See unw_set_reg(3)
+for a way to
+write registers which fit in a single word.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_set_fpreg()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_set_fpreg()
+is thread\-safe as well as safe to use
+from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_EBADREG
+ An attempt was made to write a register
+that is either invalid or not accessible in the current frame.
+.TP
+UNW_EREADONLY
+ An attempt was made to write to a
+read\-only register.
+.PP
+In addition, unw_set_fpreg()
+may return any error returned by
+the access_mem(),
+access_reg(),
+and
+access_fpreg()
+call\-backs (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+libunwind\-ia64(3),
+unw_get_fpreg(3),
+unw_is_fpreg(3),
+unw_is_signal_frame(3),
+unw_set_reg(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_set_fpreg.tex b/src/pal/src/libunwind/doc/unw_set_fpreg.tex
new file mode 100644
index 0000000000..aaf7fb25a7
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_set_fpreg.tex
@@ -0,0 +1,79 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_set\_fpreg}{David Mosberger-Tang}{Programming Library}{unw\_set\_fpreg}unw\_set\_fpreg -- set contents of floating-point register
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_set\_fpreg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_fpreg\_t} \Var{val});\\
+
+\section{Description}
+
+The \Func{unw\_set\_fpreg}() routine sets the value of register
+\Var{reg} in the stack frame identified by cursor \Var{cp} to the
+value passed in \Var{val}.
+
+The register numbering is target-dependent and described in separate
+manual pages (e.g., libunwind-ia64(3) for the IA-64 target).
+Furthermore, the exact set of accessible registers may depend on the
+type of frame that \Var{cp} is referring to. For ordinary stack
+frames, it is normally possible to access only the preserved
+(``callee-saved'') registers and frame-related registers (such as the
+stack-pointer). However, for signal frames (see
+\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access
+all registers.
+
+Note that \Func{unw\_set\_fpreg}() can only write the contents of
+floating-point registers. See \Func{unw\_set\_reg}(3) for a way to
+write registers which fit in a single word.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_set\_fpreg}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_set\_fpreg}() is thread-safe as well as safe to use
+from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_EBADREG}] An attempt was made to write a register
+ that is either invalid or not accessible in the current frame.
+\item[\Const{UNW\_EREADONLY}] An attempt was made to write to a
+ read-only register.
+\end{Description}
+In addition, \Func{unw\_set\_fpreg}() may return any error returned by
+the \Func{access\_mem}(), \Func{access\_reg}(), and
+\Func{access\_fpreg}() call-backs (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{libunwind-ia64(3)},
+\SeeAlso{unw\_get\_fpreg(3)},
+\SeeAlso{unw\_is\_fpreg(3)},
+\SeeAlso{unw\_is\_signal\_frame(3)},
+\SeeAlso{unw\_set\_reg(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_set_reg.man b/src/pal/src/libunwind/doc/unw_set_reg.man
new file mode 100644
index 0000000000..5d57045f74
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_set_reg.man
@@ -0,0 +1,117 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_SET\\_REG" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_set_reg
+\-\- set register contents
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_set_reg(unw_cursor_t *cp,
+unw_regnum_t
+reg,
+unw_word_t
+val);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_set_reg()
+routine sets the value of register
+reg
+in the stack frame identified by cursor cp
+to the
+value passed in val\&.
+.PP
+The register numbering is target\-dependent and described in separate
+manual pages (e.g., libunwind\-ia64(3) for the IA\-64 target).
+Furthermore, the exact set of accessible registers may depend on the
+type of frame that cp
+is referring to. For ordinary stack
+frames, it is normally possible to access only the preserved
+(``callee\-saved\&'') registers and frame\-related registers (such as the
+stack\-pointer). However, for signal frames (see
+unw_is_signal_frame(3)),
+it is usually possible to access
+all registers.
+.PP
+Note that unw_set_reg()
+can only write the contents of
+registers whose values fit in a single word. See
+unw_set_fpreg(3)
+for a way to write registers which do not
+fit this constraint.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_set_reg()
+returns 0.
+Otherwise the negative value of one of the error\-codes below is
+returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_set_reg()
+is thread\-safe as well as safe to use
+from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_EBADREG
+ An attempt was made to write a register
+that is either invalid or not accessible in the current frame.
+.TP
+UNW_EREADONLY
+ An attempt was made to write to a
+read\-only register.
+.PP
+In addition, unw_set_reg()
+may return any error returned by
+the access_mem(),
+access_reg(),
+and
+access_fpreg()
+call\-backs (see
+unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+libunwind\-ia64(3),
+unw_get_reg(3),
+unw_is_signal_frame(3),
+unw_set_fpreg(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_set_reg.tex b/src/pal/src/libunwind/doc/unw_set_reg.tex
new file mode 100644
index 0000000000..2421846be5
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_set_reg.tex
@@ -0,0 +1,79 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_set\_reg}{David Mosberger-Tang}{Programming Library}{unw\_set\_reg}unw\_set\_reg -- set register contents
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_set\_reg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_word\_t} \Var{val});\\
+
+\section{Description}
+
+The \Func{unw\_set\_reg}() routine sets the value of register
+\Var{reg} in the stack frame identified by cursor \Var{cp} to the
+value passed in \Var{val}.
+
+The register numbering is target-dependent and described in separate
+manual pages (e.g., libunwind-ia64(3) for the IA-64 target).
+Furthermore, the exact set of accessible registers may depend on the
+type of frame that \Var{cp} is referring to. For ordinary stack
+frames, it is normally possible to access only the preserved
+(``callee-saved'') registers and frame-related registers (such as the
+stack-pointer). However, for signal frames (see
+\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access
+all registers.
+
+Note that \Func{unw\_set\_reg}() can only write the contents of
+registers whose values fit in a single word. See
+\Func{unw\_set\_fpreg}(3) for a way to write registers which do not
+fit this constraint.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_set\_reg}() returns 0.
+Otherwise the negative value of one of the error-codes below is
+returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_set\_reg}() is thread-safe as well as safe to use
+from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_EBADREG}] An attempt was made to write a register
+ that is either invalid or not accessible in the current frame.
+\item[\Const{UNW\_EREADONLY}] An attempt was made to write to a
+ read-only register.
+\end{Description}
+In addition, \Func{unw\_set\_reg}() may return any error returned by
+the \Func{access\_mem}(), \Func{access\_reg}(), and
+\Func{access\_fpreg}() call-backs (see
+\Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{libunwind-ia64(3)},
+\SeeAlso{unw\_get\_reg(3)},
+\SeeAlso{unw\_is\_signal\_frame(3)},
+\SeeAlso{unw\_set\_fpreg(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_step.man b/src/pal/src/libunwind/doc/unw_step.man
new file mode 100644
index 0000000000..54da1b2f3d
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_step.man
@@ -0,0 +1,106 @@
+'\" t
+.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_STEP" "3" "16 August 2007" "Programming Library " "Programming Library "
+.SH NAME
+unw_step
+\-\- advance to next stack frame
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+int
+unw_step(unw_cursor_t *cp);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_step()
+routine advances the unwind cursor cp
+to
+the next older, less deeply nested stack frame.
+.PP
+.SH RETURN VALUE
+
+.PP
+On successful completion, unw_step()
+returns a positive value
+if the updated cursor refers to a valid stack frame, or 0 if the
+previous stack frame was the last frame in the chain. On error, the
+negative value of one of the error\-codes below is returned.
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_step()
+is thread\-safe. If cursor cp
+is in the local
+address\-space, this routine is also safe to use from a signal handler.
+.PP
+.SH ERRORS
+
+.PP
+.TP
+UNW_EUNSPEC
+ An unspecified error occurred.
+.TP
+UNW_ENOINFO
+ Libunwind
+was unable to locate the
+unwind\-info needed to complete the operation.
+.TP
+UNW_EBADVERSION
+ The unwind\-info needed to complete the
+operation has a version or a format that is not understood by
+libunwind\&.
+.TP
+UNW_EINVALIDIP
+ The instruction\-pointer
+(``program\-counter\&'') of the next stack frame is invalid (e.g., not
+properly aligned).
+.TP
+UNW_EBADFRAME
+ The next stack frame is invalid.
+.TP
+UNW_ESTOPUNWIND
+ Returned if a call to
+find_proc_info()
+returned \-UNW_ESTOPUNWIND\&.
+.PP
+In addition, unw_step()
+may return any error returned by the
+find_proc_info(),
+get_dyn_info_list_addr(),
+access_mem(),
+access_reg(),
+or access_fpreg()
+call\-backs (see unw_create_addr_space(3)).
+.PP
+.SH SEE ALSO
+
+.PP
+libunwind(3),
+unw_create_addr_space(3)
+.PP
+.SH AUTHOR
+
+.PP
+David Mosberger\-Tang
+.br
+Email: \fBdmosberger@gmail.com\fP
+.br
+WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&.
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_step.tex b/src/pal/src/libunwind/doc/unw_step.tex
new file mode 100644
index 0000000000..106bd9ba99
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_step.tex
@@ -0,0 +1,68 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_step}{David Mosberger-Tang}{Programming Library}{unw\_step}unw\_step -- advance to next stack frame
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{int} \Func{unw\_step}(\Type{unw\_cursor\_t~*}\Var{cp});\\
+
+\section{Description}
+
+The \Func{unw\_step}() routine advances the unwind cursor \Var{cp} to
+the next older, less deeply nested stack frame.
+
+\section{Return Value}
+
+On successful completion, \Func{unw\_step}() returns a positive value
+if the updated cursor refers to a valid stack frame, or 0 if the
+previous stack frame was the last frame in the chain. On error, the
+negative value of one of the error-codes below is returned.
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_step}() is thread-safe. If cursor \Var{cp} is in the local
+address-space, this routine is also safe to use from a signal handler.
+
+\section{Errors}
+
+\begin{Description}
+\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
+\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to locate the
+ unwind-info needed to complete the operation.
+\item[\Const{UNW\_EBADVERSION}] The unwind-info needed to complete the
+ operation has a version or a format that is not understood by
+ \Prog{libunwind}.
+\item[\Const{UNW\_EINVALIDIP}] The instruction-pointer
+ (``program-counter'') of the next stack frame is invalid (e.g., not
+ properly aligned).
+\item[\Const{UNW\_EBADFRAME}] The next stack frame is invalid.
+\item[\Const{UNW\_ESTOPUNWIND}] Returned if a call to
+ \Func{find\_proc\_info}() returned -\Const{UNW\_ESTOPUNWIND}.
+\end{Description}
+In addition, \Func{unw\_step}() may return any error returned by the
+\Func{find\_proc\_info}(), \Func{get\_dyn\_info\_list\_addr}(),
+\Func{access\_mem}(), \Func{access\_reg}(), or \Func{access\_fpreg}()
+call-backs (see \Func{unw\_create\_addr\_space}(3)).
+
+\section{See Also}
+
+\SeeAlso{libunwind(3)},
+\SeeAlso{unw\_create\_addr\_space(3)}
+
+\section{Author}
+
+\noindent
+David Mosberger-Tang\\
+Email: \Email{dmosberger@gmail.com}\\
+WWW: \URL{http://www.nongnu.org/libunwind/}.
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/doc/unw_strerror.man b/src/pal/src/libunwind/doc/unw_strerror.man
new file mode 100644
index 0000000000..467c44d262
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_strerror.man
@@ -0,0 +1,63 @@
+'\" t
+.\" Manual page created with latex2man on Wed Aug 18 16:51:29 CEST 2004
+.\" NOTE: This file is generated, DO NOT EDIT.
+.de Vb
+.ft CW
+.nf
+..
+.de Ve
+.ft R
+
+.fi
+..
+.TH "UNW\\_STRERROR" "3" "18 August 2004" "Programming Library " "Programming Library "
+.SH NAME
+unw_strerror
+\-\- get text corresponding to error code
+.PP
+.SH SYNOPSIS
+
+.PP
+#include <libunwind.h>
+.br
+.PP
+const char *
+unw_strerror(int
+err_code);
+.br
+.PP
+.SH DESCRIPTION
+
+.PP
+The unw_strerror()
+routine maps the (negative) err_code
+to a corresponding text message and returns it.
+.PP
+.SH RETURN VALUE
+
+.PP
+The message that corresponds to err_code
+or, if the
+err_code
+has no corresponding message, the text "invalid error
+code".
+.PP
+.SH THREAD AND SIGNAL SAFETY
+
+.PP
+unw_strerror()
+is thread\-safe as well as safe to use
+from a signal handler.
+.PP
+.SH AUTHOR
+
+.PP
+Thomas Hallgren
+.br
+BEA Systems
+.br
+Stockholm, Sweden
+.br
+Email: \fBthallgre@bea.com\fP
+.br
+.\" NOTE: This file is generated, DO NOT EDIT.
diff --git a/src/pal/src/libunwind/doc/unw_strerror.tex b/src/pal/src/libunwind/doc/unw_strerror.tex
new file mode 100644
index 0000000000..7cad011768
--- /dev/null
+++ b/src/pal/src/libunwind/doc/unw_strerror.tex
@@ -0,0 +1,42 @@
+\documentclass{article}
+\usepackage[fancyhdr,pdf]{latex2man}
+
+\input{common.tex}
+
+\begin{document}
+
+\begin{Name}{3}{unw\_strerror}{Thomas Hallgren}{Programming Library}{unw\_strerror}unw\_strerror -- get text corresponding to error code
+\end{Name}
+
+\section{Synopsis}
+
+\File{\#include $<$libunwind.h$>$}\\
+
+\Type{const char *} \Func{unw\_strerror}(\Type{int} \Var{err\_code});\\
+
+\section{Description}
+
+The \Func{unw\_strerror}() routine maps the (negative) \Var{err\_code}
+to a corresponding text message and returns it.
+
+\section{Return Value}
+
+The message that corresponds to \Var{err\_code} or, if the
+\Var{err\_code} has no corresponding message, the text "invalid error
+code".
+
+\section{Thread and Signal Safety}
+
+\Func{unw\_strerror}() is thread-safe as well as safe to use
+from a signal handler.
+
+\section{Author}
+
+\noindent
+Thomas Hallgren\\
+BEA Systems\\
+Stockholm, Sweden\\
+Email: \Email{thallgre@bea.com}\\
+\LatexManEnd
+
+\end{document}
diff --git a/src/pal/src/libunwind/include/compiler.h b/src/pal/src/libunwind/include/compiler.h
new file mode 100644
index 0000000000..2fa59eff7f
--- /dev/null
+++ b/src/pal/src/libunwind/include/compiler.h
@@ -0,0 +1,72 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Compiler specific useful bits that are used in libunwind, and also in the
+ * tests. */
+
+#ifndef COMPILER_H
+#define COMPILER_H
+
+#ifdef __GNUC__
+# define ALIGNED(x) __attribute__((aligned(x)))
+# define CONST_ATTR __attribute__((__const__))
+# define UNUSED __attribute__((unused))
+# define NOINLINE __attribute__((noinline))
+# define NORETURN __attribute__((noreturn))
+# define ALIAS2(name) #name
+# define ALIAS(name) __attribute__((alias (ALIAS2(name))))
+# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
+# define ALWAYS_INLINE inline __attribute__((always_inline))
+# define HIDDEN __attribute__((visibility ("hidden")))
+# else
+# define ALWAYS_INLINE
+# define HIDDEN
+# endif
+# define WEAK __attribute__((weak))
+# if (__GNUC__ >= 3)
+# define likely(x) __builtin_expect ((x), 1)
+# define unlikely(x) __builtin_expect ((x), 0)
+# else
+# define likely(x) (x)
+# define unlikely(x) (x)
+# endif
+#else
+# define ALIGNED(x)
+# define ALWAYS_INLINE
+# define CONST_ATTR
+# define UNUSED
+# define NOINLINE
+# define NORETURN
+# define ALIAS(name)
+# define HIDDEN
+# define WEAK
+# define likely(x) (x)
+# define unlikely(x) (x)
+#endif
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+#endif /* COMPILER_H */
diff --git a/src/pal/src/libunwind/include/dwarf-eh.h b/src/pal/src/libunwind/include/dwarf-eh.h
new file mode 100644
index 0000000000..e03750760c
--- /dev/null
+++ b/src/pal/src/libunwind/include/dwarf-eh.h
@@ -0,0 +1,128 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_eh_h
+#define dwarf_eh_h
+
+#include "dwarf.h"
+
+/* This header file defines the format of a DWARF exception-header
+ section (.eh_frame_hdr, pointed to by program-header
+ PT_GNU_EH_FRAME). The exception-header is self-describing in the
+ sense that the format of the addresses contained in it is expressed
+ as a one-byte type-descriptor called a "pointer-encoding" (PE).
+
+ The exception header encodes the address of the .eh_frame section
+ and optionally contains a binary search table for the
+ Frame Descriptor Entries (FDEs) in the .eh_frame. The contents of
+ .eh_frame has the format described by the DWARF v3 standard
+ (http://www.eagercon.com/dwarf/dwarf3std.htm), except that code
+ addresses may be encoded in different ways. Also, .eh_frame has
+ augmentations that allow encoding a language-specific data-area
+ (LSDA) pointer and a pointer to a personality-routine.
+
+ Details:
+
+ The Common Information Entry (CIE) associated with an FDE may
+ contain an augmentation string. Each character in this string has
+ a specific meaning and either one or two associated operands. The
+ operands are stored in an augmentation body which appears right
+ after the "return_address_register" member and before the
+ "initial_instructions" member. The operands appear in the order
+ in which the characters appear in the string. For example, if the
+ augmentation string is "zL", the operand for 'z' would be first in
+ the augmentation body and the operand for 'L' would be second.
+ The following characters are supported for the CIE augmentation
+ string:
+
+ 'z': The operand for this character is a uleb128 value that gives the
+ length of the CIE augmentation body, not counting the length
+ of the uleb128 operand itself. If present, this code must
+ appear as the first character in the augmentation body.
+
+ 'L': Indicates that the FDE's augmentation body contains an LSDA
+ pointer. The operand for this character is a single byte
+ that specifies the pointer-encoding (PE) that is used for
+ the LSDA pointer.
+
+ 'R': Indicates that the code-pointers (FDE members
+ "initial_location" and "address_range" and the operand for
+ DW_CFA_set_loc) in the FDE have a non-default encoding. The
+ operand for this character is a single byte that specifies
+ the pointer-encoding (PE) that is used for the
+ code-pointers. Note: the "address_range" member is always
+ encoded as an absolute value. Apart from that, the specified
+ FDE pointer-encoding applies.
+
+ 'P': Indicates the presence of a personality routine (handler).
+ The first operand for this character specifies the
+ pointer-encoding (PE) that is used for the second operand,
+ which specifies the address of the personality routine.
+
+ If the augmentation string contains any other characters, the
+ remainder of the augmentation string should be ignored.
+ Furthermore, if the size of the augmentation body is unknown
+ (i.e., 'z' is not the first character of the augmentation string),
+ then the entire CIE as well all associated FDEs must be ignored.
+
+ A Frame Descriptor Entries (FDE) may contain an augmentation body
+ which, if present, appears right after the "address_range" member
+ and before the "instructions" member. The contents of this body
+ is implicitly defined by the augmentation string of the associated
+ CIE. The meaning of the characters in the CIE's augmentation
+ string as far as FDEs are concerned is as follows:
+
+ 'z': The first operand in the FDE's augmentation body specifies
+ the total length of the augmentation body as a uleb128 (not
+ counting the length of the uleb128 operand itself).
+
+ 'L': The operand for this character is an LSDA pointer, encoded
+ in the format specified by the corresponding operand in the
+ CIE's augmentation body.
+
+*/
+
+#define DW_EH_VERSION 1 /* The version we're implementing */
+
+struct __attribute__((packed)) dwarf_eh_frame_hdr
+ {
+ unsigned char version;
+ unsigned char eh_frame_ptr_enc;
+ unsigned char fde_count_enc;
+ unsigned char table_enc;
+ Elf_W (Addr) eh_frame;
+ /* The rest of the header is variable-length and consists of the
+ following members:
+
+ encoded_t fde_count;
+ struct
+ {
+ encoded_t start_ip; // first address covered by this FDE
+ encoded_t fde_addr; // address of the FDE
+ }
+ binary_search_table[fde_count]; */
+ };
+
+#endif /* dwarf_eh_h */
diff --git a/src/pal/src/libunwind/include/dwarf.h b/src/pal/src/libunwind/include/dwarf.h
new file mode 100644
index 0000000000..fab93c6145
--- /dev/null
+++ b/src/pal/src/libunwind/include/dwarf.h
@@ -0,0 +1,450 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_h
+#define dwarf_h
+
+#include <libunwind.h>
+
+struct dwarf_cursor; /* forward-declaration */
+struct elf_dyn_info;
+
+#include "dwarf-config.h"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef UNW_REMOTE_ONLY
+ #if defined(HAVE_LINK_H)
+ #include <link.h>
+ #elif defined(HAVE_SYS_LINK_H)
+ #include <sys/link.h>
+ #else
+ #error Could not find <link.h>
+ #endif
+#endif
+
+#include <pthread.h>
+
+/* DWARF expression opcodes. */
+
+typedef enum
+ {
+ DW_OP_addr = 0x03,
+ DW_OP_deref = 0x06,
+ DW_OP_const1u = 0x08,
+ DW_OP_const1s = 0x09,
+ DW_OP_const2u = 0x0a,
+ DW_OP_const2s = 0x0b,
+ DW_OP_const4u = 0x0c,
+ DW_OP_const4s = 0x0d,
+ DW_OP_const8u = 0x0e,
+ DW_OP_const8s = 0x0f,
+ DW_OP_constu = 0x10,
+ DW_OP_consts = 0x11,
+ DW_OP_dup = 0x12,
+ DW_OP_drop = 0x13,
+ DW_OP_over = 0x14,
+ DW_OP_pick = 0x15,
+ DW_OP_swap = 0x16,
+ DW_OP_rot = 0x17,
+ DW_OP_xderef = 0x18,
+ DW_OP_abs = 0x19,
+ DW_OP_and = 0x1a,
+ DW_OP_div = 0x1b,
+ DW_OP_minus = 0x1c,
+ DW_OP_mod = 0x1d,
+ DW_OP_mul = 0x1e,
+ DW_OP_neg = 0x1f,
+ DW_OP_not = 0x20,
+ DW_OP_or = 0x21,
+ DW_OP_plus = 0x22,
+ DW_OP_plus_uconst = 0x23,
+ DW_OP_shl = 0x24,
+ DW_OP_shr = 0x25,
+ DW_OP_shra = 0x26,
+ DW_OP_xor = 0x27,
+ DW_OP_skip = 0x2f,
+ DW_OP_bra = 0x28,
+ DW_OP_eq = 0x29,
+ DW_OP_ge = 0x2a,
+ DW_OP_gt = 0x2b,
+ DW_OP_le = 0x2c,
+ DW_OP_lt = 0x2d,
+ DW_OP_ne = 0x2e,
+ DW_OP_lit0 = 0x30,
+ DW_OP_lit1, DW_OP_lit2, DW_OP_lit3, DW_OP_lit4, DW_OP_lit5,
+ DW_OP_lit6, DW_OP_lit7, DW_OP_lit8, DW_OP_lit9, DW_OP_lit10,
+ DW_OP_lit11, DW_OP_lit12, DW_OP_lit13, DW_OP_lit14, DW_OP_lit15,
+ DW_OP_lit16, DW_OP_lit17, DW_OP_lit18, DW_OP_lit19, DW_OP_lit20,
+ DW_OP_lit21, DW_OP_lit22, DW_OP_lit23, DW_OP_lit24, DW_OP_lit25,
+ DW_OP_lit26, DW_OP_lit27, DW_OP_lit28, DW_OP_lit29, DW_OP_lit30,
+ DW_OP_lit31,
+ DW_OP_reg0 = 0x50,
+ DW_OP_reg1, DW_OP_reg2, DW_OP_reg3, DW_OP_reg4, DW_OP_reg5,
+ DW_OP_reg6, DW_OP_reg7, DW_OP_reg8, DW_OP_reg9, DW_OP_reg10,
+ DW_OP_reg11, DW_OP_reg12, DW_OP_reg13, DW_OP_reg14, DW_OP_reg15,
+ DW_OP_reg16, DW_OP_reg17, DW_OP_reg18, DW_OP_reg19, DW_OP_reg20,
+ DW_OP_reg21, DW_OP_reg22, DW_OP_reg23, DW_OP_reg24, DW_OP_reg25,
+ DW_OP_reg26, DW_OP_reg27, DW_OP_reg28, DW_OP_reg29, DW_OP_reg30,
+ DW_OP_reg31,
+ DW_OP_breg0 = 0x70,
+ DW_OP_breg1, DW_OP_breg2, DW_OP_breg3, DW_OP_breg4, DW_OP_breg5,
+ DW_OP_breg6, DW_OP_breg7, DW_OP_breg8, DW_OP_breg9, DW_OP_breg10,
+ DW_OP_breg11, DW_OP_breg12, DW_OP_breg13, DW_OP_breg14, DW_OP_breg15,
+ DW_OP_breg16, DW_OP_breg17, DW_OP_breg18, DW_OP_breg19, DW_OP_breg20,
+ DW_OP_breg21, DW_OP_breg22, DW_OP_breg23, DW_OP_breg24, DW_OP_breg25,
+ DW_OP_breg26, DW_OP_breg27, DW_OP_breg28, DW_OP_breg29, DW_OP_breg30,
+ DW_OP_breg31,
+ DW_OP_regx = 0x90,
+ DW_OP_fbreg = 0x91,
+ DW_OP_bregx = 0x92,
+ DW_OP_piece = 0x93,
+ DW_OP_deref_size = 0x94,
+ DW_OP_xderef_size = 0x95,
+ DW_OP_nop = 0x96,
+ DW_OP_push_object_address = 0x97,
+ DW_OP_call2 = 0x98,
+ DW_OP_call4 = 0x99,
+ DW_OP_call_ref = 0x9a,
+ DW_OP_lo_user = 0xe0,
+ DW_OP_hi_user = 0xff
+ }
+dwarf_expr_op_t;
+
+#define DWARF_CIE_VERSION 3
+#define DWARF_CIE_VERSION_MAX 4
+
+#define DWARF_CFA_OPCODE_MASK 0xc0
+#define DWARF_CFA_OPERAND_MASK 0x3f
+
+typedef enum
+ {
+ DW_CFA_advance_loc = 0x40,
+ DW_CFA_offset = 0x80,
+ DW_CFA_restore = 0xc0,
+ DW_CFA_nop = 0x00,
+ DW_CFA_set_loc = 0x01,
+ DW_CFA_advance_loc1 = 0x02,
+ DW_CFA_advance_loc2 = 0x03,
+ DW_CFA_advance_loc4 = 0x04,
+ DW_CFA_offset_extended = 0x05,
+ DW_CFA_restore_extended = 0x06,
+ DW_CFA_undefined = 0x07,
+ DW_CFA_same_value = 0x08,
+ DW_CFA_register = 0x09,
+ DW_CFA_remember_state = 0x0a,
+ DW_CFA_restore_state = 0x0b,
+ DW_CFA_def_cfa = 0x0c,
+ DW_CFA_def_cfa_register = 0x0d,
+ DW_CFA_def_cfa_offset = 0x0e,
+ DW_CFA_def_cfa_expression = 0x0f,
+ DW_CFA_expression = 0x10,
+ DW_CFA_offset_extended_sf = 0x11,
+ DW_CFA_def_cfa_sf = 0x12,
+ DW_CFA_def_cfa_offset_sf = 0x13,
+ DW_CFA_val_expression = 0x16,
+ DW_CFA_lo_user = 0x1c,
+ DW_CFA_MIPS_advance_loc8 = 0x1d,
+ DW_CFA_GNU_window_save = 0x2d,
+ DW_CFA_GNU_args_size = 0x2e,
+ DW_CFA_GNU_negative_offset_extended = 0x2f,
+ DW_CFA_hi_user = 0x3c
+ }
+dwarf_cfa_t;
+
+/* DWARF Pointer-Encoding (PEs).
+
+ Pointer-Encodings were invented for the GCC exception-handling
+ support for C++, but they represent a rather generic way of
+ describing the format in which an address/pointer is stored and
+ hence we include the definitions here, in the main dwarf.h file.
+ The Pointer-Encoding format is partially documented in Linux Base
+ Spec v1.3 (http://www.linuxbase.org/spec/). The rest is reverse
+ engineered from GCC.
+
+*/
+#define DW_EH_PE_FORMAT_MASK 0x0f /* format of the encoded value */
+#define DW_EH_PE_APPL_MASK 0x70 /* how the value is to be applied */
+/* Flag bit. If set, the resulting pointer is the address of the word
+ that contains the final address. */
+#define DW_EH_PE_indirect 0x80
+
+/* Pointer-encoding formats: */
+#define DW_EH_PE_omit 0xff
+#define DW_EH_PE_ptr 0x00 /* pointer-sized unsigned value */
+#define DW_EH_PE_uleb128 0x01 /* unsigned LE base-128 value */
+#define DW_EH_PE_udata2 0x02 /* unsigned 16-bit value */
+#define DW_EH_PE_udata4 0x03 /* unsigned 32-bit value */
+#define DW_EH_PE_udata8 0x04 /* unsigned 64-bit value */
+#define DW_EH_PE_sleb128 0x09 /* signed LE base-128 value */
+#define DW_EH_PE_sdata2 0x0a /* signed 16-bit value */
+#define DW_EH_PE_sdata4 0x0b /* signed 32-bit value */
+#define DW_EH_PE_sdata8 0x0c /* signed 64-bit value */
+
+/* Pointer-encoding application: */
+#define DW_EH_PE_absptr 0x00 /* absolute value */
+#define DW_EH_PE_pcrel 0x10 /* rel. to addr. of encoded value */
+#define DW_EH_PE_textrel 0x20 /* text-relative (GCC-specific???) */
+#define DW_EH_PE_datarel 0x30 /* data-relative */
+/* The following are not documented by LSB v1.3, yet they are used by
+ GCC, presumably they aren't documented by LSB since they aren't
+ used on Linux: */
+#define DW_EH_PE_funcrel 0x40 /* start-of-procedure-relative */
+#define DW_EH_PE_aligned 0x50 /* aligned pointer */
+
+extern struct mempool dwarf_reg_state_pool;
+extern struct mempool dwarf_cie_info_pool;
+
+typedef enum
+ {
+ DWARF_WHERE_UNDEF, /* register isn't saved at all */
+ DWARF_WHERE_SAME, /* register has same value as in prev. frame */
+ DWARF_WHERE_CFAREL, /* register saved at CFA-relative address */
+ DWARF_WHERE_REG, /* register saved in another register */
+ DWARF_WHERE_EXPR, /* register saved */
+ DWARF_WHERE_VAL_EXPR, /* register has computed value */
+ }
+dwarf_where_t;
+
+/* For uniformity, we'd like to treat the CFA save-location like any
+ other register save-location, but this doesn't quite work, because
+ the CFA can be expressed as a (REGISTER,OFFSET) pair. To handle
+ this, we use two dwarf_save_loc structures to describe the CFA.
+ The first one (CFA_REG_COLUMN), tells us where the CFA is saved.
+ In the case of DWARF_WHERE_EXPR, the CFA is defined by a DWARF
+ location expression whose address is given by member "val". In the
+ case of DWARF_WHERE_REG, member "val" gives the number of the
+ base-register and the "val" member of DWARF_CFA_OFF_COLUMN gives
+ the offset value. */
+#define DWARF_CFA_REG_COLUMN DWARF_NUM_PRESERVED_REGS
+#define DWARF_CFA_OFF_COLUMN (DWARF_NUM_PRESERVED_REGS + 1)
+
+typedef struct dwarf_reg_only_state
+ {
+ char where[DWARF_NUM_PRESERVED_REGS + 2]; /* how is the register saved? */
+ unw_word_t val[DWARF_NUM_PRESERVED_REGS + 2]; /* where it's saved */
+ }
+dwarf_reg_only_state_t;
+
+typedef struct dwarf_reg_state
+ {
+ unw_word_t ret_addr_column; /* which column in rule table represents return address */
+ dwarf_reg_only_state_t reg;
+ }
+dwarf_reg_state_t;
+
+typedef struct dwarf_stackable_reg_state
+ {
+ struct dwarf_stackable_reg_state *next; /* for rs_stack */
+ dwarf_reg_state_t state;
+ }
+dwarf_stackable_reg_state_t;
+
+typedef struct dwarf_reg_cache_entry
+ {
+ unw_word_t ip; /* ip this rs is for */
+ unsigned short coll_chain; /* used for hash collisions */
+ unsigned short hint; /* hint for next rs to try (or -1) */
+ unsigned short valid : 1; /* optional machine-dependent signal info */
+ unsigned short signal_frame : 1; /* optional machine-dependent signal info */
+ }
+dwarf_reg_cache_entry_t;
+
+typedef struct dwarf_cie_info
+ {
+ unw_word_t cie_instr_start; /* start addr. of CIE "initial_instructions" */
+ unw_word_t cie_instr_end; /* end addr. of CIE "initial_instructions" */
+ unw_word_t fde_instr_start; /* start addr. of FDE "instructions" */
+ unw_word_t fde_instr_end; /* end addr. of FDE "instructions" */
+ unw_word_t code_align; /* code-alignment factor */
+ unw_word_t data_align; /* data-alignment factor */
+ unw_word_t ret_addr_column; /* column of return-address register */
+ unw_word_t handler; /* address of personality-routine */
+ uint16_t abi;
+ uint16_t tag;
+ uint8_t fde_encoding;
+ uint8_t lsda_encoding;
+ unsigned int sized_augmentation : 1;
+ unsigned int have_abi_marker : 1;
+ unsigned int signal_frame : 1;
+ }
+dwarf_cie_info_t;
+
+typedef struct dwarf_state_record
+ {
+ unsigned char fde_encoding;
+ unw_word_t args_size;
+
+ dwarf_reg_state_t rs_initial; /* reg-state after CIE instructions */
+ dwarf_reg_state_t rs_current; /* current reg-state */
+ }
+dwarf_state_record_t;
+
+typedef struct dwarf_cursor
+ {
+ void *as_arg; /* argument to address-space callbacks */
+ unw_addr_space_t as; /* reference to per-address-space info */
+
+ unw_word_t cfa; /* canonical frame address; aka frame-/stack-pointer */
+ unw_word_t ip; /* instruction pointer */
+ unw_word_t args_size; /* size of arguments */
+ unw_word_t eh_args[UNW_TDEP_NUM_EH_REGS];
+ unsigned int eh_valid_mask;
+
+ dwarf_loc_t loc[DWARF_NUM_PRESERVED_REGS];
+
+ unsigned int stash_frames :1; /* stash frames for fast lookup */
+ unsigned int use_prev_instr :1; /* use previous (= call) or current (= signal) instruction? */
+ unsigned int pi_valid :1; /* is proc_info valid? */
+ unsigned int pi_is_dynamic :1; /* proc_info found via dynamic proc info? */
+ unw_proc_info_t pi; /* info about current procedure */
+
+ short hint; /* faster lookup of the rs cache */
+ short prev_rs;
+ }
+dwarf_cursor_t;
+
+#define DWARF_DEFAULT_LOG_UNW_CACHE_SIZE 7
+#define DWARF_DEFAULT_UNW_CACHE_SIZE (1 << DWARF_DEFAULT_LOG_UNW_CACHE_SIZE)
+
+#define DWARF_DEFAULT_LOG_UNW_HASH_SIZE (DWARF_DEFAULT_LOG_UNW_CACHE_SIZE + 1)
+#define DWARF_DEFAULT_UNW_HASH_SIZE (1 << DWARF_DEFAULT_LOG_UNW_HASH_SIZE)
+
+typedef unsigned char unw_hash_index_t;
+
+struct dwarf_rs_cache
+ {
+ pthread_mutex_t lock;
+ unsigned short rr_head; /* index of least-recently allocated rs */
+
+ unsigned short log_size;
+ unsigned short prev_log_size;
+
+ /* hash table that maps instruction pointer to rs index: */
+ unsigned short *hash;
+
+ uint32_t generation; /* generation number */
+
+ /* rs cache: */
+ dwarf_reg_state_t *buckets;
+ dwarf_reg_cache_entry_t *links;
+
+ /* default memory, loaded in BSS segment */
+ unsigned short default_hash[DWARF_DEFAULT_UNW_HASH_SIZE];
+ dwarf_reg_state_t default_buckets[DWARF_DEFAULT_UNW_CACHE_SIZE];
+ dwarf_reg_cache_entry_t default_links[DWARF_DEFAULT_UNW_CACHE_SIZE];
+ };
+
+/* A list of descriptors for loaded .debug_frame sections. */
+
+struct unw_debug_frame_list
+ {
+ /* The start (inclusive) and end (exclusive) of the described region. */
+ unw_word_t start;
+ unw_word_t end;
+ /* The debug frame itself. */
+ char *debug_frame;
+ size_t debug_frame_size;
+ /* Index (for binary search). */
+ struct table_entry *index;
+ size_t index_size;
+ /* Pointer to next descriptor. */
+ struct unw_debug_frame_list *next;
+ };
+
+/* Convenience macros: */
+#define dwarf_init UNW_ARCH_OBJ (dwarf_init)
+#define dwarf_callback UNW_OBJ (dwarf_callback)
+#define dwarf_find_proc_info UNW_OBJ (dwarf_find_proc_info)
+#define dwarf_find_debug_frame UNW_OBJ (dwarf_find_debug_frame)
+#define dwarf_search_unwind_table UNW_OBJ (dwarf_search_unwind_table)
+#define dwarf_find_unwind_table UNW_OBJ (dwarf_find_unwind_table)
+#define dwarf_put_unwind_info UNW_OBJ (dwarf_put_unwind_info)
+#define dwarf_put_unwind_info UNW_OBJ (dwarf_put_unwind_info)
+#define dwarf_eval_expr UNW_OBJ (dwarf_eval_expr)
+#define dwarf_stack_aligned UNW_OBJ (dwarf_stack_aligned)
+#define dwarf_extract_proc_info_from_fde \
+ UNW_OBJ (dwarf_extract_proc_info_from_fde)
+#define dwarf_find_save_locs UNW_OBJ (dwarf_find_save_locs)
+#define dwarf_make_proc_info UNW_OBJ (dwarf_make_proc_info)
+#define dwarf_apply_reg_state UNW_OBJ (dwarf_apply_reg_state)
+#define dwarf_reg_states_iterate UNW_OBJ (dwarf_reg_states_iterate)
+#define dwarf_read_encoded_pointer UNW_OBJ (dwarf_read_encoded_pointer)
+#define dwarf_step UNW_OBJ (dwarf_step)
+#define dwarf_flush_rs_cache UNW_OBJ (dwarf_flush_rs_cache)
+
+extern int dwarf_init (void);
+#ifndef UNW_REMOTE_ONLY
+extern int dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr);
+extern int dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+#endif /* !UNW_REMOTE_ONLY */
+extern int dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug,
+ unw_word_t ip, unw_word_t segbase,
+ const char* obj_name, unw_word_t start,
+ unw_word_t end);
+extern int dwarf_search_unwind_table (unw_addr_space_t as,
+ unw_word_t ip,
+ unw_dyn_info_t *di,
+ unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+
+extern int dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as,
+ char *path, unw_word_t segbase, unw_word_t mapoff,
+ unw_word_t ip);
+extern void dwarf_put_unwind_info (unw_addr_space_t as,
+ unw_proc_info_t *pi, void *arg);
+extern int dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t *addr,
+ unw_word_t len, unw_word_t *valp,
+ int *is_register);
+extern int
+dwarf_stack_aligned(struct dwarf_cursor *c, unw_word_t cfa_addr,
+ unw_word_t rbp_addr, unw_word_t *offset);
+
+extern int dwarf_extract_proc_info_from_fde (unw_addr_space_t as,
+ unw_accessors_t *a,
+ unw_word_t *fde_addr,
+ unw_proc_info_t *pi,
+ unw_word_t base,
+ int need_unwind_info,
+ int is_debug_frame,
+ void *arg);
+extern int dwarf_find_save_locs (struct dwarf_cursor *c);
+extern int dwarf_make_proc_info (struct dwarf_cursor *c);
+extern int dwarf_apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs);
+extern int dwarf_reg_states_iterate (struct dwarf_cursor *c, unw_reg_states_callback cb, void *token);
+extern int dwarf_read_encoded_pointer (unw_addr_space_t as,
+ unw_accessors_t *a,
+ unw_word_t *addr,
+ unsigned char encoding,
+ const unw_proc_info_t *pi,
+ unw_word_t *valp, void *arg);
+extern int dwarf_step (struct dwarf_cursor *c);
+extern int dwarf_flush_rs_cache (struct dwarf_rs_cache *cache);
+
+#endif /* dwarf_h */
diff --git a/src/pal/src/libunwind/include/dwarf_i.h b/src/pal/src/libunwind/include/dwarf_i.h
new file mode 100644
index 0000000000..983b9f5c2a
--- /dev/null
+++ b/src/pal/src/libunwind/include/dwarf_i.h
@@ -0,0 +1,490 @@
+#ifndef DWARF_I_H
+#define DWARF_I_H
+
+/* This file contains definitions that cannot be used in code outside
+ of libunwind. In particular, most inline functions are here
+ because otherwise they'd generate unresolved references when the
+ files are compiled with inlining disabled. */
+
+#include "dwarf.h"
+#include "libunwind_i.h"
+
+/* Unless we are told otherwise, assume that a "machine address" is
+ the size of an unw_word_t. */
+#ifndef dwarf_addr_size
+# define dwarf_addr_size(as) (sizeof (unw_word_t))
+#endif
+
+#ifndef dwarf_to_unw_regnum
+# define dwarf_to_unw_regnum_map UNW_OBJ (dwarf_to_unw_regnum_map)
+extern const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH];
+/* REG is evaluated multiple times; it better be side-effects free! */
+# define dwarf_to_unw_regnum(reg) \
+ (((reg) < DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0)
+#endif
+
+#ifdef UNW_LOCAL_ONLY
+
+/* In the local-only case, we can let the compiler directly access
+ memory and don't need to worry about differing byte-order. */
+
+typedef union __attribute__ ((packed))
+ {
+ int8_t s8;
+ int16_t s16;
+ int32_t s32;
+ int64_t s64;
+ uint8_t u8;
+ uint16_t u16;
+ uint32_t u32;
+ uint64_t u64;
+ void *ptr;
+ }
+dwarf_misaligned_value_t;
+
+static inline int
+dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ int8_t *val, void *arg)
+{
+ dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr;
+
+ *val = mvp->s8;
+ *addr += sizeof (mvp->s8);
+ return 0;
+}
+
+static inline int
+dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ int16_t *val, void *arg)
+{
+ dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr;
+
+ *val = mvp->s16;
+ *addr += sizeof (mvp->s16);
+ return 0;
+}
+
+static inline int
+dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ int32_t *val, void *arg)
+{
+ dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr;
+
+ *val = mvp->s32;
+ *addr += sizeof (mvp->s32);
+ return 0;
+}
+
+static inline int
+dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ int64_t *val, void *arg)
+{
+ dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr;
+
+ *val = mvp->s64;
+ *addr += sizeof (mvp->s64);
+ return 0;
+}
+
+static inline int
+dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ uint8_t *val, void *arg)
+{
+ dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr;
+
+ *val = mvp->u8;
+ *addr += sizeof (mvp->u8);
+ return 0;
+}
+
+static inline int
+dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ uint16_t *val, void *arg)
+{
+ dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr;
+
+ *val = mvp->u16;
+ *addr += sizeof (mvp->u16);
+ return 0;
+}
+
+static inline int
+dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ uint32_t *val, void *arg)
+{
+ dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr;
+
+ *val = mvp->u32;
+ *addr += sizeof (mvp->u32);
+ return 0;
+}
+
+static inline int
+dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ uint64_t *val, void *arg)
+{
+ dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr;
+
+ *val = mvp->u64;
+ *addr += sizeof (mvp->u64);
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+
+static inline int
+dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ uint8_t *valp, void *arg)
+{
+ unw_word_t val, aligned_addr = *addr & -sizeof (unw_word_t);
+ unw_word_t off = *addr - aligned_addr;
+ int ret;
+
+ *addr += 1;
+ ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ val >>= 8*off;
+#else
+ val >>= 8*(sizeof (unw_word_t) - 1 - off);
+#endif
+ *valp = (uint8_t) val;
+ return ret;
+}
+
+static inline int
+dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ uint16_t *val, void *arg)
+{
+ uint8_t v0, v1;
+ int ret;
+
+ if ((ret = dwarf_readu8 (as, a, addr, &v0, arg)) < 0
+ || (ret = dwarf_readu8 (as, a, addr, &v1, arg)) < 0)
+ return ret;
+
+ if (tdep_big_endian (as))
+ *val = (uint16_t) v0 << 8 | v1;
+ else
+ *val = (uint16_t) v1 << 8 | v0;
+ return 0;
+}
+
+static inline int
+dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ uint32_t *val, void *arg)
+{
+ uint16_t v0, v1;
+ int ret;
+
+ if ((ret = dwarf_readu16 (as, a, addr, &v0, arg)) < 0
+ || (ret = dwarf_readu16 (as, a, addr, &v1, arg)) < 0)
+ return ret;
+
+ if (tdep_big_endian (as))
+ *val = (uint32_t) v0 << 16 | v1;
+ else
+ *val = (uint32_t) v1 << 16 | v0;
+ return 0;
+}
+
+static inline int
+dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ uint64_t *val, void *arg)
+{
+ uint32_t v0, v1;
+ int ret;
+
+ if ((ret = dwarf_readu32 (as, a, addr, &v0, arg)) < 0
+ || (ret = dwarf_readu32 (as, a, addr, &v1, arg)) < 0)
+ return ret;
+
+ if (tdep_big_endian (as))
+ *val = (uint64_t) v0 << 32 | v1;
+ else
+ *val = (uint64_t) v1 << 32 | v0;
+ return 0;
+}
+
+static inline int
+dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ int8_t *val, void *arg)
+{
+ uint8_t uval;
+ int ret;
+
+ if ((ret = dwarf_readu8 (as, a, addr, &uval, arg)) < 0)
+ return ret;
+ *val = (int8_t) uval;
+ return 0;
+}
+
+static inline int
+dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ int16_t *val, void *arg)
+{
+ uint16_t uval;
+ int ret;
+
+ if ((ret = dwarf_readu16 (as, a, addr, &uval, arg)) < 0)
+ return ret;
+ *val = (int16_t) uval;
+ return 0;
+}
+
+static inline int
+dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ int32_t *val, void *arg)
+{
+ uint32_t uval;
+ int ret;
+
+ if ((ret = dwarf_readu32 (as, a, addr, &uval, arg)) < 0)
+ return ret;
+ *val = (int32_t) uval;
+ return 0;
+}
+
+static inline int
+dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ int64_t *val, void *arg)
+{
+ uint64_t uval;
+ int ret;
+
+ if ((ret = dwarf_readu64 (as, a, addr, &uval, arg)) < 0)
+ return ret;
+ *val = (int64_t) uval;
+ return 0;
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+static inline int
+dwarf_readw (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ unw_word_t *val, void *arg)
+{
+ uint32_t u32;
+ uint64_t u64;
+ int ret;
+
+ switch (dwarf_addr_size (as))
+ {
+ case 4:
+ ret = dwarf_readu32 (as, a, addr, &u32, arg);
+ if (ret < 0)
+ return ret;
+ *val = u32;
+ return ret;
+
+ case 8:
+ ret = dwarf_readu64 (as, a, addr, &u64, arg);
+ if (ret < 0)
+ return ret;
+ *val = u64;
+ return ret;
+
+ default:
+ abort ();
+ }
+}
+
+/* Read an unsigned "little-endian base 128" value. See Chapter 7.6
+ of DWARF spec v3. */
+
+static inline int
+dwarf_read_uleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ unw_word_t *valp, void *arg)
+{
+ unw_word_t val = 0, shift = 0;
+ unsigned char byte;
+ int ret;
+
+ do
+ {
+ if ((ret = dwarf_readu8 (as, a, addr, &byte, arg)) < 0)
+ return ret;
+
+ val |= ((unw_word_t) byte & 0x7f) << shift;
+ shift += 7;
+ }
+ while (byte & 0x80);
+
+ *valp = val;
+ return 0;
+}
+
+/* Read a signed "little-endian base 128" value. See Chapter 7.6 of
+ DWARF spec v3. */
+
+static inline int
+dwarf_read_sleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ unw_word_t *valp, void *arg)
+{
+ unw_word_t val = 0, shift = 0;
+ unsigned char byte;
+ int ret;
+
+ do
+ {
+ if ((ret = dwarf_readu8 (as, a, addr, &byte, arg)) < 0)
+ return ret;
+
+ val |= ((unw_word_t) byte & 0x7f) << shift;
+ shift += 7;
+ }
+ while (byte & 0x80);
+
+ if (shift < 8 * sizeof (unw_word_t) && (byte & 0x40) != 0)
+ /* sign-extend negative value */
+ val |= ((unw_word_t) -1) << shift;
+
+ *valp = val;
+ return 0;
+}
+
+static ALWAYS_INLINE int
+dwarf_read_encoded_pointer_inlined (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, unsigned char encoding,
+ const unw_proc_info_t *pi,
+ unw_word_t *valp, void *arg)
+{
+ unw_word_t val, initial_addr = *addr;
+ uint16_t uval16;
+ uint32_t uval32;
+ uint64_t uval64;
+ int16_t sval16 = 0;
+ int32_t sval32 = 0;
+ int64_t sval64 = 0;
+ int ret;
+
+ /* DW_EH_PE_omit and DW_EH_PE_aligned don't follow the normal
+ format/application encoding. Handle them first. */
+ if (encoding == DW_EH_PE_omit)
+ {
+ *valp = 0;
+ return 0;
+ }
+ else if (encoding == DW_EH_PE_aligned)
+ {
+ int size = dwarf_addr_size (as);
+ *addr = (initial_addr + size - 1) & -size;
+ return dwarf_readw (as, a, addr, valp, arg);
+ }
+
+ switch (encoding & DW_EH_PE_FORMAT_MASK)
+ {
+ case DW_EH_PE_ptr:
+ if ((ret = dwarf_readw (as, a, addr, &val, arg)) < 0)
+ return ret;
+ break;
+
+ case DW_EH_PE_uleb128:
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
+ return ret;
+ break;
+
+ case DW_EH_PE_udata2:
+ if ((ret = dwarf_readu16 (as, a, addr, &uval16, arg)) < 0)
+ return ret;
+ val = uval16;
+ break;
+
+ case DW_EH_PE_udata4:
+ if ((ret = dwarf_readu32 (as, a, addr, &uval32, arg)) < 0)
+ return ret;
+ val = uval32;
+ break;
+
+ case DW_EH_PE_udata8:
+ if ((ret = dwarf_readu64 (as, a, addr, &uval64, arg)) < 0)
+ return ret;
+ val = uval64;
+ break;
+
+ case DW_EH_PE_sleb128:
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
+ return ret;
+ break;
+
+ case DW_EH_PE_sdata2:
+ if ((ret = dwarf_reads16 (as, a, addr, &sval16, arg)) < 0)
+ return ret;
+ val = sval16;
+ break;
+
+ case DW_EH_PE_sdata4:
+ if ((ret = dwarf_reads32 (as, a, addr, &sval32, arg)) < 0)
+ return ret;
+ val = sval32;
+ break;
+
+ case DW_EH_PE_sdata8:
+ if ((ret = dwarf_reads64 (as, a, addr, &sval64, arg)) < 0)
+ return ret;
+ val = sval64;
+ break;
+
+ default:
+ Debug (1, "unexpected encoding format 0x%x\n",
+ encoding & DW_EH_PE_FORMAT_MASK);
+ return -UNW_EINVAL;
+ }
+
+ if (val == 0)
+ {
+ /* 0 is a special value and always absolute. */
+ *valp = 0;
+ return 0;
+ }
+
+ switch (encoding & DW_EH_PE_APPL_MASK)
+ {
+ case DW_EH_PE_absptr:
+ break;
+
+ case DW_EH_PE_pcrel:
+ val += initial_addr;
+ break;
+
+ case DW_EH_PE_datarel:
+ /* XXX For now, assume that data-relative addresses are relative
+ to the global pointer. */
+ val += pi->gp;
+ break;
+
+ case DW_EH_PE_funcrel:
+ val += pi->start_ip;
+ break;
+
+ case DW_EH_PE_textrel:
+ /* XXX For now we don't support text-rel values. If there is a
+ platform which needs this, we probably would have to add a
+ "segbase" member to unw_proc_info_t. */
+ default:
+ Debug (1, "unexpected application type 0x%x\n",
+ encoding & DW_EH_PE_APPL_MASK);
+ return -UNW_EINVAL;
+ }
+
+ /* Trim off any extra bits. Assume that sign extension isn't
+ required; the only place it is needed is MIPS kernel space
+ addresses. */
+ if (sizeof (val) > dwarf_addr_size (as))
+ {
+ assert (dwarf_addr_size (as) == 4);
+ val = (uint32_t) val;
+ }
+
+ if (encoding & DW_EH_PE_indirect)
+ {
+ unw_word_t indirect_addr = val;
+
+ if ((ret = dwarf_readw (as, a, &indirect_addr, &val, arg)) < 0)
+ return ret;
+ }
+
+ *valp = val;
+ return 0;
+}
+
+#endif /* DWARF_I_H */
diff --git a/src/pal/src/libunwind/include/libunwind-aarch64.h b/src/pal/src/libunwind/include/libunwind-aarch64.h
new file mode 100644
index 0000000000..85812e151d
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-aarch64.h
@@ -0,0 +1,210 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <stddef.h>
+#include <ucontext.h>
+
+#define UNW_TARGET aarch64
+#define UNW_TARGET_AARCH64 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+
+#define UNW_TDEP_CURSOR_LEN 512
+
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+
+typedef long double unw_tdep_fpreg_t;
+
+typedef struct
+ {
+ /* no aarch64-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+typedef enum
+ {
+ /* 64-bit general registers. */
+ UNW_AARCH64_X0,
+ UNW_AARCH64_X1,
+ UNW_AARCH64_X2,
+ UNW_AARCH64_X3,
+ UNW_AARCH64_X4,
+ UNW_AARCH64_X5,
+ UNW_AARCH64_X6,
+ UNW_AARCH64_X7,
+ UNW_AARCH64_X8,
+
+ /* Temporary registers. */
+ UNW_AARCH64_X9,
+ UNW_AARCH64_X10,
+ UNW_AARCH64_X11,
+ UNW_AARCH64_X12,
+ UNW_AARCH64_X13,
+ UNW_AARCH64_X14,
+ UNW_AARCH64_X15,
+
+ /* Intra-procedure-call temporary registers. */
+ UNW_AARCH64_X16,
+ UNW_AARCH64_X17,
+
+ /* Callee-saved registers. */
+ UNW_AARCH64_X18,
+ UNW_AARCH64_X19,
+ UNW_AARCH64_X20,
+ UNW_AARCH64_X21,
+ UNW_AARCH64_X22,
+ UNW_AARCH64_X23,
+ UNW_AARCH64_X24,
+ UNW_AARCH64_X25,
+ UNW_AARCH64_X26,
+ UNW_AARCH64_X27,
+ UNW_AARCH64_X28,
+
+ /* 64-bit frame pointer. */
+ UNW_AARCH64_X29,
+
+ /* 64-bit link register. */
+ UNW_AARCH64_X30,
+
+ /* 64-bit stack pointer. */
+ UNW_AARCH64_SP = 31,
+ UNW_AARCH64_PC,
+ UNW_AARCH64_PSTATE,
+
+ /* 128-bit FP/Advanced SIMD registers. */
+ UNW_AARCH64_V0 = 64,
+ UNW_AARCH64_V1,
+ UNW_AARCH64_V2,
+ UNW_AARCH64_V3,
+ UNW_AARCH64_V4,
+ UNW_AARCH64_V5,
+ UNW_AARCH64_V6,
+ UNW_AARCH64_V7,
+ UNW_AARCH64_V8,
+ UNW_AARCH64_V9,
+ UNW_AARCH64_V10,
+ UNW_AARCH64_V11,
+ UNW_AARCH64_V12,
+ UNW_AARCH64_V13,
+ UNW_AARCH64_V14,
+ UNW_AARCH64_V15,
+ UNW_AARCH64_V16,
+ UNW_AARCH64_V17,
+ UNW_AARCH64_V18,
+ UNW_AARCH64_V19,
+ UNW_AARCH64_V20,
+ UNW_AARCH64_V21,
+ UNW_AARCH64_V22,
+ UNW_AARCH64_V23,
+ UNW_AARCH64_V24,
+ UNW_AARCH64_V25,
+ UNW_AARCH64_V26,
+ UNW_AARCH64_V27,
+ UNW_AARCH64_V28,
+ UNW_AARCH64_V29,
+ UNW_AARCH64_V30,
+ UNW_AARCH64_V31,
+
+ UNW_AARCH64_FPSR,
+ UNW_AARCH64_FPCR,
+
+ /* For AArch64, the CFA is the value of SP (x31) at the call site of the
+ previous frame. */
+ UNW_AARCH64_CFA = UNW_AARCH64_SP,
+
+ UNW_TDEP_LAST_REG = UNW_AARCH64_FPCR,
+
+ UNW_TDEP_IP = UNW_AARCH64_X30,
+ UNW_TDEP_SP = UNW_AARCH64_SP,
+ UNW_TDEP_EH = UNW_AARCH64_X0,
+
+ }
+aarch64_regnum_t;
+
+/* Use R0 through R3 to pass exception handling information. */
+#define UNW_TDEP_NUM_EH_REGS 4
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+
+/* On AArch64, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+#include "libunwind-common.h"
+#include "libunwind-dynamic.h"
+
+#define unw_tdep_getcontext(uc) (({ \
+ unw_tdep_context_t *unw_ctx = (uc); \
+ register uint64_t *unw_base asm ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \
+ __asm__ __volatile__ ( \
+ "stp x0, x1, [%[base], #0]\n" \
+ "stp x2, x3, [%[base], #16]\n" \
+ "stp x4, x5, [%[base], #32]\n" \
+ "stp x6, x7, [%[base], #48]\n" \
+ "stp x8, x9, [%[base], #64]\n" \
+ "stp x10, x11, [%[base], #80]\n" \
+ "stp x12, x13, [%[base], #96]\n" \
+ "stp x14, x13, [%[base], #112]\n" \
+ "stp x16, x17, [%[base], #128]\n" \
+ "stp x18, x19, [%[base], #144]\n" \
+ "stp x20, x21, [%[base], #160]\n" \
+ "stp x22, x23, [%[base], #176]\n" \
+ "stp x24, x25, [%[base], #192]\n" \
+ "stp x26, x27, [%[base], #208]\n" \
+ "stp x28, x29, [%[base], #224]\n" \
+ "str x30, [%[base], #240]\n" \
+ "mov x1, sp\n" \
+ "stp x1, x30, [%[base], #248]\n" \
+ : [base] "+r" (unw_base) : : "x1", "memory"); \
+ }), 0)
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-arm.h b/src/pal/src/libunwind/include/libunwind-arm.h
new file mode 100644
index 0000000000..6709b7abae
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-arm.h
@@ -0,0 +1,303 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <stddef.h>
+
+#define UNW_TARGET arm
+#define UNW_TARGET_ARM 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+
+/* FIXME for ARM. Too big? What do other things use for similar tasks? */
+#define UNW_TDEP_CURSOR_LEN 4096
+
+typedef uint32_t unw_word_t;
+typedef int32_t unw_sword_t;
+
+typedef long double unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ UNW_ARM_R0,
+ UNW_ARM_R1,
+ UNW_ARM_R2,
+ UNW_ARM_R3,
+ UNW_ARM_R4,
+ UNW_ARM_R5,
+ UNW_ARM_R6,
+ UNW_ARM_R7,
+ UNW_ARM_R8,
+ UNW_ARM_R9,
+ UNW_ARM_R10,
+ UNW_ARM_R11,
+ UNW_ARM_R12,
+ UNW_ARM_R13,
+ UNW_ARM_R14,
+ UNW_ARM_R15,
+
+ /* VFPv2 s0-s31 (obsolescent numberings). */
+ UNW_ARM_S0 = 64,
+ UNW_ARM_S1,
+ UNW_ARM_S2,
+ UNW_ARM_S3,
+ UNW_ARM_S4,
+ UNW_ARM_S5,
+ UNW_ARM_S6,
+ UNW_ARM_S7,
+ UNW_ARM_S8,
+ UNW_ARM_S9,
+ UNW_ARM_S10,
+ UNW_ARM_S11,
+ UNW_ARM_S12,
+ UNW_ARM_S13,
+ UNW_ARM_S14,
+ UNW_ARM_S15,
+ UNW_ARM_S16,
+ UNW_ARM_S17,
+ UNW_ARM_S18,
+ UNW_ARM_S19,
+ UNW_ARM_S20,
+ UNW_ARM_S21,
+ UNW_ARM_S22,
+ UNW_ARM_S23,
+ UNW_ARM_S24,
+ UNW_ARM_S25,
+ UNW_ARM_S26,
+ UNW_ARM_S27,
+ UNW_ARM_S28,
+ UNW_ARM_S29,
+ UNW_ARM_S30,
+ UNW_ARM_S31,
+
+ /* FPA register numberings. */
+ UNW_ARM_F0 = 96,
+ UNW_ARM_F1,
+ UNW_ARM_F2,
+ UNW_ARM_F3,
+ UNW_ARM_F4,
+ UNW_ARM_F5,
+ UNW_ARM_F6,
+ UNW_ARM_F7,
+
+ /* iWMMXt GR register numberings. */
+ UNW_ARM_wCGR0 = 104,
+ UNW_ARM_wCGR1,
+ UNW_ARM_wCGR2,
+ UNW_ARM_wCGR3,
+ UNW_ARM_wCGR4,
+ UNW_ARM_wCGR5,
+ UNW_ARM_wCGR6,
+ UNW_ARM_wCGR7,
+
+ /* iWMMXt register numberings. */
+ UNW_ARM_wR0 = 112,
+ UNW_ARM_wR1,
+ UNW_ARM_wR2,
+ UNW_ARM_wR3,
+ UNW_ARM_wR4,
+ UNW_ARM_wR5,
+ UNW_ARM_wR6,
+ UNW_ARM_wR7,
+ UNW_ARM_wR8,
+ UNW_ARM_wR9,
+ UNW_ARM_wR10,
+ UNW_ARM_wR11,
+ UNW_ARM_wR12,
+ UNW_ARM_wR13,
+ UNW_ARM_wR14,
+ UNW_ARM_wR15,
+
+ /* Two-byte encodings from here on. */
+
+ /* SPSR. */
+ UNW_ARM_SPSR = 128,
+ UNW_ARM_SPSR_FIQ,
+ UNW_ARM_SPSR_IRQ,
+ UNW_ARM_SPSR_ABT,
+ UNW_ARM_SPSR_UND,
+ UNW_ARM_SPSR_SVC,
+
+ /* User mode registers. */
+ UNW_ARM_R8_USR = 144,
+ UNW_ARM_R9_USR,
+ UNW_ARM_R10_USR,
+ UNW_ARM_R11_USR,
+ UNW_ARM_R12_USR,
+ UNW_ARM_R13_USR,
+ UNW_ARM_R14_USR,
+
+ /* FIQ registers. */
+ UNW_ARM_R8_FIQ = 151,
+ UNW_ARM_R9_FIQ,
+ UNW_ARM_R10_FIQ,
+ UNW_ARM_R11_FIQ,
+ UNW_ARM_R12_FIQ,
+ UNW_ARM_R13_FIQ,
+ UNW_ARM_R14_FIQ,
+
+ /* IRQ registers. */
+ UNW_ARM_R13_IRQ = 158,
+ UNW_ARM_R14_IRQ,
+
+ /* ABT registers. */
+ UNW_ARM_R13_ABT = 160,
+ UNW_ARM_R14_ABT,
+
+ /* UND registers. */
+ UNW_ARM_R13_UND = 162,
+ UNW_ARM_R14_UND,
+
+ /* SVC registers. */
+ UNW_ARM_R13_SVC = 164,
+ UNW_ARM_R14_SVC,
+
+ /* iWMMXt control registers. */
+ UNW_ARM_wC0 = 192,
+ UNW_ARM_wC1,
+ UNW_ARM_wC2,
+ UNW_ARM_wC3,
+ UNW_ARM_wC4,
+ UNW_ARM_wC5,
+ UNW_ARM_wC6,
+ UNW_ARM_wC7,
+
+ /* VFPv3/Neon 64-bit registers. */
+ UNW_ARM_D0 = 256,
+ UNW_ARM_D1,
+ UNW_ARM_D2,
+ UNW_ARM_D3,
+ UNW_ARM_D4,
+ UNW_ARM_D5,
+ UNW_ARM_D6,
+ UNW_ARM_D7,
+ UNW_ARM_D8,
+ UNW_ARM_D9,
+ UNW_ARM_D10,
+ UNW_ARM_D11,
+ UNW_ARM_D12,
+ UNW_ARM_D13,
+ UNW_ARM_D14,
+ UNW_ARM_D15,
+ UNW_ARM_D16,
+ UNW_ARM_D17,
+ UNW_ARM_D18,
+ UNW_ARM_D19,
+ UNW_ARM_D20,
+ UNW_ARM_D21,
+ UNW_ARM_D22,
+ UNW_ARM_D23,
+ UNW_ARM_D24,
+ UNW_ARM_D25,
+ UNW_ARM_D26,
+ UNW_ARM_D27,
+ UNW_ARM_D28,
+ UNW_ARM_D29,
+ UNW_ARM_D30,
+ UNW_ARM_D31,
+
+ /* For ARM, the CFA is the value of SP (r13) at the call site in the
+ previous frame. */
+ UNW_ARM_CFA,
+
+ UNW_TDEP_LAST_REG = UNW_ARM_D31,
+
+ UNW_TDEP_IP = UNW_ARM_R14, /* A little white lie. */
+ UNW_TDEP_SP = UNW_ARM_R13,
+ UNW_TDEP_EH = UNW_ARM_R0 /* FIXME. */
+ }
+arm_regnum_t;
+
+#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for ARM. */
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+/* On ARM, we define our own unw_tdep_context instead of using ucontext_t.
+ This allows us to support systems that don't support getcontext and
+ therefore do not define ucontext_t. */
+typedef struct unw_tdep_context
+ {
+ unsigned long regs[16];
+ }
+unw_tdep_context_t;
+
+/* There is no getcontext() on ARM. Use a stub version which only saves GP
+ registers. FIXME: Not ideal, may not be sufficient for all libunwind
+ use cases. Stores pc+8, which is only approximately correct, really. */
+#ifndef __thumb__
+#define unw_tdep_getcontext(uc) (({ \
+ unw_tdep_context_t *unw_ctx = (uc); \
+ register unsigned long *unw_base __asm__ ("r0") = unw_ctx->regs; \
+ __asm__ __volatile__ ( \
+ "stmia %[base], {r0-r15}" \
+ : : [base] "r" (unw_base) : "memory"); \
+ }), 0)
+#else /* __thumb__ */
+#define unw_tdep_getcontext(uc) (({ \
+ unw_tdep_context_t *unw_ctx = (uc); \
+ register unsigned long *unw_base __asm__ ("r0") = unw_ctx->regs; \
+ __asm__ __volatile__ ( \
+ ".align 2\nbx pc\nnop\n.code 32\n" \
+ "stmia %[base], {r0-r15}\n" \
+ "orr %[base], pc, #1\nbx %[base]\n" \
+ ".code 16\n" \
+ : [base] "+r" (unw_base) : : "memory", "cc"); \
+ }), 0)
+#endif
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no arm-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-common.h.in b/src/pal/src/libunwind/include/libunwind-common.h.in
new file mode 100644
index 0000000000..8d96ddca2a
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-common.h.in
@@ -0,0 +1,281 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UNW_VERSION_MAJOR @PKG_MAJOR@
+#define UNW_VERSION_MINOR @PKG_MINOR@
+#define UNW_VERSION_EXTRA @PKG_EXTRA@
+
+#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min))
+#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR)
+
+#define UNW_PASTE2(x,y) x##y
+#define UNW_PASTE(x,y) UNW_PASTE2(x,y)
+#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn)
+#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn)
+
+#ifdef UNW_LOCAL_ONLY
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_)
+#else /* !UNW_LOCAL_ONLY */
+# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_)
+#endif /* !UNW_LOCAL_ONLY */
+
+/* Error codes. The unwind routines return the *negated* values of
+ these error codes on error and a non-negative value on success. */
+typedef enum
+ {
+ UNW_ESUCCESS = 0, /* no error */
+ UNW_EUNSPEC, /* unspecified (general) error */
+ UNW_ENOMEM, /* out of memory */
+ UNW_EBADREG, /* bad register number */
+ UNW_EREADONLYREG, /* attempt to write read-only register */
+ UNW_ESTOPUNWIND, /* stop unwinding */
+ UNW_EINVALIDIP, /* invalid IP */
+ UNW_EBADFRAME, /* bad frame */
+ UNW_EINVAL, /* unsupported operation or bad value */
+ UNW_EBADVERSION, /* unwind info has unsupported version */
+ UNW_ENOINFO /* no unwind info found */
+ }
+unw_error_t;
+
+/* The following enum defines the indices for a couple of
+ (pseudo-)registers which have the same meaning across all
+ platforms. (RO) means read-only. (RW) means read-write. General
+ registers (aka "integer registers") are expected to start with
+ index 0. The number of such registers is architecture-dependent.
+ The remaining indices can be used as an architecture sees fit. The
+ last valid register index is given by UNW_REG_LAST. */
+typedef enum
+ {
+ UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */
+ UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */
+ UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */
+ UNW_REG_LAST = UNW_TDEP_LAST_REG
+ }
+unw_frame_regnum_t;
+
+/* Number of exception-handler argument registers: */
+#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS
+
+typedef enum
+ {
+ UNW_CACHE_NONE, /* no caching */
+ UNW_CACHE_GLOBAL, /* shared global cache */
+ UNW_CACHE_PER_THREAD /* per-thread caching */
+ }
+unw_caching_policy_t;
+
+typedef enum
+ {
+ UNW_INIT_SIGNAL_FRAME = 1, /* We know this is a signal frame */
+ }
+unw_init_local2_flags_t;
+
+typedef int unw_regnum_t;
+
+/* The unwind cursor starts at the youngest (most deeply nested) frame
+ and is used to track the frame state as the unwinder steps from
+ frame to frame. It is safe to make (shallow) copies of variables
+ of this type. */
+typedef struct unw_cursor
+ {
+ unw_word_t opaque[UNW_TDEP_CURSOR_LEN];
+ }
+unw_cursor_t;
+
+/* This type encapsulates the entire (preserved) machine-state. */
+typedef unw_tdep_context_t unw_context_t;
+
+/* unw_getcontext() fills the unw_context_t pointed to by UC with the
+ machine state as it exists at the call-site. For implementation
+ reasons, this needs to be a target-dependent macro. It's easiest
+ to think of unw_getcontext() as being identical to getcontext(). */
+#define unw_getcontext(uc) unw_tdep_getcontext(uc)
+
+/* Return 1 if register number R is a floating-point register, zero
+ otherwise.
+ This routine is signal-safe. */
+#define unw_is_fpreg(r) unw_tdep_is_fpreg(r)
+
+typedef unw_tdep_fpreg_t unw_fpreg_t;
+
+typedef struct unw_addr_space *unw_addr_space_t;
+
+/* Each target may define it's own set of flags, but bits 0-15 are
+ reserved for general libunwind-use. */
+#define UNW_PI_FLAG_FIRST_TDEP_BIT 16
+/* The information comes from a .debug_frame section. */
+#define UNW_PI_FLAG_DEBUG_FRAME 32
+
+typedef struct unw_proc_info
+ {
+ unw_word_t start_ip; /* first IP covered by this procedure */
+ unw_word_t end_ip; /* first IP NOT covered by this procedure */
+#if defined(NEED_LAST_IP)
+ unw_word_t last_ip; /* first IP that could begin another procedure */
+#endif
+ unw_word_t lsda; /* address of lang.-spec. data area (if any) */
+ unw_word_t handler; /* optional personality routine */
+ unw_word_t gp; /* global-pointer value for this procedure */
+ unw_word_t flags; /* misc. flags */
+
+ int format; /* unwind-info format (arch-specific) */
+ int unwind_info_size; /* size of the information (if applicable) */
+ void *unwind_info; /* unwind-info (arch-specific) */
+ unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */
+ }
+unw_proc_info_t;
+
+typedef int (*unw_reg_states_callback)(void *token,
+ void *reg_states_data,
+ size_t reg_states_data_size,
+ unw_word_t start_ip, unw_word_t end_ip);
+
+/* These are backend callback routines that provide access to the
+ state of a "remote" process. This can be used, for example, to
+ unwind another process through the ptrace() interface. */
+typedef struct unw_accessors
+ {
+ /* Look up the unwind info associated with instruction-pointer IP.
+ On success, the routine fills in the PROC_INFO structure. */
+ int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *,
+ int, void *);
+
+ /* Release any resources (e.g., memory) that were allocated for
+ the unwind info returned in by a previous call to
+ find_proc_info() with NEED_UNWIND_INFO set to 1. */
+ void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *);
+
+ /* Return the list-head of the dynamically registered unwind
+ info. */
+ int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *);
+
+ /* Access aligned word at address ADDR. The value is returned
+ according to the endianness of the host (e.g., if the host is
+ little-endian and the target is big-endian, access_mem() needs
+ to byte-swap the value before returning it). */
+ int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int,
+ void *);
+
+ /* Access register number REG at address ADDR. */
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t,
+ unw_fpreg_t *, int, void *);
+
+ int (*resume) (unw_addr_space_t, unw_cursor_t *, void *);
+
+ /* Optional call back to obtain the name of a (static) procedure.
+ Dynamically generated procedures are handled automatically by
+ libunwind. This callback is optional and may be set to
+ NULL. */
+ int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t,
+ unw_word_t *, void *);
+ }
+unw_accessors_t;
+
+typedef enum unw_save_loc_type
+ {
+ UNW_SLT_NONE, /* register is not saved ("not an l-value") */
+ UNW_SLT_MEMORY, /* register has been saved in memory */
+ UNW_SLT_REG /* register has been saved in (another) register */
+ }
+unw_save_loc_type_t;
+
+typedef struct unw_save_loc
+ {
+ unw_save_loc_type_t type;
+ union
+ {
+ unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */
+ unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */
+ }
+ u;
+ unw_tdep_save_loc_t extra; /* target-dependent additional information */
+ }
+unw_save_loc_t;
+
+/* These routines work both for local and remote unwinding. */
+
+#define unw_local_addr_space UNW_OBJ(local_addr_space)
+#define unw_create_addr_space UNW_OBJ(create_addr_space)
+#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space)
+#define unw_get_accessors UNW_ARCH_OBJ(get_accessors)
+#define unw_get_accessors_int UNW_ARCH_OBJ(get_accessors_int)
+#define unw_init_local UNW_OBJ(init_local)
+#define unw_init_local2 UNW_OBJ(init_local2)
+#define unw_init_remote UNW_OBJ(init_remote)
+#define unw_step UNW_OBJ(step)
+#define unw_resume UNW_OBJ(resume)
+#define unw_get_proc_info UNW_OBJ(get_proc_info)
+#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip)
+#define unw_reg_states_iterate UNW_OBJ(reg_states_iterate)
+#define unw_apply_reg_state UNW_OBJ(apply_reg_state)
+#define unw_get_reg UNW_OBJ(get_reg)
+#define unw_set_reg UNW_OBJ(set_reg)
+#define unw_get_fpreg UNW_OBJ(get_fpreg)
+#define unw_set_fpreg UNW_OBJ(set_fpreg)
+#define unw_get_save_loc UNW_OBJ(get_save_loc)
+#define unw_is_signal_frame UNW_OBJ(is_signal_frame)
+#define unw_handle_signal_frame UNW_OBJ(handle_signal_frame)
+#define unw_get_proc_name UNW_OBJ(get_proc_name)
+#define unw_set_caching_policy UNW_OBJ(set_caching_policy)
+#define unw_set_cache_size UNW_OBJ(set_cache_size)
+#define unw_regname UNW_ARCH_OBJ(regname)
+#define unw_flush_cache UNW_ARCH_OBJ(flush_cache)
+#define unw_strerror UNW_ARCH_OBJ(strerror)
+
+extern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int);
+extern void unw_destroy_addr_space (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors (unw_addr_space_t);
+extern unw_accessors_t *unw_get_accessors_int (unw_addr_space_t);
+extern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t);
+extern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t);
+extern int unw_set_cache_size (unw_addr_space_t, size_t, int);
+extern const char *unw_regname (unw_regnum_t);
+
+extern int unw_init_local (unw_cursor_t *, unw_context_t *);
+extern int unw_init_local2 (unw_cursor_t *, unw_context_t *, int);
+extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *);
+extern int unw_step (unw_cursor_t *);
+extern int unw_resume (unw_cursor_t *);
+extern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *);
+extern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t,
+ unw_proc_info_t *, void *);
+extern int unw_reg_states_iterate (unw_cursor_t *, unw_reg_states_callback, void *);
+extern int unw_apply_reg_state (unw_cursor_t *, void *);
+extern int unw_get_reg (unw_cursor_t *, int, unw_word_t *);
+extern int unw_set_reg (unw_cursor_t *, int, unw_word_t);
+extern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *);
+extern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t);
+extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *);
+extern int unw_is_signal_frame (unw_cursor_t *);
+extern int unw_handle_signal_frame (unw_cursor_t *);
+extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *);
+extern const char *unw_strerror (int);
+extern int unw_backtrace (void **, int);
+
+extern unw_addr_space_t unw_local_addr_space;
diff --git a/src/pal/src/libunwind/include/libunwind-coredump.h b/src/pal/src/libunwind/include/libunwind-coredump.h
new file mode 100644
index 0000000000..3c7814140f
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-coredump.h
@@ -0,0 +1,73 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef libunwind_coredump_h
+#define libunwind_coredump_h
+
+#include <libunwind.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Helper routines which make it easy to use libunwind on a coredump.
+ They're available only if UNW_REMOTE_ONLY is _not_ defined and they
+ aren't really part of the libunwind API. They are implemented in a
+ archive library called libunwind-coredump.a. */
+
+struct UCD_info;
+
+extern struct UCD_info *_UCD_create(const char *filename);
+extern void _UCD_destroy(struct UCD_info *);
+
+extern int _UCD_get_num_threads(struct UCD_info *);
+extern void _UCD_select_thread(struct UCD_info *, int);
+extern pid_t _UCD_get_pid(struct UCD_info *);
+extern int _UCD_get_cursig(struct UCD_info *);
+extern int _UCD_add_backing_file_at_segment(struct UCD_info *, int phdr_no, const char *filename);
+extern int _UCD_add_backing_file_at_vaddr(struct UCD_info *,
+ unsigned long vaddr,
+ const char *filename);
+
+extern int _UCD_find_proc_info (unw_addr_space_t, unw_word_t,
+ unw_proc_info_t *, int, void *);
+extern void _UCD_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *);
+extern int _UCD_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *,
+ void *);
+extern int _UCD_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int,
+ void *);
+extern int _UCD_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *,
+ int, void *);
+extern int _UCD_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *,
+ int, void *);
+extern int _UCD_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t,
+ unw_word_t *, void *);
+extern int _UCD_resume (unw_addr_space_t, unw_cursor_t *, void *);
+extern unw_accessors_t _UCD_accessors;
+
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* libunwind_coredump_h */
diff --git a/src/pal/src/libunwind/include/libunwind-dynamic.h b/src/pal/src/libunwind/include/libunwind-dynamic.h
new file mode 100644
index 0000000000..edb0bbd343
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-dynamic.h
@@ -0,0 +1,214 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file defines the runtime-support routines for dynamically
+generated code. Even though it is implemented as part of libunwind,
+it is logically separate from the interface to perform the actual
+unwinding. In particular, this interface is always used in the
+context of the unwind target, whereas the rest of the unwind API is
+used in context of the process that is doing the unwind (which may be
+a debugger running on another machine, for example).
+
+Note that the data-structures declared here server a dual purpose:
+when a program registers a dynamically generated procedure, it uses
+these structures directly. On the other hand, with remote-unwinding,
+the data-structures are read from the remote process's memory and
+translated into internalized versions. To facilitate remote-access,
+the following rules should be followed in declaring these structures:
+
+ (1) Declare a member as a pointer only if the the information the
+ member points to needs to be internalized as well (e.g., a
+ string representing a procedure name should be declared as
+ "const char *", but the instruction pointer should be declared
+ as unw_word_t).
+
+ (2) Provide sufficient padding to ensure that no implicit padding
+ will be needed on any of the supported target architectures. For
+ the time being, padding data structures with the assumption that
+ sizeof (unw_word_t) == 8 should be sufficient. (Note: it's not
+ impossible to internalize structures with internal padding, but
+ it does make the process a bit harder).
+
+ (3) Don't declare members that contain bitfields or floating-point
+ values.
+
+ (4) Don't declare members with enumeration types. Declare them as
+ int32_t instead. */
+
+typedef enum
+ {
+ UNW_DYN_STOP = 0, /* end-of-unwind-info marker */
+ UNW_DYN_SAVE_REG, /* save register to another register */
+ UNW_DYN_SPILL_FP_REL, /* frame-pointer-relative register spill */
+ UNW_DYN_SPILL_SP_REL, /* stack-pointer-relative register spill */
+ UNW_DYN_ADD, /* add constant value to a register */
+ UNW_DYN_POP_FRAMES, /* drop one or more stack frames */
+ UNW_DYN_LABEL_STATE, /* name the current state */
+ UNW_DYN_COPY_STATE, /* set the region's entry-state */
+ UNW_DYN_ALIAS /* get unwind info from an alias */
+ }
+unw_dyn_operation_t;
+
+typedef enum
+ {
+ UNW_INFO_FORMAT_DYNAMIC, /* unw_dyn_proc_info_t */
+ UNW_INFO_FORMAT_TABLE, /* unw_dyn_table_t */
+ UNW_INFO_FORMAT_REMOTE_TABLE, /* unw_dyn_remote_table_t */
+ UNW_INFO_FORMAT_ARM_EXIDX, /* ARM specific unwind info */
+ UNW_INFO_FORMAT_IP_OFFSET, /* Like UNW_INFO_FORMAT_REMOTE_TABLE, but
+ table entries are considered
+ relative to di->start_ip, rather
+ than di->segbase */
+ }
+unw_dyn_info_format_t;
+
+typedef struct unw_dyn_op
+ {
+ int8_t tag; /* what operation? */
+ int8_t qp; /* qualifying predicate register */
+ int16_t reg; /* what register */
+ int32_t when; /* when does it take effect? */
+ unw_word_t val; /* auxiliary value */
+ }
+unw_dyn_op_t;
+
+typedef struct unw_dyn_region_info
+ {
+ struct unw_dyn_region_info *next; /* linked list of regions */
+ int32_t insn_count; /* region length (# of instructions) */
+ uint32_t op_count; /* length of op-array */
+ unw_dyn_op_t op[1]; /* variable-length op-array */
+ }
+unw_dyn_region_info_t;
+
+typedef struct unw_dyn_proc_info
+ {
+ unw_word_t name_ptr; /* address of human-readable procedure name */
+ unw_word_t handler; /* address of personality routine */
+ uint32_t flags;
+ int32_t pad0;
+ unw_dyn_region_info_t *regions;
+ }
+unw_dyn_proc_info_t;
+
+typedef struct unw_dyn_table_info
+ {
+ unw_word_t name_ptr; /* addr. of table name (e.g., library name) */
+ unw_word_t segbase; /* segment base */
+ unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */
+ unw_word_t *table_data;
+ }
+unw_dyn_table_info_t;
+
+typedef struct unw_dyn_remote_table_info
+ {
+ unw_word_t name_ptr; /* addr. of table name (e.g., library name) */
+ unw_word_t segbase; /* segment base */
+ unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */
+ unw_word_t table_data;
+ }
+unw_dyn_remote_table_info_t;
+
+typedef struct unw_dyn_info
+ {
+ /* doubly-linked list of dyn-info structures: */
+ struct unw_dyn_info *next;
+ struct unw_dyn_info *prev;
+ unw_word_t start_ip; /* first IP covered by this entry */
+ unw_word_t end_ip; /* first IP NOT covered by this entry */
+ unw_word_t gp; /* global-pointer in effect for this entry */
+ int32_t format; /* real type: unw_dyn_info_format_t */
+ int32_t pad;
+ union
+ {
+ unw_dyn_proc_info_t pi;
+ unw_dyn_table_info_t ti;
+ unw_dyn_remote_table_info_t rti;
+ }
+ u;
+ }
+unw_dyn_info_t;
+
+typedef struct unw_dyn_info_list
+ {
+ uint32_t version;
+ uint32_t generation;
+ unw_dyn_info_t *first;
+ }
+unw_dyn_info_list_t;
+
+/* Return the size (in bytes) of an unw_dyn_region_info_t structure that can
+ hold OP_COUNT ops. */
+#define _U_dyn_region_info_size(op_count) \
+ ((char *) (((unw_dyn_region_info_t *) NULL)->op + (op_count)) \
+ - (char *) NULL)
+
+/* Register the unwind info for a single procedure.
+ This routine is NOT signal-safe. */
+extern void _U_dyn_register (unw_dyn_info_t *);
+
+/* Cancel the unwind info for a single procedure.
+ This routine is NOT signal-safe. */
+extern void _U_dyn_cancel (unw_dyn_info_t *);
+
+
+/* Convenience routines. */
+
+#define _U_dyn_op(_tag, _qp, _when, _reg, _val) \
+ ((unw_dyn_op_t) { (_tag), (_qp), (_reg), (_when), (_val) })
+
+#define _U_dyn_op_save_reg(op, qp, when, reg, dst) \
+ (*(op) = _U_dyn_op (UNW_DYN_SAVE_REG, (qp), (when), (reg), (dst)))
+
+#define _U_dyn_op_spill_fp_rel(op, qp, when, reg, offset) \
+ (*(op) = _U_dyn_op (UNW_DYN_SPILL_FP_REL, (qp), (when), (reg), \
+ (offset)))
+
+#define _U_dyn_op_spill_sp_rel(op, qp, when, reg, offset) \
+ (*(op) = _U_dyn_op (UNW_DYN_SPILL_SP_REL, (qp), (when), (reg), \
+ (offset)))
+
+#define _U_dyn_op_add(op, qp, when, reg, value) \
+ (*(op) = _U_dyn_op (UNW_DYN_ADD, (qp), (when), (reg), (value)))
+
+#define _U_dyn_op_pop_frames(op, qp, when, num_frames) \
+ (*(op) = _U_dyn_op (UNW_DYN_POP_FRAMES, (qp), (when), 0, (num_frames)))
+
+#define _U_dyn_op_label_state(op, label) \
+ (*(op) = _U_dyn_op (UNW_DYN_LABEL_STATE, _U_QP_TRUE, -1, 0, (label)))
+
+#define _U_dyn_op_copy_state(op, label) \
+ (*(op) = _U_dyn_op (UNW_DYN_COPY_STATE, _U_QP_TRUE, -1, 0, (label)))
+
+#define _U_dyn_op_alias(op, qp, when, addr) \
+ (*(op) = _U_dyn_op (UNW_DYN_ALIAS, (qp), (when), 0, (addr)))
+
+#define _U_dyn_op_stop(op) \
+ (*(op) = _U_dyn_op (UNW_DYN_STOP, _U_QP_TRUE, -1, 0, 0))
+
+/* The target-dependent qualifying predicate which is always TRUE. On
+ IA-64, that's p0 (0), on non-predicated architectures, the value is
+ ignored. */
+#define _U_QP_TRUE _U_TDEP_QP_TRUE
diff --git a/src/pal/src/libunwind/include/libunwind-hppa.h b/src/pal/src/libunwind/include/libunwind-hppa.h
new file mode 100644
index 0000000000..7013aa7726
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-hppa.h
@@ -0,0 +1,125 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET hppa
+#define UNW_TARGET_HPPA 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+#define UNW_TDEP_CURSOR_LEN 511
+
+typedef uint32_t unw_word_t;
+typedef int32_t unw_sword_t;
+
+typedef union
+ {
+ struct { unw_word_t bits[2]; } raw;
+ double val;
+ }
+unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ /* Note: general registers are expected to start with index 0.
+ This convention facilitates architecture-independent
+ implementation of the C++ exception handling ABI. See
+ _Unwind_SetGR() and _Unwind_GetGR() for details. */
+ UNW_HPPA_GR = 0,
+ UNW_HPPA_RP = 2, /* return pointer */
+ UNW_HPPA_FP = 3, /* frame pointer */
+ UNW_HPPA_SP = UNW_HPPA_GR + 30,
+
+ UNW_HPPA_FR = UNW_HPPA_GR + 32,
+
+ UNW_HPPA_IP = UNW_HPPA_FR + 32, /* instruction pointer */
+
+ /* other "preserved" registers (fpsr etc.)... */
+
+ /* PA-RISC has 4 exception-argument registers but they're not
+ contiguous. To deal with this, we define 4 pseudo
+ exception-handling registers which we then alias to the actual
+ physical register. */
+
+ UNW_HPPA_EH0 = UNW_HPPA_IP + 1, /* alias for UNW_HPPA_GR + 20 */
+ UNW_HPPA_EH1 = UNW_HPPA_EH0 + 1, /* alias for UNW_HPPA_GR + 21 */
+ UNW_HPPA_EH2 = UNW_HPPA_EH1 + 1, /* alias for UNW_HPPA_GR + 22 */
+ UNW_HPPA_EH3 = UNW_HPPA_EH2 + 1, /* alias for UNW_HPPA_GR + 31 */
+
+ /* frame info (read-only) */
+ UNW_HPPA_CFA,
+
+ UNW_TDEP_LAST_REG = UNW_HPPA_IP,
+
+ UNW_TDEP_IP = UNW_HPPA_IP,
+ UNW_TDEP_SP = UNW_HPPA_SP,
+ UNW_TDEP_EH = UNW_HPPA_EH0
+ }
+hppa_regnum_t;
+
+#define UNW_TDEP_NUM_EH_REGS 4
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+/* On PA-RISC, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_HPPA_FR) < 32)
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no PA-RISC-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext)
+extern int unw_tdep_getcontext (unw_tdep_context_t *);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-ia64.h b/src/pal/src/libunwind/include/libunwind-ia64.h
new file mode 100644
index 0000000000..0cc4f39eaa
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-ia64.h
@@ -0,0 +1,194 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#include <inttypes.h>
+#include <ucontext.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#ifdef ia64
+ /* This works around a bug in Intel's ECC v7.0 which defines "ia64"
+ as "1". */
+# undef ia64
+#endif
+
+#ifdef __hpux
+ /* On HP-UX, there is no hope of supporting UNW_LOCAL_ONLY, because
+ it's impossible to obtain the address of the members in the
+ sigcontext structure. */
+# undef UNW_LOCAL_ONLY
+# define UNW_GENERIC_ONLY
+#endif
+
+#define UNW_TARGET ia64
+#define UNW_TARGET_IA64 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+#define UNW_TDEP_CURSOR_LEN 511
+
+/* If this bit is it indicates that the procedure saved all of ar.bsp,
+ ar.bspstore, and ar.rnat. If, additionally, ar.bsp != saved ar.bsp,
+ then this procedure has performed a register-backing-store switch. */
+#define UNW_PI_FLAG_IA64_RBS_SWITCH_BIT (UNW_PI_FLAG_FIRST_TDEP_BIT + 0)
+
+#define UNW_PI_FLAG_IA64_RBS_SWITCH (1 << UNW_PI_FLAG_IA64_RBS_SWITCH_BIT)
+
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+
+/* On IA-64, we want to access the contents of floating-point
+ registers as a pair of "words", but to ensure 16-byte alignment, we
+ make it a union that contains a "long double". This will do the
+ Right Thing on all known IA-64 platforms, including HP-UX. */
+typedef union
+ {
+ struct { unw_word_t bits[2]; } raw;
+ long double dummy; /* dummy to force 16-byte alignment */
+ }
+unw_tdep_fpreg_t;
+
+typedef struct
+ {
+ /* no ia64-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+typedef enum
+ {
+ /* Note: general registers are excepted to start with index 0.
+ This convention facilitates architecture-independent
+ implementation of the C++ exception handling ABI. See
+ _Unwind_SetGR() and _Unwind_GetGR() for details. */
+ UNW_IA64_GR = 0, /* general registers (r0..r127) */
+ UNW_IA64_GP = UNW_IA64_GR + 1,
+ UNW_IA64_TP = UNW_IA64_GR + 13,
+
+ UNW_IA64_NAT = UNW_IA64_GR + 128, /* NaT registers (nat0..nat127) */
+
+ UNW_IA64_FR = UNW_IA64_NAT + 128, /* fp registers (f0..f127) */
+
+ UNW_IA64_AR = UNW_IA64_FR + 128, /* application registers (ar0..r127) */
+ UNW_IA64_AR_RSC = UNW_IA64_AR + 16,
+ UNW_IA64_AR_BSP = UNW_IA64_AR + 17,
+ UNW_IA64_AR_BSPSTORE = UNW_IA64_AR + 18,
+ UNW_IA64_AR_RNAT = UNW_IA64_AR + 19,
+ UNW_IA64_AR_CSD = UNW_IA64_AR + 25,
+ UNW_IA64_AR_26 = UNW_IA64_AR + 26,
+ UNW_IA64_AR_SSD = UNW_IA64_AR_26,
+ UNW_IA64_AR_CCV = UNW_IA64_AR + 32,
+ UNW_IA64_AR_UNAT = UNW_IA64_AR + 36,
+ UNW_IA64_AR_FPSR = UNW_IA64_AR + 40,
+ UNW_IA64_AR_PFS = UNW_IA64_AR + 64,
+ UNW_IA64_AR_LC = UNW_IA64_AR + 65,
+ UNW_IA64_AR_EC = UNW_IA64_AR + 66,
+
+ UNW_IA64_BR = UNW_IA64_AR + 128, /* branch registers (b0..p7) */
+ UNW_IA64_RP = UNW_IA64_BR + 0, /* return pointer (rp) */
+ UNW_IA64_PR = UNW_IA64_BR + 8, /* predicate registers (p0..p63) */
+ UNW_IA64_CFM,
+
+ /* frame info: */
+ UNW_IA64_BSP,
+ UNW_IA64_IP,
+ UNW_IA64_SP,
+
+ UNW_TDEP_LAST_REG = UNW_IA64_SP,
+
+ UNW_TDEP_IP = UNW_IA64_IP,
+ UNW_TDEP_SP = UNW_IA64_SP,
+ UNW_TDEP_EH = UNW_IA64_GR + 15
+ }
+ia64_regnum_t;
+
+#define UNW_TDEP_NUM_EH_REGS 4 /* r15-r18 are exception args */
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. On IA-64,
+ we use this to provide the bit number in which a NaT bit gets
+ saved. */
+ uint8_t nat_bitnr;
+
+ /* Padding reserved for future use. */
+ uint8_t reserved[7];
+ }
+unw_tdep_save_loc_t;
+
+/* On IA-64, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_IA64_FR) < 128)
+
+#include "libunwind-dynamic.h"
+#include "libunwind-common.h"
+
+#ifdef __hpux
+ /* In theory, we could use _Uia64_getcontext() on HP-UX as well, but
+ the benefit of doing so would be marginal given that it can't
+ support UNW_LOCAL_ONLY. */
+# define unw_tdep_getcontext getcontext
+#else
+# define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext)
+ extern int unw_tdep_getcontext (unw_tdep_context_t *);
+#endif
+
+/* This is a helper routine to search an ia64 unwind table. If the
+ address-space argument AS points to something other than the local
+ address-space, the memory for the unwind-info will be allocated
+ with malloc(), and should be free()d during the put_unwind_info()
+ callback. This routine is signal-safe for the local-address-space
+ case ONLY. */
+#define unw_search_ia64_unwind_table UNW_OBJ(search_unwind_table)
+extern int unw_search_ia64_unwind_table (unw_addr_space_t, unw_word_t,
+ unw_dyn_info_t *, unw_proc_info_t *,
+ int, void *);
+
+/* This is a helper routine which the get_dyn_info_list_addr()
+ callback can use to locate the special dynamic-info list entry in
+ an IA-64 unwind table. If the entry exists in the table, the
+ list-address is returned. In all other cases, 0 is returned. */
+extern unw_word_t _Uia64_find_dyn_list (unw_addr_space_t, unw_dyn_info_t *,
+ void *);
+
+/* This is a helper routine to obtain the kernel-unwind info. It is
+ signal-safe. */
+extern int _Uia64_get_kernel_table (unw_dyn_info_t *);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-mips.h b/src/pal/src/libunwind/include/libunwind-mips.h
new file mode 100644
index 0000000000..97c95e2463
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-mips.h
@@ -0,0 +1,160 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <sys/ucontext.h>
+
+#ifdef mips
+# undef mips
+#endif
+
+#define UNW_TARGET mips
+#define UNW_TARGET_MIPS 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+
+/* FIXME for MIPS. Too big? What do other things use for similar tasks? */
+#define UNW_TDEP_CURSOR_LEN 4096
+
+/* The size of a "word" varies on MIPS. This type is used for memory
+ addresses and register values, which are 32-bit wide for O32 and N32
+ ABIs, and 64-bit wide for N64 ABI. */
+#if _MIPS_SIM == _ABI64
+typedef uint64_t unw_word_t;
+#else
+typedef uint32_t unw_word_t;
+#endif
+typedef int32_t unw_sword_t;
+
+/* FIXME: MIPS ABIs. */
+typedef long double unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ UNW_MIPS_R0,
+ UNW_MIPS_R1,
+ UNW_MIPS_R2,
+ UNW_MIPS_R3,
+ UNW_MIPS_R4,
+ UNW_MIPS_R5,
+ UNW_MIPS_R6,
+ UNW_MIPS_R7,
+ UNW_MIPS_R8,
+ UNW_MIPS_R9,
+ UNW_MIPS_R10,
+ UNW_MIPS_R11,
+ UNW_MIPS_R12,
+ UNW_MIPS_R13,
+ UNW_MIPS_R14,
+ UNW_MIPS_R15,
+ UNW_MIPS_R16,
+ UNW_MIPS_R17,
+ UNW_MIPS_R18,
+ UNW_MIPS_R19,
+ UNW_MIPS_R20,
+ UNW_MIPS_R21,
+ UNW_MIPS_R22,
+ UNW_MIPS_R23,
+ UNW_MIPS_R24,
+ UNW_MIPS_R25,
+ UNW_MIPS_R26,
+ UNW_MIPS_R27,
+ UNW_MIPS_R28,
+ UNW_MIPS_R29,
+ UNW_MIPS_R30,
+ UNW_MIPS_R31,
+
+ UNW_MIPS_PC = 34,
+
+ /* FIXME: Other registers! */
+
+ /* For MIPS, the CFA is the value of SP (r29) at the call site in the
+ previous frame. */
+ UNW_MIPS_CFA,
+
+ UNW_TDEP_LAST_REG = UNW_MIPS_PC,
+
+ UNW_TDEP_IP = UNW_MIPS_R31,
+ UNW_TDEP_SP = UNW_MIPS_R29,
+ UNW_TDEP_EH = UNW_MIPS_R0 /* FIXME. */
+ }
+mips_regnum_t;
+
+typedef enum
+ {
+ UNW_MIPS_ABI_O32,
+ UNW_MIPS_ABI_N32,
+ UNW_MIPS_ABI_N64
+ }
+mips_abi_t;
+
+#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for MIPS. */
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+/* On x86, we can directly use ucontext_t as the unwind context. FIXME for
+ MIPS. */
+typedef ucontext_t unw_tdep_context_t;
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no mips-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+/* There is no getcontext() on MIPS. Use a stub version which only saves GP
+ registers. FIXME: Not ideal, may not be sufficient for all libunwind
+ use cases. */
+#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext)
+extern int unw_tdep_getcontext (ucontext_t *uc);
+
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-ppc32.h b/src/pal/src/libunwind/include/libunwind-ppc32.h
new file mode 100644
index 0000000000..47ebfde5a3
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-ppc32.h
@@ -0,0 +1,207 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET ppc32
+#define UNW_TARGET_PPC32 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/*
+ * This needs to be big enough to accommodate "struct cursor", while
+ * leaving some slack for future expansion. Changing this value will
+ * require recompiling all users of this library. Stack allocation is
+ * relatively cheap and unwind-state copying is relatively rare, so we want
+ * to err on making it rather too big than too small.
+ *
+ * To simplify this whole process, we are at least initially taking the
+ * tack that UNW_PPC32_* map straight across to the .eh_frame column register
+ * numbers. These register numbers come from gcc's source in
+ * gcc/config/rs6000/rs6000.h
+ *
+ * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115
+ * elements in the loc array, each sized 2 * unw_word_t, plus the rest of
+ * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's
+ * round that up to 280.
+ */
+
+#define UNW_TDEP_CURSOR_LEN 280
+
+#if __WORDSIZE==32
+typedef uint32_t unw_word_t;
+typedef int32_t unw_sword_t;
+#else
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+#endif
+
+typedef long double unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ UNW_PPC32_R0,
+ UNW_PPC32_R1, /* called STACK_POINTER in gcc */
+ UNW_PPC32_R2,
+ UNW_PPC32_R3,
+ UNW_PPC32_R4,
+ UNW_PPC32_R5,
+ UNW_PPC32_R6,
+ UNW_PPC32_R7,
+ UNW_PPC32_R8,
+ UNW_PPC32_R9,
+ UNW_PPC32_R10,
+ UNW_PPC32_R11, /* called STATIC_CHAIN in gcc */
+ UNW_PPC32_R12,
+ UNW_PPC32_R13,
+ UNW_PPC32_R14,
+ UNW_PPC32_R15,
+ UNW_PPC32_R16,
+ UNW_PPC32_R17,
+ UNW_PPC32_R18,
+ UNW_PPC32_R19,
+ UNW_PPC32_R20,
+ UNW_PPC32_R21,
+ UNW_PPC32_R22,
+ UNW_PPC32_R23,
+ UNW_PPC32_R24,
+ UNW_PPC32_R25,
+ UNW_PPC32_R26,
+ UNW_PPC32_R27,
+ UNW_PPC32_R28,
+ UNW_PPC32_R29,
+ UNW_PPC32_R30,
+ UNW_PPC32_R31, /* called HARD_FRAME_POINTER in gcc */
+
+ /* Count Register */
+ UNW_PPC32_CTR = 32,
+ /* Fixed-Point Status and Control Register */
+ UNW_PPC32_XER = 33,
+ /* Condition Register */
+ UNW_PPC32_CCR = 34,
+ /* Machine State Register */
+ //UNW_PPC32_MSR = 35,
+ /* MQ or SPR0, not part of generic Power, part of MPC601 */
+ //UNW_PPC32_MQ = 36,
+ /* Link Register */
+ UNW_PPC32_LR = 36,
+ /* Floating Pointer Status and Control Register */
+ UNW_PPC32_FPSCR = 37,
+
+ UNW_PPC32_F0 = 48,
+ UNW_PPC32_F1,
+ UNW_PPC32_F2,
+ UNW_PPC32_F3,
+ UNW_PPC32_F4,
+ UNW_PPC32_F5,
+ UNW_PPC32_F6,
+ UNW_PPC32_F7,
+ UNW_PPC32_F8,
+ UNW_PPC32_F9,
+ UNW_PPC32_F10,
+ UNW_PPC32_F11,
+ UNW_PPC32_F12,
+ UNW_PPC32_F13,
+ UNW_PPC32_F14,
+ UNW_PPC32_F15,
+ UNW_PPC32_F16,
+ UNW_PPC32_F17,
+ UNW_PPC32_F18,
+ UNW_PPC32_F19,
+ UNW_PPC32_F20,
+ UNW_PPC32_F21,
+ UNW_PPC32_F22,
+ UNW_PPC32_F23,
+ UNW_PPC32_F24,
+ UNW_PPC32_F25,
+ UNW_PPC32_F26,
+ UNW_PPC32_F27,
+ UNW_PPC32_F28,
+ UNW_PPC32_F29,
+ UNW_PPC32_F30,
+ UNW_PPC32_F31,
+
+ UNW_TDEP_LAST_REG = UNW_PPC32_F31,
+
+ UNW_TDEP_IP = UNW_PPC32_LR,
+ UNW_TDEP_SP = UNW_PPC32_R1,
+ UNW_TDEP_EH = UNW_PPC32_R12
+ }
+ppc32_regnum_t;
+
+/*
+ * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for
+ * passing parameters to exception handlers.
+ */
+
+#define UNW_TDEP_NUM_EH_REGS 4
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+/* On ppc, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+/* XXX this is not ideal: an application should not be prevented from
+ using the "getcontext" name just because it's using libunwind. We
+ can't just use __getcontext() either, because that isn't exported
+ by glibc... */
+#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no ppc32-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-ppc64.h b/src/pal/src/libunwind/include/libunwind-ppc64.h
new file mode 100644
index 0000000000..9944628da0
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-ppc64.h
@@ -0,0 +1,271 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET ppc64
+#define UNW_TARGET_PPC64 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/*
+ * This needs to be big enough to accommodate "struct cursor", while
+ * leaving some slack for future expansion. Changing this value will
+ * require recompiling all users of this library. Stack allocation is
+ * relatively cheap and unwind-state copying is relatively rare, so we want
+ * to err on making it rather too big than too small.
+ *
+ * To simplify this whole process, we are at least initially taking the
+ * tack that UNW_PPC64_* map straight across to the .eh_frame column register
+ * numbers. These register numbers come from gcc's source in
+ * gcc/config/rs6000/rs6000.h
+ *
+ * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115
+ * elements in the loc array, each sized 2 * unw_word_t, plus the rest of
+ * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's
+ * round that up to 280.
+ */
+
+#define UNW_TDEP_CURSOR_LEN 280
+
+#if __WORDSIZE==32
+typedef uint32_t unw_word_t;
+typedef int32_t unw_sword_t;
+#else
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+#endif
+
+typedef long double unw_tdep_fpreg_t;
+
+/*
+ * Vector register (in PowerPC64 used for AltiVec registers)
+ */
+typedef struct {
+ uint64_t halves[2];
+} unw_tdep_vreg_t;
+
+typedef enum
+ {
+ UNW_PPC64_R0,
+ UNW_PPC64_R1, /* called STACK_POINTER in gcc */
+ UNW_PPC64_R2,
+ UNW_PPC64_R3,
+ UNW_PPC64_R4,
+ UNW_PPC64_R5,
+ UNW_PPC64_R6,
+ UNW_PPC64_R7,
+ UNW_PPC64_R8,
+ UNW_PPC64_R9,
+ UNW_PPC64_R10,
+ UNW_PPC64_R11, /* called STATIC_CHAIN in gcc */
+ UNW_PPC64_R12,
+ UNW_PPC64_R13,
+ UNW_PPC64_R14,
+ UNW_PPC64_R15,
+ UNW_PPC64_R16,
+ UNW_PPC64_R17,
+ UNW_PPC64_R18,
+ UNW_PPC64_R19,
+ UNW_PPC64_R20,
+ UNW_PPC64_R21,
+ UNW_PPC64_R22,
+ UNW_PPC64_R23,
+ UNW_PPC64_R24,
+ UNW_PPC64_R25,
+ UNW_PPC64_R26,
+ UNW_PPC64_R27,
+ UNW_PPC64_R28,
+ UNW_PPC64_R29,
+ UNW_PPC64_R30,
+ UNW_PPC64_R31, /* called HARD_FRAME_POINTER in gcc */
+
+ UNW_PPC64_F0 = 32,
+ UNW_PPC64_F1,
+ UNW_PPC64_F2,
+ UNW_PPC64_F3,
+ UNW_PPC64_F4,
+ UNW_PPC64_F5,
+ UNW_PPC64_F6,
+ UNW_PPC64_F7,
+ UNW_PPC64_F8,
+ UNW_PPC64_F9,
+ UNW_PPC64_F10,
+ UNW_PPC64_F11,
+ UNW_PPC64_F12,
+ UNW_PPC64_F13,
+ UNW_PPC64_F14,
+ UNW_PPC64_F15,
+ UNW_PPC64_F16,
+ UNW_PPC64_F17,
+ UNW_PPC64_F18,
+ UNW_PPC64_F19,
+ UNW_PPC64_F20,
+ UNW_PPC64_F21,
+ UNW_PPC64_F22,
+ UNW_PPC64_F23,
+ UNW_PPC64_F24,
+ UNW_PPC64_F25,
+ UNW_PPC64_F26,
+ UNW_PPC64_F27,
+ UNW_PPC64_F28,
+ UNW_PPC64_F29,
+ UNW_PPC64_F30,
+ UNW_PPC64_F31,
+ /* Note that there doesn't appear to be an .eh_frame register column
+ for the FPSCR register. I don't know why this is. Since .eh_frame
+ info is what this implementation uses for unwinding, we have no way
+ to unwind this register, and so we will not expose an FPSCR register
+ number in the libunwind API.
+ */
+
+ UNW_PPC64_LR = 65,
+ UNW_PPC64_CTR = 66,
+ UNW_PPC64_ARG_POINTER = 67,
+
+ UNW_PPC64_CR0 = 68,
+ UNW_PPC64_CR1,
+ UNW_PPC64_CR2,
+ UNW_PPC64_CR3,
+ UNW_PPC64_CR4,
+ /* CR5 .. CR7 are currently unused */
+ UNW_PPC64_CR5,
+ UNW_PPC64_CR6,
+ UNW_PPC64_CR7,
+
+ UNW_PPC64_XER = 76,
+
+ UNW_PPC64_V0 = 77,
+ UNW_PPC64_V1,
+ UNW_PPC64_V2,
+ UNW_PPC64_V3,
+ UNW_PPC64_V4,
+ UNW_PPC64_V5,
+ UNW_PPC64_V6,
+ UNW_PPC64_V7,
+ UNW_PPC64_V8,
+ UNW_PPC64_V9,
+ UNW_PPC64_V10,
+ UNW_PPC64_V11,
+ UNW_PPC64_V12,
+ UNW_PPC64_V13,
+ UNW_PPC64_V14,
+ UNW_PPC64_V15,
+ UNW_PPC64_V16,
+ UNW_PPC64_V17,
+ UNW_PPC64_V18,
+ UNW_PPC64_V19,
+ UNW_PPC64_V20,
+ UNW_PPC64_V21,
+ UNW_PPC64_V22,
+ UNW_PPC64_V23,
+ UNW_PPC64_V24,
+ UNW_PPC64_V25,
+ UNW_PPC64_V26,
+ UNW_PPC64_V27,
+ UNW_PPC64_V28,
+ UNW_PPC64_V29,
+ UNW_PPC64_V30,
+ UNW_PPC64_V31,
+
+ UNW_PPC64_VRSAVE = 109,
+ UNW_PPC64_VSCR = 110,
+ UNW_PPC64_SPE_ACC = 111,
+ UNW_PPC64_SPEFSCR = 112,
+
+ /* frame info (read-only) */
+ UNW_PPC64_FRAME_POINTER,
+ UNW_PPC64_NIP,
+
+
+ UNW_TDEP_LAST_REG = UNW_PPC64_NIP,
+
+ UNW_TDEP_IP = UNW_PPC64_NIP,
+ UNW_TDEP_SP = UNW_PPC64_R1,
+ UNW_TDEP_EH = UNW_PPC64_R12
+ }
+ppc64_regnum_t;
+
+typedef enum
+ {
+ UNW_PPC64_ABI_ELFv1,
+ UNW_PPC64_ABI_ELFv2
+ }
+ppc64_abi_t;
+
+/*
+ * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for
+ * passing parameters to exception handlers.
+ */
+
+#define UNW_TDEP_NUM_EH_REGS 4
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+/* On ppc64, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+/* XXX this is not ideal: an application should not be prevented from
+ using the "getcontext" name just because it's using libunwind. We
+ can't just use __getcontext() either, because that isn't exported
+ by glibc... */
+#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no ppc64-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-ptrace.h b/src/pal/src/libunwind/include/libunwind-ptrace.h
new file mode 100644
index 0000000000..801325c4d4
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-ptrace.h
@@ -0,0 +1,63 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef libunwind_ptrace_h
+#define libunwind_ptrace_h
+
+#include <libunwind.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Helper routines which make it easy to use libunwind via ptrace().
+ They're available only if UNW_REMOTE_ONLY is _not_ defined and they
+ aren't really part of the libunwind API. They are implemented in a
+ archive library called libunwind-ptrace.a. */
+
+extern void *_UPT_create (pid_t);
+extern void _UPT_destroy (void *);
+extern int _UPT_find_proc_info (unw_addr_space_t, unw_word_t,
+ unw_proc_info_t *, int, void *);
+extern void _UPT_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *);
+extern int _UPT_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *,
+ void *);
+extern int _UPT_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int,
+ void *);
+extern int _UPT_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *,
+ int, void *);
+extern int _UPT_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *,
+ int, void *);
+extern int _UPT_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t,
+ unw_word_t *, void *);
+extern int _UPT_resume (unw_addr_space_t, unw_cursor_t *, void *);
+extern unw_accessors_t _UPT_accessors;
+
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* libunwind_ptrace_h */
diff --git a/src/pal/src/libunwind/include/libunwind-sh.h b/src/pal/src/libunwind/include/libunwind-sh.h
new file mode 100644
index 0000000000..927f61ff42
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-sh.h
@@ -0,0 +1,114 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <stddef.h>
+#include <ucontext.h>
+
+#define UNW_TARGET sh
+#define UNW_TARGET_SH 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+
+#define UNW_TDEP_CURSOR_LEN 4096
+
+typedef uint32_t unw_word_t;
+typedef int32_t unw_sword_t;
+
+typedef long double unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ UNW_SH_R0,
+ UNW_SH_R1,
+ UNW_SH_R2,
+ UNW_SH_R3,
+ UNW_SH_R4,
+ UNW_SH_R5,
+ UNW_SH_R6,
+ UNW_SH_R7,
+ UNW_SH_R8,
+ UNW_SH_R9,
+ UNW_SH_R10,
+ UNW_SH_R11,
+ UNW_SH_R12,
+ UNW_SH_R13,
+ UNW_SH_R14,
+ UNW_SH_R15,
+
+ UNW_SH_PC,
+ UNW_SH_PR,
+
+ UNW_TDEP_LAST_REG = UNW_SH_PR,
+
+ UNW_TDEP_IP = UNW_SH_PR,
+ UNW_TDEP_SP = UNW_SH_R15,
+ UNW_TDEP_EH = UNW_SH_R0
+ }
+sh_regnum_t;
+
+#define UNW_TDEP_NUM_EH_REGS 2
+
+typedef ucontext_t unw_tdep_context_t;
+
+#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no sh-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-tilegx.h b/src/pal/src/libunwind/include/libunwind-tilegx.h
new file mode 100644
index 0000000000..0f84ea65ee
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-tilegx.h
@@ -0,0 +1,161 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET tilegx
+#define UNW_TARGET_TILEGX 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+
+#define UNW_TDEP_CURSOR_LEN 4096
+
+/* The size of a "word" varies on TILEGX. This type is used for memory
+ addresses and register values. */
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+
+typedef long double unw_tdep_fpreg_t;
+
+typedef enum
+{
+ UNW_TILEGX_R0,
+ UNW_TILEGX_R1,
+ UNW_TILEGX_R2,
+ UNW_TILEGX_R3,
+ UNW_TILEGX_R4,
+ UNW_TILEGX_R5,
+ UNW_TILEGX_R6,
+ UNW_TILEGX_R7,
+ UNW_TILEGX_R8,
+ UNW_TILEGX_R9,
+ UNW_TILEGX_R10,
+ UNW_TILEGX_R11,
+ UNW_TILEGX_R12,
+ UNW_TILEGX_R13,
+ UNW_TILEGX_R14,
+ UNW_TILEGX_R15,
+ UNW_TILEGX_R16,
+ UNW_TILEGX_R17,
+ UNW_TILEGX_R18,
+ UNW_TILEGX_R19,
+ UNW_TILEGX_R20,
+ UNW_TILEGX_R21,
+ UNW_TILEGX_R22,
+ UNW_TILEGX_R23,
+ UNW_TILEGX_R24,
+ UNW_TILEGX_R25,
+ UNW_TILEGX_R26,
+ UNW_TILEGX_R27,
+ UNW_TILEGX_R28,
+ UNW_TILEGX_R29,
+ UNW_TILEGX_R30,
+ UNW_TILEGX_R31,
+ UNW_TILEGX_R32,
+ UNW_TILEGX_R33,
+ UNW_TILEGX_R34,
+ UNW_TILEGX_R35,
+ UNW_TILEGX_R36,
+ UNW_TILEGX_R37,
+ UNW_TILEGX_R38,
+ UNW_TILEGX_R39,
+ UNW_TILEGX_R40,
+ UNW_TILEGX_R41,
+ UNW_TILEGX_R42,
+ UNW_TILEGX_R43,
+ UNW_TILEGX_R44,
+ UNW_TILEGX_R45,
+ UNW_TILEGX_R46,
+ UNW_TILEGX_R47,
+ UNW_TILEGX_R48,
+ UNW_TILEGX_R49,
+ UNW_TILEGX_R50,
+ UNW_TILEGX_R51,
+ UNW_TILEGX_R52,
+ UNW_TILEGX_R53,
+ UNW_TILEGX_R54,
+ UNW_TILEGX_R55,
+
+ /* FIXME: Other registers! */
+
+ UNW_TILEGX_PC,
+ /* For TILEGX, the CFA is the value of SP (r54) at the call site in the
+ previous frame. */
+ UNW_TILEGX_CFA,
+
+ UNW_TDEP_LAST_REG = UNW_TILEGX_PC,
+
+ UNW_TDEP_IP = UNW_TILEGX_R55, /* R55 is link register for Tilegx */
+ UNW_TDEP_SP = UNW_TILEGX_R54,
+ UNW_TDEP_EH = UNW_TILEGX_R0 /* FIXME. */
+} tilegx_regnum_t;
+
+typedef enum
+{
+ UNW_TILEGX_ABI_N64 = 2
+} tilegx_abi_t;
+
+#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for TILEGX. */
+
+typedef struct unw_tdep_save_loc
+{
+ /* Additional target-dependent info on a save location. */
+} unw_tdep_save_loc_t;
+
+typedef ucontext_t unw_tdep_context_t;
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+{
+ /* no tilegx-specific auxiliary proc-info */
+} unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#define unw_tdep_getcontext getcontext
+
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-x86.h b/src/pal/src/libunwind/include/libunwind-x86.h
new file mode 100644
index 0000000000..40fe0464f2
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-x86.h
@@ -0,0 +1,187 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET x86
+#define UNW_TARGET_X86 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+#define UNW_TDEP_CURSOR_LEN 127
+
+typedef uint32_t unw_word_t;
+typedef int32_t unw_sword_t;
+
+typedef union {
+ struct { uint8_t b[4]; } val32;
+ struct { uint8_t b[10]; } val80;
+ struct { uint8_t b[16]; } val128;
+} unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ /* Note: general registers are expected to start with index 0.
+ This convention facilitates architecture-independent
+ implementation of the C++ exception handling ABI. See
+ _Unwind_SetGR() and _Unwind_GetGR() for details.
+
+ The described register usage convention is based on "System V
+ Application Binary Interface, Intel386 Architecture Processor
+ Supplement, Fourth Edition" at
+
+ http://www.linuxbase.org/spec/refspecs/elf/abi386-4.pdf
+
+ It would have been nice to use the same register numbering as
+ DWARF, but that doesn't work because the libunwind requires
+ that the exception argument registers be consecutive, which the
+ wouldn't be with the DWARF numbering. */
+ UNW_X86_EAX, /* scratch (exception argument 1) */
+ UNW_X86_EDX, /* scratch (exception argument 2) */
+ UNW_X86_ECX, /* scratch */
+ UNW_X86_EBX, /* preserved */
+ UNW_X86_ESI, /* preserved */
+ UNW_X86_EDI, /* preserved */
+ UNW_X86_EBP, /* (optional) frame-register */
+ UNW_X86_ESP, /* (optional) frame-register */
+ UNW_X86_EIP, /* frame-register */
+ UNW_X86_EFLAGS, /* scratch (except for "direction", which is fixed */
+ UNW_X86_TRAPNO, /* scratch */
+
+ /* MMX/stacked-fp registers */
+ UNW_X86_ST0, /* fp return value */
+ UNW_X86_ST1, /* scratch */
+ UNW_X86_ST2, /* scratch */
+ UNW_X86_ST3, /* scratch */
+ UNW_X86_ST4, /* scratch */
+ UNW_X86_ST5, /* scratch */
+ UNW_X86_ST6, /* scratch */
+ UNW_X86_ST7, /* scratch */
+
+ UNW_X86_FCW, /* scratch */
+ UNW_X86_FSW, /* scratch */
+ UNW_X86_FTW, /* scratch */
+ UNW_X86_FOP, /* scratch */
+ UNW_X86_FCS, /* scratch */
+ UNW_X86_FIP, /* scratch */
+ UNW_X86_FEA, /* scratch */
+ UNW_X86_FDS, /* scratch */
+
+ /* SSE registers */
+ UNW_X86_XMM0_lo, /* scratch */
+ UNW_X86_XMM0_hi, /* scratch */
+ UNW_X86_XMM1_lo, /* scratch */
+ UNW_X86_XMM1_hi, /* scratch */
+ UNW_X86_XMM2_lo, /* scratch */
+ UNW_X86_XMM2_hi, /* scratch */
+ UNW_X86_XMM3_lo, /* scratch */
+ UNW_X86_XMM3_hi, /* scratch */
+ UNW_X86_XMM4_lo, /* scratch */
+ UNW_X86_XMM4_hi, /* scratch */
+ UNW_X86_XMM5_lo, /* scratch */
+ UNW_X86_XMM5_hi, /* scratch */
+ UNW_X86_XMM6_lo, /* scratch */
+ UNW_X86_XMM6_hi, /* scratch */
+ UNW_X86_XMM7_lo, /* scratch */
+ UNW_X86_XMM7_hi, /* scratch */
+
+ UNW_X86_MXCSR, /* scratch */
+
+ /* segment registers */
+ UNW_X86_GS, /* special */
+ UNW_X86_FS, /* special */
+ UNW_X86_ES, /* special */
+ UNW_X86_DS, /* special */
+ UNW_X86_SS, /* special */
+ UNW_X86_CS, /* special */
+ UNW_X86_TSS, /* special */
+ UNW_X86_LDT, /* special */
+
+ /* frame info (read-only) */
+ UNW_X86_CFA,
+
+ UNW_X86_XMM0, /* scratch */
+ UNW_X86_XMM1, /* scratch */
+ UNW_X86_XMM2, /* scratch */
+ UNW_X86_XMM3, /* scratch */
+ UNW_X86_XMM4, /* scratch */
+ UNW_X86_XMM5, /* scratch */
+ UNW_X86_XMM6, /* scratch */
+ UNW_X86_XMM7, /* scratch */
+
+ UNW_TDEP_LAST_REG = UNW_X86_XMM7,
+
+ UNW_TDEP_IP = UNW_X86_EIP,
+ UNW_TDEP_SP = UNW_X86_ESP,
+ UNW_TDEP_EH = UNW_X86_EAX
+ }
+x86_regnum_t;
+
+#define UNW_TDEP_NUM_EH_REGS 2 /* eax and edx are exception args */
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+/* On x86, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no x86-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext)
+extern int unw_tdep_getcontext (unw_tdep_context_t *);
+
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind-x86_64.h b/src/pal/src/libunwind/include/libunwind-x86_64.h
new file mode 100644
index 0000000000..78eb541afb
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind-x86_64.h
@@ -0,0 +1,141 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef LIBUNWIND_H
+#define LIBUNWIND_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <inttypes.h>
+#include <ucontext.h>
+
+#define UNW_TARGET x86_64
+#define UNW_TARGET_X86_64 1
+
+#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
+
+/* This needs to be big enough to accommodate "struct cursor", while
+ leaving some slack for future expansion. Changing this value will
+ require recompiling all users of this library. Stack allocation is
+ relatively cheap and unwind-state copying is relatively rare, so we
+ want to err on making it rather too big than too small. */
+#define UNW_TDEP_CURSOR_LEN 127
+
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+
+typedef long double unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ UNW_X86_64_RAX,
+ UNW_X86_64_RDX,
+ UNW_X86_64_RCX,
+ UNW_X86_64_RBX,
+ UNW_X86_64_RSI,
+ UNW_X86_64_RDI,
+ UNW_X86_64_RBP,
+ UNW_X86_64_RSP,
+ UNW_X86_64_R8,
+ UNW_X86_64_R9,
+ UNW_X86_64_R10,
+ UNW_X86_64_R11,
+ UNW_X86_64_R12,
+ UNW_X86_64_R13,
+ UNW_X86_64_R14,
+ UNW_X86_64_R15,
+ UNW_X86_64_RIP,
+#ifdef CONFIG_MSABI_SUPPORT
+ UNW_X86_64_XMM0,
+ UNW_X86_64_XMM1,
+ UNW_X86_64_XMM2,
+ UNW_X86_64_XMM3,
+ UNW_X86_64_XMM4,
+ UNW_X86_64_XMM5,
+ UNW_X86_64_XMM6,
+ UNW_X86_64_XMM7,
+ UNW_X86_64_XMM8,
+ UNW_X86_64_XMM9,
+ UNW_X86_64_XMM10,
+ UNW_X86_64_XMM11,
+ UNW_X86_64_XMM12,
+ UNW_X86_64_XMM13,
+ UNW_X86_64_XMM14,
+ UNW_X86_64_XMM15,
+ UNW_TDEP_LAST_REG = UNW_X86_64_XMM15,
+#else
+ UNW_TDEP_LAST_REG = UNW_X86_64_RIP,
+#endif
+
+ /* XXX Add other regs here */
+
+ /* frame info (read-only) */
+ UNW_X86_64_CFA,
+
+ UNW_TDEP_IP = UNW_X86_64_RIP,
+ UNW_TDEP_SP = UNW_X86_64_RSP,
+ UNW_TDEP_BP = UNW_X86_64_RBP,
+ UNW_TDEP_EH = UNW_X86_64_RAX
+ }
+x86_64_regnum_t;
+
+#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ char unused;
+ }
+unw_tdep_save_loc_t;
+
+/* On x86_64, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+typedef struct
+ {
+ /* no x86-64-specific auxiliary proc-info */
+ char unused;
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-dynamic.h"
+#include "libunwind-common.h"
+
+#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext)
+#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
+
+extern int unw_tdep_getcontext (unw_tdep_context_t *);
+extern int unw_tdep_is_fpreg (int);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* LIBUNWIND_H */
diff --git a/src/pal/src/libunwind/include/libunwind.h.in b/src/pal/src/libunwind/include/libunwind.h.in
new file mode 100644
index 0000000000..7a56168c8b
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind.h.in
@@ -0,0 +1,36 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+#include "libunwind-aarch64.h"
+#elif defined __arm__
+# include "libunwind-arm.h"
+#elif defined __hppa__
+# include "libunwind-hppa.h"
+#elif defined __ia64__
+# include "libunwind-ia64.h"
+#elif defined __mips__
+# include "libunwind-mips.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "libunwind-ppc32.h"
+#elif defined __powerpc64__
+# include "libunwind-ppc64.h"
+#elif defined __sh__
+# include "libunwind-sh.h"
+#elif defined __i386__
+# include "libunwind-x86.h"
+#elif defined __x86_64__
+# include "libunwind-x86_64.h"
+#elif defined __tilegx__
+# include "libunwind-tilegx.h"
+#else
+# error "Unsupported arch"
+#endif
+
+#else /* UNW_REMOTE_ONLY */
+
+# include "libunwind-@arch@.h"
+
+#endif /* UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/include/libunwind_i.h b/src/pal/src/libunwind/include/libunwind_i.h
new file mode 100644
index 0000000000..0fcf32695e
--- /dev/null
+++ b/src/pal/src/libunwind/include/libunwind_i.h
@@ -0,0 +1,366 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This files contains libunwind-internal definitions which are
+ subject to frequent change and are not to be exposed to
+ libunwind-users. */
+
+#ifndef libunwind_i_h
+#define libunwind_i_h
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "compiler.h"
+
+#if defined(HAVE___THREAD) && HAVE___THREAD
+#define UNWI_DEFAULT_CACHING_POLICY UNW_CACHE_PER_THREAD
+#else
+#define UNWI_DEFAULT_CACHING_POLICY UNW_CACHE_GLOBAL
+#endif
+
+/* Platform-independent libunwind-internal declarations. */
+
+#include <sys/types.h> /* HP-UX needs this before include of pthread.h */
+
+#include <assert.h>
+#include <libunwind.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#if defined(HAVE_ELF_H)
+# include <elf.h>
+#elif defined(HAVE_SYS_ELF_H)
+# include <sys/elf.h>
+#else
+# error Could not locate <elf.h>
+#endif
+
+#if defined(HAVE_ENDIAN_H)
+# include <endian.h>
+#elif defined(HAVE_SYS_ENDIAN_H)
+# include <sys/endian.h>
+# if defined(_LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN)
+# define __LITTLE_ENDIAN _LITTLE_ENDIAN
+# endif
+# if defined(_BIG_ENDIAN) && !defined(__BIG_ENDIAN)
+# define __BIG_ENDIAN _BIG_ENDIAN
+# endif
+# if defined(_BYTE_ORDER) && !defined(__BYTE_ORDER)
+# define __BYTE_ORDER _BYTE_ORDER
+# endif
+#else
+# define __LITTLE_ENDIAN 1234
+# define __BIG_ENDIAN 4321
+# if defined(__hpux)
+# define __BYTE_ORDER __BIG_ENDIAN
+# elif defined(__QNX__)
+# if defined(__BIGENDIAN__)
+# define __BYTE_ORDER __BIG_ENDIAN
+# elif defined(__LITTLEENDIAN__)
+# define __BYTE_ORDER __LITTLE_ENDIAN
+# else
+# error Host has unknown byte-order.
+# endif
+# else
+# error Host has unknown byte-order.
+# endif
+#endif
+
+#if defined(HAVE__BUILTIN_UNREACHABLE)
+# define unreachable() __builtin_unreachable()
+#else
+# define unreachable() do { } while (1)
+#endif
+
+#ifdef DEBUG
+# define UNW_DEBUG 1
+#else
+# define UNW_DEBUG 0
+#endif
+
+/* Make it easy to write thread-safe code which may or may not be
+ linked against libpthread. The macros below can be used
+ unconditionally and if -lpthread is around, they'll call the
+ corresponding routines otherwise, they do nothing. */
+
+#pragma weak pthread_mutex_init
+#pragma weak pthread_mutex_lock
+#pragma weak pthread_mutex_unlock
+
+#define mutex_init(l) \
+ (pthread_mutex_init != NULL ? pthread_mutex_init ((l), NULL) : 0)
+#define mutex_lock(l) \
+ (pthread_mutex_lock != NULL ? pthread_mutex_lock (l) : 0)
+#define mutex_unlock(l) \
+ (pthread_mutex_unlock != NULL ? pthread_mutex_unlock (l) : 0)
+
+#ifdef HAVE_ATOMIC_OPS_H
+# include <atomic_ops.h>
+static inline int
+cmpxchg_ptr (void *addr, void *old, void *new)
+{
+ union
+ {
+ void *vp;
+ AO_t *aop;
+ }
+ u;
+
+ u.vp = addr;
+ return AO_compare_and_swap(u.aop, (AO_t) old, (AO_t) new);
+}
+# define fetch_and_add1(_ptr) AO_fetch_and_add1(_ptr)
+# define fetch_and_add(_ptr, value) AO_fetch_and_add(_ptr, value)
+ /* GCC 3.2.0 on HP-UX crashes on cmpxchg_ptr() */
+# if !(defined(__hpux) && __GNUC__ == 3 && __GNUC_MINOR__ == 2)
+# define HAVE_CMPXCHG
+# endif
+# define HAVE_FETCH_AND_ADD
+#elif defined(HAVE_SYNC_ATOMICS) || defined(HAVE_IA64INTRIN_H)
+# ifdef HAVE_IA64INTRIN_H
+# include <ia64intrin.h>
+# endif
+static inline int
+cmpxchg_ptr (void *addr, void *old, void *new)
+{
+ union
+ {
+ void *vp;
+ long *vlp;
+ }
+ u;
+
+ u.vp = addr;
+ return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new);
+}
+# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1)
+# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value)
+# define HAVE_CMPXCHG
+# define HAVE_FETCH_AND_ADD
+#endif
+#define atomic_read(ptr) (*(ptr))
+
+#define UNWI_OBJ(fn) UNW_PASTE(UNW_PREFIX,UNW_PASTE(I,fn))
+#define UNWI_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_UI,UNW_TARGET),_), fn)
+
+#define unwi_full_mask UNWI_ARCH_OBJ(full_mask)
+
+/* Type of a mask that can be used to inhibit preemption. At the
+ userlevel, preemption is caused by signals and hence sigset_t is
+ appropriate. In constrast, the Linux kernel uses "unsigned long"
+ to hold the processor "flags" instead. */
+typedef sigset_t intrmask_t;
+
+extern intrmask_t unwi_full_mask;
+
+/* Silence compiler warnings about variables which are used only if libunwind
+ is configured in a certain way */
+static inline void mark_as_used(void *v UNUSED) {
+}
+
+#if defined(CONFIG_BLOCK_SIGNALS)
+# define SIGPROCMASK(how, new_mask, old_mask) \
+ sigprocmask((how), (new_mask), (old_mask))
+#else
+# define SIGPROCMASK(how, new_mask, old_mask) mark_as_used(old_mask)
+#endif
+
+/* Prefer adaptive mutexes if available */
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#define UNW_PTHREAD_MUTEX_INITIALIZER PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+#else
+#define UNW_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#endif
+
+#define define_lock(name) \
+ pthread_mutex_t name = UNW_PTHREAD_MUTEX_INITIALIZER
+#define lock_init(l) mutex_init (l)
+#define lock_acquire(l,m) \
+do { \
+ SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &(m)); \
+ mutex_lock (l); \
+} while (0)
+#define lock_release(l,m) \
+do { \
+ mutex_unlock (l); \
+ SIGPROCMASK (SIG_SETMASK, &(m), NULL); \
+} while (0)
+
+#define SOS_MEMORY_SIZE 16384 /* see src/mi/mempool.c */
+
+#ifndef MAP_ANONYMOUS
+# define MAP_ANONYMOUS MAP_ANON
+#endif
+#define GET_MEMORY(mem, size) \
+do { \
+ /* Hopefully, mmap() goes straight through to a system call stub... */ \
+ mem = mmap (NULL, size, PROT_READ | PROT_WRITE, \
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
+ if (mem == MAP_FAILED) \
+ mem = NULL; \
+} while (0)
+
+#define unwi_find_dynamic_proc_info UNWI_OBJ(find_dynamic_proc_info)
+#define unwi_extract_dynamic_proc_info UNWI_OBJ(extract_dynamic_proc_info)
+#define unwi_put_dynamic_unwind_info UNWI_OBJ(put_dynamic_unwind_info)
+#define unwi_dyn_remote_find_proc_info UNWI_OBJ(dyn_remote_find_proc_info)
+#define unwi_dyn_remote_put_unwind_info UNWI_OBJ(dyn_remote_put_unwind_info)
+#define unwi_dyn_validate_cache UNWI_OBJ(dyn_validate_cache)
+
+extern int unwi_find_dynamic_proc_info (unw_addr_space_t as,
+ unw_word_t ip,
+ unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern int unwi_extract_dynamic_proc_info (unw_addr_space_t as,
+ unw_word_t ip,
+ unw_proc_info_t *pi,
+ unw_dyn_info_t *di,
+ int need_unwind_info,
+ void *arg);
+extern void unwi_put_dynamic_unwind_info (unw_addr_space_t as,
+ unw_proc_info_t *pi, void *arg);
+
+/* These handle the remote (cross-address-space) case of accessing
+ dynamic unwind info. */
+
+extern int unwi_dyn_remote_find_proc_info (unw_addr_space_t as,
+ unw_word_t ip,
+ unw_proc_info_t *pi,
+ int need_unwind_info,
+ void *arg);
+extern void unwi_dyn_remote_put_unwind_info (unw_addr_space_t as,
+ unw_proc_info_t *pi,
+ void *arg);
+extern int unwi_dyn_validate_cache (unw_addr_space_t as, void *arg);
+
+extern unw_dyn_info_list_t _U_dyn_info_list;
+extern pthread_mutex_t _U_dyn_info_list_lock;
+
+#if UNW_DEBUG
+#define unwi_debug_level UNWI_ARCH_OBJ(debug_level)
+extern long unwi_debug_level;
+
+# include <stdio.h>
+# define Debug(level,format...) \
+do { \
+ if (unwi_debug_level >= level) \
+ { \
+ int _n = level; \
+ if (_n > 16) \
+ _n = 16; \
+ fprintf (stderr, "%*c>%s: ", _n, ' ', __FUNCTION__); \
+ fprintf (stderr, format); \
+ } \
+} while (0)
+# define Dprintf(format...) fprintf (stderr, format)
+#else
+# define Debug(level,format...)
+# define Dprintf(format...)
+#endif
+
+static ALWAYS_INLINE int
+print_error (const char *string)
+{
+ return write (2, string, strlen (string));
+}
+
+#define mi_init UNWI_ARCH_OBJ(mi_init)
+
+extern void mi_init (void); /* machine-independent initializations */
+extern unw_word_t _U_dyn_info_list_addr (void);
+
+/* This is needed/used by ELF targets only. */
+
+struct elf_image
+ {
+ void *image; /* pointer to mmap'd image */
+ size_t size; /* (file-) size of the image */
+ };
+
+struct elf_dyn_info
+ {
+ struct elf_image ei;
+ unw_dyn_info_t di_cache;
+ unw_dyn_info_t di_debug; /* additional table info for .debug_frame */
+#if UNW_TARGET_IA64
+ unw_dyn_info_t ktab;
+#endif
+#if UNW_TARGET_ARM
+ unw_dyn_info_t di_arm; /* additional table info for .ARM.exidx */
+#endif
+ };
+
+static inline void invalidate_edi (struct elf_dyn_info *edi)
+{
+ if (edi->ei.image)
+ munmap (edi->ei.image, edi->ei.size);
+ memset (edi, 0, sizeof (*edi));
+ edi->di_cache.format = -1;
+ edi->di_debug.format = -1;
+#if UNW_TARGET_ARM
+ edi->di_arm.format = -1;
+#endif
+}
+
+
+/* Provide a place holder for architecture to override for fast access
+ to memory when known not to need to validate and know the access
+ will be local to the process. A suitable override will improve
+ unw_tdep_trace() performance in particular. */
+#define ACCESS_MEM_FAST(ret,validate,cur,addr,to) \
+ do { (ret) = dwarf_get ((cur), DWARF_MEM_LOC ((cur), (addr)), &(to)); } \
+ while (0)
+
+/* Define GNU and processor specific values for the Phdr p_type field in case
+ they aren't defined by <elf.h>. */
+#ifndef PT_GNU_EH_FRAME
+# define PT_GNU_EH_FRAME 0x6474e550
+#endif /* !PT_GNU_EH_FRAME */
+#ifndef PT_ARM_EXIDX
+# define PT_ARM_EXIDX 0x70000001 /* ARM unwind segment */
+#endif /* !PT_ARM_EXIDX */
+
+#include "tdep/libunwind_i.h"
+
+#ifndef tdep_get_func_addr
+# define tdep_get_func_addr(as,addr,v) (*(v) = addr, 0)
+#endif
+
+#ifndef DWARF_VAL_LOC
+# define DWARF_IS_VAL_LOC(l) 0
+# define DWARF_VAL_LOC(c,v) DWARF_NULL_LOC
+#endif
+
+#define UNW_ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
+
+#endif /* libunwind_i_h */
+
diff --git a/src/pal/src/libunwind/include/mempool.h b/src/pal/src/libunwind/include/mempool.h
new file mode 100644
index 0000000000..1f1c770099
--- /dev/null
+++ b/src/pal/src/libunwind/include/mempool.h
@@ -0,0 +1,89 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef mempool_h
+#define mempool_h
+
+/* Memory pools provide simple memory management of fixed-size
+ objects. Memory pools are used for two purposes:
+
+ o To ensure a stack can be unwound even when a process
+ is out of memory.
+
+ o To ensure a stack can be unwound at any time in a
+ multi-threaded process (e.g., even at a time when the normal
+ malloc-lock is taken, possibly by the very thread that is
+ being unwind).
+
+
+ To achieve the second objective, memory pools allocate memory
+ directly via mmap() system call (or an equivalent facility).
+
+ The first objective is accomplished by reserving memory ahead of
+ time. Since the memory requirements of stack unwinding generally
+ depends on the complexity of the procedures being unwind, there is
+ no absolute guarantee that unwinding will always work, but in
+ practice, this should not be a serious problem. */
+
+#include <sys/types.h>
+
+#include "libunwind_i.h"
+
+#define sos_alloc(s) UNWI_ARCH_OBJ(_sos_alloc)(s)
+#define mempool_init(p,s,r) UNWI_ARCH_OBJ(_mempool_init)(p,s,r)
+#define mempool_alloc(p) UNWI_ARCH_OBJ(_mempool_alloc)(p)
+#define mempool_free(p,o) UNWI_ARCH_OBJ(_mempool_free)(p,o)
+
+/* The mempool structure should be treated as an opaque object. It's
+ declared here only to enable static allocation of mempools. */
+struct mempool
+ {
+ pthread_mutex_t lock;
+ size_t obj_size; /* object size (rounded up for alignment) */
+ size_t chunk_size; /* allocation granularity */
+ unsigned int reserve; /* minimum (desired) size of the free-list */
+ unsigned int num_free; /* number of objects on the free-list */
+ struct object
+ {
+ struct object *next;
+ }
+ *free_list;
+ };
+
+/* Emergency allocation for one-time stuff that doesn't fit the memory
+ pool model. A limited amount of memory is available in this
+ fashion and once allocated, there is no way to free it. */
+extern void *sos_alloc (size_t size);
+
+/* Initialize POOL for an object size of OBJECT_SIZE bytes. RESERVE
+ is the number of objects that should be reserved for use under
+ tight memory situations. If it is zero, mempool attempts to pick a
+ reasonable default value. */
+extern void mempool_init (struct mempool *pool,
+ size_t obj_size, size_t reserve);
+extern void *mempool_alloc (struct mempool *pool);
+extern void mempool_free (struct mempool *pool, void *object);
+
+#endif /* mempool_h */
diff --git a/src/pal/src/libunwind/include/remote.h b/src/pal/src/libunwind/include/remote.h
new file mode 100644
index 0000000000..064d6309ad
--- /dev/null
+++ b/src/pal/src/libunwind/include/remote.h
@@ -0,0 +1,129 @@
+#ifndef REMOTE_H
+#define REMOTE_H
+
+/* Helper functions for accessing (remote) memory. These functions
+ assume that all addresses are naturally aligned (e.g., 32-bit
+ quantity is stored at a 32-bit-aligned address. */
+
+#ifdef UNW_LOCAL_ONLY
+
+static inline int
+fetch8 (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, int8_t *valp, void *arg)
+{
+ *valp = *(int8_t *) (uintptr_t) *addr;
+ *addr += 1;
+ return 0;
+}
+
+static inline int
+fetch16 (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, int16_t *valp, void *arg)
+{
+ *valp = *(int16_t *) (uintptr_t) *addr;
+ *addr += 2;
+ return 0;
+}
+
+static inline int
+fetch32 (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, int32_t *valp, void *arg)
+{
+ *valp = *(int32_t *) (uintptr_t) *addr;
+ *addr += 4;
+ return 0;
+}
+
+static inline int
+fetchw (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, unw_word_t *valp, void *arg)
+{
+ *valp = *(unw_word_t *) (uintptr_t) *addr;
+ *addr += sizeof (unw_word_t);
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+
+#define WSIZE (sizeof (unw_word_t))
+
+static inline int
+fetch8 (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, int8_t *valp, void *arg)
+{
+ unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr;
+ int ret;
+
+ *addr += 1;
+
+ ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ val >>= 8*off;
+#else
+ val >>= 8*(WSIZE - 1 - off);
+#endif
+ *valp = val & 0xff;
+ return ret;
+}
+
+static inline int
+fetch16 (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, int16_t *valp, void *arg)
+{
+ unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr;
+ int ret;
+
+ if ((off & 0x1) != 0)
+ return -UNW_EINVAL;
+
+ *addr += 2;
+
+ ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ val >>= 8*off;
+#else
+ val >>= 8*(WSIZE - 2 - off);
+#endif
+ *valp = val & 0xffff;
+ return ret;
+}
+
+static inline int
+fetch32 (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, int32_t *valp, void *arg)
+{
+ unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr;
+ int ret;
+
+ if ((off & 0x3) != 0)
+ return -UNW_EINVAL;
+
+ *addr += 4;
+
+ ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg);
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ val >>= 8*off;
+#else
+ val >>= 8*(WSIZE - 4 - off);
+#endif
+ *valp = val & 0xffffffff;
+ return ret;
+}
+
+static inline int
+fetchw (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, unw_word_t *valp, void *arg)
+{
+ int ret;
+
+ ret = (*a->access_mem) (as, *addr, valp, 0, arg);
+ *addr += WSIZE;
+ return ret;
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#endif /* REMOTE_H */
diff --git a/src/pal/src/libunwind/include/tdep-aarch64/dwarf-config.h b/src/pal/src/libunwind/include/tdep-aarch64/dwarf-config.h
new file mode 100644
index 0000000000..f65db17ee6
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-aarch64/dwarf-config.h
@@ -0,0 +1,52 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* This matches the value udes by GCC (see
+ gcc/config/aarch64/aarch64.h:DWARF_FRAME_REGISTERS. */
+#define DWARF_NUM_PRESERVED_REGS 97
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) 0
+
+#define dwarf_to_unw_regnum(reg) (((reg) <= UNW_AARCH64_V31) ? (reg) : 0)
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-aarch64/jmpbuf.h b/src/pal/src/libunwind/include/tdep-aarch64/jmpbuf.h
new file mode 100644
index 0000000000..3f01a442ba
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-aarch64/jmpbuf.h
@@ -0,0 +1,33 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+/* FIXME for AArch64 */
+
+#define JB_SP 13
+#define JB_RP 14
+#define JB_MASK_SAVED 15
+#define JB_MASK 16
diff --git a/src/pal/src/libunwind/include/tdep-aarch64/libunwind_i.h b/src/pal/src/libunwind/include/tdep-aarch64/libunwind_i.h
new file mode 100644
index 0000000000..b91273fa1c
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-aarch64/libunwind_i.h
@@ -0,0 +1,320 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef AARCH64_LIBUNWIND_I_H
+#define AARCH64_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "elf64.h"
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef enum
+ {
+ UNW_AARCH64_FRAME_STANDARD = -2, /* regular fp, sp +/- offset */
+ UNW_AARCH64_FRAME_SIGRETURN = -1, /* special sigreturn frame */
+ UNW_AARCH64_FRAME_OTHER = 0, /* not cacheable (special or unrecognised) */
+ UNW_AARCH64_FRAME_GUESSED = 1 /* guessed it was regular, but not known */
+ }
+unw_tdep_frame_type_t;
+
+typedef struct
+ {
+ uint64_t virtual_address;
+ int64_t frame_type : 2; /* unw_tdep_frame_type_t classification */
+ int64_t last_frame : 1; /* non-zero if last frame in chain */
+ int64_t cfa_reg_sp : 1; /* cfa dwarf base register is sp vs. fp */
+ int64_t cfa_reg_offset : 30; /* cfa is at this offset from base register value */
+ int64_t fp_cfa_offset : 30; /* fp saved at this offset from cfa (-1 = not saved) */
+ int64_t lr_cfa_offset : 30; /* lr saved at this offset from cfa (-1 = not saved) */
+ int64_t sp_cfa_offset : 30; /* sp saved at this offset from cfa (-1 = not saved) */
+ }
+unw_tdep_frame_t;
+
+#ifdef UNW_LOCAL_ONLY
+
+typedef unw_word_t aarch64_loc_t;
+
+#else /* !UNW_LOCAL_ONLY */
+
+typedef struct aarch64_loc
+ {
+ unw_word_t w0, w1;
+ }
+aarch64_loc_t;
+
+#endif /* !UNW_LOCAL_ONLY */
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+ int big_endian;
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+ };
+
+struct cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+
+ unw_tdep_frame_t frame_info; /* quick tracing assist info */
+
+ enum
+ {
+ AARCH64_SCF_NONE,
+ AARCH64_SCF_LINUX_RT_SIGFRAME,
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+ unw_word_t sigcontext_sp;
+ unw_word_t sigcontext_pc;
+ int validate;
+ };
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_word_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_word_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 0, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0,
+ c->as_arg);
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 1, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1,
+ 1, c->as_arg);
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+
+
+#define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace)
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame UNW_OBJ(tdep_stash_frame)
+#define tdep_trace UNW_OBJ(tdep_trace)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+#define tdep_big_endian(as) ((as)->big_endian)
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+extern int tdep_trace (unw_cursor_t *cursor, void **addresses, int *n);
+extern void tdep_stash_frame (struct dwarf_cursor *c,
+ struct dwarf_reg_state *rs);
+extern int tdep_getcontext_trace (unw_tdep_context_t *);
+
+#endif /* AARCH64_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-arm/dwarf-config.h b/src/pal/src/libunwind/include/tdep-arm/dwarf-config.h
new file mode 100644
index 0000000000..f50228975e
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-arm/dwarf-config.h
@@ -0,0 +1,51 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* This is FIRST_PSEUDO_REGISTER in GCC, since DWARF_FRAME_REGISTERS is not
+ explicitly defined. */
+#define DWARF_NUM_PRESERVED_REGS 128
+
+#define dwarf_to_unw_regnum(reg) (((reg) < 16) ? (reg) : 0)
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) 0
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-arm/ex_tables.h b/src/pal/src/libunwind/include/tdep-arm/ex_tables.h
new file mode 100644
index 0000000000..9df5e0a9fa
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-arm/ex_tables.h
@@ -0,0 +1,55 @@
+/* libunwind - a platform-independent unwind library
+ Copyright 2011 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef ARM_EX_TABLES_H
+#define ARM_EX_TABLES_H
+
+typedef enum arm_exbuf_cmd {
+ ARM_EXIDX_CMD_FINISH,
+ ARM_EXIDX_CMD_DATA_PUSH,
+ ARM_EXIDX_CMD_DATA_POP,
+ ARM_EXIDX_CMD_REG_POP,
+ ARM_EXIDX_CMD_REG_TO_SP,
+ ARM_EXIDX_CMD_VFP_POP,
+ ARM_EXIDX_CMD_WREG_POP,
+ ARM_EXIDX_CMD_WCGR_POP,
+ ARM_EXIDX_CMD_RESERVED,
+ ARM_EXIDX_CMD_REFUSED,
+} arm_exbuf_cmd_t;
+
+struct arm_exbuf_data
+{
+ arm_exbuf_cmd_t cmd;
+ uint32_t data;
+};
+
+#define arm_exidx_extract UNW_OBJ(arm_exidx_extract)
+#define arm_exidx_decode UNW_OBJ(arm_exidx_decode)
+#define arm_exidx_apply_cmd UNW_OBJ(arm_exidx_apply_cmd)
+
+int arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf);
+int arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c);
+int arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c);
+
+#endif // ARM_EX_TABLES_H
diff --git a/src/pal/src/libunwind/include/tdep-arm/jmpbuf.h b/src/pal/src/libunwind/include/tdep-arm/jmpbuf.h
new file mode 100644
index 0000000000..008e77f796
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-arm/jmpbuf.h
@@ -0,0 +1,32 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+/* FIXME for ARM! */
+
+#define JB_SP 4
+#define JB_RP 5
+#define JB_MASK_SAVED 6
+#define JB_MASK 7
diff --git a/src/pal/src/libunwind/include/tdep-arm/libunwind_i.h b/src/pal/src/libunwind/include/tdep-arm/libunwind_i.h
new file mode 100644
index 0000000000..2602f41c4f
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-arm/libunwind_i.h
@@ -0,0 +1,326 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef ARM_LIBUNWIND_I_H
+#define ARM_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "elf32.h"
+#include "mempool.h"
+#include "dwarf.h"
+#include "ex_tables.h"
+
+typedef enum
+ {
+ UNW_ARM_FRAME_SYSCALL = -3, /* r7 saved in r12, sp offset zero */
+ UNW_ARM_FRAME_STANDARD = -2, /* regular r7, sp +/- offset */
+ UNW_ARM_FRAME_SIGRETURN = -1, /* special sigreturn frame */
+ UNW_ARM_FRAME_OTHER = 0, /* not cacheable (special or unrecognised) */
+ UNW_ARM_FRAME_GUESSED = 1 /* guessed it was regular, but not known */
+ }
+unw_tdep_frame_type_t;
+
+typedef struct
+ {
+ uint32_t virtual_address;
+ int32_t frame_type : 3; /* unw_tdep_frame_type_t classification */
+ int32_t last_frame : 1; /* non-zero if last frame in chain */
+ int32_t cfa_reg_sp : 1; /* cfa dwarf base register is sp vs. r7 */
+ int32_t cfa_reg_offset : 30; /* cfa is at this offset from base register value */
+ int32_t r7_cfa_offset : 30; /* r7 saved at this offset from cfa (-1 = not saved) */
+ int32_t lr_cfa_offset : 30; /* lr saved at this offset from cfa (-1 = not saved) */
+ int32_t sp_cfa_offset : 30; /* sp saved at this offset from cfa (-1 = not saved) */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+ int big_endian;
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+ };
+
+struct cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+
+ unw_tdep_frame_t frame_info; /* quick tracing assist info */
+
+ enum
+ {
+ ARM_SCF_NONE, /* no signal frame */
+ ARM_SCF_LINUX_SIGFRAME, /* non-RT signal frame, kernel >=2.6.18 */
+ ARM_SCF_LINUX_RT_SIGFRAME, /* RT signal frame, kernel >=2.6.18 */
+ ARM_SCF_LINUX_OLD_SIGFRAME, /* non-RT signal frame, kernel < 2.6.18 */
+ ARM_SCF_LINUX_OLD_RT_SIGFRAME, /* RT signal frame, kernel < 2.6.18 */
+ ARM_SCF_FREEBSD_SIGFRAME, /* FreeBSD sigframe */
+ ARM_SCF_FREEBSD_SYSCALL, /* FreeBSD syscall stub */
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+ unw_word_t sigcontext_sp;
+ unw_word_t sigcontext_pc;
+ int validate;
+ };
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_word_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_word_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 0, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0,
+ c->as_arg);
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 1, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1,
+ 1, c->as_arg);
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+#define arm_find_proc_info UNW_OBJ(find_proc_info)
+#define arm_put_unwind_info UNW_OBJ(put_unwind_info)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table UNW_OBJ(search_unwind_table)
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame UNW_OBJ(tdep_stash_frame)
+#define tdep_trace UNW_OBJ(tdep_trace)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ arm_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ arm_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+#define tdep_big_endian(as) ((as)->big_endian)
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int arm_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info,
+ void *arg);
+extern void arm_put_unwind_info (unw_addr_space_t as,
+ unw_proc_info_t *pi, void *arg);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+extern int tdep_trace (unw_cursor_t *cursor, void **addresses, int *n);
+extern void tdep_stash_frame (struct dwarf_cursor *c,
+ struct dwarf_reg_state *rs);
+
+/* unwinding method selection support */
+#define UNW_ARM_METHOD_ALL 0xFF
+#define UNW_ARM_METHOD_DWARF 0x01
+#define UNW_ARM_METHOD_FRAME 0x02
+#define UNW_ARM_METHOD_EXIDX 0x04
+
+#define unwi_unwind_method UNW_OBJ(unwind_method)
+extern int unwi_unwind_method;
+
+#define UNW_TRY_METHOD(x) (unwi_unwind_method & x)
+
+#endif /* ARM_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-hppa/dwarf-config.h b/src/pal/src/libunwind/include/tdep-hppa/dwarf-config.h
new file mode 100644
index 0000000000..fb963c7d30
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-hppa/dwarf-config.h
@@ -0,0 +1,54 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* See DWARF_FRAME_REGNUM() macro in gcc/config/pa/pa32-regs.h: */
+#define dwarf_to_unw_regnum(reg) \
+ (((reg) < DWARF_NUM_PRESERVED_REGS) ? (reg) : 0)
+
+/* This matches the value used by GCC (see
+ gcc/config/pa/pa32-regs.h:FIRST_PSEUDO_REGISTER), which leaves
+ plenty of room for expansion. */
+#define DWARF_NUM_PRESERVED_REGS 89
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) 1
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see X86_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-hppa/jmpbuf.h b/src/pal/src/libunwind/include/tdep-hppa/jmpbuf.h
new file mode 100644
index 0000000000..91f062ff7d
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-hppa/jmpbuf.h
@@ -0,0 +1,33 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+#ifndef JB_SP
+# define JB_SP 19
+#endif
+#define JB_RP 20
+#define JB_MASK_SAVED 21
+#define JB_MASK 22
diff --git a/src/pal/src/libunwind/include/tdep-hppa/libunwind_i.h b/src/pal/src/libunwind/include/tdep-hppa/libunwind_i.h
new file mode 100644
index 0000000000..72649aa3ec
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-hppa/libunwind_i.h
@@ -0,0 +1,279 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef HPPA_LIBUNWIND_I_H
+#define HPPA_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "elf32.h"
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef struct
+ {
+ /* no hppa-specific fast trace */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+ };
+
+struct cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+
+ /* Format of sigcontext structure and address at which it is
+ stored: */
+ enum
+ {
+ HPPA_SCF_NONE, /* no signal frame encountered */
+ HPPA_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+ };
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_word_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_word_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 0, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0,
+ c->as_arg);
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 1, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1,
+ 1, c->as_arg);
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+#define tdep_big_endian(as) 1
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (ucontext_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+
+#endif /* HPPA_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-ia64/jmpbuf.h b/src/pal/src/libunwind/include/tdep-ia64/jmpbuf.h
new file mode 100644
index 0000000000..d642af2075
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ia64/jmpbuf.h
@@ -0,0 +1,32 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP and BSP: */
+
+#define JB_SP 0
+#define JB_RP 8
+#define JB_BSP 17
+#define JB_MASK_SAVED 70
+#define JB_MASK 71
diff --git a/src/pal/src/libunwind/include/tdep-ia64/libunwind_i.h b/src/pal/src/libunwind/include/tdep-ia64/libunwind_i.h
new file mode 100644
index 0000000000..1d9770bab8
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ia64/libunwind_i.h
@@ -0,0 +1,281 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef IA64_LIBUNWIND_I_H
+#define IA64_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include "elf64.h"
+#include "mempool.h"
+
+typedef struct
+ {
+ /* no ia64-specific fast trace */
+ }
+unw_tdep_frame_t;
+
+enum ia64_pregnum
+ {
+ /* primary unat: */
+ IA64_REG_PRI_UNAT_GR,
+ IA64_REG_PRI_UNAT_MEM,
+
+ /* memory stack (order matters: see build_script() */
+ IA64_REG_PSP, /* previous memory stack pointer */
+ /* register stack */
+ IA64_REG_BSP, /* register stack pointer */
+ IA64_REG_BSPSTORE,
+ IA64_REG_PFS, /* previous function state */
+ IA64_REG_RNAT,
+ /* instruction pointer: */
+ IA64_REG_IP,
+
+ /* preserved registers: */
+ IA64_REG_R4, IA64_REG_R5, IA64_REG_R6, IA64_REG_R7,
+ IA64_REG_NAT4, IA64_REG_NAT5, IA64_REG_NAT6, IA64_REG_NAT7,
+ IA64_REG_UNAT, IA64_REG_PR, IA64_REG_LC, IA64_REG_FPSR,
+ IA64_REG_B1, IA64_REG_B2, IA64_REG_B3, IA64_REG_B4, IA64_REG_B5,
+ IA64_REG_F2, IA64_REG_F3, IA64_REG_F4, IA64_REG_F5,
+ IA64_REG_F16, IA64_REG_F17, IA64_REG_F18, IA64_REG_F19,
+ IA64_REG_F20, IA64_REG_F21, IA64_REG_F22, IA64_REG_F23,
+ IA64_REG_F24, IA64_REG_F25, IA64_REG_F26, IA64_REG_F27,
+ IA64_REG_F28, IA64_REG_F29, IA64_REG_F30, IA64_REG_F31,
+ IA64_NUM_PREGS
+ };
+
+#ifdef UNW_LOCAL_ONLY
+
+typedef unw_word_t ia64_loc_t;
+
+#else /* !UNW_LOCAL_ONLY */
+
+typedef struct ia64_loc
+ {
+ unw_word_t w0, w1;
+ }
+ia64_loc_t;
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#include "script.h"
+
+#define ABI_UNKNOWN 0
+#define ABI_LINUX 1
+#define ABI_HPUX 2
+#define ABI_FREEBSD 3
+#define ABI_OPENVMS 4
+#define ABI_NSK 5 /* Tandem/HP Non-Stop Kernel */
+#define ABI_WINDOWS 6
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+ int big_endian;
+ int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation;
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+#ifndef UNW_REMOTE_ONLY
+ unsigned long long shared_object_removals;
+#endif
+
+ struct ia64_script_cache global_cache;
+ };
+
+/* Note: The ABI numbers in the ABI-markers (.unwabi directive) are
+ not the same as the above ABI numbers. */
+#define ABI_MARKER_OLD_LINUX_SIGTRAMP ((0 << 8) | 's')
+#define ABI_MARKER_OLD_LINUX_INTERRUPT ((0 << 8) | 'i')
+#define ABI_MARKER_HP_UX_SIGTRAMP ((1 << 8) | 1)
+#define ABI_MARKER_LINUX_SIGTRAMP ((3 << 8) | 's')
+#define ABI_MARKER_LINUX_INTERRUPT ((3 << 8) | 'i')
+
+struct cursor
+ {
+ void *as_arg; /* argument to address-space callbacks */
+ unw_addr_space_t as; /* reference to per-address-space info */
+
+ /* IP, CFM, and predicate cache (these are always equal to the
+ values stored in ip_loc, cfm_loc, and pr_loc,
+ respectively). */
+ unw_word_t ip; /* instruction pointer value */
+ unw_word_t cfm; /* current frame mask */
+ unw_word_t pr; /* current predicate values */
+
+ /* current frame info: */
+ unw_word_t bsp; /* backing store pointer value */
+ unw_word_t sp; /* stack pointer value */
+ unw_word_t psp; /* previous sp value */
+ ia64_loc_t cfm_loc; /* cfm save location (or NULL) */
+ ia64_loc_t ec_loc; /* ar.ec save location (usually cfm_loc) */
+ ia64_loc_t loc[IA64_NUM_PREGS];
+
+ unw_word_t eh_args[4]; /* exception handler arguments */
+ unw_word_t sigcontext_addr; /* address of sigcontext or 0 */
+ unw_word_t sigcontext_off; /* sigcontext-offset relative to signal sp */
+
+ short hint;
+ short prev_script;
+
+ uint8_t nat_bitnr[4]; /* NaT bit numbers for r4-r7 */
+ uint16_t abi_marker; /* abi_marker for current frame (if any) */
+ uint16_t last_abi_marker; /* last abi_marker encountered so far */
+ uint8_t eh_valid_mask;
+
+ unsigned int pi_valid :1; /* is proc_info valid? */
+ unsigned int pi_is_dynamic :1; /* proc_info found via dynamic proc info? */
+ unw_proc_info_t pi; /* info about current procedure */
+
+ /* In case of stack-discontiguities, such as those introduced by
+ signal-delivery on an alternate signal-stack (see
+ sigaltstack(2)), we use the following data-structure to keep
+ track of the register-backing-store areas across on which the
+ current frame may be backed up. Since there are at most 96
+ stacked registers and since we only have to track the current
+ frame and only areas that are not empty, this puts an upper
+ limit on the # of backing-store areas we have to track.
+
+ Note that the rbs-area indexed by rbs_curr identifies the
+ rbs-area that was in effect at the time AR.BSP had the value
+ c->bsp. However, this rbs area may not actually contain the
+ value in the register that c->bsp corresponds to because that
+ register may not have gotten spilled until much later, when a
+ possibly different rbs-area might have been in effect
+ already. */
+ uint8_t rbs_curr; /* index of curr. rbs-area (contains c->bsp) */
+ uint8_t rbs_left_edge; /* index of inner-most valid rbs-area */
+ struct rbs_area
+ {
+ unw_word_t end;
+ unw_word_t size;
+ ia64_loc_t rnat_loc;
+ }
+ rbs_area[96 + 2]; /* 96 stacked regs + 1 extra stack on each side... */
+};
+
+struct ia64_global_unwind_state
+ {
+ pthread_mutex_t lock; /* global data lock */
+
+ volatile char init_done;
+
+ /* Table of registers that prologues can save (and order in which
+ they're saved). */
+ const unsigned char save_order[8];
+
+ /*
+ * uc_addr() may return pointers to these variables. We need to
+ * make sure they don't get written via ia64_put() or
+ * ia64_putfp(). To make it possible to test for these variables
+ * quickly, we collect them in a single sub-structure.
+ */
+ struct
+ {
+ unw_word_t r0; /* r0 is byte-order neutral */
+ unw_fpreg_t f0; /* f0 is byte-order neutral */
+ unw_fpreg_t f1_le, f1_be; /* f1 is byte-order dependent */
+ }
+ read_only;
+ unw_fpreg_t nat_val_le, nat_val_be;
+ unw_fpreg_t int_val_le, int_val_be;
+
+ struct mempool reg_state_pool;
+ struct mempool labeled_state_pool;
+
+# if UNW_DEBUG
+ const char *preg_name[IA64_NUM_PREGS];
+# endif
+ };
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done unw.init_done
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table unw_search_ia64_unwind_table
+#define tdep_find_unwind_table ia64_find_unwind_table
+#define tdep_find_proc_info UNW_OBJ(find_proc_info)
+#define tdep_uc_addr UNW_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+#define tdep_get_as(c) ((c)->as)
+#define tdep_get_as_arg(c) ((c)->as_arg)
+#define tdep_get_ip(c) ((c)->ip)
+#define tdep_big_endian(as) ((c)->as->big_endian != 0)
+
+#ifndef UNW_LOCAL_ONLY
+# define tdep_put_unwind_info UNW_OBJ(put_unwind_info)
+#endif
+
+/* This can't be an UNW_ARCH_OBJ() because we need separate
+ unw.initialized flags for the local-only and generic versions of
+ the library. Also, if we wanted to have a single, shared global
+ data structure, we couldn't declare "unw" as HIDDEN. */
+#define unw UNW_OBJ(data)
+
+extern void tdep_init (void);
+extern int tdep_find_unwind_table (struct elf_dyn_info *edi,
+ unw_addr_space_t as, char *path,
+ unw_word_t segbase, unw_word_t mapoff,
+ unw_word_t ip);
+extern int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info,
+ void *arg);
+extern void tdep_put_unwind_info (unw_addr_space_t as,
+ unw_proc_info_t *pi, void *arg);
+extern void *tdep_uc_addr (ucontext_t *uc, unw_regnum_t regnum,
+ uint8_t *nat_bitnr);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+
+extern struct ia64_global_unwind_state unw;
+
+/* In user-level, we have no reasonable way of determining the base of
+ an arbitrary backing-store. We default to half the
+ address-space. */
+#define rbs_get_base(c,bspstore,rbs_basep) \
+ (*(rbs_basep) = (bspstore) - (((unw_word_t) 1) << 63), 0)
+
+#endif /* IA64_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-ia64/rse.h b/src/pal/src/libunwind/include/tdep-ia64/rse.h
new file mode 100644
index 0000000000..ee521a5917
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ia64/rse.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 1998, 1999, 2002, 2003, 2005 Hewlett-Packard Co
+ * David Mosberger-Tang <davidm@hpl.hp.com>
+ *
+ * Register stack engine related helper functions. This file may be
+ * used in applications, so be careful about the name-space and give
+ * some consideration to non-GNU C compilers (though __inline__ is
+ * fine).
+ */
+#ifndef RSE_H
+#define RSE_H
+
+#include <libunwind.h>
+
+static inline uint64_t
+rse_slot_num (uint64_t addr)
+{
+ return (addr >> 3) & 0x3f;
+}
+
+/*
+ * Return TRUE if ADDR is the address of an RNAT slot.
+ */
+static inline uint64_t
+rse_is_rnat_slot (uint64_t addr)
+{
+ return rse_slot_num (addr) == 0x3f;
+}
+
+/*
+ * Returns the address of the RNAT slot that covers the slot at
+ * address SLOT_ADDR.
+ */
+static inline uint64_t
+rse_rnat_addr (uint64_t slot_addr)
+{
+ return slot_addr | (0x3f << 3);
+}
+
+/*
+ * Calculate the number of registers in the dirty partition starting at
+ * BSPSTORE and ending at BSP. This isn't simply (BSP-BSPSTORE)/8
+ * because every 64th slot stores ar.rnat.
+ */
+static inline uint64_t
+rse_num_regs (uint64_t bspstore, uint64_t bsp)
+{
+ uint64_t slots = (bsp - bspstore) >> 3;
+
+ return slots - (rse_slot_num(bspstore) + slots)/0x40;
+}
+
+/*
+ * The inverse of the above: given bspstore and the number of
+ * registers, calculate ar.bsp.
+ */
+static inline uint64_t
+rse_skip_regs (uint64_t addr, long num_regs)
+{
+ long delta = rse_slot_num(addr) + num_regs;
+
+ if (num_regs < 0)
+ delta -= 0x3e;
+ return addr + ((num_regs + delta/0x3f) << 3);
+}
+
+#endif /* RSE_H */
diff --git a/src/pal/src/libunwind/include/tdep-ia64/script.h b/src/pal/src/libunwind/include/tdep-ia64/script.h
new file mode 100644
index 0000000000..fe3360bf58
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ia64/script.h
@@ -0,0 +1,85 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define IA64_LOG_UNW_CACHE_SIZE 7
+#define IA64_UNW_CACHE_SIZE (1 << IA64_LOG_UNW_CACHE_SIZE)
+
+#define IA64_LOG_UNW_HASH_SIZE (IA64_LOG_UNW_CACHE_SIZE + 1)
+#define IA64_UNW_HASH_SIZE (1 << IA64_LOG_UNW_HASH_SIZE)
+
+typedef unsigned char unw_hash_index_t;
+
+struct ia64_script_insn
+ {
+ unsigned int opc; /* see enum ia64_script_insn_opcode */
+ unsigned int dst;
+ unw_word_t val;
+ };
+
+/* Updating each preserved register may result in one script
+ instruction each. At the end of the script, psp gets popped,
+ accounting for one more instruction. */
+#define IA64_MAX_SCRIPT_LEN (IA64_NUM_PREGS + 1)
+
+struct ia64_script
+ {
+ unw_word_t ip; /* ip this script is for */
+ unw_word_t pr_mask; /* mask of predicates script depends on */
+ unw_word_t pr_val; /* predicate values this script is for */
+ unw_proc_info_t pi; /* info about underlying procedure */
+ unsigned short lru_chain; /* used for least-recently-used chain */
+ unsigned short coll_chain; /* used for hash collisions */
+ unsigned short hint; /* hint for next script to try (or -1) */
+ unsigned short count; /* number of instructions in script */
+ unsigned short abi_marker;
+ struct ia64_script_insn insn[IA64_MAX_SCRIPT_LEN];
+ };
+
+struct ia64_script_cache
+ {
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_TS_t busy; /* is the script-cache busy? */
+#else
+ pthread_mutex_t lock;
+#endif
+ unsigned short lru_head; /* index of lead-recently used script */
+ unsigned short lru_tail; /* index of most-recently used script */
+
+ /* hash table that maps instruction pointer to script index: */
+ unsigned short hash[IA64_UNW_HASH_SIZE];
+
+ uint32_t generation; /* generation number */
+
+ /* script cache: */
+ struct ia64_script buckets[IA64_UNW_CACHE_SIZE];
+ };
+
+#define ia64_cache_proc_info UNW_OBJ(cache_proc_info)
+#define ia64_get_cached_proc_info UNW_OBJ(get_cached_proc_info)
+
+struct cursor; /* forward declaration */
+
+extern int ia64_cache_proc_info (struct cursor *c);
+extern int ia64_get_cached_proc_info (struct cursor *c);
diff --git a/src/pal/src/libunwind/include/tdep-mips/dwarf-config.h b/src/pal/src/libunwind/include/tdep-mips/dwarf-config.h
new file mode 100644
index 0000000000..8006d0b8dd
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-mips/dwarf-config.h
@@ -0,0 +1,54 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* This is FIRST_PSEUDO_REGISTER in GCC, since DWARF_FRAME_REGISTERS is not
+ explicitly defined. */
+#define DWARF_NUM_PRESERVED_REGS 188
+
+#define dwarf_to_unw_regnum(reg) (((reg) < 32) ? (reg) : 0)
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian)
+
+/* Return the size of an address, for DWARF purposes. */
+#define dwarf_addr_size(addr_space) ((addr_space)->addr_size)
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-mips/jmpbuf.h b/src/pal/src/libunwind/include/tdep-mips/jmpbuf.h
new file mode 100644
index 0000000000..c099f9267e
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-mips/jmpbuf.h
@@ -0,0 +1,32 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+/* FIXME for MIPS! */
+
+#define JB_SP 4
+#define JB_RP 5
+#define JB_MASK_SAVED 6
+#define JB_MASK 7
diff --git a/src/pal/src/libunwind/include/tdep-mips/libunwind_i.h b/src/pal/src/libunwind/include/tdep-mips/libunwind_i.h
new file mode 100644
index 0000000000..3fe40c0c05
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-mips/libunwind_i.h
@@ -0,0 +1,331 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef MIPS_LIBUNWIND_I_H
+#define MIPS_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#if !defined(UNW_REMOTE_ONLY) && _MIPS_SIM == _ABI64
+# include "elf64.h"
+#else
+# include "elf32.h"
+#endif
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef struct
+ {
+ /* no mips-specific fast trace */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+
+ int big_endian;
+ mips_abi_t abi;
+ unsigned int addr_size;
+
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+};
+
+#define tdep_big_endian(as) ((as)->big_endian)
+
+struct cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+ unw_word_t sigcontext_addr;
+ };
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifndef UNW_REMOTE_ONLY
+# if _MIPS_SIM == _ABIN32
+typedef long long mips_reg_t;
+# else
+typedef long mips_reg_t;
+# endif
+#endif
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+
+/* FIXME: Implement these for the MIPS FPU. */
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) (intptr_t) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) (intptr_t) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(mips_reg_t *) (intptr_t) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(mips_reg_t *) (intptr_t) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+static inline int
+read_s32 (struct dwarf_cursor *c, unw_word_t addr, unw_word_t *val)
+{
+ int offset = addr & 4;
+ int ret;
+ unw_word_t memval;
+
+ ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg);
+ if (ret < 0)
+ return ret;
+
+ if ((offset != 0) == tdep_big_endian (c->as))
+ *val = (int32_t) memval;
+ else
+ *val = (int32_t) (memval >> 32);
+
+ return 0;
+}
+
+static inline int
+write_s32 (struct dwarf_cursor *c, unw_word_t addr, const unw_word_t *val)
+{
+ int offset = addr & 4;
+ int ret;
+ unw_word_t memval;
+
+ ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg);
+ if (ret < 0)
+ return ret;
+
+ if ((offset != 0) == tdep_big_endian (c->as))
+ memval = (memval & ~0xffffffffLL) | (uint32_t) *val;
+ else
+ memval = (memval & 0xffffffffLL) | (uint32_t) (*val << 32);
+
+ return (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 1, c->as_arg);
+}
+
+/* FIXME: Implement these for the MIPS FPU. */
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 0, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0,
+ c->as_arg);
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 1, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1,
+ 1, c->as_arg);
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else if (c->as->abi == UNW_MIPS_ABI_O32)
+ return read_s32 (c, DWARF_GET_LOC (loc), val);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else if (c->as->abi == UNW_MIPS_ABI_O32)
+ return write_s32 (c, DWARF_GET_LOC (loc), &val);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (ucontext_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+
+#endif /* MIPS_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-ppc32/dwarf-config.h b/src/pal/src/libunwind/include/tdep-ppc32/dwarf-config.h
new file mode 100644
index 0000000000..bf6886b066
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ppc32/dwarf-config.h
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* For PPC64, 48 GPRs + 33 FPRs + 33 AltiVec + 1 SPE */
+#define DWARF_NUM_PRESERVED_REGS 115
+
+#define DWARF_REGNUM_MAP_LENGTH 115
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) 1
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see X86_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-ppc32/jmpbuf.h b/src/pal/src/libunwind/include/tdep-ppc32/jmpbuf.h
new file mode 100644
index 0000000000..861e94d971
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ppc32/jmpbuf.h
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+#define JB_SP 6
+#define JB_RP 7
+#define JB_MASK_SAVED 8
+#define JB_MASK 9
diff --git a/src/pal/src/libunwind/include/tdep-ppc32/libunwind_i.h b/src/pal/src/libunwind/include/tdep-ppc32/libunwind_i.h
new file mode 100644
index 0000000000..4cf6d135f6
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ppc32/libunwind_i.h
@@ -0,0 +1,314 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef PPC32_LIBUNWIND_I_H
+#define PPC32_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "elf32.h"
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef struct
+ {
+ /* no ppc32-specific fast trace */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+{
+ struct unw_accessors acc;
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+ int validate;
+};
+
+struct cursor
+{
+ struct dwarf_cursor dwarf; /* must be first */
+
+ /* Format of sigcontext structure and address at which it is
+ stored: */
+ enum
+ {
+ PPC_SCF_NONE, /* no signal frame encountered */
+ PPC_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+};
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_IS_FP_LOC(l) 0
+# define DWARF_IS_V_LOC(l) 0
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_VREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+#else /* !UNW_LOCAL_ONLY */
+
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_LOC_TYPE_V (1 << 2)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_IS_V_LOC(l) (((l).type & DWARF_LOC_TYPE_V) != 0)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+# define DWARF_VREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_V))
+
+#endif /* !UNW_LOCAL_ONLY */
+
+static inline int
+dwarf_getvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val)
+{
+ unw_word_t *valp = (unw_word_t *) val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ assert (DWARF_IS_V_LOC (loc));
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp,
+ 0, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 0, c->as_arg);
+}
+
+static inline int
+dwarf_putvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ unw_word_t *valp = (unw_word_t *) & val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ assert (DWARF_IS_V_LOC (loc));
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp,
+ 1, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 1, c->as_arg);
+}
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val)
+{
+ unw_word_t *valp = (unw_word_t *) val;
+ unw_word_t addr;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ assert (DWARF_IS_FP_LOC (loc));
+ assert (!DWARF_IS_V_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 0, c->as_arg);
+
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ unw_word_t *valp = (unw_word_t *) & val;
+ unw_word_t addr;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ assert (DWARF_IS_FP_LOC (loc));
+ assert (!DWARF_IS_V_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+
+ return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 1, c->as_arg);
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t * val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+ assert (!DWARF_IS_V_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+ assert (!DWARF_IS_V_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+#define tdep_get_func_addr UNW_OBJ(get_func_addr)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip,
+ int need_unwind_info);
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+#define tdep_big_endian(as) 1
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t * di,
+ unw_proc_info_t * pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (ucontext_t * uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t * valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t * valp, int write);
+extern int tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr,
+ unw_word_t *entry_point);
+
+#endif /* PPC64_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-ppc64/dwarf-config.h b/src/pal/src/libunwind/include/tdep-ppc64/dwarf-config.h
new file mode 100644
index 0000000000..6d8ef0a940
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ppc64/dwarf-config.h
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* For PPC64, 48 GPRs + 33 FPRs + 33 AltiVec + 1 SPE */
+#define DWARF_NUM_PRESERVED_REGS 115
+
+#define DWARF_REGNUM_MAP_LENGTH 115
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian)
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see X86_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-ppc64/jmpbuf.h b/src/pal/src/libunwind/include/tdep-ppc64/jmpbuf.h
new file mode 100644
index 0000000000..861e94d971
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ppc64/jmpbuf.h
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+#define JB_SP 6
+#define JB_RP 7
+#define JB_MASK_SAVED 8
+#define JB_MASK 9
diff --git a/src/pal/src/libunwind/include/tdep-ppc64/libunwind_i.h b/src/pal/src/libunwind/include/tdep-ppc64/libunwind_i.h
new file mode 100644
index 0000000000..975f3bb366
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-ppc64/libunwind_i.h
@@ -0,0 +1,369 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef PPC64_LIBUNWIND_I_H
+#define PPC64_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "elf64.h"
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef struct
+ {
+ /* no ppc64-specific fast trace */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+{
+ struct unw_accessors acc;
+ int big_endian;
+ ppc64_abi_t abi;
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+ int validate;
+};
+
+struct cursor
+{
+ struct dwarf_cursor dwarf; /* must be first */
+
+ /* Format of sigcontext structure and address at which it is
+ stored: */
+ enum
+ {
+ PPC_SCF_NONE, /* no signal frame encountered */
+ PPC_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+};
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_VREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+
+static inline int
+dwarf_getvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_word_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_word_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_LOC_TYPE_V (1 << 2)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_IS_V_LOC(l) (((l).type & DWARF_LOC_TYPE_V) != 0)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+# define DWARF_VREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_V))
+
+static inline int
+dwarf_getvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val)
+{
+ unw_word_t *valp = (unw_word_t *) val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ assert (DWARF_IS_V_LOC (loc));
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp,
+ 0, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 0, c->as_arg);
+}
+
+static inline int
+dwarf_putvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ unw_word_t *valp = (unw_word_t *) & val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ assert (DWARF_IS_V_LOC (loc));
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp,
+ 1, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 1, c->as_arg);
+}
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val)
+{
+ unw_word_t *valp = (unw_word_t *) val;
+ unw_word_t addr;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ assert (DWARF_IS_FP_LOC (loc));
+ assert (!DWARF_IS_V_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 0, c->as_arg);
+
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ unw_word_t *valp = (unw_word_t *) & val;
+ unw_word_t addr;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ assert (DWARF_IS_FP_LOC (loc));
+ assert (!DWARF_IS_V_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+
+ return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 1, c->as_arg);
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t * val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+ assert (!DWARF_IS_V_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+ assert (!DWARF_IS_V_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+#define tdep_get_func_addr UNW_OBJ(get_func_addr)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip,
+ int need_unwind_info);
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+#define tdep_big_endian(as) ((as)->big_endian)
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t * di,
+ unw_proc_info_t * pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (ucontext_t * uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t * valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t * valp, int write);
+extern int tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr,
+ unw_word_t *entry_point);
+
+#endif /* PPC64_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-sh/dwarf-config.h b/src/pal/src/libunwind/include/tdep-sh/dwarf-config.h
new file mode 100644
index 0000000000..2f76f5be7f
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-sh/dwarf-config.h
@@ -0,0 +1,49 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+#define DWARF_NUM_PRESERVED_REGS 18
+
+#define dwarf_to_unw_regnum(reg) (((reg) <= UNW_SH_PR) ? (reg) : 0)
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian)
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-sh/jmpbuf.h b/src/pal/src/libunwind/include/tdep-sh/jmpbuf.h
new file mode 100644
index 0000000000..8b44b5b219
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-sh/jmpbuf.h
@@ -0,0 +1,48 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+/* SH4 glibc jump buffer contents:
+ * 0. r8
+ * 1. r9
+ * 2. r10
+ * 3. r11
+ * 4. r12
+ * 5. r13
+ * 6. r14
+ * 7. r15
+ * 8. pr/pc
+ * 9. gbr
+ * 10. fpscr
+ * 11. fr12
+ * 12. fr13
+ * 13. fr14
+ * 14. fr15
+ */
+
+#define JB_SP 7
+#define JB_RP 8
+#define JB_MASK_SAVED 15
+#define JB_MASK 16
diff --git a/src/pal/src/libunwind/include/tdep-sh/libunwind_i.h b/src/pal/src/libunwind/include/tdep-sh/libunwind_i.h
new file mode 100644
index 0000000000..8ced49104b
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-sh/libunwind_i.h
@@ -0,0 +1,280 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef SH_LIBUNWIND_I_H
+#define SH_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "elf32.h"
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef struct
+ {
+ /* no sh-specific fast trace */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+ int big_endian;
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+ };
+
+struct cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+ enum
+ {
+ SH_SCF_NONE, /* no signal frame */
+ SH_SCF_LINUX_SIGFRAME, /* non-RT signal frame */
+ SH_SCF_LINUX_RT_SIGFRAME, /* RT signal frame */
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+ unw_word_t sigcontext_sp;
+ unw_word_t sigcontext_pc;
+ };
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_word_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_word_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 0, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0,
+ c->as_arg);
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 1, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1,
+ 1, c->as_arg);
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+#define tdep_big_endian(as) ((as)->big_endian)
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+
+#endif /* SH_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-tilegx/dwarf-config.h b/src/pal/src/libunwind/include/tdep-tilegx/dwarf-config.h
new file mode 100644
index 0000000000..93bc6aaecc
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-tilegx/dwarf-config.h
@@ -0,0 +1,50 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* This is FIRST_PSEUDO_REGISTER in GCC, since DWARF_FRAME_REGISTERS is not
+ explicitly defined. */
+#define DWARF_NUM_PRESERVED_REGS 188
+
+#define DWARF_REGNUM_MAP_LENGTH (56 + 2)
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian)
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+{
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */
+#endif
+} dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-tilegx/jmpbuf.h b/src/pal/src/libunwind/include/tdep-tilegx/jmpbuf.h
new file mode 100644
index 0000000000..3afe9e46cc
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-tilegx/jmpbuf.h
@@ -0,0 +1,33 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+/* FIXME for Tilegx! */
+
+#define JB_SP 4
+#define JB_RP 5
+#define JB_MASK_SAVED 6
+#define JB_MASK 7
diff --git a/src/pal/src/libunwind/include/tdep-tilegx/libunwind_i.h b/src/pal/src/libunwind/include/tdep-tilegx/libunwind_i.h
new file mode 100644
index 0000000000..2cfed456a7
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-tilegx/libunwind_i.h
@@ -0,0 +1,263 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef TILEGX_LIBUNWIND_I_H
+#define TILEGX_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+# include "elf64.h"
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef struct
+{
+ /* no Tilegx-specific fast trace */
+} unw_tdep_frame_t;
+
+struct unw_addr_space
+{
+ struct unw_accessors acc;
+
+ int big_endian;
+ tilegx_abi_t abi;
+ unsigned int addr_size;
+
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+};
+
+#define tdep_big_endian(as) ((as)->big_endian)
+
+struct cursor
+{
+ struct dwarf_cursor dwarf; /* must be first */
+ unw_word_t sigcontext_addr;
+ unw_word_t sigcontext_sp;
+ unw_word_t sigcontext_pc;
+};
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifndef UNW_REMOTE_ONLY
+typedef long tilegx_reg_t;
+#endif
+
+#ifdef UNW_LOCAL_ONLY
+#define DWARF_NULL_LOC DWARF_LOC (0, 0)
+#define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+#define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+#define DWARF_IS_REG_LOC(l) 0
+#define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+#define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+#define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \
+ tdep_uc_addr((c)->as_arg, (r)), 0))
+
+/* Tilegx has no FP. */
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ Debug (1, "Tielgx has no fp!\n");
+ abort();
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ Debug (1, "Tielgx has no fp!\n");
+ abort();
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+
+ *val = *(tilegx_reg_t *) (intptr_t) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+
+ *(tilegx_reg_t *) (intptr_t) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+#define DWARF_LOC_TYPE_FP (1 << 0)
+#define DWARF_LOC_TYPE_REG (1 << 1)
+#define DWARF_NULL_LOC DWARF_LOC (0, 0)
+#define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+#define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+#define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+#define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+#define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+#define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+#define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+/* TILEGX has no fp. */
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ Debug (1, "Tielgx has no fp!\n");
+ abort();
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ Debug (1, "Tielgx has no fp!\n");
+ abort();
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_needs_initialization UNW_OBJ(needs_initialization)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+
+#ifdef UNW_LOCAL_ONLY
+#define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+#define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+#define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+#define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as,
+ unw_word_t ip,
+ unw_dyn_info_t *di,
+ unw_proc_info_t *pi,
+ int need_unwind_info,
+ void *arg);
+extern void *tdep_uc_addr (ucontext_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei,
+ pid_t pid, unw_word_t ip,
+ unsigned long *segbase,
+ unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c,
+ unw_regnum_t reg,
+ unw_word_t *valp,
+ int write);
+extern int tdep_access_fpreg (struct cursor *c,
+ unw_regnum_t reg,
+ unw_fpreg_t *valp,
+ int write);
+
+#endif /* TILEGX_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-x86/dwarf-config.h b/src/pal/src/libunwind/include/tdep-x86/dwarf-config.h
new file mode 100644
index 0000000000..f76f9c1c4e
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-x86/dwarf-config.h
@@ -0,0 +1,52 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* This matches the value used by GCC (see
+ gcc/config/i386.h:DWARF_FRAME_REGISTERS), which leaves plenty of
+ room for expansion. */
+#define DWARF_NUM_PRESERVED_REGS 17
+
+#define DWARF_REGNUM_MAP_LENGTH 19
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) 0
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+#ifndef UNW_LOCAL_ONLY
+ unw_word_t type; /* see X86_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-x86/jmpbuf.h b/src/pal/src/libunwind/include/tdep-x86/jmpbuf.h
new file mode 100644
index 0000000000..521dfa6992
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-x86/jmpbuf.h
@@ -0,0 +1,42 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+#if defined __linux__
+
+#define JB_SP 4
+#define JB_RP 5
+#define JB_MASK_SAVED 6
+#define JB_MASK 7
+
+#elif defined __FreeBSD__
+
+#define JB_SP 2
+#define JB_RP 0
+#define JB_MASK_SAVED 11
+#define JB_MASK 7
+
+#endif
diff --git a/src/pal/src/libunwind/include/tdep-x86/libunwind_i.h b/src/pal/src/libunwind/include/tdep-x86/libunwind_i.h
new file mode 100644
index 0000000000..5231189a49
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-x86/libunwind_i.h
@@ -0,0 +1,293 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef X86_LIBUNWIND_I_H
+#define X86_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "elf32.h"
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef struct
+ {
+ /* no x86-specific fast trace */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+ };
+
+struct cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+
+ /* Format of sigcontext structure and address at which it is
+ stored: */
+ enum
+ {
+ X86_SCF_NONE, /* no signal frame encountered */
+ X86_SCF_LINUX_SIGFRAME, /* Linux x86 sigcontext */
+ X86_SCF_LINUX_RT_SIGFRAME, /* POSIX ucontext_t */
+ X86_SCF_FREEBSD_SIGFRAME, /* FreeBSD x86 sigcontext */
+ X86_SCF_FREEBSD_SIGFRAME4, /* FreeBSD 4.x x86 sigcontext */
+ X86_SCF_FREEBSD_OSIGFRAME, /* FreeBSD pre-4.x x86 sigcontext */
+ X86_SCF_FREEBSD_SYSCALL, /* FreeBSD x86 syscall */
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+ int validate;
+ ucontext_t *uc;
+ };
+
+static inline ucontext_t *
+dwarf_get_uc(const struct dwarf_cursor *cursor)
+{
+ const struct cursor *c = (struct cursor *) cursor->as_arg;
+ return c->uc;
+}
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) })
+# define DWARF_IS_REG_LOC(l) 0
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr(dwarf_get_uc(c), (r)), 0))
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ tdep_uc_addr(dwarf_get_uc(c), (r)), 0))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
+ return 0;
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (!DWARF_GET_LOC (loc))
+ return -1;
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#else /* !UNW_LOCAL_ONLY */
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ val, 0, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 0, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0,
+ c->as_arg);
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ char *valp = (char *) &val;
+ unw_word_t addr;
+ int ret;
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc),
+ &val, 1, c->as_arg);
+
+ addr = DWARF_GET_LOC (loc);
+ if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp,
+ 1, c->as_arg)) < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1,
+ 1, c->as_arg);
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ /* If a code-generator were to save a value of type unw_word_t in a
+ floating-point register, we would have to support this case. I
+ suppose it could happen with MMX registers, but does it really
+ happen? */
+ assert (!DWARF_IS_FP_LOC (loc));
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+#define tdep_getcontext_trace unw_getcontext
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#define tdep_fetch_frame(c,ip,n) do {} while(0)
+#define tdep_cache_frame(c) 0
+#define tdep_reuse_frame(c,frame) do {} while(0)
+#define tdep_stash_frame(c,rs) do {} while(0)
+#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+#define tdep_big_endian(as) 0
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern void *tdep_uc_addr (ucontext_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+
+#endif /* X86_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep-x86_64/dwarf-config.h b/src/pal/src/libunwind/include/tdep-x86_64/dwarf-config.h
new file mode 100644
index 0000000000..ff77808e06
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-x86_64/dwarf-config.h
@@ -0,0 +1,57 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* copy of include/tdep-x86/dwarf-config.h, modified slightly for x86-64
+ some consolidation is possible here */
+
+#ifndef dwarf_config_h
+#define dwarf_config_h
+
+/* XXX need to verify if this value is correct */
+#ifdef CONFIG_MSABI_SUPPORT
+#define DWARF_NUM_PRESERVED_REGS 33
+#else
+#define DWARF_NUM_PRESERVED_REGS 17
+#endif
+
+#define DWARF_REGNUM_MAP_LENGTH DWARF_NUM_PRESERVED_REGS
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) 0
+
+/* Convert a pointer to a dwarf_cursor structure to a pointer to
+ unw_cursor_t. */
+#define dwarf_to_cursor(c) ((unw_cursor_t *) (c))
+
+typedef struct dwarf_loc
+ {
+ unw_word_t val;
+ unw_word_t type; /* see X86_LOC_TYPE_* macros. */
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff --git a/src/pal/src/libunwind/include/tdep-x86_64/jmpbuf.h b/src/pal/src/libunwind/include/tdep-x86_64/jmpbuf.h
new file mode 100644
index 0000000000..d57196676d
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-x86_64/jmpbuf.h
@@ -0,0 +1,43 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#if defined __linux__
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+#define JB_SP 6
+#define JB_RP 7
+#define JB_MASK_SAVED 8
+#define JB_MASK 9
+
+#elif defined __FreeBSD__
+
+#define JB_SP 2
+#define JB_RP 0
+/* Pretend the ip cannot be 0 and mask is always saved */
+#define JB_MASK_SAVED 0
+#define JB_MASK 9
+
+#endif
diff --git a/src/pal/src/libunwind/include/tdep-x86_64/libunwind_i.h b/src/pal/src/libunwind/include/tdep-x86_64/libunwind_i.h
new file mode 100644
index 0000000000..283525c16a
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep-x86_64/libunwind_i.h
@@ -0,0 +1,264 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef X86_64_LIBUNWIND_I_H
+#define X86_64_LIBUNWIND_I_H
+
+/* Target-dependent definitions that are internal to libunwind but need
+ to be shared with target-independent code. */
+
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "elf64.h"
+#include "mempool.h"
+#include "dwarf.h"
+
+typedef enum
+ {
+ UNW_X86_64_FRAME_ALIGNED = -3, /* frame stack pointer aligned */
+ UNW_X86_64_FRAME_STANDARD = -2, /* regular rbp, rsp +/- offset */
+ UNW_X86_64_FRAME_SIGRETURN = -1, /* special sigreturn frame */
+ UNW_X86_64_FRAME_OTHER = 0, /* not cacheable (special or unrecognised) */
+ UNW_X86_64_FRAME_GUESSED = 1 /* guessed it was regular, but not known */
+ }
+unw_tdep_frame_type_t;
+
+typedef struct
+ {
+ uint64_t virtual_address;
+ int64_t frame_type : 3; /* unw_tdep_frame_type_t classification */
+ int64_t last_frame : 1; /* non-zero if last frame in chain */
+ int64_t cfa_reg_rsp : 1; /* cfa dwarf base register is rsp vs. rbp */
+ int64_t cfa_reg_offset : 29; /* cfa is at this offset from base register value */
+ int64_t rbp_cfa_offset : 15; /* rbp saved at this offset from cfa (-1 = not saved) */
+ int64_t rsp_cfa_offset : 15; /* rsp saved at this offset from cfa (-1 = not saved) */
+ }
+unw_tdep_frame_t;
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+ unw_caching_policy_t caching_policy;
+#ifdef HAVE_ATOMIC_OPS_H
+ AO_t cache_generation;
+#else
+ uint32_t cache_generation;
+#endif
+ unw_word_t dyn_generation; /* see dyn-common.h */
+ unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */
+ struct dwarf_rs_cache global_cache;
+ struct unw_debug_frame_list *debug_frames;
+ };
+
+struct cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+
+ unw_tdep_frame_t frame_info; /* quick tracing assist info */
+
+ /* Format of sigcontext structure and address at which it is
+ stored: */
+ enum
+ {
+ X86_64_SCF_NONE, /* no signal frame encountered */
+ X86_64_SCF_LINUX_RT_SIGFRAME, /* Linux ucontext_t */
+ X86_64_SCF_FREEBSD_SIGFRAME, /* FreeBSD signal frame */
+ X86_64_SCF_FREEBSD_SYSCALL, /* FreeBSD syscall */
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+ int validate;
+ ucontext_t *uc;
+ };
+
+static inline ucontext_t *
+dwarf_get_uc(const struct dwarf_cursor *cursor)
+{
+ const struct cursor *c = (struct cursor *) cursor->as_arg;
+ return c->uc;
+}
+
+#define DWARF_GET_LOC(l) ((l).val)
+# define DWARF_LOC_TYPE_MEM (0 << 0)
+# define DWARF_LOC_TYPE_FP (1 << 0)
+# define DWARF_LOC_TYPE_REG (1 << 1)
+# define DWARF_LOC_TYPE_VAL (1 << 2)
+
+# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0)
+# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0)
+# define DWARF_IS_MEM_LOC(l) ((l).type == DWARF_LOC_TYPE_MEM)
+# define DWARF_IS_VAL_LOC(l) (((l).type & DWARF_LOC_TYPE_VAL) != 0)
+
+# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) })
+# define DWARF_VAL_LOC(c,v) DWARF_LOC ((v), DWARF_LOC_TYPE_VAL)
+# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), DWARF_LOC_TYPE_MEM)
+
+#ifdef UNW_LOCAL_ONLY
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0)
+# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0))
+# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
+ x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0))
+
+#else /* !UNW_LOCAL_ONLY */
+
+# define DWARF_NULL_LOC DWARF_LOC (0, 0)
+# define DWARF_IS_NULL_LOC(l) \
+ ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; })
+# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG)
+# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
+ | DWARF_LOC_TYPE_FP))
+
+#endif /* !UNW_LOCAL_ONLY */
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ abort ();
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ abort ();
+}
+
+static inline int
+dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ if (DWARF_IS_MEM_LOC (loc))
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val,
+ 0, c->as_arg);
+ assert(DWARF_IS_VAL_LOC (loc));
+ *val = DWARF_GET_LOC (loc);
+ return 0;
+}
+
+static inline int
+dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
+{
+ assert(!DWARF_IS_VAL_LOC (loc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+ if (DWARF_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+ else
+ return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val,
+ 1, c->as_arg);
+}
+
+#define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace)
+#define tdep_init_done UNW_OBJ(init_done)
+#define tdep_init_mem_validate UNW_OBJ(init_mem_validate)
+#define tdep_init UNW_OBJ(init)
+/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
+ tdep_search_unwind_table. */
+#define tdep_search_unwind_table dwarf_search_unwind_table
+#define tdep_find_unwind_table dwarf_find_unwind_table
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+#if __linux__
+# define tdep_fetch_frame UNW_OBJ(fetch_frame)
+# define tdep_cache_frame UNW_OBJ(cache_frame)
+# define tdep_reuse_frame UNW_OBJ(reuse_frame)
+#else
+# define tdep_fetch_frame(c,ip,n) do {} while(0)
+# define tdep_cache_frame(c) 0
+# define tdep_reuse_frame(c,frame) do {} while(0)
+#endif
+#define tdep_stash_frame UNW_OBJ(stash_frame)
+#define tdep_trace UNW_OBJ(tdep_trace)
+#define x86_64_r_uc_addr UNW_OBJ(r_uc_addr)
+
+#ifdef UNW_LOCAL_ONLY
+# define tdep_find_proc_info(c,ip,n) \
+ dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ dwarf_put_unwind_info((as), (pi), (arg))
+#else
+# define tdep_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define tdep_put_unwind_info(as,pi,arg) \
+ (*(as)->acc.put_unwind_info)((as), (pi), (arg))
+#endif
+
+#define tdep_get_as(c) ((c)->dwarf.as)
+#define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
+#define tdep_get_ip(c) ((c)->dwarf.ip)
+#define tdep_big_endian(as) 0
+
+extern int tdep_init_done;
+
+extern void tdep_init (void);
+extern void tdep_init_mem_validate (void);
+extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg);
+extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen);
+extern void tdep_get_exe_image_path (char *path);
+extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
+ unw_word_t *valp, int write);
+extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
+ unw_fpreg_t *valp, int write);
+#if __linux__
+extern void tdep_fetch_frame (struct dwarf_cursor *c, unw_word_t ip,
+ int need_unwind_info);
+extern int tdep_cache_frame (struct dwarf_cursor *c);
+extern void tdep_reuse_frame (struct dwarf_cursor *c,
+ int frame);
+extern void tdep_stash_frame (struct dwarf_cursor *c,
+ struct dwarf_reg_state *rs);
+#endif
+
+extern int tdep_getcontext_trace (unw_tdep_context_t *);
+extern int tdep_trace (unw_cursor_t *cursor, void **addresses, int *n);
+
+#endif /* X86_64_LIBUNWIND_I_H */
diff --git a/src/pal/src/libunwind/include/tdep/dwarf-config.h b/src/pal/src/libunwind/include/tdep/dwarf-config.h
new file mode 100644
index 0000000000..c759a46c63
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep/dwarf-config.h
@@ -0,0 +1,28 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#if defined __aarch64__
+# include "tdep-aarch64/dwarf-config.h"
+#elif defined __arm__
+# include "tdep-arm/dwarf-config.h"
+#elif defined __hppa__
+# include "tdep-hppa/dwarf-config.h"
+#elif defined __ia64__
+# include "tdep-ia64/dwarf-config.h"
+#elif defined __mips__
+# include "tdep-mips/dwarf-config.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "tdep-ppc32/dwarf-config.h"
+#elif defined __powerpc64__
+# include "tdep-ppc64/dwarf-config.h"
+#elif defined __sh__
+# include "tdep-sh/dwarf-config.h"
+#elif defined __i386__
+# include "tdep-x86/dwarf-config.h"
+#elif defined __x86_64__ || defined __amd64__
+# include "tdep-x86_64/dwarf-config.h"
+#elif defined __tilegx__
+# include "tdep-tilegx/dwarf-config.h"
+#else
+# error "Unsupported arch"
+#endif
diff --git a/src/pal/src/libunwind/include/tdep/jmpbuf.h b/src/pal/src/libunwind/include/tdep/jmpbuf.h
new file mode 100644
index 0000000000..13093a0cdc
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep/jmpbuf.h
@@ -0,0 +1,30 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+# include "tdep-aarch64/jmpbuf.h"
+#elif defined __arm__
+# include "tdep-arm/jmpbuf.h"
+#elif defined __hppa__
+# include "tdep-hppa/jmpbuf.h"
+#elif defined __ia64__
+# include "tdep-ia64/jmpbuf.h"
+#elif defined __mips__
+# include "tdep-mips/jmpbuf.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "tdep-ppc32/jmpbuf.h"
+#elif defined __powerpc64__
+# include "tdep-ppc64/jmpbuf.h"
+#elif defined __i386__
+# include "tdep-x86/jmpbuf.h"
+#elif defined __x86_64__
+# include "tdep-x86_64/jmpbuf.h"
+#elif defined __tilegx__
+# include "tdep-tilegx/jmpbuf.h"
+#else
+# error "Unsupported arch"
+#endif
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/include/tdep/libunwind_i.h.in b/src/pal/src/libunwind/include/tdep/libunwind_i.h.in
new file mode 100644
index 0000000000..af05a7fba2
--- /dev/null
+++ b/src/pal/src/libunwind/include/tdep/libunwind_i.h.in
@@ -0,0 +1,37 @@
+/* Provide a real file - not a symlink - as it would cause multiarch conflicts
+ when multiple different arch releases are installed simultaneously. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined __aarch64__
+# include "tdep-aarch64/libunwind_i.h"
+#elif defined __arm__
+# include "tdep-arm/libunwind_i.h"
+#elif defined __hppa__
+# include "tdep-hppa/libunwind_i.h"
+#elif defined __ia64__
+# include "tdep-ia64/libunwind_i.h"
+#elif defined __mips__
+# include "tdep-mips/libunwind_i.h"
+#elif defined __powerpc__ && !defined __powerpc64__
+# include "tdep-ppc32/libunwind_i.h"
+#elif defined __powerpc64__
+# include "tdep-ppc64/libunwind_i.h"
+#elif defined __sh__
+# include "tdep-sh/libunwind_i.h"
+#elif defined __i386__
+# include "tdep-x86/libunwind_i.h"
+#elif defined __x86_64__
+# include "tdep-x86_64/libunwind_i.h"
+#elif defined __tilegx__
+# include "tdep-tilegx/libunwind_i.h"
+#else
+# error "Unsupported arch"
+#endif
+
+
+#else /* UNW_REMOTE_ONLY */
+
+# include "tdep-@arch@/libunwind_i.h"
+
+#endif /* UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/include/unwind.h b/src/pal/src/libunwind/include/unwind.h
new file mode 100644
index 0000000000..7cf128deca
--- /dev/null
+++ b/src/pal/src/libunwind/include/unwind.h
@@ -0,0 +1,154 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef _UNWIND_H
+#define _UNWIND_H
+
+/* For uint64_t */
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Minimal interface as per C++ ABI draft standard:
+
+ http://www.codesourcery.com/cxx-abi/abi-eh.html */
+
+typedef enum
+ {
+ _URC_NO_REASON = 0,
+ _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
+ _URC_FATAL_PHASE2_ERROR = 2,
+ _URC_FATAL_PHASE1_ERROR = 3,
+ _URC_NORMAL_STOP = 4,
+ _URC_END_OF_STACK = 5,
+ _URC_HANDLER_FOUND = 6,
+ _URC_INSTALL_CONTEXT = 7,
+ _URC_CONTINUE_UNWIND = 8
+ }
+_Unwind_Reason_Code;
+
+typedef int _Unwind_Action;
+
+#define _UA_SEARCH_PHASE 1
+#define _UA_CLEANUP_PHASE 2
+#define _UA_HANDLER_FRAME 4
+#define _UA_FORCE_UNWIND 8
+
+struct _Unwind_Context; /* opaque data-structure */
+struct _Unwind_Exception; /* forward-declaration */
+
+typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
+ struct _Unwind_Exception *);
+
+typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action,
+ uint64_t,
+ struct _Unwind_Exception *,
+ struct _Unwind_Context *,
+ void *);
+
+/* The C++ ABI requires exception_class, private_1, and private_2 to
+ be of type uint64 and the entire structure to be
+ double-word-aligned. Please note that exception_class stays 64-bit
+ even on 32-bit machines for gcc compatibility. */
+struct _Unwind_Exception
+ {
+ uint64_t exception_class;
+ _Unwind_Exception_Cleanup_Fn exception_cleanup;
+ unsigned long private_1;
+ unsigned long private_2;
+ } __attribute__((__aligned__));
+
+extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
+extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
+ _Unwind_Stop_Fn, void *);
+extern void _Unwind_Resume (struct _Unwind_Exception *);
+extern void _Unwind_DeleteException (struct _Unwind_Exception *);
+extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int);
+extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long);
+extern unsigned long _Unwind_GetIP (struct _Unwind_Context *);
+extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
+extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long);
+extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*);
+extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *);
+
+#ifdef _GNU_SOURCE
+
+/* Callback for _Unwind_Backtrace(). The backtrace stops immediately
+ if the callback returns any value other than _URC_NO_REASON. */
+typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *,
+ void *);
+
+/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why
+ _UA_END_OF_STACK exists. */
+# define _UA_END_OF_STACK 16
+
+/* If the unwind was initiated due to a forced unwind, resume that
+ operation, else re-raise the exception. This is used by
+ __cxa_rethrow(). */
+extern _Unwind_Reason_Code
+ _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *);
+
+/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why
+ _Unwind_GetBSP() exists. */
+extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *);
+
+/* Return the "canonical frame address" for the given context.
+ This is used by NPTL... */
+extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *);
+
+/* Return the base-address for data references. */
+extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *);
+
+/* Return the base-address for text references. */
+extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *);
+
+/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any
+ cleanup. The first frame for which the callback is invoked is the
+ one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace()
+ returns _URC_END_OF_STACK when the backtrace stopped due to
+ reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it
+ stops for any other reason. */
+extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *);
+
+/* Find the start-address of the procedure containing the specified IP
+ or NULL if it cannot be found (e.g., because the function has no
+ unwind info). Note: there is not necessarily a one-to-one
+ correspondence between source-level functions and procedures: some
+ functions don't have unwind-info and others are split into multiple
+ procedures. */
+extern void *_Unwind_FindEnclosingFunction (void *);
+
+/* See also Linux Standard Base Spec:
+ http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */
+
+#endif /* _GNU_SOURCE */
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _UNWIND_H */
diff --git a/src/pal/src/libunwind/include/x86/jmpbuf.h b/src/pal/src/libunwind/include/x86/jmpbuf.h
new file mode 100644
index 0000000000..94d5984f08
--- /dev/null
+++ b/src/pal/src/libunwind/include/x86/jmpbuf.h
@@ -0,0 +1,31 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Use glibc's jump-buffer indices; NPTL peeks at SP: */
+
+#define JB_SP 4
+#define JB_RP 5
+#define JB_MASK_SAVED 6
+#define JB_MASK 7
diff --git a/src/pal/src/libunwind/scripts/kernel-diff.sh b/src/pal/src/libunwind/scripts/kernel-diff.sh
new file mode 100755
index 0000000000..459194e15a
--- /dev/null
+++ b/src/pal/src/libunwind/scripts/kernel-diff.sh
@@ -0,0 +1,10 @@
+kdir=${1:-../kernel}
+scriptdir=$(dirname $0)
+udir=$(dirname $scriptdir)
+cat $scriptdir/kernel-files.txt | \
+(while read l r; do
+ left=$(eval echo $l)
+ right=$(eval echo $r)
+# echo $left $right
+ diff -up $left $right
+done)
diff --git a/src/pal/src/libunwind/scripts/kernel-files.txt b/src/pal/src/libunwind/scripts/kernel-files.txt
new file mode 100644
index 0000000000..d79e453a33
--- /dev/null
+++ b/src/pal/src/libunwind/scripts/kernel-files.txt
@@ -0,0 +1,19 @@
+$udir/include/tdep-ia64/rse.h $kdir/arch/ia64/unwind/rse.h
+$udir/src/ia64/Ginit_local.c $kdir/arch/ia64/unwind/init_local.c
+$udir/src/ia64/Gis_signal_frame.c $kdir/arch/ia64/unwind/is_signal_frame.c
+$udir/src/ia64/Gparser.c $kdir/arch/ia64/unwind/parser.c
+$udir/src/ia64/Grbs.c $kdir/arch/ia64/unwind/rbs.c
+$udir/src/ia64/Gregs.c $kdir/arch/ia64/unwind/regs.c
+$udir/src/ia64/Gscript.c $kdir/arch/ia64/unwind/script.c
+$udir/src/ia64/Gstep.c $kdir/arch/ia64/unwind/step.c
+$udir/src/ia64/init.h $kdir/arch/ia64/unwind/init.h
+$udir/src/ia64/offsets.h $kdir/arch/ia64/unwind/offsets.h
+$udir/src/ia64/regname.c $kdir/arch/ia64/unwind/regname.c
+$udir/src/ia64/regs.h $kdir/arch/ia64/unwind/regs.h
+$udir/src/ia64/unwind_decoder.h $kdir/arch/ia64/unwind/unwind_decoder.h
+$udir/src/mi/Gget_fpreg.c $kdir/unwind/get_fpreg.c
+$udir/src/mi/Gget_reg.c $kdir/unwind/get_reg.c
+$udir/src/mi/Gset_fpreg.c $kdir/unwind/set_fpreg.c
+$udir/src/mi/Gset_reg.c $kdir/unwind/set_reg.c
+$udir/src/mi/flush_cache.c $kdir/unwind/flush_cache.c
+$udir/src/mi/mempool.c $kdir/unwind/mempool.c
diff --git a/src/pal/src/libunwind/scripts/make-L-files b/src/pal/src/libunwind/scripts/make-L-files
new file mode 100755
index 0000000000..8280e3d76a
--- /dev/null
+++ b/src/pal/src/libunwind/scripts/make-L-files
@@ -0,0 +1,30 @@
+#!/bin/sh
+cwd=`pwd`
+dir=`basename ${cwd}`
+#
+# When compiling a file that goes into libunwind, we only
+# need to compile it when we really do support UNW_LOCAL_ONLY.
+# In contrast, libunwind-tests should always get compiled.
+#
+if test $dir = "tests"; then
+ local_only_test=""
+else
+ local_only_test="defined(UNW_LOCAL_ONLY) && "
+fi
+for gname in `ls G*.c G*.cxx G*.S 2>/dev/null`; do
+ lname="L$(expr $gname : '.\(.*\)')"
+ bk edit $lname >/dev/null 2>&1
+ ext=$(expr $gname : '[^.]*[.]\(.*\)')
+ if [ "$ext" = "S" ]; then
+ include=""
+ else
+ include="#include <libunwind.h>"
+ fi
+ echo -e "\
+#define UNW_LOCAL_ONLY\n\
+$include\n\
+#if ${local_only_test}!defined(UNW_REMOTE_ONLY)\n\
+#include \"$gname\"\n\
+#endif" > $lname
+ echo created $lname
+done
diff --git a/src/pal/src/libunwind/src/CMakeLists.txt b/src/pal/src/libunwind/src/CMakeLists.txt
new file mode 100644
index 0000000000..537177716d
--- /dev/null
+++ b/src/pal/src/libunwind/src/CMakeLists.txt
@@ -0,0 +1,337 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+project(unwind)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+
+include(configure.cmake)
+
+# The HAVE___THREAD set to 1 causes creation of thread local variable with tls_model("initial-exec")
+# which is incompatible with usage of the unwind code in a shared library.
+add_definitions(-DHAVE___THREAD=0)
+add_definitions(-DHAVE_CONFIG_H=1)
+
+add_definitions(-DPACKAGE_STRING="")
+add_definitions(-DPACKAGE_BUGREPORT="")
+
+add_definitions(-D_GNU_SOURCE)
+
+add_compile_options(-Wno-header-guard)
+
+if(CLR_CMAKE_PLATFORM_ARCH_ARM)
+ # Disable warning in asm: use of SP or PC in the list is deprecated
+ add_compile_options(-Wno-inline-asm)
+ # Disable warning due to labs function called on unsigned argument
+ add_compile_options(-Wno-absolute-value)
+ # Disable warning due to incorrect format specifier in debugging printf via the Debug macro
+ add_compile_options(-Wno-format)
+ # Disable warning for a bug in the libunwind source src/arm/Gtrace.c:529, but not in code that we exercise
+ add_compile_options(-Wno-implicit-function-declaration)
+ # We compile code with -std=c99 and the asm keyword is not recognized as it is a gnu extension
+ add_definitions(-Dasm=__asm__)
+ # The arm sources include ex_tables.h from include/tdep-arm without going through a redirection
+ # in include/tdep like it works for similar files on other architectures. So we need to add
+ # the include/tdep-arm to include directories
+ include_directories(../include/tdep-arm)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+ # Disable warning due to labs function called on unsigned argument
+ add_compile_options(-Wno-absolute-value)
+ # We compile code with -std=c99 and the asm keyword is not recognized as it is a gnu extension
+ add_definitions(-Dasm=__asm__)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+ # Disable warning due to incorrect format specifier in debugging printf via the Debug macro
+ add_compile_options(-Wno-format)
+ # Disable warning for a bug in the libunwind source src/x86/Gos-linux.c, but not in code that we exercise
+ add_compile_options(-Wno-incompatible-pointer-types)
+endif()
+
+SET(libunwind_ptrace_la_SOURCES
+ ptrace/_UPT_elf.c
+ ptrace/_UPT_accessors.c ptrace/_UPT_access_fpreg.c
+ ptrace/_UPT_access_mem.c ptrace/_UPT_access_reg.c
+ ptrace/_UPT_create.c ptrace/_UPT_destroy.c
+ ptrace/_UPT_find_proc_info.c ptrace/_UPT_get_dyn_info_list_addr.c
+ ptrace/_UPT_put_unwind_info.c ptrace/_UPT_get_proc_name.c
+ ptrace/_UPT_reg_offset.c ptrace/_UPT_resume.c
+)
+
+SET(libunwind_coredump_la_SOURCES
+ coredump/_UCD_accessors.c
+ coredump/_UCD_create.c
+ coredump/_UCD_destroy.c
+ coredump/_UCD_access_mem.c
+ coredump/_UCD_elf_map_image.c
+ coredump/_UCD_find_proc_info.c
+ coredump/_UCD_get_proc_name.c
+
+ coredump/_UPT_elf.c
+ coredump/_UPT_access_fpreg.c
+ coredump/_UPT_get_dyn_info_list_addr.c
+ coredump/_UPT_put_unwind_info.c
+ coredump/_UPT_resume.c
+)
+
+# List of arch-independent files needed by generic library (libunwind-$ARCH):
+SET(libunwind_la_SOURCES_generic
+ mi/Gdyn-extract.c mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c
+ mi/Gget_accessors.c
+ mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c
+ mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c
+ mi/Gget_reg.c mi/Gset_reg.c
+ mi/Gget_fpreg.c mi/Gset_fpreg.c
+ mi/Gset_caching_policy.c
+ mi/Gset_cache_size.c
+)
+
+SET(libunwind_la_SOURCES_os_linux
+ os-linux.c
+)
+
+SET(libunwind_la_SOURCES_os_linux_local
+# Nothing when we don't want to support CXX exceptions
+)
+
+SET(libunwind_la_SOURCES_os_freebsd
+ os-freebsd.c
+)
+
+SET(libunwind_la_SOURCES_os_freebsd_local
+# Nothing
+)
+
+if(CLR_CMAKE_PLATFORM_LINUX)
+ SET(libunwind_la_SOURCES_os ${libunwind_la_SOURCES_os_linux})
+ SET(libunwind_la_SOURCES_os_local ${libunwind_la_SOURCES_os_linux_local})
+ SET(libunwind_la_SOURCES_x86_os x86/Gos-linux.c)
+ SET(libunwind_x86_la_SOURCES_os x86/getcontext-linux.S)
+ SET(libunwind_la_SOURCES_x86_os_local x86/Los-linux.c)
+ SET(libunwind_la_SOURCES_x86_64_os x86_64/Gos-linux.c)
+ SET(libunwind_la_SOURCES_x86_64_os_local x86_64/Los-linux.c)
+ SET(libunwind_la_SOURCES_arm_os arm/Gos-linux.c)
+ SET(libunwind_la_SOURCES_arm_os_local arm/Los-linux.c)
+ list(APPEND libunwind_coredump_la_SOURCES coredump/_UCD_access_reg_linux.c)
+elseif(CLR_CMAKE_PLATFORM_FREEBSD)
+ SET(libunwind_la_SOURCES_os ${libunwind_la_SOURCES_os_freebsd})
+ SET(libunwind_la_SOURCES_os_local ${libunwind_la_SOURCES_os_freebsd_local})
+ SET(libunwind_la_SOURCES_x86_os x86/Gos-freebsd.c)
+ SET(libunwind_x86_la_SOURCES_os x86/getcontext-freebsd.S)
+ SET(libunwind_la_SOURCES_x86_os_local x86/Los-freebsd.c)
+ SET(libunwind_la_SOURCES_x86_64_os x86_64/Gos-freebsd.c)
+ SET(libunwind_la_SOURCES_x86_64_os_local x86_64/Los-freebsd.c)
+ SET(libunwind_la_SOURCES_arm_os arm/Gos-freebsd.c)
+ SET(libunwind_la_SOURCES_arm_os_local arm/Los-freebsd.c)
+ list(APPEND libunwind_coredump_la_SOURCES coredump/_UCD_access_reg_freebsd.c)
+endif()
+
+# List of arch-independent files needed by both local-only and generic
+# libraries:
+SET(libunwind_la_SOURCES_common
+ ${libunwind_la_SOURCES_os}
+ mi/init.c mi/flush_cache.c mi/mempool.c mi/strerror.c
+)
+
+SET(libunwind_la_SOURCES_local_unwind
+# Nothing when we don't want to support CXX exceptions
+)
+
+# List of arch-independent files needed by local-only library (libunwind):
+SET(libunwind_la_SOURCES_local_nounwind
+ ${libunwind_la_SOURCES_os_local}
+ mi/backtrace.c
+ mi/dyn-cancel.c mi/dyn-info-list.c mi/dyn-register.c
+ mi/Ldyn-extract.c mi/Lfind_dynamic_proc_info.c
+ mi/Lget_accessors.c
+ mi/Lget_proc_info_by_ip.c mi/Lget_proc_name.c
+ mi/Lput_dynamic_unwind_info.c mi/Ldestroy_addr_space.c
+ mi/Lget_reg.c mi/Lset_reg.c
+ mi/Lget_fpreg.c mi/Lset_fpreg.c
+ mi/Lset_caching_policy.c
+ mi/Lset_cache_size.c
+)
+
+SET(libunwind_la_SOURCES_local
+ ${libunwind_la_SOURCES_local_nounwind}
+ ${libunwind_la_SOURCES_local_unwind}
+)
+
+SET(libunwind_dwarf_common_la_SOURCES
+ dwarf/global.c
+)
+
+SET(libunwind_dwarf_local_la_SOURCES
+ dwarf/Lexpr.c dwarf/Lfde.c dwarf/Lparser.c dwarf/Lpe.c
+ dwarf/Lfind_proc_info-lsb.c
+ dwarf/Lfind_unwind_table.c
+)
+
+SET(libunwind_dwarf_generic_la_SOURCES
+ dwarf/Gexpr.c dwarf/Gfde.c dwarf/Gparser.c dwarf/Gpe.c
+ dwarf/Gfind_proc_info-lsb.c
+ dwarf/Gfind_unwind_table.c
+)
+
+SET(libunwind_elf32_la_SOURCES
+ elf32.c
+)
+
+SET(libunwind_elf64_la_SOURCES
+ elf64.c
+)
+SET(libunwind_elfxx_la_SOURCES
+ elfxx.c
+)
+
+# The list of files that go into libunwind and libunwind-aarch64:
+SET(libunwind_la_SOURCES_aarch64_common
+ ${libunwind_la_SOURCES_common}
+ aarch64/is_fpreg.c
+ aarch64/regname.c
+)
+
+# The list of files that go into libunwind:
+SET(libunwind_la_SOURCES_aarch64
+ ${libunwind_la_SOURCES_aarch64_common}
+ ${libunwind_la_SOURCES_local}
+ aarch64/Lapply_reg_state.c aarch64/Lreg_states_iterate.c
+ aarch64/Lcreate_addr_space.c aarch64/Lget_proc_info.c
+ aarch64/Lget_save_loc.c aarch64/Lglobal.c aarch64/Linit.c
+ aarch64/Linit_local.c aarch64/Linit_remote.c
+ aarch64/Lis_signal_frame.c aarch64/Lregs.c aarch64/Lresume.c
+ aarch64/Lstash_frame.c aarch64/Lstep.c aarch64/Ltrace.c
+ aarch64/getcontext.S
+)
+
+SET(libunwind_aarch64_la_SOURCES_aarch64
+ ${libunwind_la_SOURCES_aarch64_common}
+ ${libunwind_la_SOURCES_generic}
+ aarch64/Gapply_reg_state.c aarch64/Greg_states_iterate.c
+ aarch64/Gcreate_addr_space.c aarch64/Gget_proc_info.c
+ aarch64/Gget_save_loc.c aarch64/Gglobal.c aarch64/Ginit.c
+ aarch64/Ginit_local.c aarch64/Ginit_remote.c
+ aarch64/Gis_signal_frame.c aarch64/Gregs.c aarch64/Gresume.c
+ aarch64/Gstash_frame.c aarch64/Gstep.c aarch64/Gtrace.c
+)
+
+# The list of files that go into libunwind and libunwind-arm:
+SET(libunwind_la_SOURCES_arm_common
+ ${libunwind_la_SOURCES_common}
+ arm/is_fpreg.c arm/regname.c
+)
+
+# The list of files that go into libunwind:
+SET(libunwind_la_SOURCES_arm
+ ${libunwind_la_SOURCES_arm_common}
+ ${libunwind_la_SOURCES_arm_os_local}
+ ${libunwind_la_SOURCES_local}
+ arm/getcontext.S
+ arm/Lapply_reg_state.c arm/Lreg_states_iterate.c
+ arm/Lcreate_addr_space.c arm/Lget_proc_info.c arm/Lget_save_loc.c
+ arm/Lglobal.c arm/Linit.c arm/Linit_local.c arm/Linit_remote.c
+ arm/Lregs.c arm/Lresume.c arm/Lstep.c
+ arm/Lex_tables.c arm/Lstash_frame.c arm/Ltrace.c
+)
+
+# The list of files that go into libunwind-arm:
+SET(libunwind_arm_la_SOURCES_arm
+ ${libunwind_la_SOURCES_arm_common}
+ ${libunwind_la_SOURCES_arm_os}
+ ${libunwind_la_SOURCES_generic}
+ arm/Gapply_reg_state.c arm/Greg_states_iterate.c
+ arm/Gcreate_addr_space.c arm/Gget_proc_info.c arm/Gget_save_loc.c
+ arm/Gglobal.c arm/Ginit.c arm/Ginit_local.c arm/Ginit_remote.c
+ arm/Gregs.c arm/Gresume.c arm/Gstep.c
+ arm/Gex_tables.c arm/Gstash_frame.c arm/Gtrace.c
+)
+
+# The list of files that go both into libunwind and libunwind-x86:
+SET(libunwind_la_SOURCES_x86_common
+ ${libunwind_la_SOURCES_common}
+ x86/is_fpreg.c x86/regname.c
+)
+
+# The list of files that go into libunwind:
+SET(libunwind_la_SOURCES_x86
+ ${libunwind_la_SOURCES_x86_common}
+ ${libunwind_la_SOURCES_x86_os_local}
+ ${libunwind_la_SOURCES_local}
+ x86/Lapply_reg_state.c x86/Lreg_states_iterate.c
+ x86/Lcreate_addr_space.c x86/Lget_save_loc.c x86/Lglobal.c
+ x86/Linit.c x86/Linit_local.c x86/Linit_remote.c
+ x86/Lget_proc_info.c x86/Lregs.c
+ x86/Lresume.c x86/Lstep.c
+)
+
+# The list of files that go into libunwind-x86:
+SET(libunwind_x86_la_SOURCES_x86
+ ${libunwind_la_SOURCES_x86_common}
+ ${libunwind_la_SOURCES_x86_os}
+ ${libunwind_la_SOURCES_generic}
+ x86/Gapply_reg_state.c x86/Greg_states_iterate.c
+ x86/Gcreate_addr_space.c x86/Gget_save_loc.c x86/Gglobal.c
+ x86/Ginit.c x86/Ginit_local.c x86/Ginit_remote.c
+ x86/Gget_proc_info.c x86/Gregs.c
+ x86/Gresume.c x86/Gstep.c
+)
+
+# The list of files that go both into libunwind and libunwind-x86_64:
+SET(libunwind_la_SOURCES_x86_64_common
+ ${libunwind_la_SOURCES_common}
+ x86_64/is_fpreg.c x86_64/regname.c
+)
+
+# The list of files that go into libunwind:
+SET(libunwind_la_SOURCES_x86_64
+ ${libunwind_la_SOURCES_x86_64_common}
+ ${libunwind_la_SOURCES_x86_64_os_local}
+ ${libunwind_la_SOURCES_local}
+ x86_64/setcontext.S
+ x86_64/Lapply_reg_state.c x86_64/Lreg_states_iterate.c
+ x86_64/Lcreate_addr_space.c x86_64/Lget_save_loc.c x86_64/Lglobal.c
+ x86_64/Linit.c x86_64/Linit_local.c x86_64/Linit_remote.c
+ x86_64/Lget_proc_info.c x86_64/Lregs.c x86_64/Lresume.c
+ x86_64/Lstash_frame.c x86_64/Lstep.c x86_64/Ltrace.c x86_64/getcontext.S
+)
+
+# The list of files that go into libunwind-x86_64:
+SET(libunwind_x86_64_la_SOURCES_x86_64
+ ${libunwind_la_SOURCES_x86_64_common}
+ ${libunwind_la_SOURCES_x86_64_os}
+ ${libunwind_la_SOURCES_generic}
+ x86_64/Gapply_reg_state.c x86_64/Greg_states_iterate.c
+ x86_64/Gcreate_addr_space.c x86_64/Gget_save_loc.c x86_64/Gglobal.c
+ x86_64/Ginit.c x86_64/Ginit_local.c x86_64/Ginit_remote.c
+ x86_64/Gget_proc_info.c x86_64/Gregs.c x86_64/Gresume.c
+ x86_64/Gstash_frame.c x86_64/Gstep.c x86_64/Gtrace.c
+)
+
+if(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+ SET(libunwind_la_SOURCES ${libunwind_la_SOURCES_aarch64})
+ SET(libunwind_aarch64_la_SOURCES ${libunwind_aarch64_la_SOURCES_aarch64})
+ SET(libunwind_elf_la_SOURCES ${libunwind_elf64_la_SOURCES})
+ list(APPEND libunwind_setjmp_la_SOURCES aarch64/siglongjmp.S)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
+ SET(libunwind_la_SOURCES ${libunwind_la_SOURCES_arm})
+ SET(libunwind_arm_la_SOURCES ${libunwind_arm_la_SOURCES_arm})
+ SET(libunwind_elf_la_SOURCES ${libunwind_elf32_la_SOURCES})
+ list(APPEND libunwind_setjmp_la_SOURCES arm/siglongjmp.S)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+ SET(libunwind_la_SOURCES ${libunwind_la_SOURCES_x86} ${libunwind_x86_la_SOURCES_os})
+ SET(libunwind_x86_la_SOURCES ${libunwind_x86_la_SOURCES_x86})
+ SET(libunwind_elf_la_SOURCES ${libunwind_elf32_la_SOURCES})
+ list(APPEND libunwind_setjmp_la_SOURCES x86/longjmp.S x86/siglongjmp.S)
+elseif(CLR_CMAKE_PLATFORM_ARCH_AMD64)
+ SET(libunwind_la_SOURCES ${libunwind_la_SOURCES_x86_64})
+ SET(libunwind_x86_64_la_SOURCES ${libunwind_x86_64_la_SOURCES_x86_64})
+ SET(libunwind_elf_la_SOURCES ${libunwind_elf64_la_SOURCES})
+ list(APPEND libunwind_setjmp_la_SOURCES x86_64/longjmp.S x86_64/siglongjmp.SA)
+endif()
+
+add_library(libunwind
+ OBJECT
+ ${libunwind_la_SOURCES}
+ ${libunwind_dwarf_local_la_SOURCES}
+ ${libunwind_dwarf_common_la_SOURCES}
+ ${libunwind_elf_la_SOURCES}
+)
+
diff --git a/src/pal/src/libunwind/src/Makefile.am b/src/pal/src/libunwind/src/Makefile.am
new file mode 100644
index 0000000000..a557d8d1f4
--- /dev/null
+++ b/src/pal/src/libunwind/src/Makefile.am
@@ -0,0 +1,750 @@
+SOVERSION=8:1:0 # See comments at end of file.
+SETJMP_SO_VERSION=0:0:0
+COREDUMP_SO_VERSION=0:0:0
+#
+# Don't link with start-files since we don't use any constructors/destructors:
+#
+COMMON_SO_LDFLAGS = $(LDFLAGS_NOSTARTFILES)
+
+lib_LIBRARIES =
+lib_LTLIBRARIES =
+if !REMOTE_ONLY
+lib_LTLIBRARIES += libunwind.la
+if BUILD_PTRACE
+lib_LTLIBRARIES += libunwind-ptrace.la
+endif
+if BUILD_COREDUMP
+lib_LTLIBRARIES += libunwind-coredump.la
+endif
+endif
+
+noinst_HEADERS =
+noinst_LTLIBRARIES =
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libunwind-generic.pc
+
+if !REMOTE_ONLY
+pkgconfig_DATA += unwind/libunwind.pc
+endif
+
+if BUILD_PTRACE
+pkgconfig_DATA += ptrace/libunwind-ptrace.pc
+endif
+
+if BUILD_SETJMP
+pkgconfig_DATA += setjmp/libunwind-setjmp.pc
+endif
+
+if BUILD_COREDUMP
+pkgconfig_DATA += coredump/libunwind-coredump.pc
+endif
+
+### libunwind-ptrace:
+libunwind_ptrace_la_SOURCES = \
+ ptrace/_UPT_elf.c \
+ ptrace/_UPT_accessors.c ptrace/_UPT_access_fpreg.c \
+ ptrace/_UPT_access_mem.c ptrace/_UPT_access_reg.c \
+ ptrace/_UPT_create.c ptrace/_UPT_destroy.c \
+ ptrace/_UPT_find_proc_info.c ptrace/_UPT_get_dyn_info_list_addr.c \
+ ptrace/_UPT_put_unwind_info.c ptrace/_UPT_get_proc_name.c \
+ ptrace/_UPT_reg_offset.c ptrace/_UPT_resume.c
+noinst_HEADERS += ptrace/_UPT_internal.h
+
+### libunwind-coredump:
+libunwind_coredump_la_SOURCES = \
+ coredump/_UCD_accessors.c \
+ coredump/_UCD_create.c \
+ coredump/_UCD_destroy.c \
+ coredump/_UCD_access_mem.c \
+ coredump/_UCD_elf_map_image.c \
+ coredump/_UCD_find_proc_info.c \
+ coredump/_UCD_get_proc_name.c \
+ \
+ coredump/_UPT_elf.c \
+ coredump/_UPT_access_fpreg.c \
+ coredump/_UPT_get_dyn_info_list_addr.c \
+ coredump/_UPT_put_unwind_info.c \
+ coredump/_UPT_resume.c
+libunwind_coredump_la_LDFLAGS = $(COMMON_SO_LDFLAGS) \
+ -version-info $(COREDUMP_SO_VERSION)
+libunwind_coredump_la_LIBADD = $(LIBLZMA)
+noinst_HEADERS += coredump/_UCD_internal.h coredump/_UCD_lib.h
+
+### libunwind-setjmp:
+libunwind_setjmp_la_LDFLAGS = $(COMMON_SO_LDFLAGS) \
+ -version-info $(SETJMP_SO_VERSION)
+
+if USE_ELF32
+LIBUNWIND_ELF = libunwind-elf32.la
+endif
+if USE_ELF64
+LIBUNWIND_ELF = libunwind-elf64.la
+endif
+if USE_ELFXX
+LIBUNWIND_ELF = libunwind-elfxx.la
+endif
+
+libunwind_setjmp_la_LIBADD = $(LIBUNWIND_ELF) \
+ libunwind-$(arch).la \
+ libunwind.la -lc
+libunwind_setjmp_la_SOURCES = setjmp/longjmp.c \
+ setjmp/siglongjmp.c
+noinst_HEADERS += setjmp/setjmp_i.h
+
+### libunwind:
+libunwind_la_LIBADD =
+
+# List of arch-independent files needed by both local-only and generic
+# libraries:
+libunwind_la_SOURCES_common = \
+ $(libunwind_la_SOURCES_os) \
+ mi/init.c mi/flush_cache.c mi/mempool.c mi/strerror.c
+
+# List of arch-independent files needed by generic library (libunwind-$ARCH):
+libunwind_la_SOURCES_generic = \
+ mi/Gdyn-extract.c mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \
+ mi/Gget_accessors.c \
+ mi/Gget_proc_info_by_ip.c mi/Gget_proc_name.c \
+ mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \
+ mi/Gget_reg.c mi/Gset_reg.c \
+ mi/Gget_fpreg.c mi/Gset_fpreg.c \
+ mi/Gset_caching_policy.c \
+ mi/Gset_cache_size.c
+
+if SUPPORT_CXX_EXCEPTIONS
+libunwind_la_SOURCES_local_unwind = \
+ unwind/Backtrace.c unwind/DeleteException.c \
+ unwind/FindEnclosingFunction.c unwind/ForcedUnwind.c \
+ unwind/GetBSP.c unwind/GetCFA.c unwind/GetDataRelBase.c \
+ unwind/GetGR.c unwind/GetIP.c unwind/GetLanguageSpecificData.c \
+ unwind/GetRegionStart.c unwind/GetTextRelBase.c \
+ unwind/RaiseException.c unwind/Resume.c \
+ unwind/Resume_or_Rethrow.c unwind/SetGR.c unwind/SetIP.c \
+ unwind/GetIPInfo.c
+
+# _ReadULEB()/_ReadSLEB() are needed for Intel C++ 8.0 compatibility
+libunwind_la_SOURCES_os_linux_local = mi/_ReadULEB.c mi/_ReadSLEB.c
+endif
+
+# List of arch-independent files needed by local-only library (libunwind):
+libunwind_la_SOURCES_local_nounwind = \
+ $(libunwind_la_SOURCES_os_local) \
+ mi/backtrace.c \
+ mi/dyn-cancel.c mi/dyn-info-list.c mi/dyn-register.c \
+ mi/Ldyn-extract.c mi/Lfind_dynamic_proc_info.c \
+ mi/Lget_accessors.c \
+ mi/Lget_proc_info_by_ip.c mi/Lget_proc_name.c \
+ mi/Lput_dynamic_unwind_info.c mi/Ldestroy_addr_space.c \
+ mi/Lget_reg.c mi/Lset_reg.c \
+ mi/Lget_fpreg.c mi/Lset_fpreg.c \
+ mi/Lset_caching_policy.c \
+ mi/Lset_cache_size.c
+
+libunwind_la_SOURCES_local = \
+ $(libunwind_la_SOURCES_local_nounwind) \
+ $(libunwind_la_SOURCES_local_unwind)
+
+noinst_HEADERS += os-linux.h
+libunwind_la_SOURCES_os_linux = os-linux.c
+
+libunwind_la_SOURCES_os_hpux = os-hpux.c
+
+libunwind_la_SOURCES_os_freebsd = os-freebsd.c
+
+libunwind_la_SOURCES_os_qnx = os-qnx.c
+
+libunwind_dwarf_common_la_SOURCES = dwarf/global.c
+
+libunwind_dwarf_local_la_SOURCES = \
+ dwarf/Lexpr.c dwarf/Lfde.c dwarf/Lparser.c dwarf/Lpe.c \
+ dwarf/Lfind_proc_info-lsb.c \
+ dwarf/Lfind_unwind_table.c
+libunwind_dwarf_local_la_LIBADD = libunwind-dwarf-common.la
+
+libunwind_dwarf_generic_la_SOURCES = \
+ dwarf/Gexpr.c dwarf/Gfde.c dwarf/Gparser.c dwarf/Gpe.c \
+ dwarf/Gfind_proc_info-lsb.c \
+ dwarf/Gfind_unwind_table.c
+libunwind_dwarf_generic_la_LIBADD = libunwind-dwarf-common.la
+
+if USE_DWARF
+ noinst_LTLIBRARIES += libunwind-dwarf-common.la libunwind-dwarf-generic.la
+if !REMOTE_ONLY
+ noinst_LTLIBRARIES += libunwind-dwarf-local.la
+endif
+ libunwind_la_LIBADD += libunwind-dwarf-local.la
+endif
+
+noinst_HEADERS += elf32.h elf64.h elfxx.h
+
+libunwind_elf32_la_SOURCES = elf32.c
+libunwind_elf64_la_SOURCES = elf64.c
+libunwind_elfxx_la_SOURCES = elfxx.c
+libunwind_elf32_la_LIBADD = $(LIBLZMA)
+libunwind_elf64_la_LIBADD = $(LIBLZMA)
+libunwind_elfxx_la_LIBADD = $(LIBLZMA)
+
+noinst_LTLIBRARIES += $(LIBUNWIND_ELF)
+libunwind_la_LIBADD += $(LIBUNWIND_ELF)
+
+# The list of files that go into libunwind and libunwind-aarch64:
+noinst_HEADERS += aarch64/init.h aarch64/offsets.h aarch64/unwind_i.h
+libunwind_la_SOURCES_aarch64_common = $(libunwind_la_SOURCES_common) \
+ aarch64/is_fpreg.c aarch64/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_aarch64 = $(libunwind_la_SOURCES_aarch64_common) \
+ $(libunwind_la_SOURCES_local) \
+ aarch64/Lapply_reg_state.c aarch64/Lreg_states_iterate.c \
+ aarch64/Lcreate_addr_space.c aarch64/Lget_proc_info.c \
+ aarch64/Lget_save_loc.c aarch64/Lglobal.c aarch64/Linit.c \
+ aarch64/Linit_local.c aarch64/Linit_remote.c \
+ aarch64/Lis_signal_frame.c aarch64/Lregs.c aarch64/Lresume.c \
+ aarch64/Lstash_frame.c aarch64/Lstep.c aarch64/Ltrace.c \
+ aarch64/getcontext.S
+
+libunwind_aarch64_la_SOURCES_aarch64 = $(libunwind_la_SOURCES_aarch64_common) \
+ $(libunwind_la_SOURCES_generic) \
+ aarch64/Gapply_reg_state.c aarch64/Greg_states_iterate.c \
+ aarch64/Gcreate_addr_space.c aarch64/Gget_proc_info.c \
+ aarch64/Gget_save_loc.c aarch64/Gglobal.c aarch64/Ginit.c \
+ aarch64/Ginit_local.c aarch64/Ginit_remote.c \
+ aarch64/Gis_signal_frame.c aarch64/Gregs.c aarch64/Gresume.c \
+ aarch64/Gstash_frame.c aarch64/Gstep.c aarch64/Gtrace.c
+
+# The list of files that go into libunwind and libunwind-arm:
+noinst_HEADERS += arm/init.h arm/offsets.h arm/unwind_i.h
+libunwind_la_SOURCES_arm_common = $(libunwind_la_SOURCES_common) \
+ arm/is_fpreg.c arm/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_arm = $(libunwind_la_SOURCES_arm_common) \
+ $(libunwind_la_SOURCES_arm_os_local) \
+ $(libunwind_la_SOURCES_local) \
+ arm/getcontext.S \
+ arm/Lapply_reg_state.c arm/Lreg_states_iterate.c \
+ arm/Lcreate_addr_space.c arm/Lget_proc_info.c arm/Lget_save_loc.c \
+ arm/Lglobal.c arm/Linit.c arm/Linit_local.c arm/Linit_remote.c \
+ arm/Lregs.c arm/Lresume.c arm/Lstep.c \
+ arm/Lex_tables.c arm/Lstash_frame.c arm/Ltrace.c
+
+# The list of files that go into libunwind-arm:
+libunwind_arm_la_SOURCES_arm = $(libunwind_la_SOURCES_arm_common) \
+ $(libunwind_la_SOURCES_arm_os) \
+ $(libunwind_la_SOURCES_generic) \
+ arm/Gapply_reg_state.c arm/Greg_states_iterate.c \
+ arm/Gcreate_addr_space.c arm/Gget_proc_info.c arm/Gget_save_loc.c \
+ arm/Gglobal.c arm/Ginit.c arm/Ginit_local.c arm/Ginit_remote.c \
+ arm/Gregs.c arm/Gresume.c arm/Gstep.c \
+ arm/Gex_tables.c arm/Gstash_frame.c arm/Gtrace.c
+
+# The list of files that go both into libunwind and libunwind-ia64:
+noinst_HEADERS += ia64/init.h ia64/offsets.h ia64/regs.h \
+ ia64/ucontext_i.h ia64/unwind_decoder.h ia64/unwind_i.h
+libunwind_la_SOURCES_ia64_common = $(libunwind_la_SOURCES_common) \
+ ia64/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_ia64 = $(libunwind_la_SOURCES_ia64_common) \
+ $(libunwind_la_SOURCES_local) \
+ \
+ ia64/dyn_info_list.S ia64/getcontext.S \
+ \
+ ia64/Lapply_reg_state.c ia64/Lreg_states_iterate.c \
+ ia64/Lcreate_addr_space.c ia64/Lget_proc_info.c ia64/Lget_save_loc.c \
+ ia64/Lglobal.c ia64/Linit.c ia64/Linit_local.c ia64/Linit_remote.c \
+ ia64/Linstall_cursor.S ia64/Lis_signal_frame.c ia64/Lparser.c \
+ ia64/Lrbs.c ia64/Lregs.c ia64/Lresume.c ia64/Lscript.c ia64/Lstep.c \
+ ia64/Ltables.c ia64/Lfind_unwind_table.c
+
+# The list of files that go into libunwind-ia64:
+libunwind_ia64_la_SOURCES_ia64 = $(libunwind_la_SOURCES_ia64_common) \
+ $(libunwind_la_SOURCES_generic) \
+ ia64/Gapply_reg_state.c ia64/Greg_states_iterate.c \
+ ia64/Gcreate_addr_space.c ia64/Gget_proc_info.c ia64/Gget_save_loc.c \
+ ia64/Gglobal.c ia64/Ginit.c ia64/Ginit_local.c ia64/Ginit_remote.c \
+ ia64/Ginstall_cursor.S ia64/Gis_signal_frame.c ia64/Gparser.c \
+ ia64/Grbs.c ia64/Gregs.c ia64/Gresume.c ia64/Gscript.c ia64/Gstep.c \
+ ia64/Gtables.c ia64/Gfind_unwind_table.c
+
+# The list of files that go both into libunwind and libunwind-hppa:
+noinst_HEADERS += hppa/init.h hppa/offsets.h hppa/unwind_i.h
+libunwind_la_SOURCES_hppa_common = $(libunwind_la_SOURCES_common) \
+ hppa/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_hppa = $(libunwind_la_SOURCES_hppa_common) \
+ $(libunwind_la_SOURCES_local) \
+ hppa/getcontext.S hppa/setcontext.S \
+ hppa/Lapply_reg_state.c hppa/Lreg_states_iterate.c \
+ hppa/Lcreate_addr_space.c hppa/Lget_save_loc.c hppa/Lglobal.c \
+ hppa/Linit.c hppa/Linit_local.c hppa/Linit_remote.c \
+ hppa/Lis_signal_frame.c hppa/Lget_proc_info.c hppa/Lregs.c \
+ hppa/Lresume.c hppa/Lstep.c
+
+# The list of files that go into libunwind-hppa:
+libunwind_hppa_la_SOURCES_hppa = $(libunwind_la_SOURCES_hppa_common) \
+ $(libunwind_la_SOURCES_generic) \
+ hppa/Gapply_reg_state.c hppa/Greg_states_iterate.c \
+ hppa/Gcreate_addr_space.c hppa/Gget_save_loc.c hppa/Gglobal.c \
+ hppa/Ginit.c hppa/Ginit_local.c hppa/Ginit_remote.c \
+ hppa/Gis_signal_frame.c hppa/Gget_proc_info.c hppa/Gregs.c \
+ hppa/Gresume.c hppa/Gstep.c
+
+# The list of files that go info libunwind and libunwind-mips:
+noinst_HEADERS += mips/init.h mips/offsets.h mips/unwind_i.h
+libunwind_la_SOURCES_mips_common = $(libunwind_la_SOURCES_common) \
+ mips/is_fpreg.c mips/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_mips = $(libunwind_la_SOURCES_mips_common) \
+ $(libunwind_la_SOURCES_local) \
+ mips/getcontext.S \
+ mips/Lapply_reg_state.c mips/Lreg_states_iterate.c \
+ mips/Lcreate_addr_space.c mips/Lget_proc_info.c mips/Lget_save_loc.c \
+ mips/Lglobal.c mips/Linit.c mips/Linit_local.c mips/Linit_remote.c \
+ mips/Lis_signal_frame.c mips/Lregs.c mips/Lresume.c mips/Lstep.c
+
+libunwind_mips_la_SOURCES_mips = $(libunwind_la_SOURCES_mips_common) \
+ $(libunwind_la_SOURCES_generic) \
+ mips/Gapply_reg_state.c mips/Greg_states_iterate.c \
+ mips/Gcreate_addr_space.c mips/Gget_proc_info.c mips/Gget_save_loc.c \
+ mips/Gglobal.c mips/Ginit.c mips/Ginit_local.c mips/Ginit_remote.c \
+ mips/Gis_signal_frame.c mips/Gregs.c mips/Gresume.c mips/Gstep.c
+
+# The list of files that go info libunwind and libunwind-tilegx:
+noinst_HEADERS += tilegx/init.h tilegx/offsets.h tilegx/unwind_i.h
+libunwind_la_SOURCES_tilegx_common = $(libunwind_la_SOURCES_common) \
+ tilegx/is_fpreg.c tilegx/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_tilegx = $(libunwind_la_SOURCES_tilegx_common) \
+ $(libunwind_la_SOURCES_local) \
+ tilegx/getcontext.S \
+ tilegx/Lapply_reg_state.c tilegx/Lreg_states_iterate.c \
+ tilegx/Lcreate_addr_space.c tilegx/Lget_proc_info.c tilegx/Lget_save_loc.c \
+ tilegx/Lglobal.c tilegx/Linit.c tilegx/Linit_local.c tilegx/Linit_remote.c \
+ tilegx/Lis_signal_frame.c tilegx/Lregs.c tilegx/Lresume.c tilegx/Lstep.c
+
+libunwind_tilegx_la_SOURCES_tilegx = $(libunwind_la_SOURCES_tilegx_common) \
+ $(libunwind_la_SOURCES_generic) \
+ tilegx/Gapply_reg_state.c tilegx/Greg_states_iterate.c \
+ tilegx/Gcreate_addr_space.c tilegx/Gget_proc_info.c tilegx/Gget_save_loc.c \
+ tilegx/Gglobal.c tilegx/Ginit.c tilegx/Ginit_local.c tilegx/Ginit_remote.c \
+ tilegx/Gis_signal_frame.c tilegx/Gregs.c tilegx/Gresume.c tilegx/Gstep.c
+
+
+# The list of files that go both into libunwind and libunwind-x86:
+noinst_HEADERS += x86/init.h x86/offsets.h x86/unwind_i.h
+libunwind_la_SOURCES_x86_common = $(libunwind_la_SOURCES_common) \
+ x86/is_fpreg.c x86/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_x86 = $(libunwind_la_SOURCES_x86_common) \
+ $(libunwind_la_SOURCES_x86_os_local) \
+ $(libunwind_la_SOURCES_local) \
+ x86/Lapply_reg_state.c x86/Lreg_states_iterate.c \
+ x86/Lcreate_addr_space.c x86/Lget_save_loc.c x86/Lglobal.c \
+ x86/Linit.c x86/Linit_local.c x86/Linit_remote.c \
+ x86/Lget_proc_info.c x86/Lregs.c \
+ x86/Lresume.c x86/Lstep.c
+
+# The list of files that go into libunwind-x86:
+libunwind_x86_la_SOURCES_x86 = $(libunwind_la_SOURCES_x86_common) \
+ $(libunwind_la_SOURCES_x86_os) \
+ $(libunwind_la_SOURCES_generic) \
+ x86/Gapply_reg_state.c x86/Greg_states_iterate.c \
+ x86/Gcreate_addr_space.c x86/Gget_save_loc.c x86/Gglobal.c \
+ x86/Ginit.c x86/Ginit_local.c x86/Ginit_remote.c \
+ x86/Gget_proc_info.c x86/Gregs.c \
+ x86/Gresume.c x86/Gstep.c
+
+# The list of files that go both into libunwind and libunwind-x86_64:
+noinst_HEADERS += x86_64/offsets.h \
+ x86_64/init.h x86_64/unwind_i.h x86_64/ucontext_i.h
+libunwind_la_SOURCES_x86_64_common = $(libunwind_la_SOURCES_common) \
+ x86_64/is_fpreg.c x86_64/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_x86_64 = $(libunwind_la_SOURCES_x86_64_common) \
+ $(libunwind_la_SOURCES_x86_64_os_local) \
+ $(libunwind_la_SOURCES_local) \
+ x86_64/setcontext.S \
+ x86_64/Lapply_reg_state.c x86_64/Lreg_states_iterate.c \
+ x86_64/Lcreate_addr_space.c x86_64/Lget_save_loc.c x86_64/Lglobal.c \
+ x86_64/Linit.c x86_64/Linit_local.c x86_64/Linit_remote.c \
+ x86_64/Lget_proc_info.c x86_64/Lregs.c x86_64/Lresume.c \
+ x86_64/Lstash_frame.c x86_64/Lstep.c x86_64/Ltrace.c x86_64/getcontext.S
+
+# The list of files that go into libunwind-x86_64:
+libunwind_x86_64_la_SOURCES_x86_64 = $(libunwind_la_SOURCES_x86_64_common) \
+ $(libunwind_la_SOURCES_x86_64_os) \
+ $(libunwind_la_SOURCES_generic) \
+ x86_64/Gapply_reg_state.c x86_64/Greg_states_iterate.c \
+ x86_64/Gcreate_addr_space.c x86_64/Gget_save_loc.c x86_64/Gglobal.c \
+ x86_64/Ginit.c x86_64/Ginit_local.c x86_64/Ginit_remote.c \
+ x86_64/Gget_proc_info.c x86_64/Gregs.c x86_64/Gresume.c \
+ x86_64/Gstash_frame.c x86_64/Gstep.c x86_64/Gtrace.c
+
+# The list of local files that go to Power 64 and 32:
+libunwind_la_SOURCES_ppc = \
+ ppc/Lget_proc_info.c ppc/Lget_save_loc.c ppc/Linit_local.c \
+ ppc/Linit_remote.c ppc/Lis_signal_frame.c
+
+# The list of generic files that go to Power 64 and 32:
+libunwind_ppc_la_SOURCES_ppc_generic = \
+ ppc/Gget_proc_info.c ppc/Gget_save_loc.c ppc/Ginit_local.c \
+ ppc/Ginit_remote.c ppc/Gis_signal_frame.c
+
+# The list of files that go both into libunwind and libunwind-ppc32:
+noinst_HEADERS += ppc32/init.h ppc32/unwind_i.h ppc32/ucontext_i.h
+libunwind_la_SOURCES_ppc32_common = $(libunwind_la_SOURCES_common) \
+ ppc32/is_fpreg.c ppc32/regname.c ppc32/get_func_addr.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_ppc32 = $(libunwind_la_SOURCES_ppc32_common) \
+ $(libunwind_la_SOURCES_local) \
+ $(libunwind_la_SOURCES_ppc) \
+ ppc32/Lapply_reg_state.c ppc32/Lreg_states_iterate.c \
+ ppc32/Lcreate_addr_space.c \
+ ppc32/Lglobal.c ppc32/Linit.c \
+ ppc32/Lregs.c ppc32/Lresume.c ppc32/Lstep.c
+
+# The list of files that go into libunwind-ppc32:
+libunwind_ppc32_la_SOURCES_ppc32 = $(libunwind_la_SOURCES_ppc32_common) \
+ $(libunwind_la_SOURCES_generic) \
+ $(libunwind_ppc_la_SOURCES_ppc_generic) \
+ ppc32/Gapply_reg_state.c ppc32/Greg_states_iterate.c \
+ ppc32/Gcreate_addr_space.c \
+ ppc32/Gglobal.c ppc32/Ginit.c \
+ ppc32/Gregs.c ppc32/Gresume.c ppc32/Gstep.c
+
+# The list of files that go both into libunwind and libunwind-ppc64:
+noinst_HEADERS += ppc64/init.h ppc64/unwind_i.h ppc64/ucontext_i.h
+libunwind_la_SOURCES_ppc64_common = $(libunwind_la_SOURCES_common) \
+ ppc64/is_fpreg.c ppc64/regname.c ppc64/get_func_addr.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_ppc64 = $(libunwind_la_SOURCES_ppc64_common) \
+ $(libunwind_la_SOURCES_local) \
+ $(libunwind_la_SOURCES_ppc) \
+ ppc64/Lapply_reg_state.c ppc64/Lreg_states_iterate.c \
+ ppc64/Lcreate_addr_space.c \
+ ppc64/Lglobal.c ppc64/Linit.c \
+ ppc64/Lregs.c ppc64/Lresume.c ppc64/Lstep.c
+
+# The list of files that go into libunwind-ppc64:
+libunwind_ppc64_la_SOURCES_ppc64 = $(libunwind_la_SOURCES_ppc64_common) \
+ $(libunwind_la_SOURCES_generic) \
+ $(libunwind_ppc_la_SOURCES_ppc_generic) \
+ ppc64/Gapply_reg_state.c ppc64/Greg_states_iterate.c \
+ ppc64/Gcreate_addr_space.c \
+ ppc64/Gglobal.c ppc64/Ginit.c \
+ ppc64/Gregs.c ppc64/Gresume.c ppc64/Gstep.c
+
+# The list of files that go into libunwind and libunwind-sh:
+noinst_HEADERS += sh/init.h sh/offsets.h sh/unwind_i.h
+libunwind_la_SOURCES_sh_common = $(libunwind_la_SOURCES_common) \
+ sh/is_fpreg.c sh/regname.c
+
+# The list of files that go into libunwind:
+libunwind_la_SOURCES_sh = $(libunwind_la_SOURCES_sh_common) \
+ $(libunwind_la_SOURCES_local) \
+ sh/Lapply_reg_state.c sh/Lreg_states_iterate.c \
+ sh/Lcreate_addr_space.c sh/Lget_proc_info.c sh/Lget_save_loc.c \
+ sh/Lglobal.c sh/Linit.c sh/Linit_local.c sh/Linit_remote.c \
+ sh/Lis_signal_frame.c sh/Lregs.c sh/Lresume.c sh/Lstep.c
+
+libunwind_sh_la_SOURCES_sh = $(libunwind_la_SOURCES_sh_common) \
+ $(libunwind_la_SOURCES_generic) \
+ sh/Gapply_reg_state.c sh/Greg_states_iterate.c \
+ sh/Gcreate_addr_space.c sh/Gget_proc_info.c sh/Gget_save_loc.c \
+ sh/Gglobal.c sh/Ginit.c sh/Ginit_local.c sh/Ginit_remote.c \
+ sh/Gis_signal_frame.c sh/Gregs.c sh/Gresume.c sh/Gstep.c
+
+if REMOTE_ONLY
+install-exec-hook:
+# Nothing to do here....
+else
+#
+# This is not ideal, but I know of no other way to install an
+# alias for a library. For the shared version, we have to do
+# a file check before creating the link, because it isn't going
+# to be there if the user configured with --disable-shared.
+#
+install-exec-hook:
+ if test -f $(DESTDIR)$(libdir)/libunwind-$(arch).a; then \
+ cd $(DESTDIR)$(libdir) && $(LN_S) -f libunwind-$(arch).a libunwind-generic.a; \
+ fi
+ if test -f $(DESTDIR)$(libdir)/libunwind-$(arch).so; then \
+ cd $(DESTDIR)$(libdir) && $(LN_S) -f libunwind-$(arch).so \
+ libunwind-generic.so; \
+ fi
+endif
+
+if OS_LINUX
+ libunwind_la_SOURCES_os = $(libunwind_la_SOURCES_os_linux)
+ libunwind_la_SOURCES_os_local = $(libunwind_la_SOURCES_os_linux_local)
+ libunwind_la_SOURCES_x86_os = x86/Gos-linux.c
+ libunwind_x86_la_SOURCES_os = x86/getcontext-linux.S
+ libunwind_la_SOURCES_x86_os_local = x86/Los-linux.c
+ libunwind_la_SOURCES_x86_64_os = x86_64/Gos-linux.c
+ libunwind_la_SOURCES_x86_64_os_local = x86_64/Los-linux.c
+ libunwind_la_SOURCES_arm_os = arm/Gos-linux.c
+ libunwind_la_SOURCES_arm_os_local = arm/Los-linux.c
+ libunwind_coredump_la_SOURCES += coredump/_UCD_access_reg_linux.c
+endif
+
+if OS_HPUX
+ libunwind_la_SOURCES_os = $(libunwind_la_SOURCES_os_hpux)
+ libunwind_la_SOURCES_os_local = $(libunwind_la_SOURCES_os_hpux_local)
+endif
+
+if OS_FREEBSD
+ libunwind_la_SOURCES_os = $(libunwind_la_SOURCES_os_freebsd)
+ libunwind_la_SOURCES_os_local = $(libunwind_la_SOURCES_os_freebsd_local)
+ libunwind_la_SOURCES_x86_os = x86/Gos-freebsd.c
+ libunwind_x86_la_SOURCES_os = x86/getcontext-freebsd.S
+ libunwind_la_SOURCES_x86_os_local = x86/Los-freebsd.c
+ libunwind_la_SOURCES_x86_64_os = x86_64/Gos-freebsd.c
+ libunwind_la_SOURCES_x86_64_os_local = x86_64/Los-freebsd.c
+ libunwind_la_SOURCES_arm_os = arm/Gos-freebsd.c
+ libunwind_la_SOURCES_arm_os_local = arm/Los-freebsd.c
+ libunwind_coredump_la_SOURCES += coredump/_UCD_access_reg_freebsd.c
+endif
+
+if OS_QNX
+ libunwind_la_SOURCES_os = $(libunwind_la_SOURCES_os_qnx)
+ libunwind_la_SOURCES_os_local = $(libunwind_la_SOURCES_os_qnx_local)
+ libunwind_la_SOURCES_arm_os = arm/Gos-other.c
+ libunwind_la_SOURCES_arm_os_local = arm/Los-other.c
+endif
+
+if ARCH_AARCH64
+ lib_LTLIBRARIES += libunwind-aarch64.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_aarch64)
+ libunwind_aarch64_la_SOURCES = $(libunwind_aarch64_la_SOURCES_aarch64)
+ libunwind_aarch64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_aarch64_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_aarch64_la_LIBADD += libunwind-elf64.la
+if !REMOTE_ONLY
+ libunwind_aarch64_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += aarch64/siglongjmp.S
+else
+if ARCH_ARM
+ lib_LTLIBRARIES += libunwind-arm.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_arm)
+ libunwind_arm_la_SOURCES = $(libunwind_arm_la_SOURCES_arm)
+ libunwind_arm_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_arm_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_arm_la_LIBADD += libunwind-elf32.la
+if !REMOTE_ONLY
+ libunwind_arm_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += arm/siglongjmp.S
+else
+if ARCH_IA64
+ BUILT_SOURCES = Gcursor_i.h Lcursor_i.h
+mk_Gcursor_i.s: $(srcdir)/ia64/mk_Gcursor_i.c
+ $(COMPILE) -S "$(srcdir)/ia64/mk_Gcursor_i.c" -o mk_Gcursor_i.s
+mk_Lcursor_i.s: $(srcdir)/ia64/mk_Lcursor_i.c
+ $(COMPILE) -S "$(srcdir)/ia64/mk_Lcursor_i.c" -o mk_Lcursor_i.s
+Gcursor_i.h: mk_Gcursor_i.s
+ "$(srcdir)/ia64/mk_cursor_i" mk_Gcursor_i.s > Gcursor_i.h
+Lcursor_i.h: mk_Lcursor_i.s
+ "$(srcdir)/ia64/mk_cursor_i" mk_Lcursor_i.s > Lcursor_i.h
+
+ lib_LTLIBRARIES += libunwind-ia64.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_ia64)
+ libunwind_ia64_la_SOURCES = $(libunwind_ia64_la_SOURCES_ia64)
+ libunwind_ia64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_ia64_la_LIBADD = libunwind-elf64.la
+if !REMOTE_ONLY
+ libunwind_ia64_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += ia64/setjmp.S ia64/sigsetjmp.S \
+ ia64/longjmp.S ia64/siglongjmp.S
+else
+if ARCH_HPPA
+ lib_LTLIBRARIES += libunwind-hppa.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_hppa)
+ libunwind_hppa_la_SOURCES = $(libunwind_hppa_la_SOURCES_hppa)
+ libunwind_hppa_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_hppa_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_hppa_la_LIBADD += libunwind-elf32.la
+if !REMOTE_ONLY
+ libunwind_hppa_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += hppa/siglongjmp.S
+else
+if ARCH_MIPS
+ lib_LTLIBRARIES += libunwind-mips.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_mips)
+ libunwind_mips_la_SOURCES = $(libunwind_mips_la_SOURCES_mips)
+ libunwind_mips_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_mips_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_mips_la_LIBADD += libunwind-elfxx.la
+if !REMOTE_ONLY
+ libunwind_mips_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += mips/siglongjmp.S
+else
+if ARCH_TILEGX
+ lib_LTLIBRARIES += libunwind-tilegx.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_tilegx)
+ libunwind_tilegx_la_SOURCES = $(libunwind_tilegx_la_SOURCES_tilegx)
+ libunwind_tilegx_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_tilegx_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_tilegx_la_LIBADD += libunwind-elfxx.la
+if !REMOTE_ONLY
+ libunwind_tilegx_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += tilegx/siglongjmp.S
+else
+if ARCH_X86
+ lib_LTLIBRARIES += libunwind-x86.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86) $(libunwind_x86_la_SOURCES_os)
+ libunwind_x86_la_SOURCES = $(libunwind_x86_la_SOURCES_x86)
+ libunwind_x86_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_x86_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_x86_la_LIBADD += libunwind-elf32.la
+if !REMOTE_ONLY
+ libunwind_x86_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += x86/longjmp.S x86/siglongjmp.S
+else
+if ARCH_X86_64
+ lib_LTLIBRARIES += libunwind-x86_64.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86_64)
+ libunwind_x86_64_la_SOURCES = $(libunwind_x86_64_la_SOURCES_x86_64)
+ libunwind_x86_64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_x86_64_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_x86_64_la_LIBADD += libunwind-elf64.la
+if !REMOTE_ONLY
+ libunwind_x86_64_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += x86_64/longjmp.S x86_64/siglongjmp.S
+else
+if ARCH_PPC32
+ lib_LTLIBRARIES += libunwind-ppc32.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_ppc32)
+ libunwind_ppc32_la_SOURCES = $(libunwind_ppc32_la_SOURCES_ppc32)
+ libunwind_ppc32_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_ppc32_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_ppc32_la_LIBADD += libunwind-elf32.la
+if !REMOTE_ONLY
+ libunwind_ppc32_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += ppc/longjmp.S ppc/siglongjmp.S
+else
+if ARCH_PPC64
+ lib_LTLIBRARIES += libunwind-ppc64.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_ppc64)
+ libunwind_ppc64_la_SOURCES = $(libunwind_ppc64_la_SOURCES_ppc64)
+ libunwind_ppc64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_ppc64_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_ppc64_la_LIBADD += libunwind-elf64.la
+if !REMOTE_ONLY
+ libunwind_ppc64_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += ppc/longjmp.S ppc/siglongjmp.S
+else
+if ARCH_SH
+ lib_LTLIBRARIES += libunwind-sh.la
+ libunwind_la_SOURCES = $(libunwind_la_SOURCES_sh)
+ libunwind_sh_la_SOURCES = $(libunwind_sh_la_SOURCES_sh)
+ libunwind_sh_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION)
+ libunwind_sh_la_LIBADD = libunwind-dwarf-generic.la
+ libunwind_sh_la_LIBADD += libunwind-elf32.la
+if !REMOTE_ONLY
+ libunwind_sh_la_LIBADD += libunwind.la -lc
+endif
+ libunwind_setjmp_la_SOURCES += sh/siglongjmp.S
+
+endif # ARCH_SH
+endif # ARCH_PPC64
+endif # ARCH_PPC32
+endif # ARCH_X86_64
+endif # ARCH_X86
+endif # ARCH_TILEGX
+endif # ARCH_MIPS
+endif # ARCH_HPPA
+endif # ARCH_IA64
+endif # ARCH_ARM
+endif # ARCH_AARCH64
+
+# libunwind-setjmp depends on libunwind-$(arch). Therefore must be added
+# at the end.
+if BUILD_SETJMP
+lib_LTLIBRARIES += libunwind-setjmp.la
+endif
+
+#
+# Don't link with standard libraries, because those may mention
+# libunwind already.
+#
+libunwind_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -XCClinker -nostdlib \
+ $(LDFLAGS_STATIC_LIBCXA) -version-info $(SOVERSION)
+libunwind_la_LIBADD += -lc $(LIBCRTS)
+libunwind_la_LIBADD += $(LIBLZMA)
+
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/tdep-$(arch) -I.
+AM_CCASFLAGS = $(AM_CPPFLAGS)
+noinst_HEADERS += unwind/unwind-internal.h
+
+EXTRA_DIST = $(libunwind_la_SOURCES_aarch64) \
+ $(libunwind_la_SOURCES_arm) \
+ $(libunwind_la_SOURCES_hppa) \
+ $(libunwind_la_SOURCES_ia64) \
+ $(libunwind_la_SOURCES_mips) \
+ $(libunwind_la_SOURCES_sh) \
+ $(libunwind_la_SOURCES_x86) \
+ $(libunwind_la_SOURCES_os_freebsd) \
+ $(libunwind_la_SOURCES_os_linux) \
+ $(libunwind_la_SOURCES_os_hpux) \
+ $(libunwind_la_SOURCES_os_qnx) \
+ $(libunwind_la_SOURCES_common) \
+ $(libunwind_la_SOURCES_local) \
+ $(libunwind_la_SOURCES_generic) \
+ $(libunwind_aarch64_la_SOURCES_aarch64) \
+ $(libunwind_arm_la_SOURCES_arm) \
+ $(libunwind_hppa_la_SOURCES_hppa) \
+ $(libunwind_ia64_la_SOURCES_ia64) \
+ $(libunwind_mips_la_SOURCES_mips) \
+ $(libunwind_sh_la_SOURCES_sh) \
+ $(libunwind_x86_la_SOURCES_x86) \
+ $(libunwind_x86_64_la_SOURCES_x86_64)
+
+MAINTAINERCLEANFILES = Makefile.in
+
+# The -version-info flag accepts an argument of the form
+# `current[:revision[:age]]'. So, passing `-version-info 3:12:1' sets
+# current to 3, revision to 12, and age to 1.
+
+# If either revision or age are omitted, they default to 0. Also note
+# that age must be less than or equal to the current interface number.
+
+# Here are a set of rules to help you update your library version
+# information:
+
+# 1. Start with version information of `0:0:0' for each libtool
+# library.
+
+# 2. Update the version information only immediately before a public
+# release of your software. More frequent updates are unnecessary,
+# and only guarantee that the current interface number gets larger
+# faster.
+
+# 3. If the library source code has changed at all since the last
+# update, then increment revision (`c:r:a' becomes `c:r+1:a').
+
+# 4. If any interfaces have been added, removed, or changed since the
+# last update, increment current, and set revision to 0.
+
+# 5. If any interfaces have been added since the last public release,
+# then increment age.
+
+# 6. If any interfaces have been removed since the last public
+# release, then set age to 0.
diff --git a/src/pal/src/libunwind/src/aarch64/Gapply_reg_state.c b/src/pal/src/libunwind/src/aarch64/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gcreate_addr_space.c b/src/pal/src/libunwind/src/aarch64/Gcreate_addr_space.c
new file mode 100644
index 0000000000..f217adc745
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gcreate_addr_space.c
@@ -0,0 +1,60 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /* AArch64 supports little-endian and big-endian. */
+ if (byte_order != 0 && byte_order != __LITTLE_ENDIAN
+ && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ /* Default to little-endian for AArch64. */
+ if (byte_order == 0 || byte_order == __LITTLE_ENDIAN)
+ as->big_endian = 0;
+ else
+ as->big_endian = 1;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gget_proc_info.c b/src/pal/src/libunwind/src/aarch64/Gget_proc_info.c
new file mode 100644
index 0000000000..c363d2405d
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gget_proc_info.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ ret = dwarf_make_proc_info (&c->dwarf);
+ if (ret < 0)
+ return ret;
+
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gget_save_loc.c b/src/pal/src/libunwind/src/aarch64/Gget_save_loc.c
new file mode 100644
index 0000000000..86bbbd03d1
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gget_save_loc.c
@@ -0,0 +1,100 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ dwarf_loc_t loc;
+
+ switch (reg)
+ {
+ case UNW_AARCH64_X0:
+ case UNW_AARCH64_X1:
+ case UNW_AARCH64_X2:
+ case UNW_AARCH64_X3:
+ case UNW_AARCH64_X4:
+ case UNW_AARCH64_X5:
+ case UNW_AARCH64_X6:
+ case UNW_AARCH64_X7:
+ case UNW_AARCH64_X8:
+ case UNW_AARCH64_X9:
+ case UNW_AARCH64_X10:
+ case UNW_AARCH64_X11:
+ case UNW_AARCH64_X12:
+ case UNW_AARCH64_X13:
+ case UNW_AARCH64_X14:
+ case UNW_AARCH64_X15:
+ case UNW_AARCH64_X16:
+ case UNW_AARCH64_X17:
+ case UNW_AARCH64_X18:
+ case UNW_AARCH64_X19:
+ case UNW_AARCH64_X20:
+ case UNW_AARCH64_X21:
+ case UNW_AARCH64_X22:
+ case UNW_AARCH64_X23:
+ case UNW_AARCH64_X24:
+ case UNW_AARCH64_X25:
+ case UNW_AARCH64_X26:
+ case UNW_AARCH64_X27:
+ case UNW_AARCH64_X28:
+ case UNW_AARCH64_X29:
+ case UNW_AARCH64_X30:
+ case UNW_AARCH64_SP:
+ case UNW_AARCH64_PC:
+ case UNW_AARCH64_PSTATE:
+ loc = c->dwarf.loc[reg];
+ break;
+
+ default:
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+ break;
+ }
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gglobal.c b/src/pal/src/libunwind/src/aarch64/Gglobal.c
new file mode 100644
index 0000000000..72e36b2d4d
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gglobal.c
@@ -0,0 +1,57 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (aarch64_lock);
+HIDDEN int tdep_init_done;
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&aarch64_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ aarch64_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&aarch64_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Ginit.c b/src/pal/src/libunwind/src/aarch64/Ginit.c
new file mode 100644
index 0000000000..9c4eae8298
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Ginit.c
@@ -0,0 +1,190 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+static inline void *
+uc_addr (ucontext_t *uc, int reg)
+{
+ if (reg >= UNW_AARCH64_X0 && reg < UNW_AARCH64_V0)
+ return &uc->uc_mcontext.regs[reg];
+ else if (reg >= UNW_AARCH64_V0 && reg <= UNW_AARCH64_V31)
+ return &GET_FPCTX(uc)->vregs[reg - UNW_AARCH64_V0];
+ else
+ return NULL;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg)
+{
+ return uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (16, "mem[%lx] <- %lx\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (16, "mem[%lx] -> %lx\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = arg;
+
+ if (unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) addr = *val;
+ Debug (12, "%s <- %lx\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %lx\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = arg;
+ unw_fpreg_t *addr;
+
+ if (!unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ *(unw_fpreg_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+aarch64_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = aarch64_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/aarch64/Ginit_local.c b/src/pal/src/libunwind/src/aarch64/Ginit_local.c
new file mode 100644
index 0000000000..cd60ca840f
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Ginit_local.c
@@ -0,0 +1,78 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2011-2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common (unw_cursor_t *cursor, unw_context_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = uc;
+
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/aarch64/Ginit_remote.c b/src/pal/src/libunwind/src/aarch64/Ginit_remote.c
new file mode 100644
index 0000000000..9b8ba5b89d
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Ginit_remote.c
@@ -0,0 +1,45 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gis_signal_frame.c b/src/pal/src/libunwind/src/aarch64/Gis_signal_frame.c
new file mode 100644
index 0000000000..67159d8396
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gis_signal_frame.c
@@ -0,0 +1,64 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+/* The restorer stub will always have the form:
+
+ d2801168 movz x8, #0x8b
+ d4000001 svc #0x0
+*/
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+#ifdef __linux__
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ ip = c->dwarf.ip;
+
+ ret = (*a->access_mem) (as, ip, &w0, 0, arg);
+ if (ret < 0)
+ return ret;
+
+ /* FIXME: distinguish 32bit insn vs 64bit registers. */
+ if (w0 != 0xd4000001d2801168)
+ return 0;
+
+ return 1;
+
+#else
+ return -UNW_ENOINFO;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Greg_states_iterate.c b/src/pal/src/libunwind/src/aarch64/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gregs.c b/src/pal/src/libunwind/src/aarch64/Gregs.c
new file mode 100644
index 0000000000..a884373445
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gregs.c
@@ -0,0 +1,118 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ dwarf_loc_t loc = DWARF_NULL_LOC;
+ unsigned int mask;
+
+ switch (reg)
+ {
+ case UNW_AARCH64_X0:
+ case UNW_AARCH64_X1:
+ case UNW_AARCH64_X2:
+ case UNW_AARCH64_X3:
+ mask = 1 << reg;
+ if (write)
+ {
+ c->dwarf.eh_args[reg] = *valp;
+ c->dwarf.eh_valid_mask |= mask;
+ return 0;
+ }
+ else if ((c->dwarf.eh_valid_mask & mask) != 0)
+ {
+ *valp = c->dwarf.eh_args[reg];
+ return 0;
+ }
+ else
+ loc = c->dwarf.loc[reg];
+ break;
+
+ case UNW_AARCH64_X30:
+ if (write)
+ c->dwarf.ip = *valp; /* update the IP cache */
+ case UNW_AARCH64_X4:
+ case UNW_AARCH64_X5:
+ case UNW_AARCH64_X6:
+ case UNW_AARCH64_X7:
+ case UNW_AARCH64_X8:
+ case UNW_AARCH64_X9:
+ case UNW_AARCH64_X10:
+ case UNW_AARCH64_X11:
+ case UNW_AARCH64_X12:
+ case UNW_AARCH64_X13:
+ case UNW_AARCH64_X14:
+ case UNW_AARCH64_X15:
+ case UNW_AARCH64_X16:
+ case UNW_AARCH64_X17:
+ case UNW_AARCH64_X18:
+ case UNW_AARCH64_X19:
+ case UNW_AARCH64_X20:
+ case UNW_AARCH64_X21:
+ case UNW_AARCH64_X22:
+ case UNW_AARCH64_X23:
+ case UNW_AARCH64_X24:
+ case UNW_AARCH64_X25:
+ case UNW_AARCH64_X26:
+ case UNW_AARCH64_X27:
+ case UNW_AARCH64_X28:
+ case UNW_AARCH64_X29:
+ case UNW_AARCH64_PC:
+ case UNW_AARCH64_PSTATE:
+ loc = c->dwarf.loc[reg];
+ break;
+
+ case UNW_AARCH64_SP:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+ default:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ dwarf_loc_t loc = c->dwarf.loc[reg];
+ if (write)
+ return dwarf_putfp (&c->dwarf, loc, *valp);
+ else
+ return dwarf_getfp (&c->dwarf, loc, valp);
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gresume.c b/src/pal/src/libunwind/src/aarch64/Gresume.c
new file mode 100644
index 0000000000..3d82739293
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gresume.c
@@ -0,0 +1,198 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2011-2013 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+HIDDEN inline int
+aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+#ifdef __linux__
+ struct cursor *c = (struct cursor *) cursor;
+ unw_tdep_context_t *uc = c->dwarf.as_arg;
+
+ if (c->sigcontext_format == AARCH64_SCF_NONE)
+ {
+ /* Since there are no signals involved here we restore EH and non scratch
+ registers only. */
+ unsigned long regs[24];
+ regs[0] = uc->uc_mcontext.regs[0];
+ regs[1] = uc->uc_mcontext.regs[1];
+ regs[2] = uc->uc_mcontext.regs[2];
+ regs[3] = uc->uc_mcontext.regs[3];
+ regs[4] = uc->uc_mcontext.regs[19];
+ regs[5] = uc->uc_mcontext.regs[20];
+ regs[6] = uc->uc_mcontext.regs[21];
+ regs[7] = uc->uc_mcontext.regs[22];
+ regs[8] = uc->uc_mcontext.regs[23];
+ regs[9] = uc->uc_mcontext.regs[24];
+ regs[10] = uc->uc_mcontext.regs[25];
+ regs[11] = uc->uc_mcontext.regs[26];
+ regs[12] = uc->uc_mcontext.regs[27];
+ regs[13] = uc->uc_mcontext.regs[28];
+ regs[14] = uc->uc_mcontext.regs[29]; /* FP */
+ regs[15] = uc->uc_mcontext.regs[30]; /* LR */
+ regs[16] = GET_FPCTX(uc)->vregs[8];
+ regs[17] = GET_FPCTX(uc)->vregs[9];
+ regs[18] = GET_FPCTX(uc)->vregs[10];
+ regs[19] = GET_FPCTX(uc)->vregs[11];
+ regs[20] = GET_FPCTX(uc)->vregs[12];
+ regs[21] = GET_FPCTX(uc)->vregs[13];
+ regs[22] = GET_FPCTX(uc)->vregs[14];
+ regs[23] = GET_FPCTX(uc)->vregs[15];
+ unsigned long sp = uc->uc_mcontext.sp;
+
+ struct regs_overlay {
+ char x[sizeof(regs)];
+ };
+
+ asm volatile (
+ "mov x4, %0\n"
+ "mov x5, %1\n"
+ "ldp x0, x1, [x4]\n"
+ "ldp x2, x3, [x4,16]\n"
+ "ldp x19, x20, [x4,32]\n"
+ "ldp x21, x22, [x4,48]\n"
+ "ldp x23, x24, [x4,64]\n"
+ "ldp x25, x26, [x4,80]\n"
+ "ldp x27, x28, [x4,96]\n"
+ "ldp x29, x30, [x4,112]\n"
+ "ldp d8, d9, [x4,128]\n"
+ "ldp d10, d11, [x4,144]\n"
+ "ldp d12, d13, [x4,160]\n"
+ "ldp d14, d15, [x4,176]\n"
+ "mov sp, x5\n"
+ "ret \n"
+ :
+ : "r" (regs),
+ "r" (sp),
+ "m" (*(struct regs_overlay *)regs)
+ );
+ }
+ else
+ {
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+
+ if (c->dwarf.eh_valid_mask & 0x1) sc->regs[0] = c->dwarf.eh_args[0];
+ if (c->dwarf.eh_valid_mask & 0x2) sc->regs[1] = c->dwarf.eh_args[1];
+ if (c->dwarf.eh_valid_mask & 0x4) sc->regs[2] = c->dwarf.eh_args[2];
+ if (c->dwarf.eh_valid_mask & 0x8) sc->regs[3] = c->dwarf.eh_args[3];
+
+ sc->regs[4] = uc->uc_mcontext.regs[4];
+ sc->regs[5] = uc->uc_mcontext.regs[5];
+ sc->regs[6] = uc->uc_mcontext.regs[6];
+ sc->regs[7] = uc->uc_mcontext.regs[7];
+ sc->regs[8] = uc->uc_mcontext.regs[8];
+ sc->regs[9] = uc->uc_mcontext.regs[9];
+ sc->regs[10] = uc->uc_mcontext.regs[10];
+ sc->regs[11] = uc->uc_mcontext.regs[11];
+ sc->regs[12] = uc->uc_mcontext.regs[12];
+ sc->regs[13] = uc->uc_mcontext.regs[13];
+ sc->regs[14] = uc->uc_mcontext.regs[14];
+ sc->regs[15] = uc->uc_mcontext.regs[15];
+ sc->regs[16] = uc->uc_mcontext.regs[16];
+ sc->regs[17] = uc->uc_mcontext.regs[17];
+ sc->regs[18] = uc->uc_mcontext.regs[18];
+ sc->regs[19] = uc->uc_mcontext.regs[19];
+ sc->regs[20] = uc->uc_mcontext.regs[20];
+ sc->regs[21] = uc->uc_mcontext.regs[21];
+ sc->regs[22] = uc->uc_mcontext.regs[22];
+ sc->regs[23] = uc->uc_mcontext.regs[23];
+ sc->regs[24] = uc->uc_mcontext.regs[24];
+ sc->regs[25] = uc->uc_mcontext.regs[25];
+ sc->regs[26] = uc->uc_mcontext.regs[26];
+ sc->regs[27] = uc->uc_mcontext.regs[27];
+ sc->regs[28] = uc->uc_mcontext.regs[28];
+ sc->regs[29] = uc->uc_mcontext.regs[29];
+ sc->regs[30] = uc->uc_mcontext.regs[30];
+ sc->sp = uc->uc_mcontext.sp;
+ sc->pc = uc->uc_mcontext.pc;
+ sc->pstate = uc->uc_mcontext.pstate;
+
+ asm volatile (
+ "mov sp, %0\n"
+ "ret %1\n"
+ : : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc)
+ );
+ }
+ unreachable();
+#else
+ printf ("%s: implement me\n", __FUNCTION__);
+#endif
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+static inline void
+establish_machine_state (struct cursor *c)
+{
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_AARCH64_V31; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ as->acc.access_fpreg (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ as->acc.access_reg (as, reg, &val, 1, arg);
+ }
+ }
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if (!c->dwarf.ip)
+ {
+ /* This can happen easily when the frame-chain gets truncated
+ due to bad or missing unwind-info. */
+ Debug (1, "refusing to resume execution at address 0\n");
+ return -UNW_EINVAL;
+ }
+
+ establish_machine_state (c);
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gstash_frame.c b/src/pal/src/libunwind/src/aarch64/Gstash_frame.c
new file mode 100644
index 0000000000..6689af1a61
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gstash_frame.c
@@ -0,0 +1,89 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY
+ Copyright (C) 2014 CERN and Aalto University
+ Contributed by Filip Nyback
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN void
+tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
+{
+ struct cursor *c = (struct cursor *) dwarf_to_cursor (d);
+ unw_tdep_frame_t *f = &c->frame_info;
+
+ Debug (4, "ip=0x%lx cfa=0x%lx type %d cfa [where=%d val=%ld] cfaoff=%ld"
+ " ra=0x%lx fp [where=%d val=%ld @0x%lx] lr [where=%d val=%ld @0x%lx] "
+ "sp [where=%d val=%ld @0x%lx]\n",
+ d->ip, d->cfa, f->frame_type,
+ rs->reg.where[DWARF_CFA_REG_COLUMN],
+ rs->reg.val[DWARF_CFA_REG_COLUMN],
+ rs->reg.val[DWARF_CFA_OFF_COLUMN],
+ DWARF_GET_LOC(d->loc[rs->ret_addr_column]),
+ rs->reg.where[FP], rs->reg.val[FP], DWARF_GET_LOC(d->loc[FP]),
+ rs->reg.where[LR], rs->reg.val[LR], DWARF_GET_LOC(d->loc[LR]),
+ rs->reg.where[SP], rs->reg.val[SP], DWARF_GET_LOC(d->loc[SP]));
+
+ /* A standard frame is defined as:
+ - CFA is register-relative offset off FP or SP;
+ - Return address is saved in LR;
+ - FP is unsaved or saved at CFA+offset, offset != -1;
+ - LR is unsaved or saved at CFA+offset, offset != -1;
+ - SP is unsaved or saved at CFA+offset, offset != -1. */
+ if (f->frame_type == UNW_AARCH64_FRAME_OTHER
+ && (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
+ && (rs->reg.val[DWARF_CFA_REG_COLUMN] == FP
+ || rs->reg.val[DWARF_CFA_REG_COLUMN] == SP)
+ && labs(rs->reg.val[DWARF_CFA_OFF_COLUMN]) < (1 << 29)
+ && rs->ret_addr_column == LR
+ && (rs->reg.where[FP] == DWARF_WHERE_UNDEF
+ || rs->reg.where[FP] == DWARF_WHERE_SAME
+ || (rs->reg.where[FP] == DWARF_WHERE_CFAREL
+ && labs(rs->reg.val[FP]) < (1 << 29)
+ && rs->reg.val[FP]+1 != 0))
+ && (rs->reg.where[LR] == DWARF_WHERE_UNDEF
+ || rs->reg.where[LR] == DWARF_WHERE_SAME
+ || (rs->reg.where[LR] == DWARF_WHERE_CFAREL
+ && labs(rs->reg.val[LR]) < (1 << 29)
+ && rs->reg.val[LR]+1 != 0))
+ && (rs->reg.where[SP] == DWARF_WHERE_UNDEF
+ || rs->reg.where[SP] == DWARF_WHERE_SAME
+ || (rs->reg.where[SP] == DWARF_WHERE_CFAREL
+ && labs(rs->reg.val[SP]) < (1 << 29)
+ && rs->reg.val[SP]+1 != 0)))
+ {
+ /* Save information for a standard frame. */
+ f->frame_type = UNW_AARCH64_FRAME_STANDARD;
+ f->cfa_reg_sp = (rs->reg.val[DWARF_CFA_REG_COLUMN] == SP);
+ f->cfa_reg_offset = rs->reg.val[DWARF_CFA_OFF_COLUMN];
+ if (rs->reg.where[FP] == DWARF_WHERE_CFAREL)
+ f->fp_cfa_offset = rs->reg.val[FP];
+ if (rs->reg.where[LR] == DWARF_WHERE_CFAREL)
+ f->lr_cfa_offset = rs->reg.val[LR];
+ if (rs->reg.where[SP] == DWARF_WHERE_CFAREL)
+ f->sp_cfa_offset = rs->reg.val[SP];
+ Debug (4, " standard frame\n");
+ }
+ else
+ Debug (4, " unusual frame\n");
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gstep.c b/src/pal/src/libunwind/src/aarch64/Gstep.c
new file mode 100644
index 0000000000..fdf64a73f3
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gstep.c
@@ -0,0 +1,189 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2011-2013 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+/* Recognise PLT entries such as:
+ 40ddf0: b0000570 adrp x16, 4ba000 <_GLOBAL_OFFSET_TABLE_+0x2a8>
+ 40ddf4: f9433611 ldr x17, [x16,#1640]
+ 40ddf8: 9119a210 add x16, x16, #0x668
+ 40ddfc: d61f0220 br x17 */
+static int
+is_plt_entry (struct dwarf_cursor *c)
+{
+ unw_word_t w0, w1;
+ unw_accessors_t *a;
+ int ret;
+
+ a = unw_get_accessors_int (c->as);
+ if ((ret = (*a->access_mem) (c->as, c->ip, &w0, 0, c->as_arg)) < 0
+ || (ret = (*a->access_mem) (c->as, c->ip + 8, &w1, 0, c->as_arg)) < 0)
+ return 0;
+
+ ret = (((w0 & 0xff0000009f000000) == 0xf900000090000000)
+ && ((w1 & 0xffffffffff000000) == 0xd61f022091000000));
+
+ Debug (14, "ip=0x%lx => 0x%016lx 0x%016lx, ret = %d\n", c->ip, w0, w1, ret);
+ return ret;
+}
+
+static int
+aarch64_handle_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+ unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa;
+ struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0);
+
+ if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0)
+ return -UNW_EUNSPEC;
+
+ ret = unw_is_signal_frame (cursor);
+ Debug(1, "unw_is_signal_frame()=%d\n", ret);
+
+ /* Save the SP and PC to be able to return execution at this point
+ later in time (unw_resume). */
+ c->sigcontext_sp = c->dwarf.cfa;
+ c->sigcontext_pc = c->dwarf.ip;
+
+ if (ret)
+ {
+ c->sigcontext_format = AARCH64_SCF_LINUX_RT_SIGFRAME;
+ sc_addr = sp_addr + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF;
+ }
+ else
+ return -UNW_EUNSPEC;
+
+ c->sigcontext_addr = sc_addr;
+ c->frame_info.frame_type = UNW_AARCH64_FRAME_SIGRETURN;
+ c->frame_info.cfa_reg_offset = sc_addr - sp_addr;
+
+ /* Update the dwarf cursor.
+ Set the location of the registers to the corresponding addresses of the
+ uc_mcontext / sigcontext structure contents. */
+ c->dwarf.loc[UNW_AARCH64_X0] = DWARF_LOC (sc_addr + LINUX_SC_X0_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X1] = DWARF_LOC (sc_addr + LINUX_SC_X1_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X2] = DWARF_LOC (sc_addr + LINUX_SC_X2_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X3] = DWARF_LOC (sc_addr + LINUX_SC_X3_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X4] = DWARF_LOC (sc_addr + LINUX_SC_X4_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X5] = DWARF_LOC (sc_addr + LINUX_SC_X5_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X6] = DWARF_LOC (sc_addr + LINUX_SC_X6_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X7] = DWARF_LOC (sc_addr + LINUX_SC_X7_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X8] = DWARF_LOC (sc_addr + LINUX_SC_X8_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X9] = DWARF_LOC (sc_addr + LINUX_SC_X9_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X10] = DWARF_LOC (sc_addr + LINUX_SC_X10_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X11] = DWARF_LOC (sc_addr + LINUX_SC_X11_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X12] = DWARF_LOC (sc_addr + LINUX_SC_X12_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X13] = DWARF_LOC (sc_addr + LINUX_SC_X13_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X14] = DWARF_LOC (sc_addr + LINUX_SC_X14_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X15] = DWARF_LOC (sc_addr + LINUX_SC_X15_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X16] = DWARF_LOC (sc_addr + LINUX_SC_X16_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X17] = DWARF_LOC (sc_addr + LINUX_SC_X17_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X18] = DWARF_LOC (sc_addr + LINUX_SC_X18_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X19] = DWARF_LOC (sc_addr + LINUX_SC_X19_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X20] = DWARF_LOC (sc_addr + LINUX_SC_X20_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X21] = DWARF_LOC (sc_addr + LINUX_SC_X21_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X22] = DWARF_LOC (sc_addr + LINUX_SC_X22_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X23] = DWARF_LOC (sc_addr + LINUX_SC_X23_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X24] = DWARF_LOC (sc_addr + LINUX_SC_X24_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X25] = DWARF_LOC (sc_addr + LINUX_SC_X25_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X26] = DWARF_LOC (sc_addr + LINUX_SC_X26_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X27] = DWARF_LOC (sc_addr + LINUX_SC_X27_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X28] = DWARF_LOC (sc_addr + LINUX_SC_X28_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X29] = DWARF_LOC (sc_addr + LINUX_SC_X29_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_X30] = DWARF_LOC (sc_addr + LINUX_SC_X30_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_SP] = DWARF_LOC (sc_addr + LINUX_SC_SP_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_PC] = DWARF_LOC (sc_addr + LINUX_SC_PC_OFF, 0);
+ c->dwarf.loc[UNW_AARCH64_PSTATE] = DWARF_LOC (sc_addr + LINUX_SC_PSTATE_OFF, 0);
+
+ /* Set SP/CFA and PC/IP. */
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_SP], &c->dwarf.cfa);
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_PC], &c->dwarf.ip);
+
+ c->dwarf.pi_valid = 0;
+ c->dwarf.use_prev_instr = 0;
+
+ return 1;
+}
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx))\n",
+ c, c->dwarf.ip, c->dwarf.cfa);
+
+ /* Check if this is a signal frame. */
+ if (unw_is_signal_frame (cursor) > 0)
+ return aarch64_handle_signal_frame (cursor);
+
+ ret = dwarf_step (&c->dwarf);
+ Debug(1, "dwarf_step()=%d\n", ret);
+
+ if (unlikely (ret == -UNW_ESTOPUNWIND))
+ return ret;
+
+ if (unlikely (ret < 0))
+ {
+ /* DWARF failed. */
+ if (is_plt_entry (&c->dwarf))
+ {
+ Debug (2, "found plt entry\n");
+ c->frame_info.frame_type = UNW_AARCH64_FRAME_STANDARD;
+ }
+ else
+ {
+ Debug (2, "fallback\n");
+ c->frame_info.frame_type = UNW_AARCH64_FRAME_GUESSED;
+ }
+ /* Use link register (X30). */
+ c->frame_info.cfa_reg_offset = 0;
+ c->frame_info.cfa_reg_sp = 0;
+ c->frame_info.fp_cfa_offset = -1;
+ c->frame_info.lr_cfa_offset = -1;
+ c->frame_info.sp_cfa_offset = -1;
+ c->dwarf.loc[UNW_AARCH64_PC] = c->dwarf.loc[UNW_AARCH64_X30];
+ c->dwarf.loc[UNW_AARCH64_X30] = DWARF_NULL_LOC;
+ if (!DWARF_IS_NULL_LOC (c->dwarf.loc[UNW_AARCH64_PC]))
+ {
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_PC], &c->dwarf.ip);
+ if (ret < 0)
+ {
+ Debug (2, "failed to get pc from link register: %d\n", ret);
+ return ret;
+ }
+ Debug (2, "link register (x30) = 0x%016lx\n", c->dwarf.ip);
+ ret = 1;
+ }
+ else
+ c->dwarf.ip = 0;
+ }
+
+ return (c->dwarf.ip == 0) ? 0 : 1;
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Gtrace.c b/src/pal/src/libunwind/src/aarch64/Gtrace.c
new file mode 100644
index 0000000000..c67faf0e35
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Gtrace.c
@@ -0,0 +1,548 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY
+ Copyright (C) 2014 CERN and Aalto University
+ Contributed by Filip Nyback
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+#include <signal.h>
+#include <limits.h>
+
+#pragma weak pthread_once
+#pragma weak pthread_key_create
+#pragma weak pthread_getspecific
+#pragma weak pthread_setspecific
+
+/* Initial hash table size. Table expands by 2 bits (times four). */
+#define HASH_MIN_BITS 14
+
+typedef struct
+{
+ unw_tdep_frame_t *frames;
+ size_t log_size;
+ size_t used;
+ size_t dtor_count; /* Counts how many times our destructor has already
+ been called. */
+} unw_trace_cache_t;
+
+static const unw_tdep_frame_t empty_frame = { 0, UNW_AARCH64_FRAME_OTHER, -1, -1, 0, -1, -1, -1 };
+static define_lock (trace_init_lock);
+static pthread_once_t trace_cache_once = PTHREAD_ONCE_INIT;
+static sig_atomic_t trace_cache_once_happen;
+static pthread_key_t trace_cache_key;
+static struct mempool trace_cache_pool;
+static __thread unw_trace_cache_t *tls_cache;
+static __thread int tls_cache_destroyed;
+
+/* Free memory for a thread's trace cache. */
+static void
+trace_cache_free (void *arg)
+{
+ unw_trace_cache_t *cache = arg;
+ if (++cache->dtor_count < PTHREAD_DESTRUCTOR_ITERATIONS)
+ {
+ /* Not yet our turn to get destroyed. Re-install ourselves into the key. */
+ pthread_setspecific(trace_cache_key, cache);
+ Debug(5, "delayed freeing cache %p (%zx to go)\n", cache,
+ PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count);
+ return;
+ }
+ tls_cache_destroyed = 1;
+ tls_cache = NULL;
+ munmap (cache->frames, (1u << cache->log_size) * sizeof(unw_tdep_frame_t));
+ mempool_free (&trace_cache_pool, cache);
+ Debug(5, "freed cache %p\n", cache);
+}
+
+/* Initialise frame tracing for threaded use. */
+static void
+trace_cache_init_once (void)
+{
+ pthread_key_create (&trace_cache_key, &trace_cache_free);
+ mempool_init (&trace_cache_pool, sizeof (unw_trace_cache_t), 0);
+ trace_cache_once_happen = 1;
+}
+
+static unw_tdep_frame_t *
+trace_cache_buckets (size_t n)
+{
+ unw_tdep_frame_t *frames;
+ size_t i;
+
+ GET_MEMORY(frames, n * sizeof (unw_tdep_frame_t));
+ if (likely(frames != NULL))
+ for (i = 0; i < n; ++i)
+ frames[i] = empty_frame;
+
+ return frames;
+}
+
+/* Allocate and initialise hash table for frame cache lookups.
+ Returns the cache initialised with (1u << HASH_LOW_BITS) hash
+ buckets, or NULL if there was a memory allocation problem. */
+static unw_trace_cache_t *
+trace_cache_create (void)
+{
+ unw_trace_cache_t *cache;
+
+ if (tls_cache_destroyed)
+ {
+ /* The current thread is in the process of exiting. Don't recreate
+ cache, as we wouldn't have another chance to free it. */
+ Debug(5, "refusing to reallocate cache: "
+ "thread-locals are being deallocated\n");
+ return NULL;
+ }
+
+ if (! (cache = mempool_alloc(&trace_cache_pool)))
+ {
+ Debug(5, "failed to allocate cache\n");
+ return NULL;
+ }
+
+ if (! (cache->frames = trace_cache_buckets(1u << HASH_MIN_BITS)))
+ {
+ Debug(5, "failed to allocate buckets\n");
+ mempool_free(&trace_cache_pool, cache);
+ return NULL;
+ }
+
+ cache->log_size = HASH_MIN_BITS;
+ cache->used = 0;
+ cache->dtor_count = 0;
+ tls_cache_destroyed = 0; /* Paranoia: should already be 0. */
+ Debug(5, "allocated cache %p\n", cache);
+ return cache;
+}
+
+/* Expand the hash table in the frame cache if possible. This always
+ quadruples the hash size, and clears all previous frame entries. */
+static int
+trace_cache_expand (unw_trace_cache_t *cache)
+{
+ size_t old_size = (1u << cache->log_size);
+ size_t new_log_size = cache->log_size + 2;
+ unw_tdep_frame_t *new_frames = trace_cache_buckets (1u << new_log_size);
+
+ if (unlikely(! new_frames))
+ {
+ Debug(5, "failed to expand cache to 2^%lu buckets\n", new_log_size);
+ return -UNW_ENOMEM;
+ }
+
+ Debug(5, "expanded cache from 2^%lu to 2^%lu buckets\n", cache->log_size, new_log_size);
+ munmap(cache->frames, old_size * sizeof(unw_tdep_frame_t));
+ cache->frames = new_frames;
+ cache->log_size = new_log_size;
+ cache->used = 0;
+ return 0;
+}
+
+static unw_trace_cache_t *
+trace_cache_get_unthreaded (void)
+{
+ unw_trace_cache_t *cache;
+ intrmask_t saved_mask;
+ static unw_trace_cache_t *global_cache = NULL;
+ lock_acquire (&trace_init_lock, saved_mask);
+ if (! global_cache)
+ {
+ mempool_init (&trace_cache_pool, sizeof (unw_trace_cache_t), 0);
+ global_cache = trace_cache_create ();
+ }
+ cache = global_cache;
+ lock_release (&trace_init_lock, saved_mask);
+ Debug(5, "using cache %p\n", cache);
+ return cache;
+}
+
+/* Get the frame cache for the current thread. Create it if there is none. */
+static unw_trace_cache_t *
+trace_cache_get (void)
+{
+ unw_trace_cache_t *cache;
+ if (likely (pthread_once != NULL))
+ {
+ pthread_once(&trace_cache_once, &trace_cache_init_once);
+ if (!trace_cache_once_happen)
+ {
+ return trace_cache_get_unthreaded();
+ }
+ if (! (cache = tls_cache))
+ {
+ cache = trace_cache_create();
+ pthread_setspecific(trace_cache_key, cache);
+ tls_cache = cache;
+ }
+ Debug(5, "using cache %p\n", cache);
+ return cache;
+ }
+ else
+ {
+ return trace_cache_get_unthreaded();
+ }
+}
+
+/* Initialise frame properties for address cache slot F at address
+ PC using current CFA, FP and SP values. Modifies CURSOR to
+ that location, performs one unw_step(), and fills F with what
+ was discovered about the location. Returns F.
+
+ FIXME: This probably should tell DWARF handling to never evaluate
+ or use registers other than FP, SP and PC in case there is
+ highly unusual unwind info which uses these creatively. */
+static unw_tdep_frame_t *
+trace_init_addr (unw_tdep_frame_t *f,
+ unw_cursor_t *cursor,
+ unw_word_t cfa,
+ unw_word_t pc,
+ unw_word_t fp,
+ unw_word_t sp)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct dwarf_cursor *d = &c->dwarf;
+ int ret = -UNW_EINVAL;
+
+ /* Initialise frame properties: unknown, not last. */
+ f->virtual_address = pc;
+ f->frame_type = UNW_AARCH64_FRAME_OTHER;
+ f->last_frame = 0;
+ f->cfa_reg_sp = -1;
+ f->cfa_reg_offset = 0;
+ f->fp_cfa_offset = -1;
+ f->lr_cfa_offset = -1;
+ f->sp_cfa_offset = -1;
+
+ /* Reinitialise cursor to this instruction - but undo next/prev PC
+ adjustment because unw_step will redo it - and force PC, FP and
+ SP into register locations (=~ ucontext we keep), then set
+ their desired values. Then perform the step. */
+ d->ip = pc + d->use_prev_instr;
+ d->cfa = cfa;
+ d->loc[UNW_AARCH64_X29] = DWARF_REG_LOC (d, UNW_AARCH64_X29);
+ d->loc[UNW_AARCH64_SP] = DWARF_REG_LOC (d, UNW_AARCH64_SP);
+ d->loc[UNW_AARCH64_PC] = DWARF_REG_LOC (d, UNW_AARCH64_PC);
+ c->frame_info = *f;
+
+ if (likely(dwarf_put (d, d->loc[UNW_AARCH64_X29], fp) >= 0)
+ && likely(dwarf_put (d, d->loc[UNW_AARCH64_SP], sp) >= 0)
+ && likely(dwarf_put (d, d->loc[UNW_AARCH64_PC], pc) >= 0)
+ && likely((ret = unw_step (cursor)) >= 0))
+ *f = c->frame_info;
+
+ /* If unw_step() stopped voluntarily, remember that, even if it
+ otherwise could not determine anything useful. This avoids
+ failing trace if we hit frames without unwind info, which is
+ common for the outermost frame (CRT stuff) on many systems.
+ This avoids failing trace in very common circumstances; failing
+ to unw_step() loop wouldn't produce any better result. */
+ if (ret == 0)
+ f->last_frame = -1;
+
+ Debug (3, "frame va %lx type %d last %d cfa %s+%d fp @ cfa%+d lr @ cfa%+d sp @ cfa%+d\n",
+ f->virtual_address, f->frame_type, f->last_frame,
+ f->cfa_reg_sp ? "sp" : "fp", f->cfa_reg_offset,
+ f->fp_cfa_offset, f->lr_cfa_offset, f->sp_cfa_offset);
+
+ return f;
+}
+
+/* Look up and if necessary fill in frame attributes for address PC
+ in CACHE using current CFA, FP and SP values. Uses CURSOR to
+ perform any unwind steps necessary to fill the cache. Returns the
+ frame cache slot which describes RIP. */
+static unw_tdep_frame_t *
+trace_lookup (unw_cursor_t *cursor,
+ unw_trace_cache_t *cache,
+ unw_word_t cfa,
+ unw_word_t pc,
+ unw_word_t fp,
+ unw_word_t sp)
+{
+ /* First look up for previously cached information using cache as
+ linear probing hash table with probe step of 1. Majority of
+ lookups should be completed within few steps, but it is very
+ important the hash table does not fill up, or performance falls
+ off the cliff. */
+ uint64_t i, addr;
+ uint64_t cache_size = 1u << cache->log_size;
+ uint64_t slot = ((pc * 0x9e3779b97f4a7c16) >> 43) & (cache_size-1);
+ unw_tdep_frame_t *frame;
+
+ for (i = 0; i < 16; ++i)
+ {
+ frame = &cache->frames[slot];
+ addr = frame->virtual_address;
+
+ /* Return if we found the address. */
+ if (likely(addr == pc))
+ {
+ Debug (4, "found address after %ld steps\n", i);
+ return frame;
+ }
+
+ /* If slot is empty, reuse it. */
+ if (likely(! addr))
+ break;
+
+ /* Linear probe to next slot candidate, step = 1. */
+ if (++slot >= cache_size)
+ slot -= cache_size;
+ }
+
+ /* If we collided after 16 steps, or if the hash is more than half
+ full, force the hash to expand. Fill the selected slot, whether
+ it's free or collides. Note that hash expansion drops previous
+ contents; further lookups will refill the hash. */
+ Debug (4, "updating slot %lu after %ld steps, replacing 0x%lx\n", slot, i, addr);
+ if (unlikely(addr || cache->used >= cache_size / 2))
+ {
+ if (unlikely(trace_cache_expand (cache) < 0))
+ return NULL;
+
+ cache_size = 1u << cache->log_size;
+ slot = ((pc * 0x9e3779b97f4a7c16) >> 43) & (cache_size-1);
+ frame = &cache->frames[slot];
+ addr = frame->virtual_address;
+ }
+
+ if (! addr)
+ ++cache->used;
+
+ return trace_init_addr (frame, cursor, cfa, pc, fp, sp);
+}
+
+/* Fast stack backtrace for AArch64.
+
+ This is used by backtrace() implementation to accelerate frequent
+ queries for current stack, without any desire to unwind. It fills
+ BUFFER with the call tree from CURSOR upwards for at most SIZE
+ stack levels. The first frame, backtrace itself, is omitted. When
+ called, SIZE should give the maximum number of entries that can be
+ stored into BUFFER. Uses an internal thread-specific cache to
+ accelerate queries.
+
+ The caller should fall back to a unw_step() loop if this function
+ fails by returning -UNW_ESTOPUNWIND, meaning the routine hit a
+ stack frame that is too complex to be traced in the fast path.
+
+ This function is tuned for clients which only need to walk the
+ stack to get the call tree as fast as possible but without any
+ other details, for example profilers sampling the stack thousands
+ to millions of times per second. The routine handles the most
+ common AArch64 ABI stack layouts: CFA is FP or SP plus/minus
+ constant offset, return address is in LR, and FP, LR and SP are
+ either unchanged or saved on stack at constant offset from the CFA;
+ the signal return frame; and frames without unwind info provided
+ they are at the outermost (final) frame or can conservatively be
+ assumed to be frame-pointer based.
+
+ Any other stack layout will cause the routine to give up. There
+ are only a handful of relatively rarely used functions which do
+ not have a stack in the standard form: vfork, longjmp, setcontext
+ and _dl_runtime_profile on common linux systems for example.
+
+ On success BUFFER and *SIZE reflect the trace progress up to *SIZE
+ stack levels or the outermost frame, which ever is less. It may
+ stop short of outermost frame if unw_step() loop would also do so,
+ e.g. if there is no more unwind information; this is not reported
+ as an error.
+
+ The function returns a negative value for errors, -UNW_ESTOPUNWIND
+ if tracing stopped because of an unusual frame unwind info. The
+ BUFFER and *SIZE reflect tracing progress up to the error frame.
+
+ Callers of this function would normally look like this:
+
+ unw_cursor_t cur;
+ unw_context_t ctx;
+ void addrs[128];
+ int depth = 128;
+ int ret;
+
+ unw_getcontext(&ctx);
+ unw_init_local(&cur, &ctx);
+ if ((ret = unw_tdep_trace(&cur, addrs, &depth)) < 0)
+ {
+ depth = 0;
+ unw_getcontext(&ctx);
+ unw_init_local(&cur, &ctx);
+ while ((ret = unw_step(&cur)) > 0 && depth < 128)
+ {
+ unw_word_t ip;
+ unw_get_reg(&cur, UNW_REG_IP, &ip);
+ addresses[depth++] = (void *) ip;
+ }
+ }
+*/
+HIDDEN int
+tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct dwarf_cursor *d = &c->dwarf;
+ unw_trace_cache_t *cache;
+ unw_word_t fp, sp, pc, cfa, lr;
+ int maxdepth = 0;
+ int depth = 0;
+ int ret;
+
+ /* Check input parametres. */
+ if (unlikely(! cursor || ! buffer || ! size || (maxdepth = *size) <= 0))
+ return -UNW_EINVAL;
+
+ Debug (1, "begin ip 0x%lx cfa 0x%lx\n", d->ip, d->cfa);
+
+ /* Tell core dwarf routines to call back to us. */
+ d->stash_frames = 1;
+
+ /* Determine initial register values. These are direct access safe
+ because we know they come from the initial machine context. */
+ pc = d->ip;
+ sp = cfa = d->cfa;
+ ACCESS_MEM_FAST(ret, 0, d, DWARF_GET_LOC(d->loc[UNW_AARCH64_X29]), fp);
+ assert(ret == 0);
+ lr = 0;
+
+ /* Get frame cache. */
+ if (unlikely(! (cache = trace_cache_get())))
+ {
+ Debug (1, "returning %d, cannot get trace cache\n", -UNW_ENOMEM);
+ *size = 0;
+ d->stash_frames = 0;
+ return -UNW_ENOMEM;
+ }
+
+ /* Trace the stack upwards, starting from current RIP. Adjust
+ the RIP address for previous/next instruction as the main
+ unwinding logic would also do. We undo this before calling
+ back into unw_step(). */
+ while (depth < maxdepth)
+ {
+ pc -= d->use_prev_instr;
+ Debug (2, "depth %d cfa 0x%lx pc 0x%lx sp 0x%lx fp 0x%lx\n",
+ depth, cfa, pc, sp, fp);
+
+ /* See if we have this address cached. If not, evaluate enough of
+ the dwarf unwind information to fill the cache line data, or to
+ decide this frame cannot be handled in fast trace mode. We
+ cache negative results too to prevent unnecessary dwarf parsing
+ for common failures. */
+ unw_tdep_frame_t *f = trace_lookup (cursor, cache, cfa, pc, fp, sp);
+
+ /* If we don't have information for this frame, give up. */
+ if (unlikely(! f))
+ {
+ ret = -UNW_ENOINFO;
+ break;
+ }
+
+ Debug (3, "frame va %lx type %d last %d cfa %s+%d fp @ cfa%+d lr @ cfa%+d sp @ cfa%+d\n",
+ f->virtual_address, f->frame_type, f->last_frame,
+ f->cfa_reg_sp ? "sp" : "fp", f->cfa_reg_offset,
+ f->fp_cfa_offset, f->lr_cfa_offset, f->sp_cfa_offset);
+
+ assert (f->virtual_address == pc);
+
+ /* Stop if this was the last frame. In particular don't evaluate
+ new register values as it may not be safe - we don't normally
+ run with full validation on, and do not want to - and there's
+ enough bad unwind info floating around that we need to trust
+ what unw_step() previously said, in potentially bogus frames. */
+ if (f->last_frame)
+ break;
+
+ /* Evaluate CFA and registers for the next frame. */
+ switch (f->frame_type)
+ {
+ case UNW_AARCH64_FRAME_GUESSED:
+ /* Fall thru to standard processing after forcing validation. */
+ c->validate = 1;
+
+ case UNW_AARCH64_FRAME_STANDARD:
+ /* Advance standard traceable frame. */
+ cfa = (f->cfa_reg_sp ? sp : fp) + f->cfa_reg_offset;
+ if (likely(f->lr_cfa_offset != -1))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->lr_cfa_offset, pc);
+ else if (lr != 0)
+ {
+ /* Use the saved link register as the new pc. */
+ pc = lr;
+ lr = 0;
+ }
+ if (likely(ret >= 0) && likely(f->fp_cfa_offset != -1))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->fp_cfa_offset, fp);
+
+ /* Don't bother reading SP from DWARF, CFA becomes new SP. */
+ sp = cfa;
+
+ /* Next frame needs to back up for unwind info lookup. */
+ d->use_prev_instr = 1;
+ break;
+
+ case UNW_AARCH64_FRAME_SIGRETURN:
+ cfa = cfa + f->cfa_reg_offset; /* cfa now points to ucontext_t. */
+
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_PC_OFF, pc);
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_X29_OFF, fp);
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_SP_OFF, sp);
+ /* Save the link register here in case we end up in a function that
+ doesn't save the link register in the prologue, e.g. kill. */
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_X30_OFF, lr);
+
+ /* Resume stack at signal restoration point. The stack is not
+ necessarily continuous here, especially with sigaltstack(). */
+ cfa = sp;
+
+ /* Next frame should not back up. */
+ d->use_prev_instr = 0;
+ break;
+
+ default:
+ /* We cannot trace through this frame, give up and tell the
+ caller we had to stop. Data collected so far may still be
+ useful to the caller, so let it know how far we got. */
+ ret = -UNW_ESTOPUNWIND;
+ break;
+ }
+
+ Debug (4, "new cfa 0x%lx pc 0x%lx sp 0x%lx fp 0x%lx\n",
+ cfa, pc, sp, fp);
+
+ /* If we failed or ended up somewhere bogus, stop. */
+ if (unlikely(ret < 0 || pc < 0x4000))
+ break;
+
+ /* Record this address in stack trace. We skipped the first address. */
+ buffer[depth++] = (void *) (pc - d->use_prev_instr);
+ }
+
+#if UNW_DEBUG
+ Debug (1, "returning %d, depth %d\n", ret, depth);
+#endif
+ *size = depth;
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/aarch64/Lapply_reg_state.c b/src/pal/src/libunwind/src/aarch64/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lcreate_addr_space.c b/src/pal/src/libunwind/src/aarch64/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lget_proc_info.c b/src/pal/src/libunwind/src/aarch64/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lget_save_loc.c b/src/pal/src/libunwind/src/aarch64/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lglobal.c b/src/pal/src/libunwind/src/aarch64/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Linit.c b/src/pal/src/libunwind/src/aarch64/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Linit_local.c b/src/pal/src/libunwind/src/aarch64/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Linit_remote.c b/src/pal/src/libunwind/src/aarch64/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lis_signal_frame.c b/src/pal/src/libunwind/src/aarch64/Lis_signal_frame.c
new file mode 100644
index 0000000000..b9a7c4f51a
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lreg_states_iterate.c b/src/pal/src/libunwind/src/aarch64/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lregs.c b/src/pal/src/libunwind/src/aarch64/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lresume.c b/src/pal/src/libunwind/src/aarch64/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lstash_frame.c b/src/pal/src/libunwind/src/aarch64/Lstash_frame.c
new file mode 100644
index 0000000000..77587803d0
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lstash_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstash_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Lstep.c b/src/pal/src/libunwind/src/aarch64/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/Ltrace.c b/src/pal/src/libunwind/src/aarch64/Ltrace.c
new file mode 100644
index 0000000000..fcd3f239c9
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/Ltrace.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gtrace.c"
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/gen-offsets.c b/src/pal/src/libunwind/src/aarch64/gen-offsets.c
new file mode 100644
index 0000000000..eadc2377d8
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/gen-offsets.c
@@ -0,0 +1,68 @@
+#include <stdio.h>
+#include <stddef.h>
+#include <ucontext.h>
+#include <asm/sigcontext.h>
+
+#define UC(N,X) \
+ printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))
+
+#define SC(N,X) \
+ printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))
+
+int
+main (void)
+{
+ printf (
+"/* Linux-specific definitions: */\n\n"
+
+"/* Define various structure offsets to simplify cross-compilation. */\n\n"
+
+"/* Offsets for AArch64 Linux \"ucontext_t\": */\n\n");
+
+ UC ("FLAGS", uc_flags);
+ UC ("LINK", uc_link);
+ UC ("STACK", uc_stack);
+ UC ("MCONTEXT", uc_mcontext);
+ UC ("SIGMASK", uc_sigmask);
+
+ printf ("\n/* Offsets for AArch64 Linux \"struct sigcontext\": */\n\n");
+
+ SC ("R0", regs[0]);
+ SC ("R1", regs[1]);
+ SC ("R2", regs[2]);
+ SC ("R3", regs[3]);
+ SC ("R4", regs[4]);
+ SC ("R5", regs[5]);
+ SC ("R6", regs[6]);
+ SC ("R7", regs[7]);
+ SC ("R8", regs[8]);
+ SC ("R9", regs[9]);
+ SC ("R10", regs[10]);
+ SC ("R11", regs[11]);
+ SC ("R12", regs[12]);
+ SC ("R13", regs[13]);
+ SC ("R14", regs[14]);
+ SC ("R15", regs[15]);
+ SC ("R16", regs[16]);
+ SC ("R17", regs[17]);
+ SC ("R18", regs[18]);
+ SC ("R19", regs[19]);
+ SC ("R20", regs[20]);
+ SC ("R21", regs[21]);
+ SC ("R22", regs[22]);
+ SC ("R23", regs[23]);
+ SC ("R24", regs[24]);
+ SC ("R25", regs[25]);
+ SC ("R26", regs[26]);
+ SC ("R27", regs[27]);
+ SC ("R28", regs[28]);
+ SC ("R29", regs[29]);
+ SC ("R30", regs[30]);
+ SC ("R31", regs[31]);
+
+ SC ("PC", pc);
+ SC ("SP", sp);
+ SC ("Fault", fault_address);
+ SC ("state", pstate);
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/aarch64/getcontext.S b/src/pal/src/libunwind/src/aarch64/getcontext.S
new file mode 100644
index 0000000000..25ed5b66be
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/getcontext.S
@@ -0,0 +1,52 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 Google, Inc
+ Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+
+/* int _Uaarch64_getcontext_trace (unw_tdep_context_t *ucp)
+
+ Saves limited machine context in UCP necessary for fast trace. If fast trace
+ fails, caller will have to get the full context.
+*/
+
+ .global _Uaarch64_getcontext_trace
+ .hidden _Uaarch64_getcontext_trace
+ .type _Uaarch64_getcontext_trace, @function
+_Uaarch64_getcontext_trace:
+ .cfi_startproc
+
+ /* Save only FP, SP, PC - exclude this call. */
+ str x29, [x0, #(LINUX_UC_MCONTEXT_OFF + LINUX_SC_X29_OFF)]
+ mov x9, sp
+ str x9, [x0, #(LINUX_UC_MCONTEXT_OFF + LINUX_SC_SP_OFF)]
+ str x30, [x0, #(LINUX_UC_MCONTEXT_OFF + LINUX_SC_PC_OFF)]
+
+ ret
+ .cfi_endproc
+ .size _Uaarch64_getcontext_trace, . - _Uaarch64_getcontext_trace
+
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/aarch64/init.h b/src/pal/src/libunwind/src/aarch64/init.h
new file mode 100644
index 0000000000..5dab60bb64
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/init.h
@@ -0,0 +1,126 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret, i;
+
+ c->dwarf.loc[UNW_AARCH64_X0] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X0);
+ c->dwarf.loc[UNW_AARCH64_X1] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X1);
+ c->dwarf.loc[UNW_AARCH64_X2] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X2);
+ c->dwarf.loc[UNW_AARCH64_X3] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X3);
+ c->dwarf.loc[UNW_AARCH64_X4] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X4);
+ c->dwarf.loc[UNW_AARCH64_X5] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X5);
+ c->dwarf.loc[UNW_AARCH64_X6] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X6);
+ c->dwarf.loc[UNW_AARCH64_X7] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X7);
+ c->dwarf.loc[UNW_AARCH64_X8] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X8);
+ c->dwarf.loc[UNW_AARCH64_X9] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X9);
+ c->dwarf.loc[UNW_AARCH64_X10] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X10);
+ c->dwarf.loc[UNW_AARCH64_X11] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X11);
+ c->dwarf.loc[UNW_AARCH64_X12] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X12);
+ c->dwarf.loc[UNW_AARCH64_X13] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X13);
+ c->dwarf.loc[UNW_AARCH64_X14] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X14);
+ c->dwarf.loc[UNW_AARCH64_X15] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X15);
+ c->dwarf.loc[UNW_AARCH64_X16] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X16);
+ c->dwarf.loc[UNW_AARCH64_X17] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X17);
+ c->dwarf.loc[UNW_AARCH64_X18] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X18);
+ c->dwarf.loc[UNW_AARCH64_X19] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X19);
+ c->dwarf.loc[UNW_AARCH64_X20] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X20);
+ c->dwarf.loc[UNW_AARCH64_X21] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X21);
+ c->dwarf.loc[UNW_AARCH64_X22] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X22);
+ c->dwarf.loc[UNW_AARCH64_X23] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X23);
+ c->dwarf.loc[UNW_AARCH64_X24] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X24);
+ c->dwarf.loc[UNW_AARCH64_X25] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X25);
+ c->dwarf.loc[UNW_AARCH64_X26] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X26);
+ c->dwarf.loc[UNW_AARCH64_X27] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X27);
+ c->dwarf.loc[UNW_AARCH64_X28] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X28);
+ c->dwarf.loc[UNW_AARCH64_X29] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X29);
+ c->dwarf.loc[UNW_AARCH64_X30] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X30);
+ c->dwarf.loc[UNW_AARCH64_SP] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_SP);
+ c->dwarf.loc[UNW_AARCH64_PC] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_PC);
+ c->dwarf.loc[UNW_AARCH64_PSTATE] = DWARF_REG_LOC (&c->dwarf,
+ UNW_AARCH64_PSTATE);
+ c->dwarf.loc[UNW_AARCH64_V0] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V0);
+ c->dwarf.loc[UNW_AARCH64_V1] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V1);
+ c->dwarf.loc[UNW_AARCH64_V2] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V2);
+ c->dwarf.loc[UNW_AARCH64_V3] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V3);
+ c->dwarf.loc[UNW_AARCH64_V4] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V4);
+ c->dwarf.loc[UNW_AARCH64_V5] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V5);
+ c->dwarf.loc[UNW_AARCH64_V6] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V6);
+ c->dwarf.loc[UNW_AARCH64_V7] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V7);
+ c->dwarf.loc[UNW_AARCH64_V8] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V8);
+ c->dwarf.loc[UNW_AARCH64_V9] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V9);
+ c->dwarf.loc[UNW_AARCH64_V10] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V10);
+ c->dwarf.loc[UNW_AARCH64_V11] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V11);
+ c->dwarf.loc[UNW_AARCH64_V12] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V12);
+ c->dwarf.loc[UNW_AARCH64_V13] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V13);
+ c->dwarf.loc[UNW_AARCH64_V14] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V14);
+ c->dwarf.loc[UNW_AARCH64_V15] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V15);
+ c->dwarf.loc[UNW_AARCH64_V16] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V16);
+ c->dwarf.loc[UNW_AARCH64_V17] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V17);
+ c->dwarf.loc[UNW_AARCH64_V18] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V18);
+ c->dwarf.loc[UNW_AARCH64_V19] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V19);
+ c->dwarf.loc[UNW_AARCH64_V20] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V20);
+ c->dwarf.loc[UNW_AARCH64_V21] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V21);
+ c->dwarf.loc[UNW_AARCH64_V22] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V22);
+ c->dwarf.loc[UNW_AARCH64_V23] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V23);
+ c->dwarf.loc[UNW_AARCH64_V24] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V24);
+ c->dwarf.loc[UNW_AARCH64_V25] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V25);
+ c->dwarf.loc[UNW_AARCH64_V26] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V26);
+ c->dwarf.loc[UNW_AARCH64_V27] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V27);
+ c->dwarf.loc[UNW_AARCH64_V28] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V28);
+ c->dwarf.loc[UNW_AARCH64_V29] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V29);
+ c->dwarf.loc[UNW_AARCH64_V30] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V30);
+ c->dwarf.loc[UNW_AARCH64_V31] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V31);
+
+ for (i = UNW_AARCH64_PSTATE + 1; i < UNW_AARCH64_V0; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_PC], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_SP], &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = AARCH64_SCF_NONE;
+ c->sigcontext_addr = 0;
+ c->sigcontext_sp = 0;
+ c->sigcontext_pc = 0;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/aarch64/is_fpreg.c b/src/pal/src/libunwind/src/aarch64/is_fpreg.c
new file mode 100644
index 0000000000..2981d27520
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/is_fpreg.c
@@ -0,0 +1,32 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_is_fpreg (int regnum)
+{
+ return (regnum >= UNW_AARCH64_V0 && regnum <= UNW_AARCH64_V31);
+}
diff --git a/src/pal/src/libunwind/src/aarch64/offsets.h b/src/pal/src/libunwind/src/aarch64/offsets.h
new file mode 100644
index 0000000000..e78251d0a8
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/offsets.h
@@ -0,0 +1,49 @@
+/* Linux-specific definitions: */
+
+/* Define various structure offsets to simplify cross-compilation. */
+
+/* Offsets for AArch64 Linux "ucontext_t": */
+
+#define LINUX_UC_FLAGS_OFF 0x0
+#define LINUX_UC_LINK_OFF 0x8
+#define LINUX_UC_STACK_OFF 0x10
+#define LINUX_UC_SIGMASK_OFF 0x28
+#define LINUX_UC_MCONTEXT_OFF 0xb0
+
+/* Offsets for AArch64 Linux "struct sigcontext": */
+
+#define LINUX_SC_FAULTADDRESS_OFF 0x00
+#define LINUX_SC_X0_OFF 0x008
+#define LINUX_SC_X1_OFF 0x010
+#define LINUX_SC_X2_OFF 0x018
+#define LINUX_SC_X3_OFF 0x020
+#define LINUX_SC_X4_OFF 0x028
+#define LINUX_SC_X5_OFF 0x030
+#define LINUX_SC_X6_OFF 0x038
+#define LINUX_SC_X7_OFF 0x040
+#define LINUX_SC_X8_OFF 0x048
+#define LINUX_SC_X9_OFF 0x050
+#define LINUX_SC_X10_OFF 0x058
+#define LINUX_SC_X11_OFF 0x060
+#define LINUX_SC_X12_OFF 0x068
+#define LINUX_SC_X13_OFF 0x070
+#define LINUX_SC_X14_OFF 0x078
+#define LINUX_SC_X15_OFF 0x080
+#define LINUX_SC_X16_OFF 0x088
+#define LINUX_SC_X17_OFF 0x090
+#define LINUX_SC_X18_OFF 0x098
+#define LINUX_SC_X19_OFF 0x0a0
+#define LINUX_SC_X20_OFF 0x0a8
+#define LINUX_SC_X21_OFF 0x0b0
+#define LINUX_SC_X22_OFF 0x0b8
+#define LINUX_SC_X23_OFF 0x0c0
+#define LINUX_SC_X24_OFF 0x0c8
+#define LINUX_SC_X25_OFF 0x0d0
+#define LINUX_SC_X26_OFF 0x0d8
+#define LINUX_SC_X27_OFF 0x0e0
+#define LINUX_SC_X28_OFF 0x0e8
+#define LINUX_SC_X29_OFF 0x0f0
+#define LINUX_SC_X30_OFF 0x0f8
+#define LINUX_SC_SP_OFF 0x100
+#define LINUX_SC_PC_OFF 0x108
+#define LINUX_SC_PSTATE_OFF 0x110
diff --git a/src/pal/src/libunwind/src/aarch64/regname.c b/src/pal/src/libunwind/src/aarch64/regname.c
new file mode 100644
index 0000000000..0f7a8bdcfb
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/regname.c
@@ -0,0 +1,106 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *const regname[] =
+ {
+ [UNW_AARCH64_X0] = "x0",
+ [UNW_AARCH64_X1] = "x1",
+ [UNW_AARCH64_X2] = "x2",
+ [UNW_AARCH64_X3] = "x3",
+ [UNW_AARCH64_X4] = "x4",
+ [UNW_AARCH64_X5] = "x5",
+ [UNW_AARCH64_X6] = "x6",
+ [UNW_AARCH64_X7] = "x7",
+ [UNW_AARCH64_X8] = "x8",
+ [UNW_AARCH64_X9] = "x9",
+ [UNW_AARCH64_X10] = "x10",
+ [UNW_AARCH64_X11] = "x11",
+ [UNW_AARCH64_X12] = "x12",
+ [UNW_AARCH64_X13] = "x13",
+ [UNW_AARCH64_X14] = "x14",
+ [UNW_AARCH64_X15] = "x15",
+ [UNW_AARCH64_X16] = "ip0",
+ [UNW_AARCH64_X17] = "ip1",
+ [UNW_AARCH64_X18] = "x18",
+ [UNW_AARCH64_X19] = "x19",
+ [UNW_AARCH64_X20] = "x20",
+ [UNW_AARCH64_X21] = "x21",
+ [UNW_AARCH64_X22] = "x22",
+ [UNW_AARCH64_X23] = "x23",
+ [UNW_AARCH64_X24] = "x24",
+ [UNW_AARCH64_X25] = "x25",
+ [UNW_AARCH64_X26] = "x26",
+ [UNW_AARCH64_X27] = "x27",
+ [UNW_AARCH64_X28] = "x28",
+ [UNW_AARCH64_X29] = "fp",
+ [UNW_AARCH64_X30] = "lr",
+ [UNW_AARCH64_SP] = "sp",
+ [UNW_AARCH64_PC] = "pc",
+ [UNW_AARCH64_V0] = "v0",
+ [UNW_AARCH64_V1] = "v1",
+ [UNW_AARCH64_V2] = "v2",
+ [UNW_AARCH64_V3] = "v3",
+ [UNW_AARCH64_V4] = "v4",
+ [UNW_AARCH64_V5] = "v5",
+ [UNW_AARCH64_V6] = "v6",
+ [UNW_AARCH64_V7] = "v7",
+ [UNW_AARCH64_V8] = "v8",
+ [UNW_AARCH64_V9] = "v9",
+ [UNW_AARCH64_V10] = "v10",
+ [UNW_AARCH64_V11] = "v11",
+ [UNW_AARCH64_V12] = "v12",
+ [UNW_AARCH64_V13] = "v13",
+ [UNW_AARCH64_V14] = "v14",
+ [UNW_AARCH64_V15] = "v15",
+ [UNW_AARCH64_V16] = "v16",
+ [UNW_AARCH64_V17] = "v17",
+ [UNW_AARCH64_V18] = "v18",
+ [UNW_AARCH64_V19] = "v19",
+ [UNW_AARCH64_V20] = "v20",
+ [UNW_AARCH64_V21] = "v21",
+ [UNW_AARCH64_V22] = "v22",
+ [UNW_AARCH64_V23] = "v23",
+ [UNW_AARCH64_V24] = "v24",
+ [UNW_AARCH64_V25] = "v25",
+ [UNW_AARCH64_V26] = "v26",
+ [UNW_AARCH64_V27] = "v27",
+ [UNW_AARCH64_V28] = "v28",
+ [UNW_AARCH64_V29] = "v29",
+ [UNW_AARCH64_V30] = "v30",
+ [UNW_AARCH64_V31] = "v31",
+ [UNW_AARCH64_FPSR] = "fpsr",
+ [UNW_AARCH64_FPCR] = "fpcr",
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname) && regname[reg] != NULL)
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/aarch64/siglongjmp.S b/src/pal/src/libunwind/src/aarch64/siglongjmp.S
new file mode 100644
index 0000000000..9985c4b4aa
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/siglongjmp.S
@@ -0,0 +1,12 @@
+ /* Dummy implementation for now. */
+
+ .global _UI_siglongjmp_cont
+ .global _UI_longjmp_cont
+
+_UI_siglongjmp_cont:
+_UI_longjmp_cont:
+ ret
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",%progbits
+#endif
diff --git a/src/pal/src/libunwind/src/aarch64/unwind_i.h b/src/pal/src/libunwind/src/aarch64/unwind_i.h
new file mode 100644
index 0000000000..3d324c2b08
--- /dev/null
+++ b/src/pal/src/libunwind/src/aarch64/unwind_i.h
@@ -0,0 +1,64 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <stdint.h>
+
+#include <libunwind-aarch64.h>
+
+#include "libunwind_i.h"
+
+/* DWARF column numbers for AArch64: */
+#define X29 29
+#define FP 29
+#define X30 30
+#define LR 30
+#define SP 31
+
+#define aarch64_lock UNW_OBJ(lock)
+#define aarch64_local_resume UNW_OBJ(local_resume)
+#define aarch64_local_addr_space_init UNW_OBJ(local_addr_space_init)
+
+extern void aarch64_local_addr_space_init (void);
+extern int aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+
+/* By-pass calls to access_mem() when known to be safe. */
+#ifdef UNW_LOCAL_ONLY
+# undef ACCESS_MEM_FAST
+# define ACCESS_MEM_FAST(ret,validate,cur,addr,to) \
+ do { \
+ if (unlikely(validate)) \
+ (ret) = dwarf_get ((cur), DWARF_MEM_LOC ((cur), (addr)), &(to)); \
+ else \
+ (ret) = 0, (to) = *(unw_word_t *)(addr); \
+ } while (0)
+#endif
+
+#define GET_FPCTX(uc) ((struct fpsimd_context *)(&uc->uc_mcontext.__reserved))
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/arm/Gapply_reg_state.c b/src/pal/src/libunwind/src/arm/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/arm/Gcreate_addr_space.c b/src/pal/src/libunwind/src/arm/Gcreate_addr_space.c
new file mode 100644
index 0000000000..7b2d6bacfd
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gcreate_addr_space.c
@@ -0,0 +1,60 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * ARM supports little-endian and big-endian.
+ */
+ if (byte_order != 0 && byte_order != __LITTLE_ENDIAN
+ && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ /* Default to little-endian for ARM. */
+ if (byte_order == 0 || byte_order == __LITTLE_ENDIAN)
+ as->big_endian = 0;
+ else
+ as->big_endian = 1;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/arm/Gex_tables.c b/src/pal/src/libunwind/src/arm/Gex_tables.c
new file mode 100644
index 0000000000..d6573a65e0
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gex_tables.c
@@ -0,0 +1,549 @@
+/* libunwind - a platform-independent unwind library
+ Copyright 2011 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file contains functionality for parsing and interpreting the ARM
+specific unwind information. Documentation about the exception handling
+ABI for the ARM architecture can be found at:
+http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf
+*/
+
+#include "libunwind_i.h"
+
+#define ARM_EXBUF_START(x) (((x) >> 4) & 0x0f)
+#define ARM_EXBUF_COUNT(x) ((x) & 0x0f)
+#define ARM_EXBUF_END(x) (ARM_EXBUF_START(x) + ARM_EXBUF_COUNT(x))
+
+#define ARM_EXIDX_CANT_UNWIND 0x00000001
+#define ARM_EXIDX_COMPACT 0x80000000
+
+#define ARM_EXTBL_OP_FINISH 0xb0
+
+enum arm_exbuf_cmd_flags {
+ ARM_EXIDX_VFP_SHIFT_16 = 1 << 16,
+ ARM_EXIDX_VFP_DOUBLE = 1 << 17,
+};
+
+struct arm_cb_data
+ {
+ /* in: */
+ unw_word_t ip; /* instruction-pointer we're looking for */
+ unw_proc_info_t *pi; /* proc-info pointer */
+ /* out: */
+ unw_dyn_info_t di; /* info about the ARM exidx segment */
+ };
+
+static inline uint32_t CONST_ATTR
+prel31_read (uint32_t prel31)
+{
+ return ((int32_t)prel31 << 1) >> 1;
+}
+
+static inline int
+prel31_to_addr (unw_addr_space_t as, void *arg, unw_word_t prel31,
+ unw_word_t *val)
+{
+ unw_word_t offset;
+
+ if ((*as->acc.access_mem)(as, prel31, &offset, 0, arg) < 0)
+ return -UNW_EINVAL;
+
+ offset = ((long)offset << 1) >> 1;
+ *val = prel31 + offset;
+
+ return 0;
+}
+
+/**
+ * Applies the given command onto the new state to the given dwarf_cursor.
+ */
+HIDDEN int
+arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c)
+{
+ int ret = 0;
+ unsigned i;
+
+ switch (edata->cmd)
+ {
+ case ARM_EXIDX_CMD_FINISH:
+ /* Set LR to PC if not set already. */
+ if (DWARF_IS_NULL_LOC (c->loc[UNW_ARM_R15]))
+ c->loc[UNW_ARM_R15] = c->loc[UNW_ARM_R14];
+ /* Set IP. */
+ dwarf_get (c, c->loc[UNW_ARM_R15], &c->ip);
+ break;
+ case ARM_EXIDX_CMD_DATA_PUSH:
+ Debug (2, "vsp = vsp - %d\n", edata->data);
+ c->cfa -= edata->data;
+ break;
+ case ARM_EXIDX_CMD_DATA_POP:
+ Debug (2, "vsp = vsp + %d\n", edata->data);
+ c->cfa += edata->data;
+ break;
+ case ARM_EXIDX_CMD_REG_POP:
+ for (i = 0; i < 16; i++)
+ if (edata->data & (1 << i))
+ {
+ Debug (2, "pop {r%d}\n", i);
+ c->loc[UNW_ARM_R0 + i] = DWARF_LOC (c->cfa, 0);
+ c->cfa += 4;
+ }
+ /* Set cfa in case the SP got popped. */
+ if (edata->data & (1 << 13))
+ dwarf_get (c, c->loc[UNW_ARM_R13], &c->cfa);
+ break;
+ case ARM_EXIDX_CMD_REG_TO_SP:
+ assert (edata->data < 16);
+ Debug (2, "vsp = r%d\n", edata->data);
+ c->loc[UNW_ARM_R13] = c->loc[UNW_ARM_R0 + edata->data];
+ dwarf_get (c, c->loc[UNW_ARM_R13], &c->cfa);
+ break;
+ case ARM_EXIDX_CMD_VFP_POP:
+ /* Skip VFP registers, but be sure to adjust stack */
+ for (i = ARM_EXBUF_START (edata->data); i <= ARM_EXBUF_END (edata->data);
+ i++)
+ c->cfa += 8;
+ if (!(edata->data & ARM_EXIDX_VFP_DOUBLE))
+ c->cfa += 4;
+ break;
+ case ARM_EXIDX_CMD_WREG_POP:
+ for (i = ARM_EXBUF_START (edata->data); i <= ARM_EXBUF_END (edata->data);
+ i++)
+ c->cfa += 8;
+ break;
+ case ARM_EXIDX_CMD_WCGR_POP:
+ for (i = 0; i < 4; i++)
+ if (edata->data & (1 << i))
+ c->cfa += 4;
+ break;
+ case ARM_EXIDX_CMD_REFUSED:
+ case ARM_EXIDX_CMD_RESERVED:
+ ret = -1;
+ break;
+ }
+ return ret;
+}
+
+/**
+ * Decodes the given unwind instructions into arm_exbuf_data and calls
+ * arm_exidx_apply_cmd that applies the command onto the dwarf_cursor.
+ */
+HIDDEN int
+arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c)
+{
+#define READ_OP() *buf++
+ const uint8_t *end = buf + len;
+ int ret;
+ struct arm_exbuf_data edata;
+
+ assert(buf != NULL);
+ assert(len > 0);
+
+ while (buf < end)
+ {
+ uint8_t op = READ_OP ();
+ if ((op & 0xc0) == 0x00)
+ {
+ edata.cmd = ARM_EXIDX_CMD_DATA_POP;
+ edata.data = (((int)op & 0x3f) << 2) + 4;
+ }
+ else if ((op & 0xc0) == 0x40)
+ {
+ edata.cmd = ARM_EXIDX_CMD_DATA_PUSH;
+ edata.data = (((int)op & 0x3f) << 2) + 4;
+ }
+ else if ((op & 0xf0) == 0x80)
+ {
+ uint8_t op2 = READ_OP ();
+ if (op == 0x80 && op2 == 0x00)
+ edata.cmd = ARM_EXIDX_CMD_REFUSED;
+ else
+ {
+ edata.cmd = ARM_EXIDX_CMD_REG_POP;
+ edata.data = ((op & 0xf) << 8) | op2;
+ edata.data = edata.data << 4;
+ }
+ }
+ else if ((op & 0xf0) == 0x90)
+ {
+ if (op == 0x9d || op == 0x9f)
+ edata.cmd = ARM_EXIDX_CMD_RESERVED;
+ else
+ {
+ edata.cmd = ARM_EXIDX_CMD_REG_TO_SP;
+ edata.data = op & 0x0f;
+ }
+ }
+ else if ((op & 0xf0) == 0xa0)
+ {
+ unsigned end = (op & 0x07);
+ edata.data = (1 << (end + 1)) - 1;
+ edata.data = edata.data << 4;
+ if (op & 0x08)
+ edata.data |= 1 << 14;
+ edata.cmd = ARM_EXIDX_CMD_REG_POP;
+ }
+ else if (op == ARM_EXTBL_OP_FINISH)
+ {
+ edata.cmd = ARM_EXIDX_CMD_FINISH;
+ buf = end;
+ }
+ else if (op == 0xb1)
+ {
+ uint8_t op2 = READ_OP ();
+ if (op2 == 0 || (op2 & 0xf0))
+ edata.cmd = ARM_EXIDX_CMD_RESERVED;
+ else
+ {
+ edata.cmd = ARM_EXIDX_CMD_REG_POP;
+ edata.data = op2 & 0x0f;
+ }
+ }
+ else if (op == 0xb2)
+ {
+ uint32_t offset = 0;
+ uint8_t byte, shift = 0;
+ do
+ {
+ byte = READ_OP ();
+ offset |= (byte & 0x7f) << shift;
+ shift += 7;
+ }
+ while (byte & 0x80);
+ edata.data = offset * 4 + 0x204;
+ edata.cmd = ARM_EXIDX_CMD_DATA_POP;
+ }
+ else if (op == 0xb3 || op == 0xc8 || op == 0xc9)
+ {
+ edata.cmd = ARM_EXIDX_CMD_VFP_POP;
+ edata.data = READ_OP ();
+ if (op == 0xc8)
+ edata.data |= ARM_EXIDX_VFP_SHIFT_16;
+ if (op != 0xb3)
+ edata.data |= ARM_EXIDX_VFP_DOUBLE;
+ }
+ else if ((op & 0xf8) == 0xb8 || (op & 0xf8) == 0xd0)
+ {
+ edata.cmd = ARM_EXIDX_CMD_VFP_POP;
+ edata.data = 0x80 | (op & 0x07);
+ if ((op & 0xf8) == 0xd0)
+ edata.data |= ARM_EXIDX_VFP_DOUBLE;
+ }
+ else if (op >= 0xc0 && op <= 0xc5)
+ {
+ edata.cmd = ARM_EXIDX_CMD_WREG_POP;
+ edata.data = 0xa0 | (op & 0x07);
+ }
+ else if (op == 0xc6)
+ {
+ edata.cmd = ARM_EXIDX_CMD_WREG_POP;
+ edata.data = READ_OP ();
+ }
+ else if (op == 0xc7)
+ {
+ uint8_t op2 = READ_OP ();
+ if (op2 == 0 || (op2 & 0xf0))
+ edata.cmd = ARM_EXIDX_CMD_RESERVED;
+ else
+ {
+ edata.cmd = ARM_EXIDX_CMD_WCGR_POP;
+ edata.data = op2 & 0x0f;
+ }
+ }
+ else
+ edata.cmd = ARM_EXIDX_CMD_RESERVED;
+
+ ret = arm_exidx_apply_cmd (&edata, c);
+ if (ret < 0)
+ return ret;
+ }
+ return 0;
+}
+
+/**
+ * Reads the entry from the given cursor and extracts the unwind instructions
+ * into buf. Returns the number of the extracted unwind insns or
+ * -UNW_ESTOPUNWIND if the special bit pattern ARM_EXIDX_CANT_UNWIND (0x1) was
+ * found.
+ */
+HIDDEN int
+arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf)
+{
+ int nbuf = 0;
+ unw_word_t entry = (unw_word_t) c->pi.unwind_info;
+ unw_word_t addr;
+ uint32_t data;
+
+ /* An ARM unwind entry consists of a prel31 offset to the start of a
+ function followed by 31bits of data:
+ * if set to 0x1: the function cannot be unwound (EXIDX_CANTUNWIND)
+ * if bit 31 is one: this is a table entry itself (ARM_EXIDX_COMPACT)
+ * if bit 31 is zero: this is a prel31 offset of the start of the
+ table entry for this function */
+ if (prel31_to_addr(c->as, c->as_arg, entry, &addr) < 0)
+ return -UNW_EINVAL;
+
+ if ((*c->as->acc.access_mem)(c->as, entry + 4, &data, 0, c->as_arg) < 0)
+ return -UNW_EINVAL;
+
+ if (data == ARM_EXIDX_CANT_UNWIND)
+ {
+ Debug (2, "0x1 [can't unwind]\n");
+ nbuf = -UNW_ESTOPUNWIND;
+ }
+ else if (data & ARM_EXIDX_COMPACT)
+ {
+ Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr,
+ (data >> 24) & 0x7f, data);
+ buf[nbuf++] = data >> 16;
+ buf[nbuf++] = data >> 8;
+ buf[nbuf++] = data;
+ }
+ else
+ {
+ unw_word_t extbl_data;
+ unsigned int n_table_words = 0;
+
+ if (prel31_to_addr(c->as, c->as_arg, entry + 4, &extbl_data) < 0)
+ return -UNW_EINVAL;
+
+ if ((*c->as->acc.access_mem)(c->as, extbl_data, &data, 0, c->as_arg) < 0)
+ return -UNW_EINVAL;
+
+ if (data & ARM_EXIDX_COMPACT)
+ {
+ int pers = (data >> 24) & 0x0f;
+ Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, pers, data);
+ if (pers == 1 || pers == 2)
+ {
+ n_table_words = (data >> 16) & 0xff;
+ extbl_data += 4;
+ }
+ else
+ buf[nbuf++] = data >> 16;
+ buf[nbuf++] = data >> 8;
+ buf[nbuf++] = data;
+ }
+ else
+ {
+ unw_word_t pers;
+ if (prel31_to_addr (c->as, c->as_arg, extbl_data, &pers) < 0)
+ return -UNW_EINVAL;
+ Debug (2, "%p Personality routine: %8p\n", (void *)addr,
+ (void *)pers);
+ if ((*c->as->acc.access_mem)(c->as, extbl_data + 4, &data, 0,
+ c->as_arg) < 0)
+ return -UNW_EINVAL;
+ n_table_words = data >> 24;
+ buf[nbuf++] = data >> 16;
+ buf[nbuf++] = data >> 8;
+ buf[nbuf++] = data;
+ extbl_data += 8;
+ }
+ assert (n_table_words <= 5);
+ unsigned j;
+ for (j = 0; j < n_table_words; j++)
+ {
+ if ((*c->as->acc.access_mem)(c->as, extbl_data, &data, 0,
+ c->as_arg) < 0)
+ return -UNW_EINVAL;
+ extbl_data += 4;
+ buf[nbuf++] = data >> 24;
+ buf[nbuf++] = data >> 16;
+ buf[nbuf++] = data >> 8;
+ buf[nbuf++] = data >> 0;
+ }
+ }
+
+ if (nbuf > 0 && buf[nbuf - 1] != ARM_EXTBL_OP_FINISH)
+ buf[nbuf++] = ARM_EXTBL_OP_FINISH;
+
+ return nbuf;
+}
+
+int
+arm_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ /* The .ARM.exidx section contains a sorted list of key-value pairs -
+ the unwind entries. The 'key' is a prel31 offset to the start of a
+ function. We binary search this section in order to find the
+ appropriate unwind entry. */
+ unw_word_t first = di->u.rti.table_data;
+ unw_word_t last = di->u.rti.table_data + di->u.rti.table_len - 8;
+ unw_word_t entry, val;
+
+ if (prel31_to_addr (as, arg, first, &val) < 0 || ip < val)
+ return -UNW_ENOINFO;
+
+ if (prel31_to_addr (as, arg, last, &val) < 0)
+ return -UNW_EINVAL;
+
+ if (ip >= val)
+ {
+ entry = last;
+
+ if (prel31_to_addr (as, arg, last, &pi->start_ip) < 0)
+ return -UNW_EINVAL;
+
+ pi->end_ip = di->end_ip -1;
+ }
+ else
+ {
+ while (first < last - 8)
+ {
+ entry = first + (((last - first) / 8 + 1) >> 1) * 8;
+
+ if (prel31_to_addr (as, arg, entry, &val) < 0)
+ return -UNW_EINVAL;
+
+ if (ip < val)
+ last = entry;
+ else
+ first = entry;
+ }
+
+ entry = first;
+
+ if (prel31_to_addr (as, arg, entry, &pi->start_ip) < 0)
+ return -UNW_EINVAL;
+
+ if (prel31_to_addr (as, arg, entry + 8, &pi->end_ip) < 0)
+ return -UNW_EINVAL;
+
+ pi->end_ip--;
+ }
+
+ if (need_unwind_info)
+ {
+ pi->unwind_info_size = 8;
+ pi->unwind_info = (void *) entry;
+ pi->format = UNW_INFO_FORMAT_ARM_EXIDX;
+ }
+ return 0;
+}
+
+int
+tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ if (UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX)
+ && di->format == UNW_INFO_FORMAT_ARM_EXIDX)
+ return arm_search_unwind_table (as, ip, di, pi, need_unwind_info, arg);
+ else if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF)
+ && di->format != UNW_INFO_FORMAT_ARM_EXIDX)
+ return dwarf_search_unwind_table (as, ip, di, pi, need_unwind_info, arg);
+
+ return -UNW_ENOINFO;
+}
+
+#ifndef UNW_REMOTE_ONLY
+/**
+ * Callback to dl_iterate_phdr to find infos about the ARM exidx segment.
+ */
+static int
+arm_phdr_cb (struct dl_phdr_info *info, size_t size, void *data)
+{
+ struct arm_cb_data *cb_data = data;
+ const Elf_W(Phdr) *p_text = NULL;
+ const Elf_W(Phdr) *p_arm_exidx = NULL;
+ const Elf_W(Phdr) *phdr = info->dlpi_phdr;
+ long n;
+
+ for (n = info->dlpi_phnum; --n >= 0; phdr++)
+ {
+ switch (phdr->p_type)
+ {
+ case PT_LOAD:
+ if (cb_data->ip >= phdr->p_vaddr + info->dlpi_addr &&
+ cb_data->ip < phdr->p_vaddr + info->dlpi_addr + phdr->p_memsz)
+ p_text = phdr;
+ break;
+
+ case PT_ARM_EXIDX:
+ p_arm_exidx = phdr;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (p_text && p_arm_exidx)
+ {
+ cb_data->di.format = UNW_INFO_FORMAT_ARM_EXIDX;
+ cb_data->di.start_ip = p_text->p_vaddr + info->dlpi_addr;
+ cb_data->di.end_ip = cb_data->di.start_ip + p_text->p_memsz;
+ cb_data->di.u.rti.name_ptr = (unw_word_t) info->dlpi_name;
+ cb_data->di.u.rti.table_data = p_arm_exidx->p_vaddr + info->dlpi_addr;
+ cb_data->di.u.rti.table_len = p_arm_exidx->p_memsz;
+ return 1;
+ }
+
+ return 0;
+}
+
+HIDDEN int
+arm_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info, void *arg)
+{
+ int ret = -1;
+ intrmask_t saved_mask;
+
+ Debug (14, "looking for IP=0x%lx\n", (long) ip);
+
+ if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF))
+ ret = dwarf_find_proc_info (as, ip, pi, need_unwind_info, arg);
+
+ if (ret < 0 && UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX))
+ {
+ struct arm_cb_data cb_data;
+
+ memset (&cb_data, 0, sizeof (cb_data));
+ cb_data.ip = ip;
+ cb_data.pi = pi;
+ cb_data.di.format = -1;
+
+ SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask);
+ ret = dl_iterate_phdr (arm_phdr_cb, &cb_data);
+ SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL);
+
+ if (cb_data.di.format != -1)
+ ret = arm_search_unwind_table (as, ip, &cb_data.di, pi,
+ need_unwind_info, arg);
+ else
+ ret = -UNW_ENOINFO;
+ }
+
+ return ret;
+}
+
+HIDDEN void
+arm_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+#endif /* !UNW_REMOTE_ONLY */
+
diff --git a/src/pal/src/libunwind/src/arm/Gget_proc_info.c b/src/pal/src/libunwind/src/arm/Gget_proc_info.c
new file mode 100644
index 0000000000..4051a10766
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gget_proc_info.c
@@ -0,0 +1,41 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ /* We can only unwind using Dwarf into on ARM: return failure code
+ if it's not present. */
+ ret = dwarf_make_proc_info (&c->dwarf);
+ if (ret < 0)
+ return ret;
+
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/arm/Gget_save_loc.c b/src/pal/src/libunwind/src/arm/Gget_save_loc.c
new file mode 100644
index 0000000000..9fb070489c
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gget_save_loc.c
@@ -0,0 +1,81 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ dwarf_loc_t loc;
+
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+
+ switch (reg)
+ {
+ case UNW_ARM_R0:
+ case UNW_ARM_R1:
+ case UNW_ARM_R2:
+ case UNW_ARM_R3:
+ case UNW_ARM_R4:
+ case UNW_ARM_R5:
+ case UNW_ARM_R6:
+ case UNW_ARM_R7:
+ case UNW_ARM_R8:
+ case UNW_ARM_R9:
+ case UNW_ARM_R10:
+ case UNW_ARM_R11:
+ case UNW_ARM_R12:
+ case UNW_ARM_R13:
+ case UNW_ARM_R14:
+ case UNW_ARM_R15:
+ loc = c->dwarf.loc[reg - UNW_ARM_R0];
+ break;
+
+ default:
+ break;
+ }
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/arm/Gglobal.c b/src/pal/src/libunwind/src/arm/Gglobal.c
new file mode 100644
index 0000000000..7b93fbd89a
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gglobal.c
@@ -0,0 +1,65 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (arm_lock);
+HIDDEN int tdep_init_done;
+
+/* Unwinding methods to use. See UNW_METHOD_ enums */
+HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_ALL;
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&arm_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ /* read ARM unwind method setting */
+ const char* str = getenv ("UNW_ARM_UNWIND_METHOD");
+ if (str)
+ {
+ unwi_unwind_method = atoi (str);
+ }
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ arm_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&arm_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/arm/Ginit.c b/src/pal/src/libunwind/src/arm/Ginit.c
new file mode 100644
index 0000000000..2720d063a2
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Ginit.c
@@ -0,0 +1,235 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+static inline void *
+uc_addr (unw_tdep_context_t *uc, int reg)
+{
+ if (reg >= UNW_ARM_R0 && reg < UNW_ARM_R0 + 16)
+ return &uc->regs[reg - UNW_ARM_R0];
+ else
+ return NULL;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (unw_tdep_context_t *uc, int reg)
+{
+ return uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+#define PAGE_SIZE 4096
+#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
+
+/* Cache of already validated addresses */
+#define NLGA 4
+static unw_word_t last_good_addr[NLGA];
+static int lga_victim;
+
+static int
+validate_mem (unw_word_t addr)
+{
+ int i, victim;
+ size_t len;
+
+ if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
+ len = PAGE_SIZE;
+ else
+ len = PAGE_SIZE * 2;
+
+ addr = PAGE_START(addr);
+
+ if (addr == 0)
+ return -1;
+
+ for (i = 0; i < NLGA; i++)
+ {
+ if (last_good_addr[i] && (addr == last_good_addr[i]))
+ return 0;
+ }
+
+ if (msync ((void *) addr, len, MS_ASYNC) == -1)
+ return -1;
+
+ victim = lga_victim;
+ for (i = 0; i < NLGA; i++) {
+ if (!last_good_addr[victim]) {
+ last_good_addr[victim++] = addr;
+ return 0;
+ }
+ victim = (victim + 1) % NLGA;
+ }
+
+ /* All slots full. Evict the victim. */
+ last_good_addr[victim] = addr;
+ victim = (victim + 1) % NLGA;
+ lga_victim = victim;
+
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ /* validate address */
+ const struct cursor *c = (const struct cursor *) arg;
+ if (c && validate_mem(addr))
+ return -1;
+
+ if (write)
+ {
+ Debug (16, "mem[%x] <- %x\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (16, "mem[%x] -> %x\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ unw_tdep_context_t *uc = arg;
+
+ if (unw_is_fpreg (reg))
+ goto badreg;
+
+Debug (16, "reg = %s\n", unw_regname (reg));
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) addr = *val;
+ Debug (12, "%s <- %x\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %x\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ unw_tdep_context_t *uc = arg;
+ unw_fpreg_t *addr;
+
+ if (!unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ *(unw_fpreg_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+arm_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = arm_find_proc_info;
+ local_addr_space.acc.put_unwind_info = arm_put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = arm_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/arm/Ginit_local.c b/src/pal/src/libunwind/src/arm/Ginit_local.c
new file mode 100644
index 0000000000..e13519b79a
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Ginit_local.c
@@ -0,0 +1,78 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common (unw_cursor_t *cursor, unw_context_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = uc;
+
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, unw_context_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/arm/Ginit_remote.c b/src/pal/src/libunwind/src/arm/Ginit_remote.c
new file mode 100644
index 0000000000..9b8ba5b89d
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Ginit_remote.c
@@ -0,0 +1,45 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/arm/Gos-freebsd.c b/src/pal/src/libunwind/src/arm/Gos-freebsd.c
new file mode 100644
index 0000000000..a1069223a5
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gos-freebsd.c
@@ -0,0 +1,129 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+ Copyright 2015 The FreeBSD Foundation
+
+ Portions of this software were developed by Konstantin Belousov
+ under sponsorship from the FreeBSD Foundation.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdio.h>
+#include <signal.h>
+#include "unwind_i.h"
+#include "offsets.h"
+#include "ex_tables.h"
+
+HIDDEN int
+arm_handle_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret, fmt;
+ unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa;
+ struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0);
+
+ if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0)
+ return -UNW_EUNSPEC;
+ fmt = unw_is_signal_frame(cursor);
+
+ c->dwarf.pi_valid = 0;
+
+ if (fmt == UNW_ARM_FRAME_SYSCALL)
+ {
+ c->sigcontext_format = ARM_SCF_FREEBSD_SYSCALL;
+ c->frame_info.frame_type = UNW_ARM_FRAME_SYSCALL;
+ c->frame_info.cfa_reg_offset = 0;
+ c->dwarf.loc[UNW_ARM_R7] = c->dwarf.loc[UNW_ARM_R12];
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R14], &c->dwarf.ip);
+ return 1;
+ }
+
+ c->sigcontext_format = ARM_SCF_FREEBSD_SIGFRAME;
+ sc_addr = sp_addr;
+
+ /* Save the SP and PC to be able to return execution at this point
+ later in time (unw_resume). */
+ c->sigcontext_sp = c->dwarf.cfa;
+ c->sigcontext_pc = c->dwarf.ip;
+
+ c->sigcontext_addr = sc_addr;
+ c->frame_info.frame_type = UNW_ARM_FRAME_SIGRETURN;
+ c->frame_info.cfa_reg_offset = sc_addr - sp_addr;
+
+ /* Update the dwarf cursor.
+ Set the location of the registers to the corresponding addresses of the
+ uc_mcontext / sigcontext structure contents. */
+#define ROFF(n) (FREEBSD_SC_UCONTEXT_OFF + FREEBSD_UC_MCONTEXT_OFF + \
+ FREEBSD_MC_R0_OFF + (n) * 4)
+#define SL(n) \
+ c->dwarf.loc[UNW_ARM_R ## n] = DWARF_LOC (sc_addr + ROFF(n), 0);
+ SL(0); SL(1); SL(2); SL(3); SL(4); SL(5); SL(6); SL(7);
+ SL(8); SL(9); SL(10); SL(11); SL(12); SL(13); SL(14); SL(15);
+#undef SL
+#undef ROFF
+
+ /* Set SP/CFA and PC/IP. */
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R13], &c->dwarf.cfa);
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R15], &c->dwarf.ip);
+
+ return 1;
+}
+
+/* Returns 1 in case of a non-RT signal frame and 2 in case of a RT signal
+ frame. */
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, w1, w2, w3, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ ip = c->dwarf.ip;
+
+ if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0)
+ return ret;
+ if ((ret = (*a->access_mem) (as, ip + 4, &w1, 0, arg)) < 0)
+ return ret;
+ if ((ret = (*a->access_mem) (as, ip + 8, &w2, 0, arg)) < 0)
+ return ret;
+ if ((ret = (*a->access_mem) (as, ip + 12, &w3, 0, arg)) < 0)
+ return ret;
+
+ if (w0 == 0xe1a0000d && w1 == 0xe2800040 && w2 == 0xe59f700c &&
+ w3 == 0xef0001a1)
+ return UNW_ARM_FRAME_SIGRETURN;
+
+ if ((ret = (*a->access_mem) (as, ip - 4, &w0, 0, arg)) < 0)
+ return ret;
+ if (w0 == 0xef000000)
+ return UNW_ARM_FRAME_SYSCALL;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/arm/Gos-linux.c b/src/pal/src/libunwind/src/arm/Gos-linux.c
new file mode 100644
index 0000000000..260e086f69
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gos-linux.c
@@ -0,0 +1,182 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdio.h>
+#include <signal.h>
+#include "unwind_i.h"
+#include "offsets.h"
+
+HIDDEN int
+arm_handle_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+ unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa;
+ struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0);
+
+ if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0)
+ return -UNW_EUNSPEC;
+
+ /* Obtain signal frame type (non-RT or RT). */
+ ret = unw_is_signal_frame (cursor);
+
+ /* Save the SP and PC to be able to return execution at this point
+ later in time (unw_resume). */
+ c->sigcontext_sp = c->dwarf.cfa;
+ c->sigcontext_pc = c->dwarf.ip;
+
+ /* Since kernel version 2.6.18 the non-RT signal frame starts with a
+ ucontext while the RT signal frame starts with a siginfo, followed
+ by a sigframe whose first element is an ucontext.
+ Prior 2.6.18 the non-RT signal frame starts with a sigcontext while
+ the RT signal frame starts with two pointers followed by a siginfo
+ and an ucontext. The first pointer points to the start of the siginfo
+ structure and the second one to the ucontext structure. */
+
+ if (ret == 1)
+ {
+ /* Handle non-RT signal frames. Check if the first word on the stack
+ is the magic number. */
+ if (sp == 0x5ac3c35a)
+ {
+ c->sigcontext_format = ARM_SCF_LINUX_SIGFRAME;
+ sc_addr = sp_addr + LINUX_UC_MCONTEXT_OFF;
+ }
+ else
+ {
+ c->sigcontext_format = ARM_SCF_LINUX_OLD_SIGFRAME;
+ sc_addr = sp_addr;
+ }
+ }
+ else if (ret == 2)
+ {
+ /* Handle RT signal frames. Check if the first word on the stack is a
+ pointer to the siginfo structure. */
+ if (sp == sp_addr + 8)
+ {
+ c->sigcontext_format = ARM_SCF_LINUX_OLD_RT_SIGFRAME;
+ sc_addr = sp_addr + 8 + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF;
+ }
+ else
+ {
+ c->sigcontext_format = ARM_SCF_LINUX_RT_SIGFRAME;
+ sc_addr = sp_addr + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF;
+ }
+ }
+ else
+ return -UNW_EUNSPEC;
+
+ c->sigcontext_addr = sc_addr;
+ c->frame_info.frame_type = UNW_ARM_FRAME_SIGRETURN;
+ c->frame_info.cfa_reg_offset = sc_addr - sp_addr;
+
+ /* Update the dwarf cursor.
+ Set the location of the registers to the corresponding addresses of the
+ uc_mcontext / sigcontext structure contents. */
+ c->dwarf.loc[UNW_ARM_R0] = DWARF_LOC (sc_addr + LINUX_SC_R0_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R1] = DWARF_LOC (sc_addr + LINUX_SC_R1_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R2] = DWARF_LOC (sc_addr + LINUX_SC_R2_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R3] = DWARF_LOC (sc_addr + LINUX_SC_R3_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R4] = DWARF_LOC (sc_addr + LINUX_SC_R4_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R5] = DWARF_LOC (sc_addr + LINUX_SC_R5_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R6] = DWARF_LOC (sc_addr + LINUX_SC_R6_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R7] = DWARF_LOC (sc_addr + LINUX_SC_R7_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R8] = DWARF_LOC (sc_addr + LINUX_SC_R8_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R9] = DWARF_LOC (sc_addr + LINUX_SC_R9_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R10] = DWARF_LOC (sc_addr + LINUX_SC_R10_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R11] = DWARF_LOC (sc_addr + LINUX_SC_FP_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R12] = DWARF_LOC (sc_addr + LINUX_SC_IP_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R13] = DWARF_LOC (sc_addr + LINUX_SC_SP_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R14] = DWARF_LOC (sc_addr + LINUX_SC_LR_OFF, 0);
+ c->dwarf.loc[UNW_ARM_R15] = DWARF_LOC (sc_addr + LINUX_SC_PC_OFF, 0);
+
+ /* Set SP/CFA and PC/IP. */
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R13], &c->dwarf.cfa);
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R15], &c->dwarf.ip);
+
+ c->dwarf.pi_valid = 0;
+
+ return 1;
+}
+
+#define ARM_NR_sigreturn 119
+#define ARM_NR_rt_sigreturn 173
+#define ARM_NR_OABI_SYSCALL_BASE 0x900000
+
+/* ARM EABI sigreturn (the syscall number is loaded into r7) */
+#define MOV_R7_SIGRETURN (0xe3a07000UL | ARM_NR_sigreturn)
+#define MOV_R7_RT_SIGRETURN (0xe3a07000UL | ARM_NR_rt_sigreturn)
+
+/* ARM OABI sigreturn (using SWI) */
+#define ARM_SIGRETURN \
+ (0xef000000UL | ARM_NR_sigreturn | ARM_NR_OABI_SYSCALL_BASE)
+#define ARM_RT_SIGRETURN \
+ (0xef000000UL | ARM_NR_rt_sigreturn | ARM_NR_OABI_SYSCALL_BASE)
+
+/* Thumb sigreturn (two insns, syscall number is loaded into r7) */
+#define THUMB_SIGRETURN (0xdf00UL << 16 | 0x2700 | ARM_NR_sigreturn)
+#define THUMB_RT_SIGRETURN (0xdf00UL << 16 | 0x2700 | ARM_NR_rt_sigreturn)
+
+/* Thumb2 sigreturn (mov.w r7, $SYS_ify(rt_sigreturn/sigreturn)) */
+#define THUMB2_SIGRETURN (((0x0700 | ARM_NR_sigreturn) << 16) | \
+ 0xf04f)
+#define THUMB2_RT_SIGRETURN (((0x0700 | ARM_NR_rt_sigreturn) << 16) | \
+ 0xf04f)
+/* TODO: with different toolchains, there are a lot more possibilities */
+
+/* Returns 1 in case of a non-RT signal frame and 2 in case of a RT signal
+ frame. */
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ /* The least bit denotes thumb/arm mode. Do not read there. */
+ ip = c->dwarf.ip & ~0x1;
+
+ if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0)
+ return ret;
+
+ /* Return 1 if the IP points to a non-RT sigreturn sequence. */
+ if (w0 == MOV_R7_SIGRETURN || w0 == ARM_SIGRETURN || w0 == THUMB_SIGRETURN
+ || w0 == THUMB2_SIGRETURN)
+ return 1;
+ /* Return 2 if the IP points to a RT sigreturn sequence. */
+ else if (w0 == MOV_R7_RT_SIGRETURN || w0 == ARM_RT_SIGRETURN
+ || w0 == THUMB_RT_SIGRETURN || w0 == THUMB2_RT_SIGRETURN)
+ return 2;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/arm/Gos-other.c b/src/pal/src/libunwind/src/arm/Gos-other.c
new file mode 100644
index 0000000000..73c102c3d2
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gos-other.c
@@ -0,0 +1,48 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdio.h>
+#include <signal.h>
+#include "unwind_i.h"
+#include "offsets.h"
+
+HIDDEN int
+arm_handle_signal_frame (unw_cursor_t *cursor)
+{
+ return -UNW_EUNSPEC;
+}
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+#if defined(__QNX__)
+ /* Not supported yet */
+ return 0;
+#else
+ printf ("%s: implement me\n", __FUNCTION__);
+ return -UNW_ENOINFO;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/arm/Greg_states_iterate.c b/src/pal/src/libunwind/src/arm/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/arm/Gregs.c b/src/pal/src/libunwind/src/arm/Gregs.c
new file mode 100644
index 0000000000..0d52f0b222
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gregs.c
@@ -0,0 +1,83 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ dwarf_loc_t loc = DWARF_NULL_LOC;
+
+ switch (reg)
+ {
+ case UNW_ARM_R15:
+ if (write)
+ c->dwarf.ip = *valp; /* update the IP cache */
+ case UNW_ARM_R0:
+ case UNW_ARM_R1:
+ case UNW_ARM_R2:
+ case UNW_ARM_R3:
+ case UNW_ARM_R4:
+ case UNW_ARM_R5:
+ case UNW_ARM_R6:
+ case UNW_ARM_R7:
+ case UNW_ARM_R8:
+ case UNW_ARM_R9:
+ case UNW_ARM_R10:
+ case UNW_ARM_R11:
+ case UNW_ARM_R12:
+ case UNW_ARM_R14:
+ loc = c->dwarf.loc[reg - UNW_ARM_R0];
+ break;
+
+ case UNW_ARM_R13:
+ case UNW_ARM_CFA:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+ /* FIXME: Initialise coprocessor & shadow registers? */
+
+ default:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+/* FIXME for ARM. */
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
diff --git a/src/pal/src/libunwind/src/arm/Gresume.c b/src/pal/src/libunwind/src/arm/Gresume.c
new file mode 100644
index 0000000000..a8288628a6
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gresume.c
@@ -0,0 +1,154 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+HIDDEN inline int
+arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+#ifdef __linux__
+ struct cursor *c = (struct cursor *) cursor;
+ unw_tdep_context_t *uc = c->dwarf.as_arg;
+
+ if (c->sigcontext_format == ARM_SCF_NONE)
+ {
+ /* Since there are no signals involved here we restore the non scratch
+ registers only. */
+ unsigned long regs[10];
+ regs[0] = uc->regs[4];
+ regs[1] = uc->regs[5];
+ regs[2] = uc->regs[6];
+ regs[3] = uc->regs[7];
+ regs[4] = uc->regs[8];
+ regs[5] = uc->regs[9];
+ regs[6] = uc->regs[10];
+ regs[7] = uc->regs[11]; /* FP */
+ regs[8] = uc->regs[13]; /* SP */
+ regs[9] = uc->regs[14]; /* LR */
+
+ struct regs_overlay {
+ char x[sizeof(regs)];
+ };
+
+ asm __volatile__ (
+ "ldmia %0, {r4-r12, lr}\n"
+ "mov sp, r12\n"
+ "bx lr\n"
+ : : "r" (regs),
+ "m" (*(struct regs_overlay *)regs)
+ );
+ }
+ else
+ {
+ /* In case a signal frame is involved, we're using its trampoline which
+ calls sigreturn. */
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+ sc->arm_r0 = uc->regs[0];
+ sc->arm_r1 = uc->regs[1];
+ sc->arm_r2 = uc->regs[2];
+ sc->arm_r3 = uc->regs[3];
+ sc->arm_r4 = uc->regs[4];
+ sc->arm_r5 = uc->regs[5];
+ sc->arm_r6 = uc->regs[6];
+ sc->arm_r7 = uc->regs[7];
+ sc->arm_r8 = uc->regs[8];
+ sc->arm_r9 = uc->regs[9];
+ sc->arm_r10 = uc->regs[10];
+ sc->arm_fp = uc->regs[11]; /* FP */
+ sc->arm_ip = uc->regs[12]; /* IP */
+ sc->arm_sp = uc->regs[13]; /* SP */
+ sc->arm_lr = uc->regs[14]; /* LR */
+ sc->arm_pc = uc->regs[15]; /* PC */
+ /* clear the ITSTATE bits. */
+ sc->arm_cpsr &= 0xf9ff03ffUL;
+
+ /* Set the SP and the PC in order to continue execution at the modified
+ trampoline which restores the signal mask and the registers. */
+ asm __volatile__ (
+ "mov sp, %0\n"
+ "bx %1\n"
+ : : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc)
+ );
+ }
+ unreachable();
+#else
+ printf ("%s: implement me\n", __FUNCTION__);
+#endif
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+static inline void
+establish_machine_state (struct cursor *c)
+{
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ as->acc.access_fpreg (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ as->acc.access_reg (as, reg, &val, 1, arg);
+ }
+ }
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if (!c->dwarf.ip)
+ {
+ /* This can happen easily when the frame-chain gets truncated
+ due to bad or missing unwind-info. */
+ Debug (1, "refusing to resume execution at address 0\n");
+ return -UNW_EINVAL;
+ }
+
+ establish_machine_state (c);
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/arm/Gstash_frame.c b/src/pal/src/libunwind/src/arm/Gstash_frame.c
new file mode 100644
index 0000000000..c5a76b86d0
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gstash_frame.c
@@ -0,0 +1,90 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY
+ Copyright (C) 2014 CERN and Aalto University
+ Contributed by Filip Nyback
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN void
+tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
+{
+ struct cursor *c = (struct cursor *) dwarf_to_cursor (d);
+ unw_tdep_frame_t *f = &c->frame_info;
+
+ Debug (4, "ip=0x%x cfa=0x%x type %d cfa [where=%d val=%d] cfaoff=%d"
+ " ra=0x%x r7 [where=%d val=%d @0x%x] lr [where=%d val=%d @0x%x] "
+ "sp [where=%d val=%d @0x%x]\n",
+ d->ip, d->cfa, f->frame_type,
+ rs->reg.where[DWARF_CFA_REG_COLUMN],
+ rs->reg.val[DWARF_CFA_REG_COLUMN],
+ rs->reg.val[DWARF_CFA_OFF_COLUMN],
+ DWARF_GET_LOC(d->loc[rs->ret_addr_column]),
+ rs->reg.where[R7], rs->reg.val[R7], DWARF_GET_LOC(d->loc[R7]),
+ rs->reg.where[LR], rs->reg.val[LR], DWARF_GET_LOC(d->loc[LR]),
+ rs->reg.where[SP], rs->reg.val[SP], DWARF_GET_LOC(d->loc[SP]));
+
+ /* A standard frame is defined as:
+ - CFA is register-relative offset off R7 or SP;
+ - Return address is saved in LR;
+ - R7 is unsaved or saved at CFA+offset, offset != -1;
+ - LR is unsaved or saved at CFA+offset, offset != -1;
+ - SP is unsaved or saved at CFA+offset, offset != -1. */
+ if (f->frame_type == UNW_ARM_FRAME_OTHER
+ && (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
+ && (rs->reg.val[DWARF_CFA_REG_COLUMN] == R7
+ || rs->reg.val[DWARF_CFA_REG_COLUMN] == SP)
+ && labs(rs->reg.val[DWARF_CFA_OFF_COLUMN]) < (1 << 29)
+ && rs->ret_addr_column == LR
+ && (rs->reg.where[R7] == DWARF_WHERE_UNDEF
+ || rs->reg.where[R7] == DWARF_WHERE_SAME
+ || (rs->reg.where[R7] == DWARF_WHERE_CFAREL
+ && labs(rs->reg.val[R7]) < (1 << 29)
+ && rs->reg.val[R7]+1 != 0))
+ && (rs->reg.where[LR] == DWARF_WHERE_UNDEF
+ || rs->reg.where[LR] == DWARF_WHERE_SAME
+ || (rs->reg.where[LR] == DWARF_WHERE_CFAREL
+ && labs(rs->reg.val[LR]) < (1 << 29)
+ && rs->reg.val[LR]+1 != 0))
+ && (rs->reg.where[SP] == DWARF_WHERE_UNDEF
+ || rs->reg.where[SP] == DWARF_WHERE_SAME
+ || (rs->reg.where[SP] == DWARF_WHERE_CFAREL
+ && labs(rs->reg.val[SP]) < (1 << 29)
+ && rs->reg.val[SP]+1 != 0)))
+ {
+ /* Save information for a standard frame. */
+ f->frame_type = UNW_ARM_FRAME_STANDARD;
+ f->cfa_reg_sp = (rs->reg.val[DWARF_CFA_REG_COLUMN] == SP);
+ f->cfa_reg_offset = rs->reg.val[DWARF_CFA_OFF_COLUMN];
+ if (rs->reg.where[R7] == DWARF_WHERE_CFAREL)
+ f->r7_cfa_offset = rs->reg.val[R7];
+ if (rs->reg.where[LR] == DWARF_WHERE_CFAREL)
+ f->lr_cfa_offset = rs->reg.val[LR];
+ if (rs->reg.where[SP] == DWARF_WHERE_CFAREL)
+ f->sp_cfa_offset = rs->reg.val[SP];
+ Debug (4, " standard frame\n");
+ }
+ else
+ Debug (4, " unusual frame\n");
+}
+
diff --git a/src/pal/src/libunwind/src/arm/Gstep.c b/src/pal/src/libunwind/src/arm/Gstep.c
new file mode 100644
index 0000000000..516c9f4d18
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gstep.c
@@ -0,0 +1,192 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+#include "ex_tables.h"
+
+#include <signal.h>
+
+#define arm_exidx_step UNW_OBJ(arm_exidx_step)
+
+static inline int
+arm_exidx_step (struct cursor *c)
+{
+ unw_word_t old_ip, old_cfa;
+ uint8_t buf[32];
+ int ret;
+
+ old_ip = c->dwarf.ip;
+ old_cfa = c->dwarf.cfa;
+
+ /* mark PC unsaved */
+ c->dwarf.loc[UNW_ARM_R15] = DWARF_NULL_LOC;
+ unw_word_t ip = c->dwarf.ip;
+ if (c->dwarf.use_prev_instr)
+ --ip;
+
+ /* check dynamic info first --- it overrides everything else */
+ ret = unwi_find_dynamic_proc_info (c->dwarf.as, ip, &c->dwarf.pi, 1,
+ c->dwarf.as_arg);
+ if (ret == -UNW_ENOINFO)
+ {
+ if ((ret = tdep_find_proc_info (&c->dwarf, ip, 1)) < 0)
+ return ret;
+ }
+
+ if (c->dwarf.pi.format != UNW_INFO_FORMAT_ARM_EXIDX)
+ return -UNW_ENOINFO;
+
+ ret = arm_exidx_extract (&c->dwarf, buf);
+ if (ret == -UNW_ESTOPUNWIND)
+ return 0;
+ else if (ret < 0)
+ return ret;
+
+ ret = arm_exidx_decode (buf, ret, &c->dwarf);
+ if (ret < 0)
+ return ret;
+
+ if (c->dwarf.ip == old_ip && c->dwarf.cfa == old_cfa)
+ {
+ Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n",
+ __FUNCTION__, (long) c->dwarf.ip);
+ return -UNW_EBADFRAME;
+ }
+
+ c->dwarf.pi_valid = 0;
+
+ return (c->dwarf.ip == 0) ? 0 : 1;
+}
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret = -UNW_EUNSPEC;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ /* Check if this is a signal frame. */
+ if (unw_is_signal_frame (cursor) > 0)
+ return arm_handle_signal_frame (cursor);
+
+#ifdef CONFIG_DEBUG_FRAME
+ /* First, try DWARF-based unwinding. */
+ if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF))
+ {
+ ret = dwarf_step (&c->dwarf);
+ Debug(1, "dwarf_step()=%d\n", ret);
+
+ if (likely (ret > 0))
+ return 1;
+ else if (unlikely (ret == -UNW_ESTOPUNWIND))
+ return ret;
+
+ if (ret < 0 && ret != -UNW_ENOINFO)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ }
+#endif /* CONFIG_DEBUG_FRAME */
+
+ /* Next, try extbl-based unwinding. */
+ if (UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX))
+ {
+ ret = arm_exidx_step (c);
+ if (ret > 0)
+ return 1;
+ if (ret == -UNW_ESTOPUNWIND || ret == 0)
+ return ret;
+ }
+
+ /* Fall back on APCS frame parsing.
+ Note: This won't work in case the ARM EABI is used. */
+#ifdef __FreeBSD__
+ if (0)
+#else
+ if (unlikely (ret < 0))
+#endif
+ {
+ if (UNW_TRY_METHOD(UNW_ARM_METHOD_FRAME))
+ {
+ Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret);
+ ret = UNW_ESUCCESS;
+ /* DWARF unwinding failed, try to follow APCS/optimized APCS frame chain */
+ unw_word_t instr, i;
+ dwarf_loc_t ip_loc, fp_loc;
+ unw_word_t frame;
+ /* Mark all registers unsaved, since we don't know where
+ they are saved (if at all), except for the EBP and
+ EIP. */
+ if (dwarf_get(&c->dwarf, c->dwarf.loc[UNW_ARM_R11], &frame) < 0)
+ {
+ return 0;
+ }
+ for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) {
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+ }
+ if (frame)
+ {
+ if (dwarf_get(&c->dwarf, DWARF_LOC(frame, 0), &instr) < 0)
+ {
+ return 0;
+ }
+ instr -= 8;
+ if (dwarf_get(&c->dwarf, DWARF_LOC(instr, 0), &instr) < 0)
+ {
+ return 0;
+ }
+ if ((instr & 0xFFFFD800) == 0xE92DD800)
+ {
+ /* Standard APCS frame. */
+ ip_loc = DWARF_LOC(frame - 4, 0);
+ fp_loc = DWARF_LOC(frame - 12, 0);
+ }
+ else
+ {
+ /* Codesourcery optimized normal frame. */
+ ip_loc = DWARF_LOC(frame, 0);
+ fp_loc = DWARF_LOC(frame - 4, 0);
+ }
+ if (dwarf_get(&c->dwarf, ip_loc, &c->dwarf.ip) < 0)
+ {
+ return 0;
+ }
+ c->dwarf.loc[UNW_ARM_R12] = ip_loc;
+ c->dwarf.loc[UNW_ARM_R11] = fp_loc;
+ c->dwarf.pi_valid = 0;
+ Debug(15, "ip=%x\n", c->dwarf.ip);
+ }
+ else
+ {
+ ret = -UNW_ENOINFO;
+ }
+ }
+ }
+ return ret == -UNW_ENOINFO ? 0 : ret;
+}
diff --git a/src/pal/src/libunwind/src/arm/Gtrace.c b/src/pal/src/libunwind/src/arm/Gtrace.c
new file mode 100644
index 0000000000..2f277520b3
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Gtrace.c
@@ -0,0 +1,557 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY
+ Copyright (C) 2014 CERN and Aalto University
+ Contributed by Filip Nyback
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+#include <signal.h>
+#include <limits.h>
+
+#pragma weak pthread_once
+#pragma weak pthread_key_create
+#pragma weak pthread_getspecific
+#pragma weak pthread_setspecific
+
+/* Initial hash table size. Table expands by 2 bits (times four). */
+#define HASH_MIN_BITS 14
+
+typedef struct
+{
+ unw_tdep_frame_t *frames;
+ size_t log_size;
+ size_t used;
+ size_t dtor_count; /* Counts how many times our destructor has already
+ been called. */
+} unw_trace_cache_t;
+
+static const unw_tdep_frame_t empty_frame = { 0, UNW_ARM_FRAME_OTHER, -1, -1, 0, -1, -1, -1 };
+static define_lock (trace_init_lock);
+static pthread_once_t trace_cache_once = PTHREAD_ONCE_INIT;
+static sig_atomic_t trace_cache_once_happen;
+static pthread_key_t trace_cache_key;
+static struct mempool trace_cache_pool;
+static __thread unw_trace_cache_t *tls_cache;
+static __thread int tls_cache_destroyed;
+
+/* Free memory for a thread's trace cache. */
+static void
+trace_cache_free (void *arg)
+{
+ unw_trace_cache_t *cache = arg;
+ if (++cache->dtor_count < PTHREAD_DESTRUCTOR_ITERATIONS)
+ {
+ /* Not yet our turn to get destroyed. Re-install ourselves into the key. */
+ pthread_setspecific(trace_cache_key, cache);
+ Debug(5, "delayed freeing cache %p (%zx to go)\n", cache,
+ PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count);
+ return;
+ }
+ tls_cache_destroyed = 1;
+ tls_cache = NULL;
+ munmap (cache->frames, (1u << cache->log_size) * sizeof(unw_tdep_frame_t));
+ mempool_free (&trace_cache_pool, cache);
+ Debug(5, "freed cache %p\n", cache);
+}
+
+/* Initialise frame tracing for threaded use. */
+static void
+trace_cache_init_once (void)
+{
+ pthread_key_create (&trace_cache_key, &trace_cache_free);
+ mempool_init (&trace_cache_pool, sizeof (unw_trace_cache_t), 0);
+ trace_cache_once_happen = 1;
+}
+
+static unw_tdep_frame_t *
+trace_cache_buckets (size_t n)
+{
+ unw_tdep_frame_t *frames;
+ size_t i;
+
+ GET_MEMORY(frames, n * sizeof (unw_tdep_frame_t));
+ if (likely(frames != NULL))
+ for (i = 0; i < n; ++i)
+ frames[i] = empty_frame;
+
+ return frames;
+}
+
+/* Allocate and initialise hash table for frame cache lookups.
+ Returns the cache initialised with (1u << HASH_LOW_BITS) hash
+ buckets, or NULL if there was a memory allocation problem. */
+static unw_trace_cache_t *
+trace_cache_create (void)
+{
+ unw_trace_cache_t *cache;
+
+ if (tls_cache_destroyed)
+ {
+ /* The current thread is in the process of exiting. Don't recreate
+ cache, as we wouldn't have another chance to free it. */
+ Debug(5, "refusing to reallocate cache: "
+ "thread-locals are being deallocated\n");
+ return NULL;
+ }
+
+ if (! (cache = mempool_alloc(&trace_cache_pool)))
+ {
+ Debug(5, "failed to allocate cache\n");
+ return NULL;
+ }
+
+ if (! (cache->frames = trace_cache_buckets(1u << HASH_MIN_BITS)))
+ {
+ Debug(5, "failed to allocate buckets\n");
+ mempool_free(&trace_cache_pool, cache);
+ return NULL;
+ }
+
+ cache->log_size = HASH_MIN_BITS;
+ cache->used = 0;
+ cache->dtor_count = 0;
+ tls_cache_destroyed = 0; /* Paranoia: should already be 0. */
+ Debug(5, "allocated cache %p\n", cache);
+ return cache;
+}
+
+/* Expand the hash table in the frame cache if possible. This always
+ quadruples the hash size, and clears all previous frame entries. */
+static int
+trace_cache_expand (unw_trace_cache_t *cache)
+{
+ size_t old_size = (1u << cache->log_size);
+ size_t new_log_size = cache->log_size + 2;
+ unw_tdep_frame_t *new_frames = trace_cache_buckets (1u << new_log_size);
+
+ if (unlikely(! new_frames))
+ {
+ Debug(5, "failed to expand cache to 2^%u buckets\n", new_log_size);
+ return -UNW_ENOMEM;
+ }
+
+ Debug(5, "expanded cache from 2^%u to 2^%u buckets\n", cache->log_size,
+ new_log_size);
+ munmap(cache->frames, old_size * sizeof(unw_tdep_frame_t));
+ cache->frames = new_frames;
+ cache->log_size = new_log_size;
+ cache->used = 0;
+ return 0;
+}
+
+static unw_trace_cache_t *
+trace_cache_get_unthreaded (void)
+{
+ unw_trace_cache_t *cache;
+ intrmask_t saved_mask;
+ static unw_trace_cache_t *global_cache = NULL;
+ lock_acquire (&trace_init_lock, saved_mask);
+ if (! global_cache)
+ {
+ mempool_init (&trace_cache_pool, sizeof (unw_trace_cache_t), 0);
+ global_cache = trace_cache_create ();
+ }
+ cache = global_cache;
+ lock_release (&trace_init_lock, saved_mask);
+ Debug(5, "using cache %p\n", cache);
+ return cache;
+}
+
+/* Get the frame cache for the current thread. Create it if there is none. */
+static unw_trace_cache_t *
+trace_cache_get (void)
+{
+ unw_trace_cache_t *cache;
+ if (likely (pthread_once != NULL))
+ {
+ pthread_once(&trace_cache_once, &trace_cache_init_once);
+ if (!trace_cache_once_happen)
+ {
+ return trace_cache_get_unthreaded();
+ }
+ if (! (cache = tls_cache))
+ {
+ cache = trace_cache_create();
+ pthread_setspecific(trace_cache_key, cache);
+ tls_cache = cache;
+ }
+ Debug(5, "using cache %p\n", cache);
+ return cache;
+ }
+ else
+ {
+ return trace_cache_get_unthreaded();
+ }
+}
+
+/* Initialise frame properties for address cache slot F at address
+ PC using current CFA, R7 and SP values. Modifies CURSOR to
+ that location, performs one unw_step(), and fills F with what
+ was discovered about the location. Returns F.
+
+ FIXME: This probably should tell DWARF handling to never evaluate
+ or use registers other than R7, SP and PC in case there is
+ highly unusual unwind info which uses these creatively. */
+static unw_tdep_frame_t *
+trace_init_addr (unw_tdep_frame_t *f,
+ unw_cursor_t *cursor,
+ unw_word_t cfa,
+ unw_word_t pc,
+ unw_word_t r7,
+ unw_word_t sp)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct dwarf_cursor *d = &c->dwarf;
+ int ret = -UNW_EINVAL;
+
+ /* Initialise frame properties: unknown, not last. */
+ f->virtual_address = pc;
+ f->frame_type = UNW_ARM_FRAME_OTHER;
+ f->last_frame = 0;
+ f->cfa_reg_sp = -1;
+ f->cfa_reg_offset = 0;
+ f->r7_cfa_offset = -1;
+ f->lr_cfa_offset = -1;
+ f->sp_cfa_offset = -1;
+
+ /* Reinitialise cursor to this instruction - but undo next/prev RIP
+ adjustment because unw_step will redo it - and force PC, R7 and
+ SP into register locations (=~ ucontext we keep), then set
+ their desired values. Then perform the step. */
+ d->ip = pc + d->use_prev_instr;
+ d->cfa = cfa;
+ d->loc[UNW_ARM_R7] = DWARF_REG_LOC (d, UNW_ARM_R7);
+ d->loc[UNW_ARM_R13] = DWARF_REG_LOC (d, UNW_ARM_R13);
+ d->loc[UNW_ARM_R15] = DWARF_REG_LOC (d, UNW_ARM_R15);
+ c->frame_info = *f;
+
+ if (likely(dwarf_put (d, d->loc[UNW_ARM_R7], r7) >= 0)
+ && likely(dwarf_put (d, d->loc[UNW_ARM_R13], sp) >= 0)
+ && likely(dwarf_put (d, d->loc[UNW_ARM_R15], pc) >= 0)
+ && likely((ret = unw_step (cursor)) >= 0))
+ *f = c->frame_info;
+
+ /* If unw_step() stopped voluntarily, remember that, even if it
+ otherwise could not determine anything useful. This avoids
+ failing trace if we hit frames without unwind info, which is
+ common for the outermost frame (CRT stuff) on many systems.
+ This avoids failing trace in very common circumstances; failing
+ to unw_step() loop wouldn't produce any better result. */
+ if (ret == 0)
+ f->last_frame = -1;
+
+ Debug (3, "frame va %x type %d last %d cfa %s+%d r7 @ cfa%+d lr @ cfa%+d sp @ cfa%+d\n",
+ f->virtual_address, f->frame_type, f->last_frame,
+ f->cfa_reg_sp ? "sp" : "r7", f->cfa_reg_offset,
+ f->r7_cfa_offset, f->lr_cfa_offset, f->sp_cfa_offset);
+
+ return f;
+}
+
+/* Look up and if necessary fill in frame attributes for address PC
+ in CACHE using current CFA, R7 and SP values. Uses CURSOR to
+ perform any unwind steps necessary to fill the cache. Returns the
+ frame cache slot which describes RIP. */
+static unw_tdep_frame_t *
+trace_lookup (unw_cursor_t *cursor,
+ unw_trace_cache_t *cache,
+ unw_word_t cfa,
+ unw_word_t pc,
+ unw_word_t r7,
+ unw_word_t sp)
+{
+ /* First look up for previously cached information using cache as
+ linear probing hash table with probe step of 1. Majority of
+ lookups should be completed within few steps, but it is very
+ important the hash table does not fill up, or performance falls
+ off the cliff. */
+ uint32_t i, addr;
+ uint32_t cache_size = 1u << cache->log_size;
+ uint32_t slot = ((pc * 0x9e3779b9) >> 11) & (cache_size-1);
+ unw_tdep_frame_t *frame;
+
+ for (i = 0; i < 16; ++i)
+ {
+ frame = &cache->frames[slot];
+ addr = frame->virtual_address;
+
+ /* Return if we found the address. */
+ if (likely(addr == pc))
+ {
+ Debug (4, "found address after %d steps\n", i);
+ return frame;
+ }
+
+ /* If slot is empty, reuse it. */
+ if (likely(! addr))
+ break;
+
+ /* Linear probe to next slot candidate, step = 1. */
+ if (++slot >= cache_size)
+ slot -= cache_size;
+ }
+
+ /* If we collided after 16 steps, or if the hash is more than half
+ full, force the hash to expand. Fill the selected slot, whether
+ it's free or collides. Note that hash expansion drops previous
+ contents; further lookups will refill the hash. */
+ Debug (4, "updating slot %u after %d steps, replacing 0x%x\n", slot, i, addr);
+ if (unlikely(addr || cache->used >= cache_size / 2))
+ {
+ if (unlikely(trace_cache_expand (cache) < 0))
+ return NULL;
+
+ cache_size = 1u << cache->log_size;
+ slot = ((pc * 0x9e3779b9) >> 11) & (cache_size-1);
+ frame = &cache->frames[slot];
+ addr = frame->virtual_address;
+ }
+
+ if (! addr)
+ ++cache->used;
+
+ return trace_init_addr (frame, cursor, cfa, pc, r7, sp);
+}
+
+/* Fast stack backtrace for ARM.
+
+ This is used by backtrace() implementation to accelerate frequent
+ queries for current stack, without any desire to unwind. It fills
+ BUFFER with the call tree from CURSOR upwards for at most SIZE
+ stack levels. The first frame, backtrace itself, is omitted. When
+ called, SIZE should give the maximum number of entries that can be
+ stored into BUFFER. Uses an internal thread-specific cache to
+ accelerate queries.
+
+ The caller should fall back to a unw_step() loop if this function
+ fails by returning -UNW_ESTOPUNWIND, meaning the routine hit a
+ stack frame that is too complex to be traced in the fast path.
+
+ This function is tuned for clients which only need to walk the
+ stack to get the call tree as fast as possible but without any
+ other details, for example profilers sampling the stack thousands
+ to millions of times per second. The routine handles the most
+ common ARM ABI stack layouts: CFA is R7 or SP plus/minus
+ constant offset, return address is in LR, and R7, LR and SP are
+ either unchanged or saved on stack at constant offset from the CFA;
+ the signal return frame; and frames without unwind info provided
+ they are at the outermost (final) frame or can conservatively be
+ assumed to be frame-pointer based.
+
+ Any other stack layout will cause the routine to give up. There
+ are only a handful of relatively rarely used functions which do
+ not have a stack in the standard form: vfork, longjmp, setcontext
+ and _dl_runtime_profile on common linux systems for example.
+
+ On success BUFFER and *SIZE reflect the trace progress up to *SIZE
+ stack levels or the outermost frame, which ever is less. It may
+ stop short of outermost frame if unw_step() loop would also do so,
+ e.g. if there is no more unwind information; this is not reported
+ as an error.
+
+ The function returns a negative value for errors, -UNW_ESTOPUNWIND
+ if tracing stopped because of an unusual frame unwind info. The
+ BUFFER and *SIZE reflect tracing progress up to the error frame.
+
+ Callers of this function would normally look like this:
+
+ unw_cursor_t cur;
+ unw_context_t ctx;
+ void addrs[128];
+ int depth = 128;
+ int ret;
+
+ unw_getcontext(&ctx);
+ unw_init_local(&cur, &ctx);
+ if ((ret = unw_tdep_trace(&cur, addrs, &depth)) < 0)
+ {
+ depth = 0;
+ unw_getcontext(&ctx);
+ unw_init_local(&cur, &ctx);
+ while ((ret = unw_step(&cur)) > 0 && depth < 128)
+ {
+ unw_word_t ip;
+ unw_get_reg(&cur, UNW_REG_IP, &ip);
+ addresses[depth++] = (void *) ip;
+ }
+ }
+*/
+HIDDEN int
+tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct dwarf_cursor *d = &c->dwarf;
+ unw_trace_cache_t *cache;
+ unw_word_t sp, pc, cfa, r7, lr;
+ int maxdepth = 0;
+ int depth = 0;
+ int ret;
+
+ /* Check input parametres. */
+ if (unlikely(! cursor || ! buffer || ! size || (maxdepth = *size) <= 0))
+ return -UNW_EINVAL;
+
+ Debug (1, "begin ip 0x%x cfa 0x%x\n", d->ip, d->cfa);
+
+ /* Tell core dwarf routines to call back to us. */
+ d->stash_frames = 1;
+
+ /* Determine initial register values. These are direct access safe
+ because we know they come from the initial machine context. */
+ pc = d->ip;
+ sp = cfa = d->cfa;
+ ACCESS_MEM_FAST(ret, 0, d, DWARF_GET_LOC(d->loc[UNW_ARM_R7]), r7);
+ assert(ret == 0);
+ lr = 0;
+
+ /* Get frame cache. */
+ if (unlikely(! (cache = trace_cache_get())))
+ {
+ Debug (1, "returning %d, cannot get trace cache\n", -UNW_ENOMEM);
+ *size = 0;
+ d->stash_frames = 0;
+ return -UNW_ENOMEM;
+ }
+
+ /* Trace the stack upwards, starting from current PC. Adjust
+ the PC address for previous/next instruction as the main
+ unwinding logic would also do. We undo this before calling
+ back into unw_step(). */
+ while (depth < maxdepth)
+ {
+ pc -= d->use_prev_instr;
+ Debug (2, "depth %d cfa 0x%x pc 0x%x sp 0x%x r7 0x%x\n",
+ depth, cfa, pc, sp, r7);
+
+ /* See if we have this address cached. If not, evaluate enough of
+ the dwarf unwind information to fill the cache line data, or to
+ decide this frame cannot be handled in fast trace mode. We
+ cache negative results too to prevent unnecessary dwarf parsing
+ for common failures. */
+ unw_tdep_frame_t *f = trace_lookup (cursor, cache, cfa, pc, r7, sp);
+
+ /* If we don't have information for this frame, give up. */
+ if (unlikely(! f))
+ {
+ ret = -UNW_ENOINFO;
+ break;
+ }
+
+ Debug (3, "frame va %x type %d last %d cfa %s+%d r7 @ cfa%+d lr @ cfa%+d sp @ cfa%+d\n",
+ f->virtual_address, f->frame_type, f->last_frame,
+ f->cfa_reg_sp ? "sp" : "r7", f->cfa_reg_offset,
+ f->r7_cfa_offset, f->lr_cfa_offset, f->sp_cfa_offset);
+
+ assert (f->virtual_address == pc);
+
+ /* Stop if this was the last frame. In particular don't evaluate
+ new register values as it may not be safe - we don't normally
+ run with full validation on, and do not want to - and there's
+ enough bad unwind info floating around that we need to trust
+ what unw_step() previously said, in potentially bogus frames. */
+ if (f->last_frame)
+ break;
+
+ /* Evaluate CFA and registers for the next frame. */
+ switch (f->frame_type)
+ {
+ case UNW_ARM_FRAME_GUESSED:
+ /* Fall thru to standard processing after forcing validation. */
+ c->validate = 1;
+
+ case UNW_ARM_FRAME_STANDARD:
+ /* Advance standard traceable frame. */
+ cfa = (f->cfa_reg_sp ? sp : r7) + f->cfa_reg_offset;
+ if (likely(f->lr_cfa_offset != -1))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->lr_cfa_offset, pc);
+ else if (lr != 0)
+ {
+ /* Use the saved link register as the new pc. */
+ pc = lr;
+ lr = 0;
+ }
+ if (likely(ret >= 0) && likely(f->r7_cfa_offset != -1))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->r7_cfa_offset, r7);
+
+ /* Don't bother reading SP from DWARF, CFA becomes new SP. */
+ sp = cfa;
+
+ /* Next frame needs to back up for unwind info lookup. */
+ d->use_prev_instr = 1;
+ break;
+
+ case UNW_ARM_FRAME_SIGRETURN:
+ cfa = cfa + f->cfa_reg_offset; /* cfa now points to ucontext_t. */
+#if defined(__linux__)
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_PC_OFF, pc);
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_R7_OFF, r7);
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_SP_OFF, sp);
+ /* Save the link register here in case we end up in a function that
+ doesn't save the link register in the prologue, e.g. kill. */
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_LR_OFF, lr);
+#elif defined(__FreeBSD__)
+ printf("XXX\n");
+#endif
+
+ /* Resume stack at signal restoration point. The stack is not
+ necessarily continuous here, especially with sigaltstack(). */
+ cfa = sp;
+
+ /* Next frame should not back up. */
+ d->use_prev_instr = 0;
+ break;
+
+ case UNW_ARM_FRAME_SYSCALL:
+ printf("XXX1\n");
+ break;
+
+ default:
+ /* We cannot trace through this frame, give up and tell the
+ caller we had to stop. Data collected so far may still be
+ useful to the caller, so let it know how far we got. */
+ ret = -UNW_ESTOPUNWIND;
+ break;
+ }
+
+ Debug (4, "new cfa 0x%x pc 0x%x sp 0x%x r7 0x%x\n",
+ cfa, pc, sp, r7);
+
+ /* If we failed or ended up somewhere bogus, stop. */
+ if (unlikely(ret < 0 || pc < 0x4000))
+ break;
+
+ /* Record this address in stack trace. We skipped the first address. */
+ buffer[depth++] = (void *) (pc - d->use_prev_instr);
+ }
+
+#if UNW_DEBUG
+ Debug (1, "returning %d, depth %d\n", ret, depth);
+#endif
+ *size = depth;
+ return ret;
+}
+
diff --git a/src/pal/src/libunwind/src/arm/Lapply_reg_state.c b/src/pal/src/libunwind/src/arm/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lcreate_addr_space.c b/src/pal/src/libunwind/src/arm/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lex_tables.c b/src/pal/src/libunwind/src/arm/Lex_tables.c
new file mode 100644
index 0000000000..4a4f925c9c
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lex_tables.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gex_tables.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lget_proc_info.c b/src/pal/src/libunwind/src/arm/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lget_save_loc.c b/src/pal/src/libunwind/src/arm/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lglobal.c b/src/pal/src/libunwind/src/arm/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Linit.c b/src/pal/src/libunwind/src/arm/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Linit_local.c b/src/pal/src/libunwind/src/arm/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Linit_remote.c b/src/pal/src/libunwind/src/arm/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lis_signal_frame.c b/src/pal/src/libunwind/src/arm/Lis_signal_frame.c
new file mode 100644
index 0000000000..b9a7c4f51a
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Los-freebsd.c b/src/pal/src/libunwind/src/arm/Los-freebsd.c
new file mode 100644
index 0000000000..a75a205df1
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Los-freebsd.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gos-freebsd.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Los-linux.c b/src/pal/src/libunwind/src/arm/Los-linux.c
new file mode 100644
index 0000000000..3cc18aabcc
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Los-linux.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gos-linux.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Los-other.c b/src/pal/src/libunwind/src/arm/Los-other.c
new file mode 100644
index 0000000000..a75a205df1
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Los-other.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gos-freebsd.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lreg_states_iterate.c b/src/pal/src/libunwind/src/arm/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lregs.c b/src/pal/src/libunwind/src/arm/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lresume.c b/src/pal/src/libunwind/src/arm/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lstash_frame.c b/src/pal/src/libunwind/src/arm/Lstash_frame.c
new file mode 100644
index 0000000000..77587803d0
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lstash_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstash_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Lstep.c b/src/pal/src/libunwind/src/arm/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/arm/Ltrace.c b/src/pal/src/libunwind/src/arm/Ltrace.c
new file mode 100644
index 0000000000..24b7b3cfa6
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/Ltrace.c
@@ -0,0 +1,6 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gtrace.c"
+#endif
+
diff --git a/src/pal/src/libunwind/src/arm/gen-offsets.c b/src/pal/src/libunwind/src/arm/gen-offsets.c
new file mode 100644
index 0000000000..7d6bf2f1c5
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/gen-offsets.c
@@ -0,0 +1,54 @@
+#include <stdio.h>
+#include <stddef.h>
+#include <ucontext.h>
+#include <asm/sigcontext.h>
+
+#define UC(N,X) \
+ printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))
+
+#define SC(N,X) \
+ printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))
+
+int
+main (void)
+{
+ printf (
+"/* Linux-specific definitions: */\n\n"
+
+"/* Define various structure offsets to simplify cross-compilation. */\n\n"
+
+"/* Offsets for ARM Linux \"ucontext_t\": */\n\n");
+
+ UC ("FLAGS", uc_flags);
+ UC ("LINK", uc_link);
+ UC ("STACK", uc_stack);
+ UC ("MCONTEXT", uc_mcontext);
+ UC ("SIGMASK", uc_sigmask);
+ UC ("REGSPACE", uc_regspace);
+
+ printf ("\n/* Offsets for ARM Linux \"struct sigcontext\": */\n\n");
+
+ SC ("TRAPNO", trap_no);
+ SC ("ERRORCODE", error_code);
+ SC ("OLDMASK", oldmask);
+ SC ("R0", arm_r0);
+ SC ("R1", arm_r1);
+ SC ("R2", arm_r2);
+ SC ("R3", arm_r3);
+ SC ("R4", arm_r4);
+ SC ("R5", arm_r5);
+ SC ("R6", arm_r6);
+ SC ("R7", arm_r7);
+ SC ("R8", arm_r8);
+ SC ("R9", arm_r9);
+ SC ("R10", arm_r10);
+ SC ("FP", arm_fp);
+ SC ("IP", arm_ip);
+ SC ("SP", arm_sp);
+ SC ("LR", arm_lr);
+ SC ("PC", arm_pc);
+ SC ("CPSR", arm_cpsr);
+ SC ("FAULTADDR", fault_address);
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/arm/getcontext.S b/src/pal/src/libunwind/src/arm/getcontext.S
new file mode 100644
index 0000000000..7e18784477
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/getcontext.S
@@ -0,0 +1,63 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+
+ .text
+ .arm
+
+ .global _Uarm_getcontext
+ .type _Uarm_getcontext, %function
+ @ This is a stub version of getcontext() for ARM which only stores core
+ @ registers. It must be called in a special way, not as a regular
+ @ function -- see also the libunwind-arm.h:unw_tdep_getcontext macro.
+_Uarm_getcontext:
+ stmfd sp!, {r0, r1}
+ @ store r0
+#if defined(__linux__)
+ str r0, [r0, #LINUX_UC_MCONTEXT_OFF + LINUX_SC_R0_OFF]
+ add r0, r0, #LINUX_UC_MCONTEXT_OFF + LINUX_SC_R0_OFF
+#elif defined(__FreeBSD__)
+ str r0, [r0, #FREEBSD_UC_MCONTEXT_OFF + FREEBSD_MC_R0_OFF]
+ add r0, r0, #FREEBSD_UC_MCONTEXT_OFF + FREEBSD_MC_R0_OFF
+#else
+#error Fix me
+#endif
+ @ store r1 to r12
+ stmib r0, {r1-r12}
+ @ reconstruct r13 at call site, then store
+ add r1, sp, #12
+ str r1, [r0, #13 * 4]
+ @ retrieve r14 from call site, then store
+ ldr r1, [sp, #8]
+ str r1, [r0, #14 * 4]
+ @ point lr to instruction after call site's stack adjustment
+ add r1, lr, #4
+ str r1, [r0, #15 * 4]
+ ldmfd sp!, {r0, r1}
+ bx lr
+#if defined(__linux__) || defined(__FreeBSD__)
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",%progbits
+#endif
diff --git a/src/pal/src/libunwind/src/arm/init.h b/src/pal/src/libunwind/src/arm/init.h
new file mode 100644
index 0000000000..7d765ecf09
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/init.h
@@ -0,0 +1,77 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret, i;
+
+ c->dwarf.loc[UNW_ARM_R0] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R0);
+ c->dwarf.loc[UNW_ARM_R1] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R1);
+ c->dwarf.loc[UNW_ARM_R2] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R2);
+ c->dwarf.loc[UNW_ARM_R3] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R3);
+ c->dwarf.loc[UNW_ARM_R4] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R4);
+ c->dwarf.loc[UNW_ARM_R5] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R5);
+ c->dwarf.loc[UNW_ARM_R6] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R6);
+ c->dwarf.loc[UNW_ARM_R7] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R7);
+ c->dwarf.loc[UNW_ARM_R8] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R8);
+ c->dwarf.loc[UNW_ARM_R9] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R9);
+ c->dwarf.loc[UNW_ARM_R10] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R10);
+ c->dwarf.loc[UNW_ARM_R11] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R11);
+ c->dwarf.loc[UNW_ARM_R12] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R12);
+ c->dwarf.loc[UNW_ARM_R13] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R13);
+ c->dwarf.loc[UNW_ARM_R14] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R14);
+ c->dwarf.loc[UNW_ARM_R15] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R15);
+ for (i = UNW_ARM_R15 + 1; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R15], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ /* FIXME: correct for ARM? */
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_ARM_R13),
+ &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = ARM_SCF_NONE;
+ c->sigcontext_addr = 0;
+ c->sigcontext_sp = 0;
+ c->sigcontext_pc = 0;
+
+ /* FIXME: Initialisation for other registers. */
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/arm/is_fpreg.c b/src/pal/src/libunwind/src/arm/is_fpreg.c
new file mode 100644
index 0000000000..e55bcff03e
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/is_fpreg.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+/* FIXME: I'm not sure if libunwind's GP/FP register distinction is very useful
+ on ARM. Count all the FP or coprocessor registers we know about for now. */
+
+int
+unw_is_fpreg (int regnum)
+{
+ return ((regnum >= UNW_ARM_S0 && regnum <= UNW_ARM_S31)
+ || (regnum >= UNW_ARM_F0 && regnum <= UNW_ARM_F7)
+ || (regnum >= UNW_ARM_wCGR0 && regnum <= UNW_ARM_wCGR7)
+ || (regnum >= UNW_ARM_wR0 && regnum <= UNW_ARM_wR15)
+ || (regnum >= UNW_ARM_wC0 && regnum <= UNW_ARM_wC7)
+ || (regnum >= UNW_ARM_D0 && regnum <= UNW_ARM_D31));
+}
diff --git a/src/pal/src/libunwind/src/arm/offsets.h b/src/pal/src/libunwind/src/arm/offsets.h
new file mode 100644
index 0000000000..621701106c
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/offsets.h
@@ -0,0 +1,42 @@
+/* Linux-specific definitions: */
+
+/* Define various structure offsets to simplify cross-compilation. */
+
+/* Offsets for ARM Linux "ucontext_t": */
+
+#define LINUX_UC_FLAGS_OFF 0x00
+#define LINUX_UC_LINK_OFF 0x04
+#define LINUX_UC_STACK_OFF 0x08
+#define LINUX_UC_MCONTEXT_OFF 0x14
+#define LINUX_UC_SIGMASK_OFF 0x68
+#define LINUX_UC_REGSPACE_OFF 0xE8
+
+/* Offsets for ARM Linux "struct sigcontext": */
+
+#define LINUX_SC_TRAPNO_OFF 0x00
+#define LINUX_SC_ERRORCODE_OFF 0x04
+#define LINUX_SC_OLDMASK_OFF 0x08
+#define LINUX_SC_R0_OFF 0x0C
+#define LINUX_SC_R1_OFF 0x10
+#define LINUX_SC_R2_OFF 0x14
+#define LINUX_SC_R3_OFF 0x18
+#define LINUX_SC_R4_OFF 0x1C
+#define LINUX_SC_R5_OFF 0x20
+#define LINUX_SC_R6_OFF 0x24
+#define LINUX_SC_R7_OFF 0x28
+#define LINUX_SC_R8_OFF 0x2C
+#define LINUX_SC_R9_OFF 0x30
+#define LINUX_SC_R10_OFF 0x34
+#define LINUX_SC_FP_OFF 0x38
+#define LINUX_SC_IP_OFF 0x3C
+#define LINUX_SC_SP_OFF 0x40
+#define LINUX_SC_LR_OFF 0x44
+#define LINUX_SC_PC_OFF 0x48
+#define LINUX_SC_CPSR_OFF 0x4C
+#define LINUX_SC_FAULTADDR_OFF 0x50
+
+/* FreeBSD-specific definitions: */
+
+#define FREEBSD_SC_UCONTEXT_OFF 0x40
+#define FREEBSD_UC_MCONTEXT_OFF 0x10
+#define FREEBSD_MC_R0_OFF 0
diff --git a/src/pal/src/libunwind/src/arm/regname.c b/src/pal/src/libunwind/src/arm/regname.c
new file mode 100644
index 0000000000..7cac630c17
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/regname.c
@@ -0,0 +1,90 @@
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ /* 0. */
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ /* 8. */
+ "r8", "r9", "r10", "fp", "ip", "sp", "lr", "pc",
+ /* 16. Obsolete FPA names. */
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ /* 24. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 32. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 40. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 48. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 56. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 64. */
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ /* 72. */
+ "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
+ /* 80. */
+ "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
+ /* 88. */
+ "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
+ /* 96. */
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ /* 104. */
+ "wCGR0", "wCGR1", "wCGR2", "wCGR3", "wCGR4", "wCGR5", "wCGR6", "wCGR7",
+ /* 112. */
+ "wR0", "wR1", "wR2", "wR3", "wR4", "wR5", "wR6", "wR7",
+ /* 128. */
+ "spsr", "spsr_fiq", "spsr_irq", "spsr_abt", "spsr_und", "spsr_svc", 0, 0,
+ /* 136. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 144. */
+ "r8_usr", "r9_usr", "r10_usr", "r11_usr", "r12_usr", "r13_usr", "r14_usr",
+ /* 151. */
+ "r8_fiq", "r9_fiq", "r10_fiq", "r11_fiq", "r12_fiq", "r13_fiq", "r14_fiq",
+ /* 158. */
+ "r13_irq", "r14_irq",
+ /* 160. */
+ "r13_abt", "r14_abt",
+ /* 162. */
+ "r13_und", "r14_und",
+ /* 164. */
+ "r13_svc", "r14_svc", 0, 0,
+ /* 168. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 176. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 184. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 192. */
+ "wC0", "wC1", "wC2", "wC3", "wC4", "wC5", "wC6", "wC7",
+ /* 200. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 208. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 216. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 224. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 232. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 240. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 248. */
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 256. */
+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ /* 264. */
+ "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
+ /* 272. */
+ "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
+ /* 280. */
+ "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/arm/siglongjmp.S b/src/pal/src/libunwind/src/arm/siglongjmp.S
new file mode 100644
index 0000000000..4df0736683
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/siglongjmp.S
@@ -0,0 +1,12 @@
+ /* Dummy implementation for now. */
+
+ .globl _UI_siglongjmp_cont
+ .globl _UI_longjmp_cont
+
+_UI_siglongjmp_cont:
+_UI_longjmp_cont:
+ bx lr
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",%progbits
+#endif
diff --git a/src/pal/src/libunwind/src/arm/unwind_i.h b/src/pal/src/libunwind/src/arm/unwind_i.h
new file mode 100644
index 0000000000..fe0bca005b
--- /dev/null
+++ b/src/pal/src/libunwind/src/arm/unwind_i.h
@@ -0,0 +1,62 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <stdint.h>
+
+#include <libunwind-arm.h>
+
+#include "libunwind_i.h"
+
+/* DWARF column numbers for ARM: */
+#define R7 7
+#define SP 13
+#define LR 14
+#define PC 15
+
+#define arm_lock UNW_OBJ(lock)
+#define arm_local_resume UNW_OBJ(local_resume)
+#define arm_local_addr_space_init UNW_OBJ(local_addr_space_init)
+
+extern void arm_local_addr_space_init (void);
+extern int arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+#define arm_handle_signal_frame UNW_OBJ(handle_signal_frame)
+extern int arm_handle_signal_frame(unw_cursor_t *cursor);
+
+/* By-pass calls to access_mem() when known to be safe. */
+#ifdef UNW_LOCAL_ONLY
+# undef ACCESS_MEM_FAST
+# define ACCESS_MEM_FAST(ret,validate,cur,addr,to) \
+ do { \
+ if (unlikely(validate)) \
+ (ret) = dwarf_get ((cur), DWARF_MEM_LOC ((cur), (addr)), &(to)); \
+ else \
+ (ret) = 0, (to) = *(unw_word_t *)(addr); \
+ } while (0)
+#endif
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/config.h.in b/src/pal/src/libunwind/src/config.h.in
new file mode 100644
index 0000000000..5e3421b4a9
--- /dev/null
+++ b/src/pal/src/libunwind/src/config.h.in
@@ -0,0 +1,16 @@
+#ifndef __LIBUNWIND_CONFIG_H__
+#define __LIBUNWIND_CONFIG_H__
+
+#cmakedefine HAVE_ELF_H
+#cmakedefine HAVE_SYS_ELF_H
+
+#cmakedefine HAVE_ENDIAN_H
+#cmakedefine HAVE_SYS_ENDIAN_H
+
+#cmakedefine HAVE_LINK_H
+#cmakedefine HAVE_SYS_LINK_H
+
+#cmakedefine HAVE__BUILTIN_UNREACHABLE
+#cmakedefine HAVE_SYNC_ATOMICS
+
+#endif
diff --git a/src/pal/src/libunwind/src/configure.cmake b/src/pal/src/libunwind/src/configure.cmake
new file mode 100644
index 0000000000..3e45405e70
--- /dev/null
+++ b/src/pal/src/libunwind/src/configure.cmake
@@ -0,0 +1,31 @@
+include(CheckCXXSourceCompiles)
+include(CheckIncludeFiles)
+
+check_include_files(elf.h HAVE_ELF_H)
+check_include_files(sys/elf.h HAVE_SYS_ELF_H)
+
+check_include_files(endian.h HAVE_ENDIAN_H)
+check_include_files(sys/endian.h HAVE_SYS_ENDIAN_H)
+
+check_include_files(link.h HAVE_LINK_H)
+check_include_files(sys/link.h HAVE_SYS_LINK_H)
+
+check_cxx_source_compiles("
+int main(int argc, char **argv)
+{
+ __sync_bool_compare_and_swap((int *)0, 0, 1);
+ __sync_fetch_and_add((int *)0, 1);
+
+ return 0;
+}" HAVE_SYNC_ATOMICS)
+
+
+check_cxx_source_compiles("
+int main(int argc, char **argv)
+{
+ __builtin_unreachable();
+
+ return 0;
+}" HAVE__BUILTIN_UNREACHABLE)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
diff --git a/src/pal/src/libunwind/src/coredump/README b/src/pal/src/libunwind/src/coredump/README
new file mode 100644
index 0000000000..204493c93e
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/README
@@ -0,0 +1,8 @@
+This code is based on "unwinding via ptrace" code from ptrace/
+directory.
+
+Files with names starting with _UCD_ are substantially changed
+from their ptrace/_UPT_... progenitors.
+
+Files which still have _UPT_... names are either verbiatim copies
+from ptrace/, or unimplemented stubs.
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_access_mem.c b/src/pal/src/libunwind/src/coredump/_UCD_access_mem.c
new file mode 100644
index 0000000000..1fdbd128ff
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_access_mem.c
@@ -0,0 +1,98 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+int
+_UCD_access_mem(unw_addr_space_t as, unw_word_t addr, unw_word_t *val,
+ int write, void *arg)
+{
+ if (write)
+ {
+ Debug(0, "write is not supported\n");
+ return -UNW_EINVAL;
+ }
+
+ struct UCD_info *ui = arg;
+
+ unw_word_t addr_last = addr + sizeof(*val)-1;
+ coredump_phdr_t *phdr;
+ unsigned i;
+ for (i = 0; i < ui->phdrs_count; i++)
+ {
+ phdr = &ui->phdrs[i];
+ if (phdr->p_vaddr <= addr && addr_last < phdr->p_vaddr + phdr->p_memsz)
+ {
+ goto found;
+ }
+ }
+ Debug(1, "addr 0x%llx is unmapped\n", (unsigned long long)addr);
+ return -UNW_EINVAL;
+
+ found: ;
+
+ const char *filename UNUSED;
+ off_t fileofs;
+ int fd;
+ if (addr_last >= phdr->p_vaddr + phdr->p_filesz)
+ {
+ /* This part of mapped address space is not present in coredump file */
+ /* Do we have it in the backup file? */
+ if (phdr->backing_fd < 0)
+ {
+ Debug(1, "access to not-present data in phdr[%d]: addr:0x%llx\n",
+ i, (unsigned long long)addr
+ );
+ return -UNW_EINVAL;
+ }
+ filename = phdr->backing_filename;
+ fileofs = addr - phdr->p_vaddr;
+ fd = phdr->backing_fd;
+ goto read;
+ }
+
+ filename = ui->coredump_filename;
+ fileofs = phdr->p_offset + (addr - phdr->p_vaddr);
+ fd = ui->coredump_fd;
+ read:
+ if (lseek(fd, fileofs, SEEK_SET) != fileofs)
+ goto read_error;
+ if (read(fd, val, sizeof(*val)) != sizeof(*val))
+ goto read_error;
+
+ Debug(1, "0x%llx <- [addr:0x%llx fileofs:0x%llx]\n",
+ (unsigned long long)(*val),
+ (unsigned long long)addr,
+ (unsigned long long)fileofs
+ );
+ return 0;
+
+ read_error:
+ Debug(1, "access out of file: addr:0x%llx fileofs:%llx file:'%s'\n",
+ (unsigned long long)addr,
+ (unsigned long long)fileofs,
+ filename
+ );
+ return -UNW_EINVAL;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_access_reg_freebsd.c b/src/pal/src/libunwind/src/coredump/_UCD_access_reg_freebsd.c
new file mode 100644
index 0000000000..0e3a83bdc6
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_access_reg_freebsd.c
@@ -0,0 +1,137 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_lib.h"
+
+#include "_UCD_internal.h"
+
+int
+_UCD_access_reg (unw_addr_space_t as,
+ unw_regnum_t regnum, unw_word_t *valp,
+ int write, void *arg)
+{
+ if (write)
+ {
+ Debug(0, "write is not supported\n");
+ return -UNW_EINVAL;
+ }
+
+ struct UCD_info *ui = arg;
+
+#if defined(UNW_TARGET_X86)
+ switch (regnum) {
+ case UNW_X86_EAX:
+ *valp = ui->prstatus->pr_reg.r_eax;
+ break;
+ case UNW_X86_EDX:
+ *valp = ui->prstatus->pr_reg.r_edx;
+ break;
+ case UNW_X86_ECX:
+ *valp = ui->prstatus->pr_reg.r_ecx;
+ break;
+ case UNW_X86_EBX:
+ *valp = ui->prstatus->pr_reg.r_ebx;
+ break;
+ case UNW_X86_ESI:
+ *valp = ui->prstatus->pr_reg.r_esi;
+ break;
+ case UNW_X86_EDI:
+ *valp = ui->prstatus->pr_reg.r_edi;
+ break;
+ case UNW_X86_EBP:
+ *valp = ui->prstatus->pr_reg.r_ebp;
+ break;
+ case UNW_X86_ESP:
+ *valp = ui->prstatus->pr_reg.r_esp;
+ break;
+ case UNW_X86_EIP:
+ *valp = ui->prstatus->pr_reg.r_eip;
+ break;
+ case UNW_X86_EFLAGS:
+ *valp = ui->prstatus->pr_reg.r_eflags;
+ break;
+ case UNW_X86_TRAPNO:
+ *valp = ui->prstatus->pr_reg.r_trapno;
+ break;
+ default:
+ Debug(0, "bad regnum:%d\n", regnum);
+ return -UNW_EINVAL;
+ }
+#elif defined(UNW_TARGET_X86_64)
+ switch (regnum) {
+ case UNW_X86_64_RAX:
+ *valp = ui->prstatus->pr_reg.r_rax;
+ break;
+ case UNW_X86_64_RDX:
+ *valp = ui->prstatus->pr_reg.r_rdx;
+ break;
+ case UNW_X86_64_RCX:
+ *valp = ui->prstatus->pr_reg.r_rcx;
+ break;
+ case UNW_X86_64_RBX:
+ *valp = ui->prstatus->pr_reg.r_rbx;
+ break;
+ case UNW_X86_64_RSI:
+ *valp = ui->prstatus->pr_reg.r_rsi;
+ break;
+ case UNW_X86_64_RDI:
+ *valp = ui->prstatus->pr_reg.r_rdi;
+ break;
+ case UNW_X86_64_RBP:
+ *valp = ui->prstatus->pr_reg.r_rbp;
+ break;
+ case UNW_X86_64_RSP:
+ *valp = ui->prstatus->pr_reg.r_rsp;
+ break;
+ case UNW_X86_64_RIP:
+ *valp = ui->prstatus->pr_reg.r_rip;
+ break;
+ default:
+ Debug(0, "bad regnum:%d\n", regnum);
+ return -UNW_EINVAL;
+ }
+#elif defined(UNW_TARGET_ARM)
+ if (regnum >= UNW_ARM_R0 && regnum <= UNW_ARM_R12) {
+ *valp = ui->prstatus->pr_reg.r[regnum];
+ } else {
+ switch (regnum) {
+ case UNW_ARM_R13:
+ *valp = ui->prstatus->pr_reg.r_sp;
+ break;
+ case UNW_ARM_R14:
+ *valp = ui->prstatus->pr_reg.r_lr;
+ break;
+ case UNW_ARM_R15:
+ *valp = ui->prstatus->pr_reg.r_pc;
+ break;
+ default:
+ Debug(0, "bad regnum:%d\n", regnum);
+ return -UNW_EINVAL;
+ }
+ }
+#else
+#error Port me
+#endif
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_access_reg_linux.c b/src/pal/src/libunwind/src/coredump/_UCD_access_reg_linux.c
new file mode 100644
index 0000000000..208d8d27b6
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_access_reg_linux.c
@@ -0,0 +1,146 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_lib.h"
+
+#include "_UCD_internal.h"
+
+int
+_UCD_access_reg (unw_addr_space_t as,
+ unw_regnum_t regnum, unw_word_t *valp,
+ int write, void *arg)
+{
+ struct UCD_info *ui = arg;
+
+ if (write)
+ {
+ Debug(0, "write is not supported\n");
+ return -UNW_EINVAL;
+ }
+
+ if (regnum < 0)
+ goto badreg;
+
+#if defined(UNW_TARGET_AARCH64)
+ if (regnum >= UNW_AARCH64_FPCR)
+ goto badreg;
+#elif defined(UNW_TARGET_ARM)
+ if (regnum >= 16)
+ goto badreg;
+#elif defined(UNW_TARGET_SH)
+ if (regnum > UNW_SH_PR)
+ goto badreg;
+#elif defined(UNW_TARGET_TILEGX)
+ if (regnum > UNW_TILEGX_CFA)
+ goto badreg;
+#else
+#if defined(UNW_TARGET_MIPS)
+ static const uint8_t remap_regs[] =
+ {
+ [UNW_MIPS_R0] = EF_REG0,
+ [UNW_MIPS_R1] = EF_REG1,
+ [UNW_MIPS_R2] = EF_REG2,
+ [UNW_MIPS_R3] = EF_REG3,
+ [UNW_MIPS_R4] = EF_REG4,
+ [UNW_MIPS_R5] = EF_REG5,
+ [UNW_MIPS_R6] = EF_REG6,
+ [UNW_MIPS_R7] = EF_REG7,
+ [UNW_MIPS_R8] = EF_REG8,
+ [UNW_MIPS_R9] = EF_REG9,
+ [UNW_MIPS_R10] = EF_REG10,
+ [UNW_MIPS_R11] = EF_REG11,
+ [UNW_MIPS_R12] = EF_REG12,
+ [UNW_MIPS_R13] = EF_REG13,
+ [UNW_MIPS_R14] = EF_REG14,
+ [UNW_MIPS_R15] = EF_REG15,
+ [UNW_MIPS_R16] = EF_REG16,
+ [UNW_MIPS_R17] = EF_REG17,
+ [UNW_MIPS_R18] = EF_REG18,
+ [UNW_MIPS_R19] = EF_REG19,
+ [UNW_MIPS_R20] = EF_REG20,
+ [UNW_MIPS_R21] = EF_REG21,
+ [UNW_MIPS_R22] = EF_REG22,
+ [UNW_MIPS_R23] = EF_REG23,
+ [UNW_MIPS_R24] = EF_REG24,
+ [UNW_MIPS_R25] = EF_REG25,
+ [UNW_MIPS_R28] = EF_REG28,
+ [UNW_MIPS_R29] = EF_REG29,
+ [UNW_MIPS_R30] = EF_REG30,
+ [UNW_MIPS_R31] = EF_REG31,
+ [UNW_MIPS_PC] = EF_CP0_EPC,
+ };
+#elif defined(UNW_TARGET_X86)
+ static const uint8_t remap_regs[] =
+ {
+ /* names from libunwind-x86.h */
+ [UNW_X86_EAX] = offsetof(struct user_regs_struct, eax) / sizeof(long),
+ [UNW_X86_EDX] = offsetof(struct user_regs_struct, edx) / sizeof(long),
+ [UNW_X86_ECX] = offsetof(struct user_regs_struct, ecx) / sizeof(long),
+ [UNW_X86_EBX] = offsetof(struct user_regs_struct, ebx) / sizeof(long),
+ [UNW_X86_ESI] = offsetof(struct user_regs_struct, esi) / sizeof(long),
+ [UNW_X86_EDI] = offsetof(struct user_regs_struct, edi) / sizeof(long),
+ [UNW_X86_EBP] = offsetof(struct user_regs_struct, ebp) / sizeof(long),
+ [UNW_X86_ESP] = offsetof(struct user_regs_struct, esp) / sizeof(long),
+ [UNW_X86_EIP] = offsetof(struct user_regs_struct, eip) / sizeof(long),
+ [UNW_X86_EFLAGS] = offsetof(struct user_regs_struct, eflags) / sizeof(long),
+ [UNW_X86_TRAPNO] = offsetof(struct user_regs_struct, orig_eax) / sizeof(long),
+ };
+#elif defined(UNW_TARGET_X86_64)
+ static const int8_t remap_regs[] =
+ {
+ [UNW_X86_64_RAX] = offsetof(struct user_regs_struct, rax) / sizeof(long),
+ [UNW_X86_64_RDX] = offsetof(struct user_regs_struct, rdx) / sizeof(long),
+ [UNW_X86_64_RCX] = offsetof(struct user_regs_struct, rcx) / sizeof(long),
+ [UNW_X86_64_RBX] = offsetof(struct user_regs_struct, rbx) / sizeof(long),
+ [UNW_X86_64_RSI] = offsetof(struct user_regs_struct, rsi) / sizeof(long),
+ [UNW_X86_64_RDI] = offsetof(struct user_regs_struct, rdi) / sizeof(long),
+ [UNW_X86_64_RBP] = offsetof(struct user_regs_struct, rbp) / sizeof(long),
+ [UNW_X86_64_RSP] = offsetof(struct user_regs_struct, rsp) / sizeof(long),
+ [UNW_X86_64_RIP] = offsetof(struct user_regs_struct, rip) / sizeof(long),
+ };
+#else
+#error Port me
+#endif
+
+ if (regnum >= (unw_regnum_t)ARRAY_SIZE(remap_regs))
+ goto badreg;
+
+ regnum = remap_regs[regnum];
+#endif
+
+ /* pr_reg is a long[] array, but it contains struct user_regs_struct's
+ * image.
+ */
+ Debug(1, "pr_reg[%d]:%ld (0x%lx)\n", regnum,
+ (long)ui->prstatus->pr_reg[regnum],
+ (long)ui->prstatus->pr_reg[regnum]
+ );
+ *valp = ui->prstatus->pr_reg[regnum];
+
+ return 0;
+
+badreg:
+ Debug(0, "bad regnum:%d\n", regnum);
+ return -UNW_EINVAL;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_accessors.c b/src/pal/src/libunwind/src/coredump/_UCD_accessors.c
new file mode 100644
index 0000000000..ae5c23d219
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_accessors.c
@@ -0,0 +1,36 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_internal.h"
+
+unw_accessors_t _UCD_accessors =
+ {
+ .find_proc_info = _UCD_find_proc_info,
+ .put_unwind_info = _UCD_put_unwind_info,
+ .get_dyn_info_list_addr = _UCD_get_dyn_info_list_addr,
+ .access_mem = _UCD_access_mem,
+ .access_reg = _UCD_access_reg,
+ .access_fpreg = _UCD_access_fpreg,
+ .resume = _UCD_resume,
+ .get_proc_name = _UCD_get_proc_name
+ };
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_create.c b/src/pal/src/libunwind/src/coredump/_UCD_create.c
new file mode 100644
index 0000000000..62f6ee05c7
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_create.c
@@ -0,0 +1,417 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+/* Endian detection */
+#include <limits.h>
+#if defined(HAVE_BYTESWAP_H)
+#include <byteswap.h>
+#endif
+#if defined(HAVE_ENDIAN_H)
+# include <endian.h>
+#elif defined(HAVE_SYS_ENDIAN_H)
+# include <sys/endian.h>
+#endif
+#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
+# define WE_ARE_BIG_ENDIAN 1
+# define WE_ARE_LITTLE_ENDIAN 0
+#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
+# define WE_ARE_BIG_ENDIAN 0
+# define WE_ARE_LITTLE_ENDIAN 1
+#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN
+# define WE_ARE_BIG_ENDIAN 1
+# define WE_ARE_LITTLE_ENDIAN 0
+#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN
+# define WE_ARE_BIG_ENDIAN 0
+# define WE_ARE_LITTLE_ENDIAN 1
+#elif defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
+# define WE_ARE_BIG_ENDIAN 1
+# define WE_ARE_LITTLE_ENDIAN 0
+#elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN
+# define WE_ARE_BIG_ENDIAN 0
+# define WE_ARE_LITTLE_ENDIAN 1
+#elif defined(__386__)
+# define WE_ARE_BIG_ENDIAN 0
+# define WE_ARE_LITTLE_ENDIAN 1
+#else
+# error "Can't determine endianness"
+#endif
+
+#include <elf.h>
+#include <sys/procfs.h> /* struct elf_prstatus */
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+#define NOTE_DATA(_hdr) STRUCT_MEMBER_P((_hdr), sizeof (Elf32_Nhdr) + UNW_ALIGN((_hdr)->n_namesz, 4))
+#define NOTE_SIZE(_hdr) (sizeof (Elf32_Nhdr) + UNW_ALIGN((_hdr)->n_namesz, 4) + UNW_ALIGN((_hdr)->n_descsz, 4))
+#define NOTE_NEXT(_hdr) STRUCT_MEMBER_P((_hdr), NOTE_SIZE(_hdr))
+#define NOTE_FITS_IN(_hdr, _size) ((_size) >= sizeof (Elf32_Nhdr) && (_size) >= NOTE_SIZE (_hdr))
+#define NOTE_FITS(_hdr, _end) NOTE_FITS_IN((_hdr), (unsigned long)((char *)(_end) - (char *)(_hdr)))
+
+struct UCD_info *
+_UCD_create(const char *filename)
+{
+ union
+ {
+ Elf32_Ehdr h32;
+ Elf64_Ehdr h64;
+ } elf_header;
+#define elf_header32 elf_header.h32
+#define elf_header64 elf_header.h64
+ bool _64bits;
+
+ struct UCD_info *ui = memset(malloc(sizeof(*ui)), 0, sizeof(*ui));
+ ui->edi.di_cache.format = -1;
+ ui->edi.di_debug.format = -1;
+#if UNW_TARGET_IA64
+ ui->edi.ktab.format = -1;
+#endif
+
+ int fd = ui->coredump_fd = open(filename, O_RDONLY);
+ if (fd < 0)
+ goto err;
+ ui->coredump_filename = strdup(filename);
+
+ /* No sane ELF32 file is going to be smaller then ELF64 _header_,
+ * so let's just read 64-bit sized one.
+ */
+ if (read(fd, &elf_header64, sizeof(elf_header64)) != sizeof(elf_header64))
+ {
+ Debug(0, "'%s' is not an ELF file\n", filename);
+ goto err;
+ }
+
+ if (memcmp(&elf_header32, ELFMAG, SELFMAG) != 0)
+ {
+ Debug(0, "'%s' is not an ELF file\n", filename);
+ goto err;
+ }
+
+ if (elf_header32.e_ident[EI_CLASS] != ELFCLASS32
+ && elf_header32.e_ident[EI_CLASS] != ELFCLASS64)
+ {
+ Debug(0, "'%s' is not a 32/64 bit ELF file\n", filename);
+ goto err;
+ }
+
+ if (WE_ARE_LITTLE_ENDIAN != (elf_header32.e_ident[EI_DATA] == ELFDATA2LSB))
+ {
+ Debug(0, "'%s' is endian-incompatible\n", filename);
+ goto err;
+ }
+
+ _64bits = (elf_header32.e_ident[EI_CLASS] == ELFCLASS64);
+ if (_64bits && sizeof(elf_header64.e_entry) > sizeof(off_t))
+ {
+ Debug(0, "Can't process '%s': 64-bit file "
+ "while only %ld bits are supported",
+ filename, 8L * sizeof(off_t));
+ goto err;
+ }
+
+ /* paranoia check */
+ if (_64bits
+ ? 0 /* todo: (elf_header64.e_ehsize != NN || elf_header64.e_phentsize != NN) */
+ : (elf_header32.e_ehsize != 52 || elf_header32.e_phentsize != 32)
+ )
+ {
+ Debug(0, "'%s' has wrong e_ehsize or e_phentsize\n", filename);
+ goto err;
+ }
+
+ off_t ofs = (_64bits ? elf_header64.e_phoff : elf_header32.e_phoff);
+ if (lseek(fd, ofs, SEEK_SET) != ofs)
+ {
+ Debug(0, "Can't read phdrs from '%s'\n", filename);
+ goto err;
+ }
+ unsigned size = ui->phdrs_count = (_64bits ? elf_header64.e_phnum : elf_header32.e_phnum);
+ coredump_phdr_t *phdrs = ui->phdrs = memset(malloc(size * sizeof(phdrs[0])), 0, size * sizeof(phdrs[0]));
+ if (_64bits)
+ {
+ coredump_phdr_t *cur = phdrs;
+ unsigned i = 0;
+ while (i < size)
+ {
+ Elf64_Phdr hdr64;
+ if (read(fd, &hdr64, sizeof(hdr64)) != sizeof(hdr64))
+ {
+ Debug(0, "Can't read phdrs from '%s'\n", filename);
+ goto err;
+ }
+ cur->p_type = hdr64.p_type ;
+ cur->p_flags = hdr64.p_flags ;
+ cur->p_offset = hdr64.p_offset;
+ cur->p_vaddr = hdr64.p_vaddr ;
+ /*cur->p_paddr = hdr32.p_paddr ; always 0 */
+//TODO: check that and abort if it isn't?
+ cur->p_filesz = hdr64.p_filesz;
+ cur->p_memsz = hdr64.p_memsz ;
+ cur->p_align = hdr64.p_align ;
+ /* cur->backing_filename = NULL; - done by memset */
+ cur->backing_fd = -1;
+ cur->backing_filesize = hdr64.p_filesz;
+ i++;
+ cur++;
+ }
+ } else {
+ coredump_phdr_t *cur = phdrs;
+ unsigned i = 0;
+ while (i < size)
+ {
+ Elf32_Phdr hdr32;
+ if (read(fd, &hdr32, sizeof(hdr32)) != sizeof(hdr32))
+ {
+ Debug(0, "Can't read phdrs from '%s'\n", filename);
+ goto err;
+ }
+ cur->p_type = hdr32.p_type ;
+ cur->p_flags = hdr32.p_flags ;
+ cur->p_offset = hdr32.p_offset;
+ cur->p_vaddr = hdr32.p_vaddr ;
+ /*cur->p_paddr = hdr32.p_paddr ; always 0 */
+ cur->p_filesz = hdr32.p_filesz;
+ cur->p_memsz = hdr32.p_memsz ;
+ cur->p_align = hdr32.p_align ;
+ /* cur->backing_filename = NULL; - done by memset */
+ cur->backing_fd = -1;
+ cur->backing_filesize = hdr32.p_memsz;
+ i++;
+ cur++;
+ }
+ }
+
+ unsigned i = 0;
+ coredump_phdr_t *cur = phdrs;
+ while (i < size)
+ {
+ Debug(2, "phdr[%03d]: type:%d", i, cur->p_type);
+ if (cur->p_type == PT_NOTE)
+ {
+ Elf32_Nhdr *note_hdr, *note_end;
+ unsigned n_threads;
+
+ ui->note_phdr = malloc(cur->p_filesz);
+ if (lseek(fd, cur->p_offset, SEEK_SET) != (off_t)cur->p_offset
+ || (uoff_t)read(fd, ui->note_phdr, cur->p_filesz) != cur->p_filesz)
+ {
+ Debug(0, "Can't read PT_NOTE from '%s'\n", filename);
+ goto err;
+ }
+
+ note_end = STRUCT_MEMBER_P (ui->note_phdr, cur->p_filesz);
+
+ /* Count number of threads */
+ n_threads = 0;
+ note_hdr = (Elf32_Nhdr *)ui->note_phdr;
+ while (NOTE_FITS (note_hdr, note_end))
+ {
+ if (note_hdr->n_type == NT_PRSTATUS)
+ n_threads++;
+
+ note_hdr = NOTE_NEXT (note_hdr);
+ }
+
+ ui->n_threads = n_threads;
+ ui->threads = malloc(sizeof (void *) * n_threads);
+
+ n_threads = 0;
+ note_hdr = (Elf32_Nhdr *)ui->note_phdr;
+ while (NOTE_FITS (note_hdr, note_end))
+ {
+ if (note_hdr->n_type == NT_PRSTATUS)
+ ui->threads[n_threads++] = NOTE_DATA (note_hdr);
+
+ note_hdr = NOTE_NEXT (note_hdr);
+ }
+ }
+ if (cur->p_type == PT_LOAD)
+ {
+ Debug(2, " ofs:%08llx va:%08llx filesize:%08llx memsize:%08llx flg:%x",
+ (unsigned long long) cur->p_offset,
+ (unsigned long long) cur->p_vaddr,
+ (unsigned long long) cur->p_filesz,
+ (unsigned long long) cur->p_memsz,
+ cur->p_flags
+ );
+ if (cur->p_filesz < cur->p_memsz)
+ Debug(2, " partial");
+ if (cur->p_flags & PF_X)
+ Debug(2, " executable");
+ }
+ Debug(2, "\n");
+ i++;
+ cur++;
+ }
+
+ if (ui->n_threads == 0)
+ {
+ Debug(0, "No NT_PRSTATUS note found in '%s'\n", filename);
+ goto err;
+ }
+
+ ui->prstatus = ui->threads[0];
+
+ return ui;
+
+ err:
+ _UCD_destroy(ui);
+ return NULL;
+}
+
+int _UCD_get_num_threads(struct UCD_info *ui)
+{
+ return ui->n_threads;
+}
+
+void _UCD_select_thread(struct UCD_info *ui, int n)
+{
+ if (n >= 0 && n < ui->n_threads)
+ ui->prstatus = ui->threads[n];
+}
+
+pid_t _UCD_get_pid(struct UCD_info *ui)
+{
+ return ui->prstatus->pr_pid;
+}
+
+int _UCD_get_cursig(struct UCD_info *ui)
+{
+ return ui->prstatus->pr_cursig;
+}
+
+int _UCD_add_backing_file_at_segment(struct UCD_info *ui, int phdr_no, const char *filename)
+{
+ if ((unsigned)phdr_no >= ui->phdrs_count)
+ {
+ Debug(0, "There is no segment %d in this coredump\n", phdr_no);
+ return -1;
+ }
+
+ struct coredump_phdr *phdr = &ui->phdrs[phdr_no];
+ if (phdr->backing_filename)
+ {
+ Debug(0, "Backing file already added to segment %d\n", phdr_no);
+ return -1;
+ }
+
+ int fd = open(filename, O_RDONLY);
+ if (fd < 0)
+ {
+ Debug(0, "Can't open '%s'\n", filename);
+ return -1;
+ }
+
+ phdr->backing_fd = fd;
+ phdr->backing_filename = strdup(filename);
+
+ struct stat statbuf;
+ if (fstat(fd, &statbuf) != 0)
+ {
+ Debug(0, "Can't stat '%s'\n", filename);
+ goto err;
+ }
+ phdr->backing_filesize = (uoff_t)statbuf.st_size;
+
+ if (phdr->p_flags != (PF_X | PF_R))
+ Debug(1, "Note: phdr[%u] is not r-x: flags are 0x%x\n", phdr_no, phdr->p_flags);
+
+ if (phdr->backing_filesize > phdr->p_memsz)
+ {
+ /* This is expected */
+ Debug(2, "Note: phdr[%u] is %lld bytes, file is larger: %lld bytes\n",
+ phdr_no,
+ (unsigned long long)phdr->p_memsz,
+ (unsigned long long)phdr->backing_filesize
+ );
+ }
+//TODO: else loudly complain? Maybe even fail?
+
+ if (phdr->p_filesz != 0)
+ {
+//TODO: loop and compare in smaller blocks
+ char *core_buf = malloc(phdr->p_filesz);
+ char *file_buf = malloc(phdr->p_filesz);
+ if (lseek(ui->coredump_fd, phdr->p_offset, SEEK_SET) != (off_t)phdr->p_offset
+ || (uoff_t)read(ui->coredump_fd, core_buf, phdr->p_filesz) != phdr->p_filesz
+ )
+ {
+ Debug(0, "Error reading from coredump file\n");
+ err_read:
+ free(core_buf);
+ free(file_buf);
+ goto err;
+ }
+ if ((uoff_t)read(fd, file_buf, phdr->p_filesz) != phdr->p_filesz)
+ {
+ Debug(0, "Error reading from '%s'\n", filename);
+ goto err_read;
+ }
+ int r = memcmp(core_buf, file_buf, phdr->p_filesz);
+ free(core_buf);
+ free(file_buf);
+ if (r != 0)
+ {
+ Debug(1, "Note: phdr[%u] first %lld bytes in core dump and in file do not match\n",
+ phdr_no, (unsigned long long)phdr->p_filesz
+ );
+ } else {
+ Debug(1, "Note: phdr[%u] first %lld bytes in core dump and in file match\n",
+ phdr_no, (unsigned long long)phdr->p_filesz
+ );
+ }
+ }
+
+ /* Success */
+ return 0;
+
+ err:
+ if (phdr->backing_fd >= 0)
+ {
+ close(phdr->backing_fd);
+ phdr->backing_fd = -1;
+ }
+ free(phdr->backing_filename);
+ phdr->backing_filename = NULL;
+ return -1;
+}
+
+int _UCD_add_backing_file_at_vaddr(struct UCD_info *ui,
+ unsigned long vaddr,
+ const char *filename)
+{
+ unsigned i;
+ for (i = 0; i < ui->phdrs_count; i++)
+ {
+ struct coredump_phdr *phdr = &ui->phdrs[i];
+ if (phdr->p_vaddr != vaddr)
+ continue;
+ /* It seems to match. Add it. */
+ return _UCD_add_backing_file_at_segment(ui, i, filename);
+ }
+ return -1;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_destroy.c b/src/pal/src/libunwind/src/coredump/_UCD_destroy.c
new file mode 100644
index 0000000000..ddc36ec898
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_destroy.c
@@ -0,0 +1,52 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_internal.h"
+
+void
+_UCD_destroy (struct UCD_info *ui)
+{
+ if (!ui)
+ return;
+
+ if (ui->coredump_fd >= 0)
+ close(ui->coredump_fd);
+ free(ui->coredump_filename);
+
+ invalidate_edi (&ui->edi);
+
+ unsigned i;
+ for (i = 0; i < ui->phdrs_count; i++)
+ {
+ struct coredump_phdr *phdr = &ui->phdrs[i];
+ free(phdr->backing_filename);
+ if (phdr->backing_fd >= 0)
+ close(phdr->backing_fd);
+ }
+
+ free(ui->phdrs);
+ free(ui->note_phdr);
+ free(ui->threads);
+
+ free(ui);
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_elf_map_image.c b/src/pal/src/libunwind/src/coredump/_UCD_elf_map_image.c
new file mode 100644
index 0000000000..4b3db0bbff
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_elf_map_image.c
@@ -0,0 +1,98 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <elf.h>
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+static coredump_phdr_t *
+CD_elf_map_image(struct UCD_info *ui, coredump_phdr_t *phdr)
+{
+ struct elf_image *ei = &ui->edi.ei;
+
+ if (phdr->backing_fd < 0)
+ {
+ /* Note: coredump file contains only phdr->p_filesz bytes.
+ * We want to map bigger area (phdr->p_memsz bytes) to make sure
+ * these pages are allocated, but non-accessible.
+ */
+ /* addr, length, prot, flags, fd, fd_offset */
+ ei->image = mmap(NULL, phdr->p_memsz, PROT_READ, MAP_PRIVATE, ui->coredump_fd, phdr->p_offset);
+ if (ei->image == MAP_FAILED)
+ {
+ ei->image = NULL;
+ return NULL;
+ }
+ ei->size = phdr->p_filesz;
+ size_t remainder_len = phdr->p_memsz - phdr->p_filesz;
+ if (remainder_len > 0)
+ {
+ void *remainder_base = (char*) ei->image + phdr->p_filesz;
+ munmap(remainder_base, remainder_len);
+ }
+ } else {
+ /* We have a backing file for this segment.
+ * This file is always longer than phdr->p_memsz,
+ * and if phdr->p_filesz !=0, first phdr->p_filesz bytes in coredump
+ * are the same as first bytes in the file. (Thus no need to map coredump)
+ * We map the entire file:
+ * unwinding may need data which is past phdr->p_memsz bytes.
+ */
+ /* addr, length, prot, flags, fd, fd_offset */
+ ei->image = mmap(NULL, phdr->backing_filesize, PROT_READ, MAP_PRIVATE, phdr->backing_fd, 0);
+ if (ei->image == MAP_FAILED)
+ {
+ ei->image = NULL;
+ return NULL;
+ }
+ ei->size = phdr->backing_filesize;
+ }
+
+ /* Check ELF header for sanity */
+ if (!elf_w(valid_object)(ei))
+ {
+ munmap(ei->image, ei->size);
+ ei->image = NULL;
+ ei->size = 0;
+ return NULL;
+ }
+
+ return phdr;
+}
+
+HIDDEN coredump_phdr_t *
+_UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip)
+{
+ unsigned i;
+ for (i = 0; i < ui->phdrs_count; i++)
+ {
+ coredump_phdr_t *phdr = &ui->phdrs[i];
+ if (phdr->p_vaddr <= ip && ip < phdr->p_vaddr + phdr->p_memsz)
+ {
+ phdr = CD_elf_map_image(ui, phdr);
+ return phdr;
+ }
+ }
+ return NULL;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_find_proc_info.c b/src/pal/src/libunwind/src/coredump/_UCD_find_proc_info.c
new file mode 100644
index 0000000000..33b66c8edb
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_find_proc_info.c
@@ -0,0 +1,163 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <elf.h>
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+static int
+get_unwind_info(struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip)
+{
+ unsigned long segbase, mapoff;
+
+#if UNW_TARGET_IA64 && defined(__linux)
+ if (!ui->edi.ktab.start_ip && _Uia64_get_kernel_table (&ui->edi.ktab) < 0)
+ return -UNW_ENOINFO;
+
+ if (ui->edi.ktab.format != -1 && ip >= ui->edi.ktab.start_ip && ip < ui->edi.ktab.end_ip)
+ return 0;
+#endif
+
+ if ((ui->edi.di_cache.format != -1
+ && ip >= ui->edi.di_cache.start_ip && ip < ui->edi.di_cache.end_ip)
+#if UNW_TARGET_ARM
+ || (ui->edi.di_debug.format != -1
+ && ip >= ui->edi.di_arm.start_ip && ip < ui->edi.di_arm.end_ip)
+#endif
+ || (ui->edi.di_debug.format != -1
+ && ip >= ui->edi.di_debug.start_ip && ip < ui->edi.di_debug.end_ip))
+ return 0;
+
+ invalidate_edi (&ui->edi);
+
+ /* Used to be tdep_get_elf_image() in ptrace unwinding code */
+ coredump_phdr_t *phdr = _UCD_get_elf_image(ui, ip);
+ if (!phdr)
+ {
+ Debug(1, "returns error: _UCD_get_elf_image failed\n");
+ return -UNW_ENOINFO;
+ }
+ /* segbase: where it is mapped in virtual memory */
+ /* mapoff: offset in the file */
+ segbase = phdr->p_vaddr;
+ /*mapoff = phdr->p_offset; WRONG! phdr->p_offset is the offset in COREDUMP file */
+ mapoff = 0;
+///FIXME. text segment is USUALLY, not always, at offset 0 in the binary/.so file.
+// ensure that at initialization.
+
+ /* Here, SEGBASE is the starting-address of the (mmap'ped) segment
+ which covers the IP we're looking for. */
+ if (tdep_find_unwind_table(&ui->edi, as, phdr->backing_filename, segbase, mapoff, ip) < 0)
+ {
+ Debug(1, "returns error: tdep_find_unwind_table failed\n");
+ return -UNW_ENOINFO;
+ }
+
+ /* This can happen in corner cases where dynamically generated
+ code falls into the same page that contains the data-segment
+ and the page-offset of the code is within the first page of
+ the executable. */
+ if (ui->edi.di_cache.format != -1
+ && (ip < ui->edi.di_cache.start_ip || ip >= ui->edi.di_cache.end_ip))
+ ui->edi.di_cache.format = -1;
+
+ if (ui->edi.di_debug.format != -1
+ && (ip < ui->edi.di_debug.start_ip || ip >= ui->edi.di_debug.end_ip))
+ ui->edi.di_debug.format = -1;
+
+ if (ui->edi.di_cache.format == -1
+#if UNW_TARGET_ARM
+ && ui->edi.di_arm.format == -1
+#endif
+ && ui->edi.di_debug.format == -1)
+ {
+ Debug(1, "returns error: all formats are -1\n");
+ return -UNW_ENOINFO;
+ }
+
+ Debug(1, "returns success\n");
+ return 0;
+}
+
+int
+_UCD_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ struct UCD_info *ui = arg;
+
+ Debug(1, "entering\n");
+
+ int ret = -UNW_ENOINFO;
+
+ if (get_unwind_info(ui, as, ip) < 0) {
+ Debug(1, "returns error: get_unwind_info failed\n");
+ return -UNW_ENOINFO;
+ }
+
+#if UNW_TARGET_IA64
+ if (ui->edi.ktab.format != -1)
+ {
+ /* The kernel unwind table resides in local memory, so we have
+ to use the local address space to search it. Since
+ _UCD_put_unwind_info() has no easy way of detecting this
+ case, we simply make a copy of the unwind-info, so
+ _UCD_put_unwind_info() can always free() the unwind-info
+ without ill effects. */
+ ret = tdep_search_unwind_table (unw_local_addr_space, ip, &ui->edi.ktab, pi,
+ need_unwind_info, arg);
+ if (ret >= 0)
+ {
+ if (!need_unwind_info)
+ pi->unwind_info = NULL;
+ else
+ {
+ void *mem = malloc (pi->unwind_info_size);
+
+ if (!mem)
+ return -UNW_ENOMEM;
+ memcpy (mem, pi->unwind_info, pi->unwind_info_size);
+ pi->unwind_info = mem;
+ }
+ }
+ }
+#endif
+
+ if (ret == -UNW_ENOINFO && ui->edi.di_cache.format != -1)
+ ret = tdep_search_unwind_table (as, ip, &ui->edi.di_cache,
+ pi, need_unwind_info, arg);
+
+#if UNW_TARGET_ARM
+ if (ret == -UNW_ENOINFO && ui->edi.di_arm.format != -1)
+ ret = tdep_search_unwind_table (as, ip, &ui->edi.di_arm, pi,
+ need_unwind_info, arg);
+#endif
+
+ if (ret == -UNW_ENOINFO && ui->edi.di_debug.format != -1)
+ ret = tdep_search_unwind_table (as, ip, &ui->edi.di_debug, pi,
+ need_unwind_info, arg);
+
+ Debug(1, "returns %d\n", ret);
+
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_get_proc_name.c b/src/pal/src/libunwind/src/coredump/_UCD_get_proc_name.c
new file mode 100644
index 0000000000..00096c48d0
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_get_proc_name.c
@@ -0,0 +1,70 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+
+/* Find the ELF image that contains IP and return the "closest"
+ procedure name, if there is one. With some caching, this could be
+ sped up greatly, but until an application materializes that's
+ sensitive to the performance of this routine, why bother... */
+static int
+elf_w (CD_get_proc_name) (struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp)
+{
+ unsigned long segbase, mapoff;
+ int ret;
+
+ /* Used to be tdep_get_elf_image() in ptrace unwinding code */
+ coredump_phdr_t *cphdr = _UCD_get_elf_image(ui, ip);
+ if (!cphdr)
+ {
+ Debug(1, "returns error: _UCD_get_elf_image failed\n");
+ return -UNW_ENOINFO;
+ }
+ /* segbase: where it is mapped in virtual memory */
+ /* mapoff: offset in the file */
+ segbase = cphdr->p_vaddr;
+ /*mapoff = phdr->p_offset; WRONG! phdr->p_offset is the offset in COREDUMP file */
+ mapoff = 0;
+
+ ret = elf_w (get_proc_name_in_image) (as, &ui->edi.ei, segbase, mapoff, ip, buf, buf_len, offp);
+
+ return ret;
+}
+
+int
+_UCD_get_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp, void *arg)
+{
+ struct UCD_info *ui = arg;
+
+#if ELF_CLASS == ELFCLASS64
+ return _Uelf64_CD_get_proc_name (ui, as, ip, buf, buf_len, offp);
+#elif ELF_CLASS == ELFCLASS32
+ return _Uelf32_CD_get_proc_name (ui, as, ip, buf, buf_len, offp);
+#else
+ return -UNW_ENOINFO;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_internal.h b/src/pal/src/libunwind/src/coredump/_UCD_internal.h
new file mode 100644
index 0000000000..3c95a2a003
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_internal.h
@@ -0,0 +1,105 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef _UCD_internal_h
+#define _UCD_internal_h
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_PROCFS_H
+#include <sys/procfs.h> /* struct elf_prstatus */
+#endif
+#include <errno.h>
+#include <string.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libunwind-coredump.h>
+
+#include "libunwind_i.h"
+
+
+#if SIZEOF_OFF_T == 4
+typedef uint32_t uoff_t;
+#elif SIZEOF_OFF_T == 8
+typedef uint64_t uoff_t;
+#else
+# error Unknown size of off_t!
+#endif
+
+
+/* Similar to ELF phdrs. p_paddr element is absent,
+ * since it's always 0 in coredumps.
+ */
+struct coredump_phdr
+ {
+ uint32_t p_type;
+ uint32_t p_flags;
+ uoff_t p_offset;
+ uoff_t p_vaddr;
+ uoff_t p_filesz;
+ uoff_t p_memsz;
+ uoff_t p_align;
+ /* Data for backing file. If backing_fd < 0, there is no file */
+ uoff_t backing_filesize;
+ char *backing_filename; /* for error meesages only */
+ int backing_fd;
+ };
+
+typedef struct coredump_phdr coredump_phdr_t;
+
+#if defined(HAVE_STRUCT_ELF_PRSTATUS)
+#define PRSTATUS_STRUCT elf_prstatus
+#elif defined(HAVE_STRUCT_PRSTATUS)
+#define PRSTATUS_STRUCT prstatus
+#else
+#define PRSTATUS_STRUCT non_existent
+#endif
+
+struct UCD_info
+ {
+ int big_endian; /* bool */
+ int coredump_fd;
+ char *coredump_filename; /* for error meesages only */
+ coredump_phdr_t *phdrs; /* array, allocated */
+ unsigned phdrs_count;
+ void *note_phdr; /* allocated or NULL */
+ struct PRSTATUS_STRUCT *prstatus; /* points inside note_phdr */
+ int n_threads;
+ struct PRSTATUS_STRUCT **threads;
+
+ struct elf_dyn_info edi;
+ };
+
+extern coredump_phdr_t * _UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip);
+
+#define STRUCT_MEMBER_P(struct_p, struct_offset) ((void *) ((char*) (struct_p) + (long) (struct_offset)))
+#define STRUCT_MEMBER(member_type, struct_p, struct_offset) (*(member_type*) STRUCT_MEMBER_P ((struct_p), (struct_offset)))
+
+#endif
diff --git a/src/pal/src/libunwind/src/coredump/_UCD_lib.h b/src/pal/src/libunwind/src/coredump/_UCD_lib.h
new file mode 100644
index 0000000000..22be32ed1e
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UCD_lib.h
@@ -0,0 +1,57 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef _UCD_lib_h
+#define _UCD_lib_h
+
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <string.h>
+#include <sys/poll.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdbool.h>
+#include <limits.h>
+#include <sys/param.h>
+#include <pwd.h>
+#include <grp.h>
+#include <syslog.h>
+
+#endif
diff --git a/src/pal/src/libunwind/src/coredump/_UPT_access_fpreg.c b/src/pal/src/libunwind/src/coredump/_UPT_access_fpreg.c
new file mode 100644
index 0000000000..0b8b86ac90
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UPT_access_fpreg.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+int
+_UCD_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ print_error (__func__);
+ print_error (" not implemented\n");
+ return -UNW_EINVAL;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UPT_elf.c b/src/pal/src/libunwind/src/coredump/_UPT_elf.c
new file mode 100644
index 0000000000..fb7b19a7cb
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UPT_elf.c
@@ -0,0 +1,5 @@
+/* We need to get a separate copy of the ELF-code into
+ libunwind-coredump since it cannot (and must not) have any ELF
+ dependencies on libunwind. */
+#include "libunwind_i.h" /* get ELFCLASS defined */
+#include "../elfxx.c"
diff --git a/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c
new file mode 100644
index 0000000000..0d11905566
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c
@@ -0,0 +1,108 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+#if UNW_TARGET_IA64 && defined(__linux)
+# include "elf64.h"
+# include "os-linux.h"
+
+static inline int
+get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
+ int *countp)
+{
+ unsigned long lo, hi, off;
+ struct UPT_info *ui = arg;
+ struct map_iterator mi;
+ char path[PATH_MAX];
+ unw_dyn_info_t *di;
+ unw_word_t res;
+ int count = 0;
+
+ maps_init (&mi, ui->pid);
+ while (maps_next (&mi, &lo, &hi, &off))
+ {
+ if (off)
+ continue;
+
+ invalidate_edi (&ui->edi);
+
+ if (elf_map_image (&ui->ei, path) < 0)
+ /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */
+ continue;
+
+ Debug (16, "checking object %s\n", path);
+
+ di = tdep_find_unwind_table (&ui->edi, as, path, lo, off);
+ if (di)
+ {
+ res = _Uia64_find_dyn_list (as, di, arg);
+ if (res && count++ == 0)
+ {
+ Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res);
+ *dil_addr = res;
+ }
+ }
+ }
+ maps_close (&mi);
+ *countp = count;
+ return 0;
+}
+
+#else
+
+static inline int
+get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
+ int *countp)
+{
+# warning Implement get_list_addr(), please.
+ *countp = 0;
+ return 0;
+}
+
+#endif
+
+int
+_UCD_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr,
+ void *arg)
+{
+ int count, ret;
+
+ Debug (12, "looking for dyn_info list\n");
+
+ if ((ret = get_list_addr (as, dil_addr, arg, &count)) < 0)
+ return ret;
+
+ /* If multiple dynamic-info list addresses are found, we would have
+ to determine which was is the one actually in use (since the
+ dynamic name resolution algorithm will pick one "winner").
+ Perhaps we'd have to track them all until we find one that's
+ non-empty. Hopefully, this case simply will never arise, since
+ only libunwind defines the dynamic info list head. */
+ assert (count <= 1);
+
+ return (count > 0) ? 0 : -UNW_ENOINFO;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UPT_put_unwind_info.c b/src/pal/src/libunwind/src/coredump/_UPT_put_unwind_info.c
new file mode 100644
index 0000000000..462e1d048c
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UPT_put_unwind_info.c
@@ -0,0 +1,36 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+void
+_UCD_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg)
+{
+ if (!pi->unwind_info)
+ return;
+ free (pi->unwind_info);
+ pi->unwind_info = NULL;
+}
diff --git a/src/pal/src/libunwind/src/coredump/_UPT_resume.c b/src/pal/src/libunwind/src/coredump/_UPT_resume.c
new file mode 100644
index 0000000000..a729c908cb
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/_UPT_resume.c
@@ -0,0 +1,35 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UCD_lib.h"
+#include "_UCD_internal.h"
+
+int
+_UCD_resume (unw_addr_space_t as, unw_cursor_t *c, void *arg)
+{
+ print_error (__func__);
+ print_error (" not implemented\n");
+ return -UNW_EINVAL;
+}
diff --git a/src/pal/src/libunwind/src/coredump/libunwind-coredump.pc.in b/src/pal/src/libunwind/src/coredump/libunwind-coredump.pc.in
new file mode 100644
index 0000000000..9cb62c086d
--- /dev/null
+++ b/src/pal/src/libunwind/src/coredump/libunwind-coredump.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libunwind-coredump
+Description: libunwind coredump library
+Version: @VERSION@
+Requires: libunwind-generic libunwind
+Libs: -L${libdir} -lunwind-coredump
+Cflags: -I${includedir}
diff --git a/src/pal/src/libunwind/src/dwarf/Gexpr.c b/src/pal/src/libunwind/src/dwarf/Gexpr.c
new file mode 100644
index 0000000000..f63c3d220c
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Gexpr.c
@@ -0,0 +1,696 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "dwarf_i.h"
+#include "libunwind_i.h"
+
+/* The "pick" operator provides an index range of 0..255 indicating
+ that the stack could at least have a depth of up to 256 elements,
+ but the GCC unwinder restricts the depth to 64, which seems
+ reasonable so we use the same value here. */
+#define MAX_EXPR_STACK_SIZE 64
+
+#define NUM_OPERANDS(signature) (((signature) >> 6) & 0x3)
+#define OPND1_TYPE(signature) (((signature) >> 3) & 0x7)
+#define OPND2_TYPE(signature) (((signature) >> 0) & 0x7)
+
+#define OPND_SIGNATURE(n, t1, t2) (((n) << 6) | ((t1) << 3) | ((t2) << 0))
+#define OPND1(t1) OPND_SIGNATURE(1, t1, 0)
+#define OPND2(t1, t2) OPND_SIGNATURE(2, t1, t2)
+
+#define VAL8 0x0
+#define VAL16 0x1
+#define VAL32 0x2
+#define VAL64 0x3
+#define ULEB128 0x4
+#define SLEB128 0x5
+#define OFFSET 0x6 /* 32-bit offset for 32-bit DWARF, 64-bit otherwise */
+#define ADDR 0x7 /* Machine address. */
+
+static const uint8_t operands[256] =
+ {
+ [DW_OP_addr] = OPND1 (ADDR),
+ [DW_OP_const1u] = OPND1 (VAL8),
+ [DW_OP_const1s] = OPND1 (VAL8),
+ [DW_OP_const2u] = OPND1 (VAL16),
+ [DW_OP_const2s] = OPND1 (VAL16),
+ [DW_OP_const4u] = OPND1 (VAL32),
+ [DW_OP_const4s] = OPND1 (VAL32),
+ [DW_OP_const8u] = OPND1 (VAL64),
+ [DW_OP_const8s] = OPND1 (VAL64),
+ [DW_OP_pick] = OPND1 (VAL8),
+ [DW_OP_plus_uconst] = OPND1 (ULEB128),
+ [DW_OP_skip] = OPND1 (VAL16),
+ [DW_OP_bra] = OPND1 (VAL16),
+ [DW_OP_breg0 + 0] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 1] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 2] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 3] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 4] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 5] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 6] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 7] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 8] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 9] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 10] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 11] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 12] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 13] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 14] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 15] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 16] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 17] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 18] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 19] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 20] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 21] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 22] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 23] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 24] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 25] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 26] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 27] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 28] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 29] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 30] = OPND1 (SLEB128),
+ [DW_OP_breg0 + 31] = OPND1 (SLEB128),
+ [DW_OP_regx] = OPND1 (ULEB128),
+ [DW_OP_fbreg] = OPND1 (SLEB128),
+ [DW_OP_bregx] = OPND2 (ULEB128, SLEB128),
+ [DW_OP_piece] = OPND1 (ULEB128),
+ [DW_OP_deref_size] = OPND1 (VAL8),
+ [DW_OP_xderef_size] = OPND1 (VAL8),
+ [DW_OP_call2] = OPND1 (VAL16),
+ [DW_OP_call4] = OPND1 (VAL32),
+ [DW_OP_call_ref] = OPND1 (OFFSET)
+ };
+
+static inline unw_sword_t
+sword (unw_addr_space_t as, unw_word_t val)
+{
+ switch (dwarf_addr_size (as))
+ {
+ case 1: return (int8_t) val;
+ case 2: return (int16_t) val;
+ case 4: return (int32_t) val;
+ case 8: return (int64_t) val;
+ default: abort ();
+ }
+}
+
+static inline unw_word_t
+read_operand (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, int operand_type, unw_word_t *val, void *arg)
+{
+ uint8_t u8;
+ uint16_t u16;
+ uint32_t u32;
+ uint64_t u64;
+ int ret;
+
+ if (operand_type == ADDR)
+ switch (dwarf_addr_size (as))
+ {
+ case 1: operand_type = VAL8; break;
+ case 2: operand_type = VAL16; break;
+ case 4: operand_type = VAL32; break;
+ case 8: operand_type = VAL64; break;
+ default: abort ();
+ }
+
+ switch (operand_type)
+ {
+ case VAL8:
+ ret = dwarf_readu8 (as, a, addr, &u8, arg);
+ if (ret < 0)
+ return ret;
+ *val = u8;
+ break;
+
+ case VAL16:
+ ret = dwarf_readu16 (as, a, addr, &u16, arg);
+ if (ret < 0)
+ return ret;
+ *val = u16;
+ break;
+
+ case VAL32:
+ ret = dwarf_readu32 (as, a, addr, &u32, arg);
+ if (ret < 0)
+ return ret;
+ *val = u32;
+ break;
+
+ case VAL64:
+ ret = dwarf_readu64 (as, a, addr, &u64, arg);
+ if (ret < 0)
+ return ret;
+ *val = u64;
+ break;
+
+ case ULEB128:
+ ret = dwarf_read_uleb128 (as, a, addr, val, arg);
+ break;
+
+ case SLEB128:
+ ret = dwarf_read_sleb128 (as, a, addr, val, arg);
+ break;
+
+ case OFFSET: /* only used by DW_OP_call_ref, which we don't implement */
+ default:
+ Debug (1, "Unexpected operand type %d\n", operand_type);
+ ret = -UNW_EINVAL;
+ }
+ return ret;
+}
+
+HIDDEN int
+dwarf_stack_aligned(struct dwarf_cursor *c, unw_word_t cfa_addr,
+ unw_word_t rbp_addr, unw_word_t *cfa_offset) {
+ unw_accessors_t *a;
+ int ret;
+ void *arg;
+ unw_word_t len;
+ uint8_t opcode;
+ unw_word_t operand1;
+
+ a = unw_get_accessors_int (c->as);
+ arg = c->as_arg;
+
+ ret = dwarf_read_uleb128(c->as, a, &rbp_addr, &len, arg);
+ if (len != 2 || ret < 0)
+ return 0;
+
+ ret = dwarf_readu8(c->as, a, &rbp_addr, &opcode, arg);
+ if (ret < 0 || opcode != DW_OP_breg6)
+ return 0;
+
+ ret = read_operand(c->as, a, &rbp_addr,
+ OPND1_TYPE(operands[opcode]), &operand1, arg);
+
+ if (ret < 0 || operand1 != 0)
+ return 0;
+
+ ret = dwarf_read_uleb128(c->as, a, &cfa_addr, &len, arg);
+ if (ret < 0 || len != 3)
+ return 0;
+
+ ret = dwarf_readu8(c->as, a, &cfa_addr, &opcode, arg);
+ if (ret < 0 || opcode != DW_OP_breg6)
+ return 0;
+
+ ret = read_operand(c->as, a, &cfa_addr,
+ OPND1_TYPE(operands[opcode]), &operand1, arg);
+ if (ret < 0)
+ return 0;
+
+ ret = dwarf_readu8(c->as, a, &cfa_addr, &opcode, arg);
+ if (ret < 0 || opcode != DW_OP_deref)
+ return 0;
+
+ *cfa_offset = operand1;
+ return 1;
+}
+
+HIDDEN int
+dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t *addr, unw_word_t len,
+ unw_word_t *valp, int *is_register)
+{
+ unw_word_t operand1 = 0, operand2 = 0, tmp1, tmp2 = 0, tmp3, end_addr;
+ uint8_t opcode, operands_signature, u8;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ unw_word_t stack[MAX_EXPR_STACK_SIZE];
+ unsigned int tos = 0;
+ uint16_t u16;
+ uint32_t u32;
+ uint64_t u64;
+ int ret;
+# define pop() \
+({ \
+ if ((tos - 1) >= MAX_EXPR_STACK_SIZE) \
+ { \
+ Debug (1, "Stack underflow\n"); \
+ return -UNW_EINVAL; \
+ } \
+ stack[--tos]; \
+})
+# define push(x) \
+do { \
+ unw_word_t _x = (x); \
+ if (tos >= MAX_EXPR_STACK_SIZE) \
+ { \
+ Debug (1, "Stack overflow\n"); \
+ return -UNW_EINVAL; \
+ } \
+ stack[tos++] = _x; \
+} while (0)
+# define pick(n) \
+({ \
+ unsigned int _index = tos - 1 - (n); \
+ if (_index >= MAX_EXPR_STACK_SIZE) \
+ { \
+ Debug (1, "Out-of-stack pick\n"); \
+ return -UNW_EINVAL; \
+ } \
+ stack[_index]; \
+})
+
+ as = c->as;
+ arg = c->as_arg;
+ a = unw_get_accessors_int (as);
+ end_addr = *addr + len;
+ *is_register = 0;
+
+ Debug (14, "len=%lu, pushing cfa=0x%lx\n",
+ (unsigned long) len, (unsigned long) c->cfa);
+
+ push (c->cfa); /* push current CFA as required by DWARF spec */
+
+ while (*addr < end_addr)
+ {
+ if ((ret = dwarf_readu8 (as, a, addr, &opcode, arg)) < 0)
+ return ret;
+
+ operands_signature = operands[opcode];
+
+ if (unlikely (NUM_OPERANDS (operands_signature) > 0))
+ {
+ if ((ret = read_operand (as, a, addr,
+ OPND1_TYPE (operands_signature),
+ &operand1, arg)) < 0)
+ return ret;
+ if (NUM_OPERANDS (operands_signature) > 1)
+ if ((ret = read_operand (as, a, addr,
+ OPND2_TYPE (operands_signature),
+ &operand2, arg)) < 0)
+ return ret;
+ }
+
+ switch ((dwarf_expr_op_t) opcode)
+ {
+ case DW_OP_lit0: case DW_OP_lit1: case DW_OP_lit2:
+ case DW_OP_lit3: case DW_OP_lit4: case DW_OP_lit5:
+ case DW_OP_lit6: case DW_OP_lit7: case DW_OP_lit8:
+ case DW_OP_lit9: case DW_OP_lit10: case DW_OP_lit11:
+ case DW_OP_lit12: case DW_OP_lit13: case DW_OP_lit14:
+ case DW_OP_lit15: case DW_OP_lit16: case DW_OP_lit17:
+ case DW_OP_lit18: case DW_OP_lit19: case DW_OP_lit20:
+ case DW_OP_lit21: case DW_OP_lit22: case DW_OP_lit23:
+ case DW_OP_lit24: case DW_OP_lit25: case DW_OP_lit26:
+ case DW_OP_lit27: case DW_OP_lit28: case DW_OP_lit29:
+ case DW_OP_lit30: case DW_OP_lit31:
+ Debug (15, "OP_lit(%d)\n", (int) opcode - DW_OP_lit0);
+ push (opcode - DW_OP_lit0);
+ break;
+
+ case DW_OP_breg0: case DW_OP_breg1: case DW_OP_breg2:
+ case DW_OP_breg3: case DW_OP_breg4: case DW_OP_breg5:
+ case DW_OP_breg6: case DW_OP_breg7: case DW_OP_breg8:
+ case DW_OP_breg9: case DW_OP_breg10: case DW_OP_breg11:
+ case DW_OP_breg12: case DW_OP_breg13: case DW_OP_breg14:
+ case DW_OP_breg15: case DW_OP_breg16: case DW_OP_breg17:
+ case DW_OP_breg18: case DW_OP_breg19: case DW_OP_breg20:
+ case DW_OP_breg21: case DW_OP_breg22: case DW_OP_breg23:
+ case DW_OP_breg24: case DW_OP_breg25: case DW_OP_breg26:
+ case DW_OP_breg27: case DW_OP_breg28: case DW_OP_breg29:
+ case DW_OP_breg30: case DW_OP_breg31:
+ Debug (15, "OP_breg(r%d,0x%lx)\n",
+ (int) opcode - DW_OP_breg0, (unsigned long) operand1);
+ if ((ret = unw_get_reg (dwarf_to_cursor (c),
+ dwarf_to_unw_regnum (opcode - DW_OP_breg0),
+ &tmp1)) < 0)
+ return ret;
+ push (tmp1 + operand1);
+ break;
+
+ case DW_OP_bregx:
+ Debug (15, "OP_bregx(r%d,0x%lx)\n",
+ (int) operand1, (unsigned long) operand2);
+ if ((ret = unw_get_reg (dwarf_to_cursor (c),
+ dwarf_to_unw_regnum (operand1), &tmp1)) < 0)
+ return ret;
+ push (tmp1 + operand2);
+ break;
+
+ case DW_OP_reg0: case DW_OP_reg1: case DW_OP_reg2:
+ case DW_OP_reg3: case DW_OP_reg4: case DW_OP_reg5:
+ case DW_OP_reg6: case DW_OP_reg7: case DW_OP_reg8:
+ case DW_OP_reg9: case DW_OP_reg10: case DW_OP_reg11:
+ case DW_OP_reg12: case DW_OP_reg13: case DW_OP_reg14:
+ case DW_OP_reg15: case DW_OP_reg16: case DW_OP_reg17:
+ case DW_OP_reg18: case DW_OP_reg19: case DW_OP_reg20:
+ case DW_OP_reg21: case DW_OP_reg22: case DW_OP_reg23:
+ case DW_OP_reg24: case DW_OP_reg25: case DW_OP_reg26:
+ case DW_OP_reg27: case DW_OP_reg28: case DW_OP_reg29:
+ case DW_OP_reg30: case DW_OP_reg31:
+ Debug (15, "OP_reg(r%d)\n", (int) opcode - DW_OP_reg0);
+ *valp = dwarf_to_unw_regnum (opcode - DW_OP_reg0);
+ *is_register = 1;
+ return 0;
+
+ case DW_OP_regx:
+ Debug (15, "OP_regx(r%d)\n", (int) operand1);
+ *valp = dwarf_to_unw_regnum (operand1);
+ *is_register = 1;
+ return 0;
+
+ case DW_OP_addr:
+ case DW_OP_const1u:
+ case DW_OP_const2u:
+ case DW_OP_const4u:
+ case DW_OP_const8u:
+ case DW_OP_constu:
+ case DW_OP_const8s:
+ case DW_OP_consts:
+ Debug (15, "OP_const(0x%lx)\n", (unsigned long) operand1);
+ push (operand1);
+ break;
+
+ case DW_OP_const1s:
+ if (operand1 & 0x80)
+ operand1 |= ((unw_word_t) -1) << 8;
+ Debug (15, "OP_const1s(%ld)\n", (long) operand1);
+ push (operand1);
+ break;
+
+ case DW_OP_const2s:
+ if (operand1 & 0x8000)
+ operand1 |= ((unw_word_t) -1) << 16;
+ Debug (15, "OP_const2s(%ld)\n", (long) operand1);
+ push (operand1);
+ break;
+
+ case DW_OP_const4s:
+ if (operand1 & 0x80000000)
+ operand1 |= (((unw_word_t) -1) << 16) << 16;
+ Debug (15, "OP_const4s(%ld)\n", (long) operand1);
+ push (operand1);
+ break;
+
+ case DW_OP_deref:
+ Debug (15, "OP_deref\n");
+ tmp1 = pop ();
+ if ((ret = dwarf_readw (as, a, &tmp1, &tmp2, arg)) < 0)
+ return ret;
+ push (tmp2);
+ break;
+
+ case DW_OP_deref_size:
+ Debug (15, "OP_deref_size(%d)\n", (int) operand1);
+ tmp1 = pop ();
+ switch (operand1)
+ {
+ default:
+ Debug (1, "Unexpected DW_OP_deref_size size %d\n",
+ (int) operand1);
+ return -UNW_EINVAL;
+
+ case 1:
+ if ((ret = dwarf_readu8 (as, a, &tmp1, &u8, arg)) < 0)
+ return ret;
+ tmp2 = u8;
+ break;
+
+ case 2:
+ if ((ret = dwarf_readu16 (as, a, &tmp1, &u16, arg)) < 0)
+ return ret;
+ tmp2 = u16;
+ break;
+
+ case 3:
+ case 4:
+ if ((ret = dwarf_readu32 (as, a, &tmp1, &u32, arg)) < 0)
+ return ret;
+ tmp2 = u32;
+ if (operand1 == 3)
+ {
+ if (dwarf_is_big_endian (as))
+ tmp2 >>= 8;
+ else
+ tmp2 &= 0xffffff;
+ }
+ break;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ if ((ret = dwarf_readu64 (as, a, &tmp1, &u64, arg)) < 0)
+ return ret;
+ tmp2 = u64;
+ if (operand1 != 8)
+ {
+ if (dwarf_is_big_endian (as))
+ tmp2 >>= 64 - 8 * operand1;
+ else
+ tmp2 &= (~ (unw_word_t) 0) << (8 * operand1);
+ }
+ break;
+ }
+ push (tmp2);
+ break;
+
+ case DW_OP_dup:
+ Debug (15, "OP_dup\n");
+ push (pick (0));
+ break;
+
+ case DW_OP_drop:
+ Debug (15, "OP_drop\n");
+ (void) pop ();
+ break;
+
+ case DW_OP_pick:
+ Debug (15, "OP_pick(%d)\n", (int) operand1);
+ push (pick (operand1));
+ break;
+
+ case DW_OP_over:
+ Debug (15, "OP_over\n");
+ push (pick (1));
+ break;
+
+ case DW_OP_swap:
+ Debug (15, "OP_swap\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (tmp1);
+ push (tmp2);
+ break;
+
+ case DW_OP_rot:
+ Debug (15, "OP_rot\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ tmp3 = pop ();
+ push (tmp1);
+ push (tmp3);
+ push (tmp2);
+ break;
+
+ case DW_OP_abs:
+ Debug (15, "OP_abs\n");
+ tmp1 = pop ();
+ if (tmp1 & ((unw_word_t) 1 << (8 * dwarf_addr_size (as) - 1)))
+ tmp1 = -tmp1;
+ push (tmp1);
+ break;
+
+ case DW_OP_and:
+ Debug (15, "OP_and\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (tmp1 & tmp2);
+ break;
+
+ case DW_OP_div:
+ Debug (15, "OP_div\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ if (tmp1)
+ tmp1 = sword (as, tmp2) / sword (as, tmp1);
+ push (tmp1);
+ break;
+
+ case DW_OP_minus:
+ Debug (15, "OP_minus\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ tmp1 = tmp2 - tmp1;
+ push (tmp1);
+ break;
+
+ case DW_OP_mod:
+ Debug (15, "OP_mod\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ if (tmp1)
+ tmp1 = tmp2 % tmp1;
+ push (tmp1);
+ break;
+
+ case DW_OP_mul:
+ Debug (15, "OP_mul\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ if (tmp1)
+ tmp1 = tmp2 * tmp1;
+ push (tmp1);
+ break;
+
+ case DW_OP_neg:
+ Debug (15, "OP_neg\n");
+ push (-pop ());
+ break;
+
+ case DW_OP_not:
+ Debug (15, "OP_not\n");
+ push (~pop ());
+ break;
+
+ case DW_OP_or:
+ Debug (15, "OP_or\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (tmp1 | tmp2);
+ break;
+
+ case DW_OP_plus:
+ Debug (15, "OP_plus\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (tmp1 + tmp2);
+ break;
+
+ case DW_OP_plus_uconst:
+ Debug (15, "OP_plus_uconst(%lu)\n", (unsigned long) operand1);
+ tmp1 = pop ();
+ push (tmp1 + operand1);
+ break;
+
+ case DW_OP_shl:
+ Debug (15, "OP_shl\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (tmp2 << tmp1);
+ break;
+
+ case DW_OP_shr:
+ Debug (15, "OP_shr\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (tmp2 >> tmp1);
+ break;
+
+ case DW_OP_shra:
+ Debug (15, "OP_shra\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (sword (as, tmp2) >> tmp1);
+ break;
+
+ case DW_OP_xor:
+ Debug (15, "OP_xor\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (tmp1 ^ tmp2);
+ break;
+
+ case DW_OP_le:
+ Debug (15, "OP_le\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (sword (as, tmp2) <= sword (as, tmp1));
+ break;
+
+ case DW_OP_ge:
+ Debug (15, "OP_ge\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (sword (as, tmp2) >= sword (as, tmp1));
+ break;
+
+ case DW_OP_eq:
+ Debug (15, "OP_eq\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (sword (as, tmp2) == sword (as, tmp1));
+ break;
+
+ case DW_OP_lt:
+ Debug (15, "OP_lt\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (sword (as, tmp2) < sword (as, tmp1));
+ break;
+
+ case DW_OP_gt:
+ Debug (15, "OP_gt\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (sword (as, tmp2) > sword (as, tmp1));
+ break;
+
+ case DW_OP_ne:
+ Debug (15, "OP_ne\n");
+ tmp1 = pop ();
+ tmp2 = pop ();
+ push (sword (as, tmp2) != sword (as, tmp1));
+ break;
+
+ case DW_OP_skip:
+ Debug (15, "OP_skip(%d)\n", (int16_t) operand1);
+ *addr += (int16_t) operand1;
+ break;
+
+ case DW_OP_bra:
+ Debug (15, "OP_skip(%d)\n", (int16_t) operand1);
+ tmp1 = pop ();
+ if (tmp1)
+ *addr += (int16_t) operand1;
+ break;
+
+ case DW_OP_nop:
+ Debug (15, "OP_nop\n");
+ break;
+
+ case DW_OP_call2:
+ case DW_OP_call4:
+ case DW_OP_call_ref:
+ case DW_OP_fbreg:
+ case DW_OP_piece:
+ case DW_OP_push_object_address:
+ case DW_OP_xderef:
+ case DW_OP_xderef_size:
+ default:
+ Debug (1, "Unexpected opcode 0x%x\n", opcode);
+ return -UNW_EINVAL;
+ }
+ }
+ *valp = pop ();
+ Debug (14, "final value = 0x%lx\n", (unsigned long) *valp);
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/dwarf/Gfde.c b/src/pal/src/libunwind/src/dwarf/Gfde.c
new file mode 100644
index 0000000000..9250b895ea
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Gfde.c
@@ -0,0 +1,359 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "dwarf_i.h"
+
+static inline int
+is_cie_id (unw_word_t val, int is_debug_frame)
+{
+ /* The CIE ID is normally 0xffffffff (for 32-bit ELF) or
+ 0xffffffffffffffff (for 64-bit ELF). However, .eh_frame
+ uses 0. */
+ if (is_debug_frame)
+ return (val == (uint32_t)(-1) || val == (uint64_t)(-1));
+ else
+ return (val == 0);
+}
+
+/* Note: we don't need to keep track of more than the first four
+ characters of the augmentation string, because we (a) ignore any
+ augmentation string contents once we find an unrecognized character
+ and (b) those characters that we do recognize, can't be
+ repeated. */
+static inline int
+parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr,
+ const unw_proc_info_t *pi, struct dwarf_cie_info *dci,
+ int is_debug_frame, void *arg)
+{
+ uint8_t version, ch, augstr[5], fde_encoding, handler_encoding;
+ unw_word_t len, cie_end_addr, aug_size;
+ uint32_t u32val;
+ uint64_t u64val;
+ size_t i;
+ int ret;
+# define STR2(x) #x
+# define STR(x) STR2(x)
+
+ /* Pick appropriate default for FDE-encoding. DWARF spec says
+ start-IP (initial_location) and the code-size (address_range) are
+ "address-unit sized constants". The `R' augmentation can be used
+ to override this, but by default, we pick an address-sized unit
+ for fde_encoding. */
+ switch (dwarf_addr_size (as))
+ {
+ case 4: fde_encoding = DW_EH_PE_udata4; break;
+ case 8: fde_encoding = DW_EH_PE_udata8; break;
+ default: fde_encoding = DW_EH_PE_omit; break;
+ }
+
+ dci->lsda_encoding = DW_EH_PE_omit;
+ dci->handler = 0;
+
+ if ((ret = dwarf_readu32 (as, a, &addr, &u32val, arg)) < 0)
+ return ret;
+
+ if (u32val != 0xffffffff)
+ {
+ /* the CIE is in the 32-bit DWARF format */
+ uint32_t cie_id;
+ /* DWARF says CIE id should be 0xffffffff, but in .eh_frame, it's 0 */
+ const uint32_t expected_id = (is_debug_frame) ? 0xffffffff : 0;
+
+ len = u32val;
+ cie_end_addr = addr + len;
+ if ((ret = dwarf_readu32 (as, a, &addr, &cie_id, arg)) < 0)
+ return ret;
+ if (cie_id != expected_id)
+ {
+ Debug (1, "Unexpected CIE id %x\n", cie_id);
+ return -UNW_EINVAL;
+ }
+ }
+ else
+ {
+ /* the CIE is in the 64-bit DWARF format */
+ uint64_t cie_id;
+ /* DWARF says CIE id should be 0xffffffffffffffff, but in
+ .eh_frame, it's 0 */
+ const uint64_t expected_id = (is_debug_frame) ? 0xffffffffffffffffull : 0;
+
+ if ((ret = dwarf_readu64 (as, a, &addr, &u64val, arg)) < 0)
+ return ret;
+ len = u64val;
+ cie_end_addr = addr + len;
+ if ((ret = dwarf_readu64 (as, a, &addr, &cie_id, arg)) < 0)
+ return ret;
+ if (cie_id != expected_id)
+ {
+ Debug (1, "Unexpected CIE id %llx\n", (long long) cie_id);
+ return -UNW_EINVAL;
+ }
+ }
+ dci->cie_instr_end = cie_end_addr;
+
+ if ((ret = dwarf_readu8 (as, a, &addr, &version, arg)) < 0)
+ return ret;
+
+ /* GCC emits version 1??? */
+ if (version != 1 && (version < DWARF_CIE_VERSION || version > DWARF_CIE_VERSION_MAX))
+ {
+ Debug (1, "Got CIE version %u, expected version 1 or between "
+ STR (DWARF_CIE_VERSION) " and " STR (DWARF_CIE_VERSION_MAX) "\n", version);
+ return -UNW_EBADVERSION;
+ }
+
+ /* read and parse the augmentation string: */
+ memset (augstr, 0, sizeof (augstr));
+ for (i = 0;;)
+ {
+ if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0)
+ return ret;
+
+ if (!ch)
+ break; /* end of augmentation string */
+
+ if (i < sizeof (augstr) - 1)
+ augstr[i++] = ch;
+ }
+
+ if ((ret = dwarf_read_uleb128 (as, a, &addr, &dci->code_align, arg)) < 0
+ || (ret = dwarf_read_sleb128 (as, a, &addr, &dci->data_align, arg)) < 0)
+ return ret;
+
+ /* Read the return-address column either as a u8 or as a uleb128. */
+ if (version == 1)
+ {
+ if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0)
+ return ret;
+ dci->ret_addr_column = ch;
+ }
+ else if ((ret = dwarf_read_uleb128 (as, a, &addr, &dci->ret_addr_column,
+ arg)) < 0)
+ return ret;
+
+ i = 0;
+ if (augstr[0] == 'z')
+ {
+ dci->sized_augmentation = 1;
+ if ((ret = dwarf_read_uleb128 (as, a, &addr, &aug_size, arg)) < 0)
+ return ret;
+ i++;
+ }
+
+ for (; i < sizeof (augstr) && augstr[i]; ++i)
+ switch (augstr[i])
+ {
+ case 'L':
+ /* read the LSDA pointer-encoding format. */
+ if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0)
+ return ret;
+ dci->lsda_encoding = ch;
+ break;
+
+ case 'R':
+ /* read the FDE pointer-encoding format. */
+ if ((ret = dwarf_readu8 (as, a, &addr, &fde_encoding, arg)) < 0)
+ return ret;
+ break;
+
+ case 'P':
+ /* read the personality-routine pointer-encoding format. */
+ if ((ret = dwarf_readu8 (as, a, &addr, &handler_encoding, arg)) < 0)
+ return ret;
+ if ((ret = dwarf_read_encoded_pointer (as, a, &addr, handler_encoding,
+ pi, &dci->handler, arg)) < 0)
+ return ret;
+ break;
+
+ case 'S':
+ /* This is a signal frame. */
+ dci->signal_frame = 1;
+
+ /* Temporarily set it to one so dwarf_parse_fde() knows that
+ it should fetch the actual ABI/TAG pair from the FDE. */
+ dci->have_abi_marker = 1;
+ break;
+
+ default:
+ Debug (1, "Unexpected augmentation string `%s'\n", augstr);
+ if (dci->sized_augmentation)
+ /* If we have the size of the augmentation body, we can skip
+ over the parts that we don't understand, so we're OK. */
+ goto done;
+ else
+ return -UNW_EINVAL;
+ }
+ done:
+ dci->fde_encoding = fde_encoding;
+ dci->cie_instr_start = addr;
+ Debug (15, "CIE parsed OK, augmentation = \"%s\", handler=0x%lx\n",
+ augstr, (long) dci->handler);
+ return 0;
+}
+
+/* Extract proc-info from the FDE starting at adress ADDR.
+
+ Pass BASE as zero for eh_frame behaviour, or a pointer to
+ debug_frame base for debug_frame behaviour. */
+
+HIDDEN int
+dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addrp, unw_proc_info_t *pi,
+ unw_word_t base,
+ int need_unwind_info, int is_debug_frame,
+ void *arg)
+{
+ unw_word_t fde_end_addr, cie_addr, cie_offset_addr, aug_end_addr = 0;
+ unw_word_t start_ip, ip_range, aug_size, addr = *addrp;
+ int ret, ip_range_encoding;
+ struct dwarf_cie_info dci;
+ uint64_t u64val;
+ uint32_t u32val;
+
+ Debug (12, "FDE @ 0x%lx\n", (long) addr);
+
+ memset (&dci, 0, sizeof (dci));
+
+ if ((ret = dwarf_readu32 (as, a, &addr, &u32val, arg)) < 0)
+ return ret;
+
+ if (u32val != 0xffffffff)
+ {
+ int32_t cie_offset = 0;
+
+ /* In some configurations, an FDE with a 0 length indicates the
+ end of the FDE-table. */
+ if (u32val == 0)
+ return -UNW_ENOINFO;
+
+ /* the FDE is in the 32-bit DWARF format */
+
+ *addrp = fde_end_addr = addr + u32val;
+ cie_offset_addr = addr;
+
+ if ((ret = dwarf_reads32 (as, a, &addr, &cie_offset, arg)) < 0)
+ return ret;
+
+ if (is_cie_id (cie_offset, is_debug_frame))
+ /* ignore CIEs (happens during linear searches) */
+ return 0;
+
+ if (is_debug_frame)
+ cie_addr = base + cie_offset;
+ else
+ /* DWARF says that the CIE_pointer in the FDE is a
+ .debug_frame-relative offset, but the GCC-generated .eh_frame
+ sections instead store a "pcrelative" offset, which is just
+ as fine as it's self-contained. */
+ cie_addr = cie_offset_addr - cie_offset;
+ }
+ else
+ {
+ int64_t cie_offset = 0;
+
+ /* the FDE is in the 64-bit DWARF format */
+
+ if ((ret = dwarf_readu64 (as, a, &addr, &u64val, arg)) < 0)
+ return ret;
+
+ *addrp = fde_end_addr = addr + u64val;
+ cie_offset_addr = addr;
+
+ if ((ret = dwarf_reads64 (as, a, &addr, &cie_offset, arg)) < 0)
+ return ret;
+
+ if (is_cie_id (cie_offset, is_debug_frame))
+ /* ignore CIEs (happens during linear searches) */
+ return 0;
+
+ if (is_debug_frame)
+ cie_addr = base + cie_offset;
+ else
+ /* DWARF says that the CIE_pointer in the FDE is a
+ .debug_frame-relative offset, but the GCC-generated .eh_frame
+ sections instead store a "pcrelative" offset, which is just
+ as fine as it's self-contained. */
+ cie_addr = (unw_word_t) ((uint64_t) cie_offset_addr - cie_offset);
+ }
+
+ Debug (15, "looking for CIE at address %lx\n", (long) cie_addr);
+
+ if ((ret = parse_cie (as, a, cie_addr, pi, &dci, is_debug_frame, arg)) < 0)
+ return ret;
+
+ /* IP-range has same encoding as FDE pointers, except that it's
+ always an absolute value: */
+ ip_range_encoding = dci.fde_encoding & DW_EH_PE_FORMAT_MASK;
+
+ if ((ret = dwarf_read_encoded_pointer (as, a, &addr, dci.fde_encoding,
+ pi, &start_ip, arg)) < 0
+ || (ret = dwarf_read_encoded_pointer (as, a, &addr, ip_range_encoding,
+ pi, &ip_range, arg)) < 0)
+ return ret;
+ pi->start_ip = start_ip;
+ pi->end_ip = start_ip + ip_range;
+ pi->handler = dci.handler;
+
+ if (dci.sized_augmentation)
+ {
+ if ((ret = dwarf_read_uleb128 (as, a, &addr, &aug_size, arg)) < 0)
+ return ret;
+ aug_end_addr = addr + aug_size;
+ }
+
+ if ((ret = dwarf_read_encoded_pointer (as, a, &addr, dci.lsda_encoding,
+ pi, &pi->lsda, arg)) < 0)
+ return ret;
+
+ Debug (15, "FDE covers IP 0x%lx-0x%lx, LSDA=0x%lx\n",
+ (long) pi->start_ip, (long) pi->end_ip, (long) pi->lsda);
+
+ if (need_unwind_info)
+ {
+ pi->format = UNW_INFO_FORMAT_TABLE;
+ pi->unwind_info_size = sizeof (dci);
+ pi->unwind_info = mempool_alloc (&dwarf_cie_info_pool);
+ if (!pi->unwind_info)
+ return -UNW_ENOMEM;
+
+ if (dci.have_abi_marker)
+ {
+ if ((ret = dwarf_readu16 (as, a, &addr, &dci.abi, arg)) < 0
+ || (ret = dwarf_readu16 (as, a, &addr, &dci.tag, arg)) < 0)
+ return ret;
+ Debug (13, "Found ABI marker = (abi=%u, tag=%u)\n",
+ dci.abi, dci.tag);
+ }
+
+ if (dci.sized_augmentation)
+ dci.fde_instr_start = aug_end_addr;
+ else
+ dci.fde_instr_start = addr;
+ dci.fde_instr_end = fde_end_addr;
+
+ memcpy (pi->unwind_info, &dci, sizeof (dci));
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/dwarf/Gfind_proc_info-lsb.c b/src/pal/src/libunwind/src/dwarf/Gfind_proc_info-lsb.c
new file mode 100644
index 0000000000..509ceff47c
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Gfind_proc_info-lsb.c
@@ -0,0 +1,935 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Locate an FDE via the ELF data-structures defined by LSB v1.3
+ (http://www.linuxbase.org/spec/). */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <limits.h>
+
+#include "dwarf_i.h"
+#include "dwarf-eh.h"
+#include "libunwind_i.h"
+
+struct table_entry
+ {
+ int32_t start_ip_offset;
+ int32_t fde_offset;
+ };
+
+#ifndef UNW_REMOTE_ONLY
+
+#ifdef __linux
+#include "os-linux.h"
+#endif
+
+static ALIAS(dwarf_search_unwind_table) int
+dwarf_search_unwind_table_int (unw_addr_space_t as,
+ unw_word_t ip,
+ unw_dyn_info_t *di,
+ unw_proc_info_t *pi,
+ int need_unwind_info, void *arg);
+static int
+linear_search (unw_addr_space_t as, unw_word_t ip,
+ unw_word_t eh_frame_start, unw_word_t eh_frame_end,
+ unw_word_t fde_count,
+ unw_proc_info_t *pi, int need_unwind_info, void *arg)
+{
+ unw_accessors_t *a = unw_get_accessors_int (unw_local_addr_space);
+ unw_word_t i = 0, fde_addr, addr = eh_frame_start;
+ int ret;
+
+ while (i++ < fde_count && addr < eh_frame_end)
+ {
+ fde_addr = addr;
+ if ((ret = dwarf_extract_proc_info_from_fde (as, a, &addr, pi,
+ eh_frame_start,
+ 0, 0, arg)) < 0)
+ return ret;
+
+ if (ip >= pi->start_ip && ip < pi->end_ip)
+ {
+ if (!need_unwind_info)
+ return 1;
+ addr = fde_addr;
+ if ((ret = dwarf_extract_proc_info_from_fde (as, a, &addr, pi,
+ eh_frame_start,
+ need_unwind_info, 0,
+ arg))
+ < 0)
+ return ret;
+ return 1;
+ }
+ }
+ return -UNW_ENOINFO;
+}
+#endif /* !UNW_REMOTE_ONLY */
+
+#ifdef CONFIG_DEBUG_FRAME
+/* Load .debug_frame section from FILE. Allocates and returns space
+ in *BUF, and sets *BUFSIZE to its size. IS_LOCAL is 1 if using the
+ local process, in which case we can search the system debug file
+ directory; 0 for other address spaces, in which case we do
+ not. Returns 0 on success, 1 on error. Succeeds even if the file
+ contains no .debug_frame. */
+/* XXX: Could use mmap; but elf_map_image keeps tons mapped in. */
+
+static int
+load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
+{
+ struct elf_image ei;
+ Elf_W (Shdr) *shdr;
+ int ret;
+
+ ei.image = NULL;
+
+ ret = elf_w (load_debuglink) (file, &ei, is_local);
+ if (ret != 0)
+ return ret;
+
+ shdr = elf_w (find_section) (&ei, ".debug_frame");
+ if (!shdr ||
+ (shdr->sh_offset + shdr->sh_size > ei.size))
+ {
+ munmap(ei.image, ei.size);
+ return 1;
+ }
+
+ *bufsize = shdr->sh_size;
+ *buf = malloc (*bufsize);
+
+ memcpy(*buf, shdr->sh_offset + ei.image, *bufsize);
+
+ Debug (4, "read %zd bytes of .debug_frame from offset %zd\n",
+ *bufsize, shdr->sh_offset);
+
+ munmap(ei.image, ei.size);
+ return 0;
+}
+
+/* Locate the binary which originated the contents of address ADDR. Return
+ the name of the binary in *name (space is allocated by the caller)
+ Returns 0 if a binary is successfully found, or 1 if an error occurs. */
+
+static int
+find_binary_for_address (unw_word_t ip, char *name, size_t name_size)
+{
+#if defined(__linux) && (!UNW_REMOTE_ONLY)
+ struct map_iterator mi;
+ int found = 0;
+ int pid = getpid ();
+ unsigned long segbase, mapoff, hi;
+
+ if (maps_init (&mi, pid) != 0)
+ return 1;
+
+ while (maps_next (&mi, &segbase, &hi, &mapoff))
+ if (ip >= segbase && ip < hi)
+ {
+ size_t len = strlen (mi.path);
+
+ if (len + 1 <= name_size)
+ {
+ memcpy (name, mi.path, len + 1);
+ found = 1;
+ }
+ break;
+ }
+ maps_close (&mi);
+ return !found;
+#endif
+
+ return 1;
+}
+
+/* Locate and/or try to load a debug_frame section for address ADDR. Return
+ pointer to debug frame descriptor, or zero if not found. */
+
+static struct unw_debug_frame_list *
+locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname,
+ unw_word_t start, unw_word_t end)
+{
+ struct unw_debug_frame_list *w, *fdesc = 0;
+ char path[PATH_MAX];
+ char *name = path;
+ int err;
+ char *buf;
+ size_t bufsize;
+
+ /* First, see if we loaded this frame already. */
+
+ for (w = as->debug_frames; w; w = w->next)
+ {
+ Debug (4, "checking %p: %lx-%lx\n", w, (long)w->start, (long)w->end);
+ if (addr >= w->start && addr < w->end)
+ return w;
+ }
+
+ /* If the object name we receive is blank, there's still a chance of locating
+ the file by parsing /proc/self/maps. */
+
+ if (strcmp (dlname, "") == 0)
+ {
+ err = find_binary_for_address (addr, name, sizeof(path));
+ if (err)
+ {
+ Debug (15, "tried to locate binary for 0x%" PRIx64 ", but no luck\n",
+ (uint64_t) addr);
+ return 0;
+ }
+ }
+ else
+ name = (char*) dlname;
+
+ err = load_debug_frame (name, &buf, &bufsize, as == unw_local_addr_space);
+
+ if (!err)
+ {
+ fdesc = malloc (sizeof (struct unw_debug_frame_list));
+
+ fdesc->start = start;
+ fdesc->end = end;
+ fdesc->debug_frame = buf;
+ fdesc->debug_frame_size = bufsize;
+ fdesc->index = NULL;
+ fdesc->next = as->debug_frames;
+
+ as->debug_frames = fdesc;
+ }
+
+ return fdesc;
+}
+
+struct debug_frame_tab
+ {
+ struct table_entry *tab;
+ uint32_t length;
+ uint32_t size;
+ };
+
+static void
+debug_frame_tab_append (struct debug_frame_tab *tab,
+ unw_word_t fde_offset, unw_word_t start_ip)
+{
+ unsigned int length = tab->length;
+
+ if (length == tab->size)
+ {
+ tab->size *= 2;
+ tab->tab = realloc (tab->tab, sizeof (struct table_entry) * tab->size);
+ }
+
+ tab->tab[length].fde_offset = fde_offset;
+ tab->tab[length].start_ip_offset = start_ip;
+
+ tab->length = length + 1;
+}
+
+static void
+debug_frame_tab_shrink (struct debug_frame_tab *tab)
+{
+ if (tab->size > tab->length)
+ {
+ tab->tab = realloc (tab->tab, sizeof (struct table_entry) * tab->length);
+ tab->size = tab->length;
+ }
+}
+
+static int
+debug_frame_tab_compare (const void *a, const void *b)
+{
+ const struct table_entry *fa = a, *fb = b;
+
+ if (fa->start_ip_offset > fb->start_ip_offset)
+ return 1;
+ else if (fa->start_ip_offset < fb->start_ip_offset)
+ return -1;
+ else
+ return 0;
+}
+
+HIDDEN int
+dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, unw_word_t ip,
+ unw_word_t segbase, const char* obj_name,
+ unw_word_t start, unw_word_t end)
+{
+ unw_dyn_info_t *di;
+ struct unw_debug_frame_list *fdesc = 0;
+ unw_accessors_t *a;
+ unw_word_t addr;
+
+ Debug (15, "Trying to find .debug_frame for %s\n", obj_name);
+ di = di_debug;
+
+ fdesc = locate_debug_info (unw_local_addr_space, ip, obj_name, start, end);
+
+ if (!fdesc)
+ {
+ Debug (15, "couldn't load .debug_frame\n");
+ return found;
+ }
+ else
+ {
+ char *buf;
+ size_t bufsize;
+ unw_word_t item_start, item_end = 0;
+ uint32_t u32val = 0;
+ uint64_t cie_id = 0;
+ struct debug_frame_tab tab;
+
+ Debug (15, "loaded .debug_frame\n");
+
+ buf = fdesc->debug_frame;
+ bufsize = fdesc->debug_frame_size;
+
+ if (bufsize == 0)
+ {
+ Debug (15, "zero-length .debug_frame\n");
+ return found;
+ }
+
+ /* Now create a binary-search table, if it does not already exist. */
+ if (!fdesc->index)
+ {
+ addr = (unw_word_t) (uintptr_t) buf;
+
+ a = unw_get_accessors_int (unw_local_addr_space);
+
+ /* Find all FDE entries in debug_frame, and make into a sorted
+ index. */
+
+ tab.length = 0;
+ tab.size = 16;
+ tab.tab = calloc (tab.size, sizeof (struct table_entry));
+
+ while (addr < (unw_word_t) (uintptr_t) (buf + bufsize))
+ {
+ uint64_t id_for_cie;
+ item_start = addr;
+
+ dwarf_readu32 (unw_local_addr_space, a, &addr, &u32val, NULL);
+
+ if (u32val == 0)
+ break;
+ else if (u32val != 0xffffffff)
+ {
+ uint32_t cie_id32 = 0;
+ item_end = addr + u32val;
+ dwarf_readu32 (unw_local_addr_space, a, &addr, &cie_id32,
+ NULL);
+ cie_id = cie_id32;
+ id_for_cie = 0xffffffff;
+ }
+ else
+ {
+ uint64_t u64val = 0;
+ /* Extended length. */
+ dwarf_readu64 (unw_local_addr_space, a, &addr, &u64val, NULL);
+ item_end = addr + u64val;
+
+ dwarf_readu64 (unw_local_addr_space, a, &addr, &cie_id, NULL);
+ id_for_cie = 0xffffffffffffffffull;
+ }
+
+ /*Debug (1, "CIE/FDE id = %.8x\n", (int) cie_id);*/
+
+ if (cie_id == id_for_cie)
+ ;
+ /*Debug (1, "Found CIE at %.8x.\n", item_start);*/
+ else
+ {
+ unw_word_t fde_addr = item_start;
+ unw_proc_info_t this_pi;
+ int err;
+
+ /*Debug (1, "Found FDE at %.8x\n", item_start);*/
+
+ err = dwarf_extract_proc_info_from_fde (unw_local_addr_space,
+ a, &fde_addr,
+ &this_pi,
+ (uintptr_t) buf, 0, 1,
+ NULL);
+ if (err == 0)
+ {
+ Debug (15, "start_ip = %lx, end_ip = %lx\n",
+ (long) this_pi.start_ip, (long) this_pi.end_ip);
+ debug_frame_tab_append (&tab,
+ item_start - (unw_word_t) (uintptr_t) buf,
+ this_pi.start_ip);
+ }
+ /*else
+ Debug (1, "FDE parse failed\n");*/
+ }
+
+ addr = item_end;
+ }
+
+ debug_frame_tab_shrink (&tab);
+ qsort (tab.tab, tab.length, sizeof (struct table_entry),
+ debug_frame_tab_compare);
+ /* for (i = 0; i < tab.length; i++)
+ {
+ fprintf (stderr, "ip %x, fde offset %x\n",
+ (int) tab.tab[i].start_ip_offset,
+ (int) tab.tab[i].fde_offset);
+ }*/
+ fdesc->index = tab.tab;
+ fdesc->index_size = tab.length;
+ }
+
+ di->format = UNW_INFO_FORMAT_TABLE;
+ di->start_ip = fdesc->start;
+ di->end_ip = fdesc->end;
+ di->u.ti.name_ptr = (unw_word_t) (uintptr_t) obj_name;
+ di->u.ti.table_data = (unw_word_t *) fdesc;
+ di->u.ti.table_len = sizeof (*fdesc) / sizeof (unw_word_t);
+ di->u.ti.segbase = segbase;
+
+ found = 1;
+ Debug (15, "found debug_frame table `%s': segbase=0x%lx, len=%lu, "
+ "gp=0x%lx, table_data=0x%lx\n",
+ (char *) (uintptr_t) di->u.ti.name_ptr,
+ (long) di->u.ti.segbase, (long) di->u.ti.table_len,
+ (long) di->gp, (long) di->u.ti.table_data);
+ }
+ return found;
+}
+
+#endif /* CONFIG_DEBUG_FRAME */
+
+#ifndef UNW_REMOTE_ONLY
+
+static Elf_W (Addr)
+dwarf_find_eh_frame_section(struct dl_phdr_info *info)
+{
+ int rc;
+ struct elf_image ei;
+ Elf_W (Addr) eh_frame = 0;
+ Elf_W (Shdr)* shdr;
+ const char *file = info->dlpi_name;
+ char exepath[PATH_MAX];
+
+ if (strlen(file) == 0)
+ {
+ tdep_get_exe_image_path(exepath);
+ file = exepath;
+ }
+
+ Debug (1, "looking for .eh_frame section in %s\n",
+ file);
+
+ rc = elf_map_image (&ei, file);
+ if (rc != 0)
+ return 0;
+
+ shdr = elf_w (find_section) (&ei, ".eh_frame");
+ if (!shdr)
+ goto out;
+
+ eh_frame = shdr->sh_addr + info->dlpi_addr;
+ Debug (4, "found .eh_frame at address %lx\n",
+ eh_frame);
+
+out:
+ munmap (ei.image, ei.size);
+
+ return eh_frame;
+}
+
+struct dwarf_callback_data
+ {
+ /* in: */
+ unw_word_t ip; /* instruction-pointer we're looking for */
+ unw_proc_info_t *pi; /* proc-info pointer */
+ int need_unwind_info;
+ /* out: */
+ int single_fde; /* did we find a single FDE? (vs. a table) */
+ unw_dyn_info_t di; /* table info (if single_fde is false) */
+ unw_dyn_info_t di_debug; /* additional table info for .debug_frame */
+ };
+
+/* ptr is a pointer to a dwarf_callback_data structure and, on entry,
+ member ip contains the instruction-pointer we're looking
+ for. */
+HIDDEN int
+dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr)
+{
+ struct dwarf_callback_data *cb_data = ptr;
+ unw_dyn_info_t *di = &cb_data->di;
+ const Elf_W(Phdr) *phdr, *p_eh_hdr, *p_dynamic, *p_text;
+ unw_word_t addr, eh_frame_start, eh_frame_end, fde_count, ip;
+ Elf_W(Addr) load_base, max_load_addr = 0;
+ int ret, need_unwind_info = cb_data->need_unwind_info;
+ unw_proc_info_t *pi = cb_data->pi;
+ struct dwarf_eh_frame_hdr *hdr = NULL;
+ unw_accessors_t *a;
+ long n;
+ int found = 0;
+ struct dwarf_eh_frame_hdr synth_eh_frame_hdr;
+#ifdef CONFIG_DEBUG_FRAME
+ unw_word_t start, end;
+#endif /* CONFIG_DEBUG_FRAME*/
+
+ ip = cb_data->ip;
+
+ /* Make sure struct dl_phdr_info is at least as big as we need. */
+ if (size < offsetof (struct dl_phdr_info, dlpi_phnum)
+ + sizeof (info->dlpi_phnum))
+ return -1;
+
+ Debug (15, "checking %s, base=0x%lx)\n",
+ info->dlpi_name, (long) info->dlpi_addr);
+
+ phdr = info->dlpi_phdr;
+ load_base = info->dlpi_addr;
+ p_text = NULL;
+ p_eh_hdr = NULL;
+ p_dynamic = NULL;
+
+ /* See if PC falls into one of the loaded segments. Find the
+ eh-header segment at the same time. */
+ for (n = info->dlpi_phnum; --n >= 0; phdr++)
+ {
+ if (phdr->p_type == PT_LOAD)
+ {
+ Elf_W(Addr) vaddr = phdr->p_vaddr + load_base;
+
+ if (ip >= vaddr && ip < vaddr + phdr->p_memsz)
+ p_text = phdr;
+
+ if (vaddr + phdr->p_filesz > max_load_addr)
+ max_load_addr = vaddr + phdr->p_filesz;
+ }
+ else if (phdr->p_type == PT_GNU_EH_FRAME)
+ p_eh_hdr = phdr;
+ else if (phdr->p_type == PT_DYNAMIC)
+ p_dynamic = phdr;
+ }
+
+ if (!p_text)
+ return 0;
+
+ if (p_eh_hdr)
+ {
+ hdr = (struct dwarf_eh_frame_hdr *) (p_eh_hdr->p_vaddr + load_base);
+ }
+ else
+ {
+ Elf_W (Addr) eh_frame;
+ Debug (1, "no .eh_frame_hdr section found\n");
+ eh_frame = dwarf_find_eh_frame_section (info);
+ if (eh_frame)
+ {
+ Debug (1, "using synthetic .eh_frame_hdr section for %s\n",
+ info->dlpi_name);
+ synth_eh_frame_hdr.version = DW_EH_VERSION;
+ synth_eh_frame_hdr.eh_frame_ptr_enc = DW_EH_PE_absptr |
+ ((sizeof(Elf_W (Addr)) == 4) ? DW_EH_PE_udata4 : DW_EH_PE_udata8);
+ synth_eh_frame_hdr.fde_count_enc = DW_EH_PE_omit;
+ synth_eh_frame_hdr.table_enc = DW_EH_PE_omit;
+ synth_eh_frame_hdr.eh_frame = eh_frame;
+ hdr = &synth_eh_frame_hdr;
+ }
+ }
+
+ if (hdr)
+ {
+ if (p_dynamic)
+ {
+ /* For dynamicly linked executables and shared libraries,
+ DT_PLTGOT is the value that data-relative addresses are
+ relative to for that object. We call this the "gp". */
+ Elf_W(Dyn) *dyn = (Elf_W(Dyn) *)(p_dynamic->p_vaddr + load_base);
+ for (; dyn->d_tag != DT_NULL; ++dyn)
+ if (dyn->d_tag == DT_PLTGOT)
+ {
+ /* Assume that _DYNAMIC is writable and GLIBC has
+ relocated it (true for x86 at least). */
+ di->gp = dyn->d_un.d_ptr;
+ break;
+ }
+ }
+ else
+ /* Otherwise this is a static executable with no _DYNAMIC. Assume
+ that data-relative addresses are relative to 0, i.e.,
+ absolute. */
+ di->gp = 0;
+ pi->gp = di->gp;
+
+ if (hdr->version != DW_EH_VERSION)
+ {
+ Debug (1, "table `%s' has unexpected version %d\n",
+ info->dlpi_name, hdr->version);
+ return 0;
+ }
+
+ a = unw_get_accessors_int (unw_local_addr_space);
+ addr = (unw_word_t) (uintptr_t) (&hdr->eh_frame);
+
+ /* (Optionally) read eh_frame_ptr: */
+ if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a,
+ &addr, hdr->eh_frame_ptr_enc, pi,
+ &eh_frame_start, NULL)) < 0)
+ return ret;
+
+ /* (Optionally) read fde_count: */
+ if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a,
+ &addr, hdr->fde_count_enc, pi,
+ &fde_count, NULL)) < 0)
+ return ret;
+
+ if (hdr->table_enc != (DW_EH_PE_datarel | DW_EH_PE_sdata4))
+ {
+ /* If there is no search table or it has an unsupported
+ encoding, fall back on linear search. */
+ if (hdr->table_enc == DW_EH_PE_omit)
+ Debug (4, "table `%s' lacks search table; doing linear search\n",
+ info->dlpi_name);
+ else
+ Debug (4, "table `%s' has encoding 0x%x; doing linear search\n",
+ info->dlpi_name, hdr->table_enc);
+
+ eh_frame_end = max_load_addr; /* XXX can we do better? */
+
+ if (hdr->fde_count_enc == DW_EH_PE_omit)
+ fde_count = ~0UL;
+ if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit)
+ abort ();
+
+ Debug (1, "eh_frame_start = %lx eh_frame_end = %lx\n",
+ eh_frame_start, eh_frame_end);
+
+ /* XXX we know how to build a local binary search table for
+ .debug_frame, so we could do that here too. */
+ found = linear_search (unw_local_addr_space, ip,
+ eh_frame_start, eh_frame_end, fde_count,
+ pi, need_unwind_info, NULL);
+ if (found != 1)
+ found = 0;
+ else
+ cb_data->single_fde = 1;
+ }
+ else
+ {
+ di->format = UNW_INFO_FORMAT_REMOTE_TABLE;
+ di->start_ip = p_text->p_vaddr + load_base;
+ di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz;
+ di->u.rti.name_ptr = (unw_word_t) (uintptr_t) info->dlpi_name;
+ di->u.rti.table_data = addr;
+ assert (sizeof (struct table_entry) % sizeof (unw_word_t) == 0);
+ di->u.rti.table_len = (fde_count * sizeof (struct table_entry)
+ / sizeof (unw_word_t));
+ /* For the binary-search table in the eh_frame_hdr, data-relative
+ means relative to the start of that section... */
+ di->u.rti.segbase = (unw_word_t) (uintptr_t) hdr;
+
+ found = 1;
+ Debug (15, "found table `%s': segbase=0x%lx, len=%lu, gp=0x%lx, "
+ "table_data=0x%lx\n", (char *) (uintptr_t) di->u.rti.name_ptr,
+ (long) di->u.rti.segbase, (long) di->u.rti.table_len,
+ (long) di->gp, (long) di->u.rti.table_data);
+ }
+ }
+
+#ifdef CONFIG_DEBUG_FRAME
+ /* Find the start/end of the described region by parsing the phdr_info
+ structure. */
+ start = (unw_word_t) -1;
+ end = 0;
+
+ for (n = 0; n < info->dlpi_phnum; n++)
+ {
+ if (info->dlpi_phdr[n].p_type == PT_LOAD)
+ {
+ unw_word_t seg_start = info->dlpi_addr + info->dlpi_phdr[n].p_vaddr;
+ unw_word_t seg_end = seg_start + info->dlpi_phdr[n].p_memsz;
+
+ if (seg_start < start)
+ start = seg_start;
+
+ if (seg_end > end)
+ end = seg_end;
+ }
+ }
+
+ found = dwarf_find_debug_frame (found, &cb_data->di_debug, ip,
+ info->dlpi_addr, info->dlpi_name, start,
+ end);
+#endif /* CONFIG_DEBUG_FRAME */
+
+ return found;
+}
+
+HIDDEN int
+dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info, void *arg)
+{
+ struct dwarf_callback_data cb_data;
+ intrmask_t saved_mask;
+ int ret;
+
+ Debug (14, "looking for IP=0x%lx\n", (long) ip);
+
+ memset (&cb_data, 0, sizeof (cb_data));
+ cb_data.ip = ip;
+ cb_data.pi = pi;
+ cb_data.need_unwind_info = need_unwind_info;
+ cb_data.di.format = -1;
+ cb_data.di_debug.format = -1;
+
+ SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask);
+ ret = dl_iterate_phdr (dwarf_callback, &cb_data);
+ SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL);
+
+ if (ret > 0)
+ {
+ if (cb_data.single_fde)
+ /* already got the result in *pi */
+ return 0;
+
+ /* search the table: */
+ if (cb_data.di.format != -1)
+ ret = dwarf_search_unwind_table_int (as, ip, &cb_data.di,
+ pi, need_unwind_info, arg);
+ else
+ ret = -UNW_ENOINFO;
+
+ if (ret == -UNW_ENOINFO && cb_data.di_debug.format != -1)
+ ret = dwarf_search_unwind_table_int (as, ip, &cb_data.di_debug, pi,
+ need_unwind_info, arg);
+ }
+ else
+ ret = -UNW_ENOINFO;
+
+ return ret;
+}
+
+static inline const struct table_entry *
+lookup (const struct table_entry *table, size_t table_size, int32_t rel_ip)
+{
+ unsigned long table_len = table_size / sizeof (struct table_entry);
+ const struct table_entry *e = NULL;
+ unsigned long lo, hi, mid;
+
+ /* do a binary search for right entry: */
+ for (lo = 0, hi = table_len; lo < hi;)
+ {
+ mid = (lo + hi) / 2;
+ e = table + mid;
+ Debug (15, "e->start_ip_offset = %lx\n", (long) e->start_ip_offset);
+ if (rel_ip < e->start_ip_offset)
+ hi = mid;
+ else
+ lo = mid + 1;
+ }
+ if (hi <= 0)
+ return NULL;
+ e = table + hi - 1;
+ return e;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+#ifndef UNW_LOCAL_ONLY
+
+/* Lookup an unwind-table entry in remote memory. Returns 1 if an
+ entry is found, 0 if no entry is found, negative if an error
+ occurred reading remote memory. */
+static int
+remote_lookup (unw_addr_space_t as,
+ unw_word_t table, size_t table_size, int32_t rel_ip,
+ struct table_entry *e, int32_t *last_ip_offset, void *arg)
+{
+ unsigned long table_len = table_size / sizeof (struct table_entry);
+ unw_accessors_t *a = unw_get_accessors_int (as);
+ unsigned long lo, hi, mid;
+ unw_word_t e_addr = 0;
+ int32_t start = 0;
+ int ret;
+
+ /* do a binary search for right entry: */
+ for (lo = 0, hi = table_len; lo < hi;)
+ {
+ mid = (lo + hi) / 2;
+ e_addr = table + mid * sizeof (struct table_entry);
+ if ((ret = dwarf_reads32 (as, a, &e_addr, &start, arg)) < 0)
+ return ret;
+
+ if (rel_ip < start)
+ hi = mid;
+ else
+ lo = mid + 1;
+ }
+ if (hi <= 0)
+ return 0;
+ e_addr = table + (hi - 1) * sizeof (struct table_entry);
+ if ((ret = dwarf_reads32 (as, a, &e_addr, &e->start_ip_offset, arg)) < 0
+ || (ret = dwarf_reads32 (as, a, &e_addr, &e->fde_offset, arg)) < 0
+ || (hi < table_len &&
+ (ret = dwarf_reads32 (as, a, &e_addr, last_ip_offset, arg)) < 0))
+ return ret;
+ return 1;
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+static int is_remote_table(int format)
+{
+ return (format == UNW_INFO_FORMAT_REMOTE_TABLE ||
+ format == UNW_INFO_FORMAT_IP_OFFSET);
+}
+
+int
+dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ const struct table_entry *e = NULL, *table;
+ unw_word_t ip_base = 0, segbase = 0, last_ip, fde_addr;
+ unw_accessors_t *a;
+#ifndef UNW_LOCAL_ONLY
+ struct table_entry ent;
+#endif
+ int ret;
+ unw_word_t debug_frame_base;
+ size_t table_len;
+
+#ifdef UNW_REMOTE_ONLY
+ assert (is_remote_table(di->format));
+#else
+ assert (is_remote_table(di->format)
+ || di->format == UNW_INFO_FORMAT_TABLE);
+#endif
+ assert (ip >= di->start_ip && ip < di->end_ip);
+
+ if (is_remote_table(di->format))
+ {
+ table = (const struct table_entry *) (uintptr_t) di->u.rti.table_data;
+ table_len = di->u.rti.table_len * sizeof (unw_word_t);
+ debug_frame_base = 0;
+ }
+ else
+ {
+ assert(di->format == UNW_INFO_FORMAT_TABLE);
+#ifndef UNW_REMOTE_ONLY
+ struct unw_debug_frame_list *fdesc = (void *) di->u.ti.table_data;
+
+ /* UNW_INFO_FORMAT_TABLE (i.e. .debug_frame) is read from local address
+ space. Both the index and the unwind tables live in local memory, but
+ the address space to check for properties like the address size and
+ endianness is the target one. */
+ as = unw_local_addr_space;
+ table = fdesc->index;
+ table_len = fdesc->index_size * sizeof (struct table_entry);
+ debug_frame_base = (uintptr_t) fdesc->debug_frame;
+#endif
+ }
+
+ a = unw_get_accessors_int (as);
+
+ segbase = di->u.rti.segbase;
+ if (di->format == UNW_INFO_FORMAT_IP_OFFSET) {
+ ip_base = di->start_ip;
+ } else {
+ ip_base = segbase;
+ }
+
+#ifndef UNW_REMOTE_ONLY
+ if (as == unw_local_addr_space)
+ {
+ e = lookup (table, table_len, ip - ip_base);
+ if (e && &e[1] < &table[table_len])
+ last_ip = e[1].start_ip_offset + ip_base;
+ else
+ last_ip = di->end_ip;
+ }
+ else
+#endif
+ {
+#ifndef UNW_LOCAL_ONLY
+ int32_t last_ip_offset = di->end_ip - ip_base;
+ segbase = di->u.rti.segbase;
+ if ((ret = remote_lookup (as, (uintptr_t) table, table_len,
+ ip - ip_base, &ent, &last_ip_offset, arg)) < 0)
+ return ret;
+ if (ret)
+ {
+ e = &ent;
+ last_ip = last_ip_offset + ip_base;
+ }
+ else
+ e = NULL; /* no info found */
+#endif
+ }
+ if (!e)
+ {
+ Debug (1, "IP %lx inside range %lx-%lx, but no explicit unwind info found\n",
+ (long) ip, (long) di->start_ip, (long) di->end_ip);
+ /* IP is inside this table's range, but there is no explicit
+ unwind info. */
+ return -UNW_ENOINFO;
+ }
+ Debug (15, "ip=0x%lx, start_ip=0x%lx\n",
+ (long) ip, (long) (e->start_ip_offset));
+ if (debug_frame_base)
+ fde_addr = e->fde_offset + debug_frame_base;
+ else
+ fde_addr = e->fde_offset + segbase;
+ Debug (1, "e->fde_offset = %lx, segbase = %lx, debug_frame_base = %lx, "
+ "fde_addr = %lx\n", (long) e->fde_offset, (long) segbase,
+ (long) debug_frame_base, (long) fde_addr);
+ if ((ret = dwarf_extract_proc_info_from_fde (as, a, &fde_addr, pi,
+ debug_frame_base ?
+ debug_frame_base : segbase,
+ need_unwind_info,
+ debug_frame_base != 0, arg)) < 0)
+ return ret;
+
+ /* .debug_frame uses an absolute encoding that does not know about any
+ shared library relocation. */
+ if (di->format == UNW_INFO_FORMAT_TABLE)
+ {
+ pi->start_ip += segbase;
+ pi->end_ip += segbase;
+ pi->flags = UNW_PI_FLAG_DEBUG_FRAME;
+ }
+
+#if defined(NEED_LAST_IP)
+ pi->last_ip = last_ip;
+#else
+ (void)last_ip;
+#endif
+ if (ip < pi->start_ip || ip >= pi->end_ip)
+ return -UNW_ENOINFO;
+
+ return 0;
+}
+
+HIDDEN void
+dwarf_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg)
+{
+ return; /* always a nop */
+}
diff --git a/src/pal/src/libunwind/src/dwarf/Gfind_unwind_table.c b/src/pal/src/libunwind/src/dwarf/Gfind_unwind_table.c
new file mode 100644
index 0000000000..6a2ad50407
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Gfind_unwind_table.c
@@ -0,0 +1,230 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+
+#include "libunwind_i.h"
+#include "dwarf-eh.h"
+#include "dwarf_i.h"
+
+#define to_unw_word(p) ((unw_word_t) (uintptr_t) (p))
+
+int
+dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as,
+ char *path, unw_word_t segbase, unw_word_t mapoff,
+ unw_word_t ip)
+{
+ Elf_W(Phdr) *phdr, *ptxt = NULL, *peh_hdr = NULL, *pdyn = NULL;
+ unw_word_t addr, eh_frame_start, fde_count, load_base;
+ unw_word_t max_load_addr = 0;
+ unw_word_t start_ip = to_unw_word (-1);
+ unw_word_t end_ip = 0;
+ struct dwarf_eh_frame_hdr *hdr;
+ unw_proc_info_t pi;
+ unw_accessors_t *a;
+ Elf_W(Ehdr) *ehdr;
+#if UNW_TARGET_ARM
+ const Elf_W(Phdr) *parm_exidx = NULL;
+#endif
+ int i, ret, found = 0;
+
+ /* XXX: Much of this code is Linux/LSB-specific. */
+
+ if (!elf_w(valid_object) (&edi->ei))
+ return -UNW_ENOINFO;
+
+ ehdr = edi->ei.image;
+ phdr = (Elf_W(Phdr) *) ((char *) edi->ei.image + ehdr->e_phoff);
+
+ for (i = 0; i < ehdr->e_phnum; ++i)
+ {
+ switch (phdr[i].p_type)
+ {
+ case PT_LOAD:
+ if (phdr[i].p_vaddr < start_ip)
+ start_ip = phdr[i].p_vaddr;
+
+ if (phdr[i].p_vaddr + phdr[i].p_memsz > end_ip)
+ end_ip = phdr[i].p_vaddr + phdr[i].p_memsz;
+
+ if (phdr[i].p_offset == mapoff)
+ ptxt = phdr + i;
+ if ((uintptr_t) edi->ei.image + phdr->p_filesz > max_load_addr)
+ max_load_addr = (uintptr_t) edi->ei.image + phdr->p_filesz;
+ break;
+
+ case PT_GNU_EH_FRAME:
+ peh_hdr = phdr + i;
+ break;
+
+ case PT_DYNAMIC:
+ pdyn = phdr + i;
+ break;
+
+#if UNW_TARGET_ARM
+ case PT_ARM_EXIDX:
+ parm_exidx = phdr + i;
+ break;
+#endif
+
+ default:
+ break;
+ }
+ }
+
+ if (!ptxt)
+ return 0;
+
+ load_base = segbase - ptxt->p_vaddr;
+ start_ip += load_base;
+ end_ip += load_base;
+
+ if (peh_hdr)
+ {
+ if (pdyn)
+ {
+ /* For dynamicly linked executables and shared libraries,
+ DT_PLTGOT is the value that data-relative addresses are
+ relative to for that object. We call this the "gp". */
+ Elf_W(Dyn) *dyn = (Elf_W(Dyn) *)(pdyn->p_offset
+ + (char *) edi->ei.image);
+ for (; dyn->d_tag != DT_NULL; ++dyn)
+ if (dyn->d_tag == DT_PLTGOT)
+ {
+ /* Assume that _DYNAMIC is writable and GLIBC has
+ relocated it (true for x86 at least). */
+ edi->di_cache.gp = dyn->d_un.d_ptr;
+ break;
+ }
+ }
+ else
+ /* Otherwise this is a static executable with no _DYNAMIC. Assume
+ that data-relative addresses are relative to 0, i.e.,
+ absolute. */
+ edi->di_cache.gp = 0;
+
+ hdr = (struct dwarf_eh_frame_hdr *) (peh_hdr->p_offset
+ + (char *) edi->ei.image);
+ if (hdr->version != DW_EH_VERSION)
+ {
+ Debug (1, "table `%s' has unexpected version %d\n",
+ path, hdr->version);
+ return -UNW_ENOINFO;
+ }
+
+ a = unw_get_accessors_int (unw_local_addr_space);
+ addr = to_unw_word (&hdr->eh_frame);
+
+ /* Fill in a dummy proc_info structure. We just need to fill in
+ enough to ensure that dwarf_read_encoded_pointer() can do it's
+ job. Since we don't have a procedure-context at this point, all
+ we have to do is fill in the global-pointer. */
+ memset (&pi, 0, sizeof (pi));
+ pi.gp = edi->di_cache.gp;
+
+ /* (Optionally) read eh_frame_ptr: */
+ if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a,
+ &addr, hdr->eh_frame_ptr_enc, &pi,
+ &eh_frame_start, NULL)) < 0)
+ return -UNW_ENOINFO;
+
+ /* (Optionally) read fde_count: */
+ if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a,
+ &addr, hdr->fde_count_enc, &pi,
+ &fde_count, NULL)) < 0)
+ return -UNW_ENOINFO;
+
+ if (hdr->table_enc != (DW_EH_PE_datarel | DW_EH_PE_sdata4))
+ {
+ #if 1
+ abort ();
+ #else
+ unw_word_t eh_frame_end;
+
+ /* If there is no search table or it has an unsupported
+ encoding, fall back on linear search. */
+ if (hdr->table_enc == DW_EH_PE_omit)
+ Debug (4, "EH lacks search table; doing linear search\n");
+ else
+ Debug (4, "EH table has encoding 0x%x; doing linear search\n",
+ hdr->table_enc);
+
+ eh_frame_end = max_load_addr; /* XXX can we do better? */
+
+ if (hdr->fde_count_enc == DW_EH_PE_omit)
+ fde_count = ~0UL;
+ if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit)
+ abort ();
+
+ return linear_search (unw_local_addr_space, ip,
+ eh_frame_start, eh_frame_end, fde_count,
+ pi, need_unwind_info, NULL);
+ #endif
+ }
+
+ edi->di_cache.start_ip = start_ip;
+ edi->di_cache.end_ip = end_ip;
+ edi->di_cache.format = UNW_INFO_FORMAT_REMOTE_TABLE;
+ edi->di_cache.u.rti.name_ptr = 0;
+ /* two 32-bit values (ip_offset/fde_offset) per table-entry: */
+ edi->di_cache.u.rti.table_len = (fde_count * 8) / sizeof (unw_word_t);
+ edi->di_cache.u.rti.table_data = ((load_base + peh_hdr->p_vaddr)
+ + (addr - to_unw_word (edi->ei.image)
+ - peh_hdr->p_offset));
+
+ /* For the binary-search table in the eh_frame_hdr, data-relative
+ means relative to the start of that section... */
+ edi->di_cache.u.rti.segbase = ((load_base + peh_hdr->p_vaddr)
+ + (to_unw_word (hdr) -
+ to_unw_word (edi->ei.image)
+ - peh_hdr->p_offset));
+ found = 1;
+ }
+
+#if UNW_TARGET_ARM
+ if (parm_exidx)
+ {
+ edi->di_arm.format = UNW_INFO_FORMAT_ARM_EXIDX;
+ edi->di_arm.start_ip = start_ip;
+ edi->di_arm.end_ip = end_ip;
+ edi->di_arm.u.rti.name_ptr = to_unw_word (path);
+ edi->di_arm.u.rti.table_data = load_base + parm_exidx->p_vaddr;
+ edi->di_arm.u.rti.table_len = parm_exidx->p_memsz;
+ found = 1;
+ }
+#endif
+
+#ifdef CONFIG_DEBUG_FRAME
+ /* Try .debug_frame. */
+ found = dwarf_find_debug_frame (found, &edi->di_debug, ip, load_base, path,
+ start_ip, end_ip);
+#endif
+
+ return found;
+}
diff --git a/src/pal/src/libunwind/src/dwarf/Gparser.c b/src/pal/src/libunwind/src/dwarf/Gparser.c
new file mode 100644
index 0000000000..7d255aeeaf
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Gparser.c
@@ -0,0 +1,1059 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "dwarf_i.h"
+#include "libunwind_i.h"
+#include <stddef.h>
+#include <limits.h>
+
+#define alloc_reg_state() (mempool_alloc (&dwarf_reg_state_pool))
+#define free_reg_state(rs) (mempool_free (&dwarf_reg_state_pool, rs))
+
+#define DWARF_UNW_CACHE_SIZE(log_size) (1 << log_size)
+#define DWARF_UNW_HASH_SIZE(log_size) (1 << (log_size + 1))
+
+static inline int
+read_regnum (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ unw_word_t *valp, void *arg)
+{
+ int ret;
+
+ if ((ret = dwarf_read_uleb128 (as, a, addr, valp, arg)) < 0)
+ return ret;
+
+ if (*valp >= DWARF_NUM_PRESERVED_REGS)
+ {
+ Debug (1, "Invalid register number %u\n", (unsigned int) *valp);
+ return -UNW_EBADREG;
+ }
+ return 0;
+}
+
+static inline void
+set_reg (dwarf_state_record_t *sr, unw_word_t regnum, dwarf_where_t where,
+ unw_word_t val)
+{
+ sr->rs_current.reg.where[regnum] = where;
+ sr->rs_current.reg.val[regnum] = val;
+}
+
+static inline int
+push_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
+{
+ dwarf_stackable_reg_state_t *old_rs = *rs_stack;
+ if (NULL == (*rs_stack = alloc_reg_state ()))
+ {
+ *rs_stack = old_rs;
+ return -1;
+ }
+ (*rs_stack)->next = old_rs;
+ return 0;
+}
+
+static inline void
+pop_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
+{
+ dwarf_stackable_reg_state_t *old_rs = *rs_stack;
+ *rs_stack = old_rs->next;
+ free_reg_state (old_rs);
+}
+
+static inline void
+empty_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
+{
+ while (*rs_stack)
+ pop_rstate_stack(rs_stack);
+}
+
+/* Run a CFI program to update the register state. */
+static int
+run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr,
+ unw_word_t *ip, unw_word_t end_ip,
+ unw_word_t *addr, unw_word_t end_addr,
+ dwarf_stackable_reg_state_t **rs_stack,
+ struct dwarf_cie_info *dci)
+{
+ unw_addr_space_t as;
+ void *arg;
+
+ if (c->pi.flags & UNW_PI_FLAG_DEBUG_FRAME)
+ {
+ /* .debug_frame CFI is stored in local address space. */
+ as = unw_local_addr_space;
+ arg = NULL;
+ }
+ else
+ {
+ as = c->as;
+ arg = c->as_arg;
+ }
+ unw_accessors_t *a = unw_get_accessors_int (as);
+ int ret = 0;
+
+ while (*ip <= end_ip && *addr < end_addr && ret >= 0)
+ {
+ unw_word_t operand = 0, regnum, val, len;
+ uint8_t u8, op;
+ uint16_t u16;
+ uint32_t u32;
+
+ if ((ret = dwarf_readu8 (as, a, addr, &op, arg)) < 0)
+ break;
+
+ if (op & DWARF_CFA_OPCODE_MASK)
+ {
+ operand = op & DWARF_CFA_OPERAND_MASK;
+ op &= ~DWARF_CFA_OPERAND_MASK;
+ }
+ switch ((dwarf_cfa_t) op)
+ {
+ case DW_CFA_advance_loc:
+ *ip += operand * dci->code_align;
+ Debug (15, "CFA_advance_loc to 0x%lx\n", (long) *ip);
+ break;
+
+ case DW_CFA_advance_loc1:
+ if ((ret = dwarf_readu8 (as, a, addr, &u8, arg)) < 0)
+ break;
+ *ip += u8 * dci->code_align;
+ Debug (15, "CFA_advance_loc1 to 0x%lx\n", (long) *ip);
+ break;
+
+ case DW_CFA_advance_loc2:
+ if ((ret = dwarf_readu16 (as, a, addr, &u16, arg)) < 0)
+ break;
+ *ip += u16 * dci->code_align;
+ Debug (15, "CFA_advance_loc2 to 0x%lx\n", (long) *ip);
+ break;
+
+ case DW_CFA_advance_loc4:
+ if ((ret = dwarf_readu32 (as, a, addr, &u32, arg)) < 0)
+ break;
+ *ip += u32 * dci->code_align;
+ Debug (15, "CFA_advance_loc4 to 0x%lx\n", (long) *ip);
+ break;
+
+ case DW_CFA_MIPS_advance_loc8:
+#ifdef UNW_TARGET_MIPS
+ {
+ uint64_t u64 = 0;
+
+ if ((ret = dwarf_readu64 (as, a, addr, &u64, arg)) < 0)
+ break;
+ *ip += u64 * dci->code_align;
+ Debug (15, "CFA_MIPS_advance_loc8\n");
+ break;
+ }
+#else
+ Debug (1, "DW_CFA_MIPS_advance_loc8 on non-MIPS target\n");
+ ret = -UNW_EINVAL;
+ break;
+#endif
+
+ case DW_CFA_offset:
+ regnum = operand;
+ if (regnum >= DWARF_NUM_PRESERVED_REGS)
+ {
+ Debug (1, "Invalid register number %u in DW_cfa_OFFSET\n",
+ (unsigned int) regnum);
+ ret = -UNW_EBADREG;
+ break;
+ }
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
+ break;
+ set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
+ Debug (15, "CFA_offset r%lu at cfa+0x%lx\n",
+ (long) regnum, (long) (val * dci->data_align));
+ break;
+
+ case DW_CFA_offset_extended:
+ if (((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
+ break;
+ set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
+ Debug (15, "CFA_offset_extended r%lu at cf+0x%lx\n",
+ (long) regnum, (long) (val * dci->data_align));
+ break;
+
+ case DW_CFA_offset_extended_sf:
+ if (((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ || ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0))
+ break;
+ set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
+ Debug (15, "CFA_offset_extended_sf r%lu at cf+0x%lx\n",
+ (long) regnum, (long) (val * dci->data_align));
+ break;
+
+ case DW_CFA_restore:
+ regnum = operand;
+ if (regnum >= DWARF_NUM_PRESERVED_REGS)
+ {
+ Debug (1, "Invalid register number %u in DW_CFA_restore\n",
+ (unsigned int) regnum);
+ ret = -UNW_EINVAL;
+ break;
+ }
+ sr->rs_current.reg.where[regnum] = sr->rs_initial.reg.where[regnum];
+ sr->rs_current.reg.val[regnum] = sr->rs_initial.reg.val[regnum];
+ Debug (15, "CFA_restore r%lu\n", (long) regnum);
+ break;
+
+ case DW_CFA_restore_extended:
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &regnum, arg)) < 0)
+ break;
+ if (regnum >= DWARF_NUM_PRESERVED_REGS)
+ {
+ Debug (1, "Invalid register number %u in "
+ "DW_CFA_restore_extended\n", (unsigned int) regnum);
+ ret = -UNW_EINVAL;
+ break;
+ }
+ sr->rs_current.reg.where[regnum] = sr->rs_initial.reg.where[regnum];
+ sr->rs_current.reg.val[regnum] = sr->rs_initial.reg.val[regnum];
+ Debug (15, "CFA_restore_extended r%lu\n", (long) regnum);
+ break;
+
+ case DW_CFA_nop:
+ break;
+
+ case DW_CFA_set_loc:
+ if ((ret = dwarf_read_encoded_pointer (as, a, addr, dci->fde_encoding,
+ &c->pi, ip,
+ arg)) < 0)
+ break;
+ Debug (15, "CFA_set_loc to 0x%lx\n", (long) *ip);
+ break;
+
+ case DW_CFA_undefined:
+ if ((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ break;
+ set_reg (sr, regnum, DWARF_WHERE_UNDEF, 0);
+ Debug (15, "CFA_undefined r%lu\n", (long) regnum);
+ break;
+
+ case DW_CFA_same_value:
+ if ((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ break;
+ set_reg (sr, regnum, DWARF_WHERE_SAME, 0);
+ Debug (15, "CFA_same_value r%lu\n", (long) regnum);
+ break;
+
+ case DW_CFA_register:
+ if (((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
+ break;
+ set_reg (sr, regnum, DWARF_WHERE_REG, val);
+ Debug (15, "CFA_register r%lu to r%lu\n", (long) regnum, (long) val);
+ break;
+
+ case DW_CFA_remember_state:
+ if (push_rstate_stack(rs_stack) < 0)
+ {
+ Debug (1, "Out of memory in DW_CFA_remember_state\n");
+ ret = -UNW_ENOMEM;
+ break;
+ }
+ (*rs_stack)->state = sr->rs_current;
+ Debug (15, "CFA_remember_state\n");
+ break;
+
+ case DW_CFA_restore_state:
+ if (!*rs_stack)
+ {
+ Debug (1, "register-state stack underflow\n");
+ ret = -UNW_EINVAL;
+ break;
+ }
+ sr->rs_current = (*rs_stack)->state;
+ pop_rstate_stack(rs_stack);
+ Debug (15, "CFA_restore_state\n");
+ break;
+
+ case DW_CFA_def_cfa:
+ if (((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
+ break;
+ set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
+ set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */
+ Debug (15, "CFA_def_cfa r%lu+0x%lx\n", (long) regnum, (long) val);
+ break;
+
+ case DW_CFA_def_cfa_sf:
+ if (((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ || ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0))
+ break;
+ set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
+ set_reg (sr, DWARF_CFA_OFF_COLUMN, 0,
+ val * dci->data_align); /* factored! */
+ Debug (15, "CFA_def_cfa_sf r%lu+0x%lx\n",
+ (long) regnum, (long) (val * dci->data_align));
+ break;
+
+ case DW_CFA_def_cfa_register:
+ if ((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ break;
+ set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
+ Debug (15, "CFA_def_cfa_register r%lu\n", (long) regnum);
+ break;
+
+ case DW_CFA_def_cfa_offset:
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
+ break;
+ set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */
+ Debug (15, "CFA_def_cfa_offset 0x%lx\n", (long) val);
+ break;
+
+ case DW_CFA_def_cfa_offset_sf:
+ if ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)
+ break;
+ set_reg (sr, DWARF_CFA_OFF_COLUMN, 0,
+ val * dci->data_align); /* factored! */
+ Debug (15, "CFA_def_cfa_offset_sf 0x%lx\n",
+ (long) (val * dci->data_align));
+ break;
+
+ case DW_CFA_def_cfa_expression:
+ /* Save the address of the DW_FORM_block for later evaluation. */
+ set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_EXPR, *addr);
+
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
+ break;
+
+ Debug (15, "CFA_def_cfa_expr @ 0x%lx [%lu bytes]\n",
+ (long) *addr, (long) len);
+ *addr += len;
+ break;
+
+ case DW_CFA_expression:
+ if ((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ break;
+
+ /* Save the address of the DW_FORM_block for later evaluation. */
+ set_reg (sr, regnum, DWARF_WHERE_EXPR, *addr);
+
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
+ break;
+
+ Debug (15, "CFA_expression r%lu @ 0x%lx [%lu bytes]\n",
+ (long) regnum, (long) addr, (long) len);
+ *addr += len;
+ break;
+
+ case DW_CFA_val_expression:
+ if ((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ break;
+
+ /* Save the address of the DW_FORM_block for later evaluation. */
+ set_reg (sr, regnum, DWARF_WHERE_VAL_EXPR, *addr);
+
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
+ break;
+
+ Debug (15, "CFA_val_expression r%lu @ 0x%lx [%lu bytes]\n",
+ (long) regnum, (long) addr, (long) len);
+ *addr += len;
+ break;
+
+ case DW_CFA_GNU_args_size:
+ if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
+ break;
+ sr->args_size = val;
+ Debug (15, "CFA_GNU_args_size %lu\n", (long) val);
+ break;
+
+ case DW_CFA_GNU_negative_offset_extended:
+ /* A comment in GCC says that this is obsoleted by
+ DW_CFA_offset_extended_sf, but that it's used by older
+ PowerPC code. */
+ if (((ret = read_regnum (as, a, addr, &regnum, arg)) < 0)
+ || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
+ break;
+ set_reg (sr, regnum, DWARF_WHERE_CFAREL, -(val * dci->data_align));
+ Debug (15, "CFA_GNU_negative_offset_extended cfa+0x%lx\n",
+ (long) -(val * dci->data_align));
+ break;
+
+ case DW_CFA_GNU_window_save:
+#ifdef UNW_TARGET_SPARC
+ /* This is a special CFA to handle all 16 windowed registers
+ on SPARC. */
+ for (regnum = 16; regnum < 32; ++regnum)
+ set_reg (sr, regnum, DWARF_WHERE_CFAREL,
+ (regnum - 16) * sizeof (unw_word_t));
+ Debug (15, "CFA_GNU_window_save\n");
+ break;
+#else
+ /* FALL THROUGH */
+#endif
+ case DW_CFA_lo_user:
+ case DW_CFA_hi_user:
+ Debug (1, "Unexpected CFA opcode 0x%x\n", op);
+ ret = -UNW_EINVAL;
+ break;
+ }
+ }
+
+ if (ret > 0)
+ ret = 0;
+ return ret;
+}
+
+static int
+fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip)
+{
+ int ret, dynamic = 1;
+
+ /* The 'ip' can point either to the previous or next instruction
+ depending on what type of frame we have: normal call or a place
+ to resume execution (e.g. after signal frame).
+
+ For a normal call frame we need to back up so we point within the
+ call itself; this is important because a) the call might be the
+ very last instruction of the function and the edge of the FDE,
+ and b) so that run_cfi_program() runs locations up to the call
+ but not more.
+
+ For signal frame, we need to do the exact opposite and look
+ up using the current 'ip' value. That is where execution will
+ continue, and it's important we get this right, as 'ip' could be
+ right at the function entry and hence FDE edge, or at instruction
+ that manipulates CFA (push/pop). */
+ if (c->use_prev_instr)
+ --ip;
+
+ memset (&c->pi, 0, sizeof (c->pi));
+
+ /* check dynamic info first --- it overrides everything else */
+ ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, 1,
+ c->as_arg);
+ if (ret == -UNW_ENOINFO)
+ {
+ dynamic = 0;
+ if ((ret = tdep_find_proc_info (c, ip, 1)) < 0)
+ return ret;
+ }
+
+ if (c->pi.format != UNW_INFO_FORMAT_DYNAMIC
+ && c->pi.format != UNW_INFO_FORMAT_TABLE
+ && c->pi.format != UNW_INFO_FORMAT_REMOTE_TABLE)
+ return -UNW_ENOINFO;
+
+ c->pi_valid = 1;
+ c->pi_is_dynamic = dynamic;
+
+ /* Let system/machine-dependent code determine frame-specific attributes. */
+ if (ret >= 0)
+ tdep_fetch_frame (c, ip, 1);
+
+ return ret;
+}
+
+static int
+parse_dynamic (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr)
+{
+ Debug (1, "Not yet implemented\n");
+ return -UNW_ENOINFO;
+}
+
+static inline void
+put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi)
+{
+ if (c->pi_is_dynamic)
+ unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
+ else if (pi->unwind_info && pi->format == UNW_INFO_FORMAT_TABLE)
+ {
+ mempool_free (&dwarf_cie_info_pool, pi->unwind_info);
+ pi->unwind_info = NULL;
+ }
+ c->pi_valid = 0;
+}
+
+static inline int
+setup_fde (struct dwarf_cursor *c, dwarf_state_record_t *sr)
+{
+ int i, ret;
+
+ assert (c->pi_valid);
+
+ memset (sr, 0, sizeof (*sr));
+ for (i = 0; i < DWARF_NUM_PRESERVED_REGS + 2; ++i)
+ set_reg (sr, i, DWARF_WHERE_SAME, 0);
+
+ struct dwarf_cie_info *dci = c->pi.unwind_info;
+ sr->rs_current.ret_addr_column = dci->ret_addr_column;
+ unw_word_t addr = dci->cie_instr_start;
+ unw_word_t curr_ip = 0;
+ dwarf_stackable_reg_state_t *rs_stack = NULL;
+ ret = run_cfi_program (c, sr, &curr_ip, ~(unw_word_t) 0, &addr,
+ dci->cie_instr_end,
+ &rs_stack, dci);
+ empty_rstate_stack(&rs_stack);
+ if (ret < 0)
+ return ret;
+
+ memcpy (&sr->rs_initial, &sr->rs_current, sizeof (sr->rs_initial));
+ return 0;
+}
+
+static inline int
+parse_fde (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr)
+{
+ int ret;
+ struct dwarf_cie_info *dci = c->pi.unwind_info;
+ unw_word_t addr = dci->fde_instr_start;
+ unw_word_t curr_ip = c->pi.start_ip;
+ dwarf_stackable_reg_state_t *rs_stack = NULL;
+ /* Process up to current `ip` for signal frame and `ip - 1` for normal call frame
+ See `c->use_prev_instr` use in `fetch_proc_info` for details. */
+ ret = run_cfi_program (c, sr, &curr_ip, ip - c->use_prev_instr, &addr, dci->fde_instr_end,
+ &rs_stack, dci);
+ empty_rstate_stack(&rs_stack);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+HIDDEN int
+dwarf_flush_rs_cache (struct dwarf_rs_cache *cache)
+{
+ int i;
+
+ if (cache->log_size == DWARF_DEFAULT_LOG_UNW_CACHE_SIZE
+ || !cache->hash) {
+ cache->hash = cache->default_hash;
+ cache->buckets = cache->default_buckets;
+ cache->links = cache->default_links;
+ cache->log_size = DWARF_DEFAULT_LOG_UNW_CACHE_SIZE;
+ } else {
+ if (cache->hash && cache->hash != cache->default_hash)
+ munmap(cache->hash, DWARF_UNW_HASH_SIZE(cache->prev_log_size)
+ * sizeof (cache->hash[0]));
+ if (cache->buckets && cache->buckets != cache->default_buckets)
+ munmap(cache->buckets, DWARF_UNW_CACHE_SIZE(cache->prev_log_size)
+ * sizeof (cache->buckets[0]));
+ if (cache->links && cache->links != cache->default_links)
+ munmap(cache->links, DWARF_UNW_CACHE_SIZE(cache->prev_log_size)
+ * sizeof (cache->links[0]));
+ GET_MEMORY(cache->hash, DWARF_UNW_HASH_SIZE(cache->log_size)
+ * sizeof (cache->hash[0]));
+ GET_MEMORY(cache->buckets, DWARF_UNW_CACHE_SIZE(cache->log_size)
+ * sizeof (cache->buckets[0]));
+ GET_MEMORY(cache->links, DWARF_UNW_CACHE_SIZE(cache->log_size)
+ * sizeof (cache->links[0]));
+ if (!cache->hash || !cache->buckets || !cache->links)
+ {
+ Debug (1, "Unable to allocate cache memory");
+ return -UNW_ENOMEM;
+ }
+ cache->prev_log_size = cache->log_size;
+ }
+
+ cache->rr_head = 0;
+
+ for (i = 0; i < DWARF_UNW_CACHE_SIZE(cache->log_size); ++i)
+ {
+ cache->links[i].coll_chain = -1;
+ cache->links[i].ip = 0;
+ cache->links[i].valid = 0;
+ }
+ for (i = 0; i< DWARF_UNW_HASH_SIZE(cache->log_size); ++i)
+ cache->hash[i] = -1;
+
+ return 0;
+}
+
+static inline struct dwarf_rs_cache *
+get_rs_cache (unw_addr_space_t as, intrmask_t *saved_maskp)
+{
+ struct dwarf_rs_cache *cache = &as->global_cache;
+ unw_caching_policy_t caching = as->caching_policy;
+
+ if (caching == UNW_CACHE_NONE)
+ return NULL;
+
+#if defined(HAVE___THREAD) && HAVE___THREAD
+ if (likely (caching == UNW_CACHE_PER_THREAD))
+ {
+ static __thread struct dwarf_rs_cache tls_cache __attribute__((tls_model("initial-exec")));
+ Debug (16, "using TLS cache\n");
+ cache = &tls_cache;
+ }
+ else
+#else
+ if (likely (caching == UNW_CACHE_GLOBAL))
+#endif
+ {
+ Debug (16, "acquiring lock\n");
+ lock_acquire (&cache->lock, *saved_maskp);
+ }
+
+ if ((atomic_read (&as->cache_generation) != atomic_read (&cache->generation))
+ || !cache->hash)
+ {
+ /* cache_size is only set in the global_cache, copy it over before flushing */
+ cache->log_size = as->global_cache.log_size;
+ if (dwarf_flush_rs_cache (cache) < 0)
+ return NULL;
+ cache->generation = as->cache_generation;
+ }
+
+ return cache;
+}
+
+static inline void
+put_rs_cache (unw_addr_space_t as, struct dwarf_rs_cache *cache,
+ intrmask_t *saved_maskp)
+{
+ assert (as->caching_policy != UNW_CACHE_NONE);
+
+ Debug (16, "unmasking signals/interrupts and releasing lock\n");
+ if (likely (as->caching_policy == UNW_CACHE_GLOBAL))
+ lock_release (&cache->lock, *saved_maskp);
+}
+
+static inline unw_hash_index_t CONST_ATTR
+hash (unw_word_t ip, unsigned short log_size)
+{
+ /* based on (sqrt(5)/2-1)*2^64 */
+# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL)
+
+ return ip * magic >> ((sizeof(unw_word_t) * 8) - (log_size + 1));
+}
+
+static inline long
+cache_match (struct dwarf_rs_cache *cache, unsigned short index, unw_word_t ip)
+{
+ return (cache->links[index].valid && (ip == cache->links[index].ip));
+}
+
+static dwarf_reg_state_t *
+rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c)
+{
+ unsigned short index;
+ unw_word_t ip = c->ip;
+
+ if (c->hint > 0)
+ {
+ index = c->hint - 1;
+ if (cache_match (cache, index, ip))
+ return &cache->buckets[index];
+ }
+
+ for (index = cache->hash[hash (ip, cache->log_size)];
+ index < DWARF_UNW_CACHE_SIZE(cache->log_size);
+ index = cache->links[index].coll_chain)
+ {
+ if (cache_match (cache, index, ip))
+ return &cache->buckets[index];
+ }
+ return NULL;
+}
+
+static inline dwarf_reg_state_t *
+rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
+{
+ unw_hash_index_t index;
+ unsigned short head;
+
+ head = cache->rr_head;
+ cache->rr_head = (head + 1) & (DWARF_UNW_CACHE_SIZE(cache->log_size) - 1);
+
+ /* remove the old rs from the hash table (if it's there): */
+ if (cache->links[head].ip)
+ {
+ unsigned short *pindex;
+ for (pindex = &cache->hash[hash (cache->links[head].ip, cache->log_size)];
+ *pindex < DWARF_UNW_CACHE_SIZE(cache->log_size);
+ pindex = &cache->links[*pindex].coll_chain)
+ {
+ if (*pindex == head)
+ {
+ *pindex = cache->links[*pindex].coll_chain;
+ break;
+ }
+ }
+ }
+
+ /* enter new rs in the hash table */
+ index = hash (c->ip, cache->log_size);
+ cache->links[head].coll_chain = cache->hash[index];
+ cache->hash[index] = head;
+
+ cache->links[head].ip = c->ip;
+ cache->links[head].valid = 1;
+ cache->links[head].signal_frame = tdep_cache_frame(c);
+ return cache->buckets + head;
+}
+
+static int
+create_state_record_for (struct dwarf_cursor *c, dwarf_state_record_t *sr,
+ unw_word_t ip)
+{
+ int ret;
+ switch (c->pi.format)
+ {
+ case UNW_INFO_FORMAT_TABLE:
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+ if ((ret = setup_fde(c, sr)) < 0)
+ return ret;
+ ret = parse_fde (c, ip, sr);
+ break;
+
+ case UNW_INFO_FORMAT_DYNAMIC:
+ ret = parse_dynamic (c, ip, sr);
+ break;
+
+ default:
+ Debug (1, "Unexpected unwind-info format %d\n", c->pi.format);
+ ret = -UNW_EINVAL;
+ }
+ return ret;
+}
+
+static inline int
+eval_location_expr (struct dwarf_cursor *c, unw_addr_space_t as,
+ unw_accessors_t *a, unw_word_t addr,
+ dwarf_loc_t *locp, void *arg)
+{
+ int ret, is_register;
+ unw_word_t len, val;
+
+ /* read the length of the expression: */
+ if ((ret = dwarf_read_uleb128 (as, a, &addr, &len, arg)) < 0)
+ return ret;
+
+ /* evaluate the expression: */
+ if ((ret = dwarf_eval_expr (c, &addr, len, &val, &is_register)) < 0)
+ return ret;
+
+ if (is_register)
+ *locp = DWARF_REG_LOC (c, dwarf_to_unw_regnum (val));
+ else
+ *locp = DWARF_MEM_LOC (c, val);
+
+ return 0;
+}
+
+static int
+apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
+{
+ unw_word_t regnum, addr, cfa, ip;
+ unw_word_t prev_ip, prev_cfa;
+ unw_addr_space_t as;
+ dwarf_loc_t cfa_loc;
+ unw_accessors_t *a;
+ int i, ret;
+ void *arg;
+
+ prev_ip = c->ip;
+ prev_cfa = c->cfa;
+
+ as = c->as;
+ arg = c->as_arg;
+ a = unw_get_accessors_int (as);
+
+ /* Evaluate the CFA first, because it may be referred to by other
+ expressions. */
+
+ if (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
+ {
+ /* CFA is equal to [reg] + offset: */
+
+ /* As a special-case, if the stack-pointer is the CFA and the
+ stack-pointer wasn't saved, popping the CFA implicitly pops
+ the stack-pointer as well. */
+ if ((rs->reg.val[DWARF_CFA_REG_COLUMN] == UNW_TDEP_SP)
+ && (UNW_TDEP_SP < ARRAY_SIZE(rs->reg.val))
+ && (rs->reg.where[UNW_TDEP_SP] == DWARF_WHERE_SAME))
+ cfa = c->cfa;
+ else
+ {
+ regnum = dwarf_to_unw_regnum (rs->reg.val[DWARF_CFA_REG_COLUMN]);
+ if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0)
+ return ret;
+ }
+ cfa += rs->reg.val[DWARF_CFA_OFF_COLUMN];
+ }
+ else
+ {
+ /* CFA is equal to EXPR: */
+
+ assert (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_EXPR);
+
+ addr = rs->reg.val[DWARF_CFA_REG_COLUMN];
+ if ((ret = eval_location_expr (c, as, a, addr, &cfa_loc, arg)) < 0)
+ return ret;
+ /* the returned location better be a memory location... */
+ if (DWARF_IS_REG_LOC (cfa_loc))
+ return -UNW_EBADFRAME;
+ cfa = DWARF_GET_LOC (cfa_loc);
+ }
+
+ dwarf_loc_t new_loc[DWARF_NUM_PRESERVED_REGS];
+ memcpy(new_loc, c->loc, sizeof(new_loc));
+
+ for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ {
+ switch ((dwarf_where_t) rs->reg.where[i])
+ {
+ case DWARF_WHERE_UNDEF:
+ new_loc[i] = DWARF_NULL_LOC;
+ break;
+
+ case DWARF_WHERE_SAME:
+ break;
+
+ case DWARF_WHERE_CFAREL:
+ new_loc[i] = DWARF_MEM_LOC (c, cfa + rs->reg.val[i]);
+ break;
+
+ case DWARF_WHERE_REG:
+ new_loc[i] = DWARF_REG_LOC (c, dwarf_to_unw_regnum (rs->reg.val[i]));
+ break;
+
+ case DWARF_WHERE_EXPR:
+ addr = rs->reg.val[i];
+ if ((ret = eval_location_expr (c, as, a, addr, new_loc + i, arg)) < 0)
+ return ret;
+ break;
+
+ case DWARF_WHERE_VAL_EXPR:
+ addr = rs->reg.val[i];
+ if ((ret = eval_location_expr (c, as, a, addr, new_loc + i, arg)) < 0)
+ return ret;
+ new_loc[i] = DWARF_VAL_LOC (c, DWARF_GET_LOC (new_loc[i]));
+ break;
+ }
+ }
+
+ memcpy(c->loc, new_loc, sizeof(new_loc));
+
+ c->cfa = cfa;
+ /* DWARF spec says undefined return address location means end of stack. */
+ if (DWARF_IS_NULL_LOC (c->loc[rs->ret_addr_column]))
+ {
+ c->ip = 0;
+ ret = 0;
+ }
+ else
+ {
+ ret = dwarf_get (c, c->loc[rs->ret_addr_column], &ip);
+ if (ret < 0)
+ return ret;
+ c->ip = ip;
+ ret = 1;
+ }
+
+ /* XXX: check for ip to be code_aligned */
+ if (c->ip == prev_ip && c->cfa == prev_cfa)
+ {
+ Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n",
+ __FUNCTION__, (long) c->ip);
+ return -UNW_EBADFRAME;
+ }
+
+ if (c->stash_frames)
+ tdep_stash_frame (c, rs);
+
+ return ret;
+}
+
+/* Find the saved locations. */
+static int
+find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
+{
+ dwarf_reg_state_t *rs;
+ struct dwarf_rs_cache *cache;
+ int ret = 0;
+ intrmask_t saved_mask;
+
+ if ((cache = get_rs_cache(c->as, &saved_mask)) &&
+ (rs = rs_lookup(cache, c)))
+ {
+ /* update hint; no locking needed: single-word writes are atomic */
+ unsigned short index = rs - cache->buckets;
+ c->use_prev_instr = ! cache->links[index].signal_frame;
+ memcpy (&sr->rs_current, rs, sizeof (*rs));
+ }
+ else
+ {
+ ret = fetch_proc_info (c, c->ip);
+ int next_use_prev_instr = c->use_prev_instr;
+ if (ret >= 0)
+ {
+ /* Update use_prev_instr for the next frame. */
+ assert(c->pi.unwind_info);
+ struct dwarf_cie_info *dci = c->pi.unwind_info;
+ next_use_prev_instr = ! dci->signal_frame;
+ ret = create_state_record_for (c, sr, c->ip);
+ }
+ put_unwind_info (c, &c->pi);
+ c->use_prev_instr = next_use_prev_instr;
+
+ if (cache && ret >= 0)
+ {
+ rs = rs_new (cache, c);
+ cache->links[rs - cache->buckets].hint = 0;
+ memcpy(rs, &sr->rs_current, sizeof(*rs));
+ }
+ }
+
+ unsigned short index = -1;
+ if (cache)
+ {
+ put_rs_cache (c->as, cache, &saved_mask);
+ if (rs)
+ {
+ index = rs - cache->buckets;
+ c->hint = cache->links[index].hint;
+ cache->links[c->prev_rs].hint = index + 1;
+ c->prev_rs = index;
+ }
+ }
+ if (ret < 0)
+ return ret;
+ if (cache)
+ tdep_reuse_frame (c, cache->links[index].signal_frame);
+ return 0;
+}
+
+/* The function finds the saved locations and applies the register
+ state as well. */
+HIDDEN int
+dwarf_step (struct dwarf_cursor *c)
+{
+ int ret;
+ dwarf_state_record_t sr;
+ if ((ret = find_reg_state (c, &sr)) < 0)
+ return ret;
+ return apply_reg_state (c, &sr.rs_current);
+}
+
+HIDDEN int
+dwarf_make_proc_info (struct dwarf_cursor *c)
+{
+#if 0
+ if (c->as->caching_policy == UNW_CACHE_NONE
+ || get_cached_proc_info (c) < 0)
+#endif
+ /* Need to check if current frame contains
+ args_size, and set cursor appropriately. Only
+ needed for unw_resume */
+ dwarf_state_record_t sr;
+ int ret;
+
+ /* Lookup it up the slow way... */
+ ret = fetch_proc_info (c, c->ip);
+ if (ret >= 0)
+ ret = create_state_record_for (c, &sr, c->ip);
+ put_unwind_info (c, &c->pi);
+ if (ret < 0)
+ return ret;
+ c->args_size = sr.args_size;
+
+ return 0;
+}
+
+static int
+dwarf_reg_states_dynamic_iterate(struct dwarf_cursor *c,
+ unw_reg_states_callback cb,
+ void *token)
+{
+ Debug (1, "Not yet implemented\n");
+ return -UNW_ENOINFO;
+}
+
+static int
+dwarf_reg_states_table_iterate(struct dwarf_cursor *c,
+ unw_reg_states_callback cb,
+ void *token)
+{
+ dwarf_state_record_t sr;
+ int ret = setup_fde(c, &sr);
+ struct dwarf_cie_info *dci = c->pi.unwind_info;
+ unw_word_t addr = dci->fde_instr_start;
+ unw_word_t curr_ip = c->pi.start_ip;
+ dwarf_stackable_reg_state_t *rs_stack = NULL;
+ while (ret >= 0 && curr_ip < c->pi.end_ip && addr < dci->fde_instr_end)
+ {
+ unw_word_t prev_ip = curr_ip;
+ ret = run_cfi_program (c, &sr, &curr_ip, prev_ip, &addr, dci->fde_instr_end,
+ &rs_stack, dci);
+ if (ret >= 0 && prev_ip < curr_ip)
+ ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), prev_ip, curr_ip);
+ }
+ empty_rstate_stack(&rs_stack);
+#if defined(NEED_LAST_IP)
+ if (ret >= 0 && curr_ip < c->pi.last_ip)
+ /* report the dead zone after the procedure ends */
+ ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), curr_ip, c->pi.last_ip);
+#else
+ if (ret >= 0 && curr_ip < c->pi.end_ip)
+ /* report for whatever is left before procedure end */
+ ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), curr_ip, c->pi.end_ip);
+#endif
+ return ret;
+}
+
+HIDDEN int
+dwarf_reg_states_iterate(struct dwarf_cursor *c,
+ unw_reg_states_callback cb,
+ void *token)
+{
+ int ret = fetch_proc_info (c, c->ip);
+ int next_use_prev_instr = c->use_prev_instr;
+ if (ret >= 0)
+ {
+ /* Update use_prev_instr for the next frame. */
+ assert(c->pi.unwind_info);
+ struct dwarf_cie_info *dci = c->pi.unwind_info;
+ next_use_prev_instr = ! dci->signal_frame;
+ switch (c->pi.format)
+ {
+ case UNW_INFO_FORMAT_TABLE:
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+ ret = dwarf_reg_states_table_iterate(c, cb, token);
+ break;
+
+ case UNW_INFO_FORMAT_DYNAMIC:
+ ret = dwarf_reg_states_dynamic_iterate (c, cb, token);
+ break;
+
+ default:
+ Debug (1, "Unexpected unwind-info format %d\n", c->pi.format);
+ ret = -UNW_EINVAL;
+ }
+ }
+ put_unwind_info (c, &c->pi);
+ c->use_prev_instr = next_use_prev_instr;
+ return ret;
+}
+
+HIDDEN int
+dwarf_apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
+{
+ return apply_reg_state(c, rs);
+}
diff --git a/src/pal/src/libunwind/src/dwarf/Gpe.c b/src/pal/src/libunwind/src/dwarf/Gpe.c
new file mode 100644
index 0000000000..a0e37ba232
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Gpe.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "dwarf_i.h"
+#include "libunwind_i.h"
+
+#include <assert.h>
+
+HIDDEN int
+dwarf_read_encoded_pointer (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, unsigned char encoding,
+ const unw_proc_info_t *pi,
+ unw_word_t *valp, void *arg)
+{
+ return dwarf_read_encoded_pointer_inlined (as, a, addr, encoding,
+ pi, valp, arg);
+}
diff --git a/src/pal/src/libunwind/src/dwarf/Lexpr.c b/src/pal/src/libunwind/src/dwarf/Lexpr.c
new file mode 100644
index 0000000000..245970c9e3
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Lexpr.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gexpr.c"
+#endif
diff --git a/src/pal/src/libunwind/src/dwarf/Lfde.c b/src/pal/src/libunwind/src/dwarf/Lfde.c
new file mode 100644
index 0000000000..e779e8f192
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Lfde.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gfde.c"
+#endif
diff --git a/src/pal/src/libunwind/src/dwarf/Lfind_proc_info-lsb.c b/src/pal/src/libunwind/src/dwarf/Lfind_proc_info-lsb.c
new file mode 100644
index 0000000000..27a5eeac18
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Lfind_proc_info-lsb.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gfind_proc_info-lsb.c"
+#endif
diff --git a/src/pal/src/libunwind/src/dwarf/Lfind_unwind_table.c b/src/pal/src/libunwind/src/dwarf/Lfind_unwind_table.c
new file mode 100644
index 0000000000..68e269f1d7
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Lfind_unwind_table.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gfind_unwind_table.c"
+#endif
diff --git a/src/pal/src/libunwind/src/dwarf/Lparser.c b/src/pal/src/libunwind/src/dwarf/Lparser.c
new file mode 100644
index 0000000000..f23aaf48e9
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Lparser.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gparser.c"
+#endif
diff --git a/src/pal/src/libunwind/src/dwarf/Lpe.c b/src/pal/src/libunwind/src/dwarf/Lpe.c
new file mode 100644
index 0000000000..a672358f06
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/Lpe.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gpe.c"
+#endif
diff --git a/src/pal/src/libunwind/src/dwarf/global.c b/src/pal/src/libunwind/src/dwarf/global.c
new file mode 100644
index 0000000000..7098507142
--- /dev/null
+++ b/src/pal/src/libunwind/src/dwarf/global.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "dwarf_i.h"
+
+HIDDEN struct mempool dwarf_reg_state_pool;
+HIDDEN struct mempool dwarf_cie_info_pool;
+
+HIDDEN int
+dwarf_init (void)
+{
+ mempool_init (&dwarf_reg_state_pool, sizeof (dwarf_stackable_reg_state_t), 0);
+ mempool_init (&dwarf_cie_info_pool, sizeof (struct dwarf_cie_info), 0);
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/elf32.c b/src/pal/src/libunwind/src/elf32.c
new file mode 100644
index 0000000000..a70bb58f24
--- /dev/null
+++ b/src/pal/src/libunwind/src/elf32.c
@@ -0,0 +1,4 @@
+#ifndef UNW_REMOTE_ONLY
+# include "elf32.h"
+# include "elfxx.c"
+#endif
diff --git a/src/pal/src/libunwind/src/elf32.h b/src/pal/src/libunwind/src/elf32.h
new file mode 100644
index 0000000000..2c7bca4c9d
--- /dev/null
+++ b/src/pal/src/libunwind/src/elf32.h
@@ -0,0 +1,9 @@
+#ifndef elf32_h
+#define elf32_h
+
+#ifndef ELF_CLASS
+#define ELF_CLASS ELFCLASS32
+#endif
+#include "elfxx.h"
+
+#endif /* elf32_h */
diff --git a/src/pal/src/libunwind/src/elf64.c b/src/pal/src/libunwind/src/elf64.c
new file mode 100644
index 0000000000..195b887948
--- /dev/null
+++ b/src/pal/src/libunwind/src/elf64.c
@@ -0,0 +1,4 @@
+#ifndef UNW_REMOTE_ONLY
+# include "elf64.h"
+# include "elfxx.c"
+#endif
diff --git a/src/pal/src/libunwind/src/elf64.h b/src/pal/src/libunwind/src/elf64.h
new file mode 100644
index 0000000000..091fba8e1f
--- /dev/null
+++ b/src/pal/src/libunwind/src/elf64.h
@@ -0,0 +1,9 @@
+#ifndef elf64_h
+#define elf64_h
+
+#ifndef ELF_CLASS
+#define ELF_CLASS ELFCLASS64
+#endif
+#include "elfxx.h"
+
+#endif /* elf64_h */
diff --git a/src/pal/src/libunwind/src/elfxx.c b/src/pal/src/libunwind/src/elfxx.c
new file mode 100644
index 0000000000..b03dfcb734
--- /dev/null
+++ b/src/pal/src/libunwind/src/elfxx.c
@@ -0,0 +1,481 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+#include <stdio.h>
+#include <sys/param.h>
+
+#ifdef HAVE_LZMA
+#include <lzma.h>
+#endif /* HAVE_LZMA */
+
+static Elf_W (Shdr)*
+elf_w (section_table) (struct elf_image *ei)
+{
+ Elf_W (Ehdr) *ehdr = ei->image;
+ Elf_W (Off) soff;
+
+ soff = ehdr->e_shoff;
+ if (soff + ehdr->e_shnum * ehdr->e_shentsize > ei->size)
+ {
+ Debug (1, "section table outside of image? (%lu > %lu)\n",
+ (unsigned long) (soff + ehdr->e_shnum * ehdr->e_shentsize),
+ (unsigned long) ei->size);
+ return NULL;
+ }
+
+ return (Elf_W (Shdr) *) ((char *) ei->image + soff);
+}
+
+static char*
+elf_w (string_table) (struct elf_image *ei, int section)
+{
+ Elf_W (Ehdr) *ehdr = ei->image;
+ Elf_W (Off) soff, str_soff;
+ Elf_W (Shdr) *str_shdr;
+
+ /* this offset is assumed to be OK */
+ soff = ehdr->e_shoff;
+
+ str_soff = soff + (section * ehdr->e_shentsize);
+ if (str_soff + ehdr->e_shentsize > ei->size)
+ {
+ Debug (1, "string shdr table outside of image? (%lu > %lu)\n",
+ (unsigned long) (str_soff + ehdr->e_shentsize),
+ (unsigned long) ei->size);
+ return NULL;
+ }
+ str_shdr = (Elf_W (Shdr) *) ((char *) ei->image + str_soff);
+
+ if (str_shdr->sh_offset + str_shdr->sh_size > ei->size)
+ {
+ Debug (1, "string table outside of image? (%lu > %lu)\n",
+ (unsigned long) (str_shdr->sh_offset + str_shdr->sh_size),
+ (unsigned long) ei->size);
+ return NULL;
+ }
+
+ Debug (16, "strtab=0x%lx\n", (long) str_shdr->sh_offset);
+ return ei->image + str_shdr->sh_offset;
+}
+
+static int
+elf_w (lookup_symbol) (unw_addr_space_t as,
+ unw_word_t ip, struct elf_image *ei,
+ Elf_W (Addr) load_offset,
+ char *buf, size_t buf_len, Elf_W (Addr) *min_dist)
+{
+ size_t syment_size;
+ Elf_W (Ehdr) *ehdr = ei->image;
+ Elf_W (Sym) *sym, *symtab, *symtab_end;
+ Elf_W (Shdr) *shdr;
+ Elf_W (Addr) val;
+ int i, ret = -UNW_ENOINFO;
+ char *strtab;
+
+ if (!elf_w (valid_object) (ei))
+ return -UNW_ENOINFO;
+
+ shdr = elf_w (section_table) (ei);
+ if (!shdr)
+ return -UNW_ENOINFO;
+
+ for (i = 0; i < ehdr->e_shnum; ++i)
+ {
+ switch (shdr->sh_type)
+ {
+ case SHT_SYMTAB:
+ case SHT_DYNSYM:
+ symtab = (Elf_W (Sym) *) ((char *) ei->image + shdr->sh_offset);
+ symtab_end = (Elf_W (Sym) *) ((char *) symtab + shdr->sh_size);
+ syment_size = shdr->sh_entsize;
+
+ strtab = elf_w (string_table) (ei, shdr->sh_link);
+ if (!strtab)
+ break;
+
+ Debug (16, "symtab=0x%lx[%d]\n",
+ (long) shdr->sh_offset, shdr->sh_type);
+
+ for (sym = symtab;
+ sym < symtab_end;
+ sym = (Elf_W (Sym) *) ((char *) sym + syment_size))
+ {
+ if (ELF_W (ST_TYPE) (sym->st_info) == STT_FUNC
+ && sym->st_shndx != SHN_UNDEF)
+ {
+ val = sym->st_value;
+ if (sym->st_shndx != SHN_ABS)
+ val += load_offset;
+ if (tdep_get_func_addr (as, val, &val) < 0)
+ continue;
+ Debug (16, "0x%016lx info=0x%02x %s\n",
+ (long) val, sym->st_info, strtab + sym->st_name);
+
+ if ((Elf_W (Addr)) (ip - val) < *min_dist)
+ {
+ *min_dist = (Elf_W (Addr)) (ip - val);
+ strncpy (buf, strtab + sym->st_name, buf_len);
+ buf[buf_len - 1] = '\0';
+ ret = (strlen (strtab + sym->st_name) >= buf_len
+ ? -UNW_ENOMEM : 0);
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ shdr = (Elf_W (Shdr) *) (((char *) shdr) + ehdr->e_shentsize);
+ }
+ return ret;
+}
+
+static Elf_W (Addr)
+elf_w (get_load_offset) (struct elf_image *ei, unsigned long segbase,
+ unsigned long mapoff)
+{
+ Elf_W (Addr) offset = 0;
+ Elf_W (Ehdr) *ehdr;
+ Elf_W (Phdr) *phdr;
+ int i;
+
+ ehdr = ei->image;
+ phdr = (Elf_W (Phdr) *) ((char *) ei->image + ehdr->e_phoff);
+
+ for (i = 0; i < ehdr->e_phnum; ++i)
+ if (phdr[i].p_type == PT_LOAD && phdr[i].p_offset == mapoff)
+ {
+ offset = segbase - phdr[i].p_vaddr;
+ break;
+ }
+
+ return offset;
+}
+
+#if HAVE_LZMA
+static size_t
+xz_uncompressed_size (uint8_t *compressed, size_t length)
+{
+ uint64_t memlimit = UINT64_MAX;
+ size_t ret = 0, pos = 0;
+ lzma_stream_flags options;
+ lzma_index *index;
+
+ if (length < LZMA_STREAM_HEADER_SIZE)
+ return 0;
+
+ uint8_t *footer = compressed + length - LZMA_STREAM_HEADER_SIZE;
+ if (lzma_stream_footer_decode (&options, footer) != LZMA_OK)
+ return 0;
+
+ if (length < LZMA_STREAM_HEADER_SIZE + options.backward_size)
+ return 0;
+
+ uint8_t *indexdata = footer - options.backward_size;
+ if (lzma_index_buffer_decode (&index, &memlimit, NULL, indexdata,
+ &pos, options.backward_size) != LZMA_OK)
+ return 0;
+
+ if (lzma_index_size (index) == options.backward_size)
+ {
+ ret = lzma_index_uncompressed_size (index);
+ }
+
+ lzma_index_end (index, NULL);
+ return ret;
+}
+
+static int
+elf_w (extract_minidebuginfo) (struct elf_image *ei, struct elf_image *mdi)
+{
+ Elf_W (Shdr) *shdr;
+ uint8_t *compressed = NULL;
+ uint64_t memlimit = UINT64_MAX; /* no memory limit */
+ size_t compressed_len, uncompressed_len;
+
+ shdr = elf_w (find_section) (ei, ".gnu_debugdata");
+ if (!shdr)
+ return 0;
+
+ compressed = ((uint8_t *) ei->image) + shdr->sh_offset;
+ compressed_len = shdr->sh_size;
+
+ uncompressed_len = xz_uncompressed_size (compressed, compressed_len);
+ if (uncompressed_len == 0)
+ {
+ Debug (1, "invalid .gnu_debugdata contents\n");
+ return 0;
+ }
+
+ mdi->size = uncompressed_len;
+ mdi->image = mmap (NULL, uncompressed_len, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+
+ if (mdi->image == MAP_FAILED)
+ return 0;
+
+ size_t in_pos = 0, out_pos = 0;
+ lzma_ret lret;
+ lret = lzma_stream_buffer_decode (&memlimit, 0, NULL,
+ compressed, &in_pos, compressed_len,
+ mdi->image, &out_pos, mdi->size);
+ if (lret != LZMA_OK)
+ {
+ Debug (1, "LZMA decompression failed: %d\n", lret);
+ munmap (mdi->image, mdi->size);
+ return 0;
+ }
+
+ return 1;
+}
+#else
+static int
+elf_w (extract_minidebuginfo) (struct elf_image *ei, struct elf_image *mdi)
+{
+ return 0;
+}
+#endif /* !HAVE_LZMA */
+
+/* Find the ELF image that contains IP and return the "closest"
+ procedure name, if there is one. With some caching, this could be
+ sped up greatly, but until an application materializes that's
+ sensitive to the performance of this routine, why bother... */
+
+HIDDEN int
+elf_w (get_proc_name_in_image) (unw_addr_space_t as, struct elf_image *ei,
+ unsigned long segbase,
+ unsigned long mapoff,
+ unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp)
+{
+ Elf_W (Addr) load_offset;
+ Elf_W (Addr) min_dist = ~(Elf_W (Addr))0;
+ int ret;
+
+ load_offset = elf_w (get_load_offset) (ei, segbase, mapoff);
+ ret = elf_w (lookup_symbol) (as, ip, ei, load_offset, buf, buf_len, &min_dist);
+
+ /* If the ELF image has MiniDebugInfo embedded in it, look up the symbol in
+ there as well and replace the previously found if it is closer. */
+ struct elf_image mdi;
+ if (elf_w (extract_minidebuginfo) (ei, &mdi))
+ {
+ int ret_mdi = elf_w (lookup_symbol) (as, ip, &mdi, load_offset, buf,
+ buf_len, &min_dist);
+
+ /* Closer symbol was found (possibly truncated). */
+ if (ret_mdi == 0 || ret_mdi == -UNW_ENOMEM)
+ {
+ ret = ret_mdi;
+ }
+
+ munmap (mdi.image, mdi.size);
+ }
+
+ if (min_dist >= ei->size)
+ return -UNW_ENOINFO; /* not found */
+ if (offp)
+ *offp = min_dist;
+ return ret;
+}
+
+HIDDEN int
+elf_w (get_proc_name) (unw_addr_space_t as, pid_t pid, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp)
+{
+ unsigned long segbase, mapoff;
+ struct elf_image ei;
+ int ret;
+ char file[PATH_MAX];
+
+ ret = tdep_get_elf_image (&ei, pid, ip, &segbase, &mapoff, file, PATH_MAX);
+ if (ret < 0)
+ return ret;
+
+ ret = elf_w (load_debuglink) (file, &ei, 1);
+ if (ret < 0)
+ return ret;
+
+ ret = elf_w (get_proc_name_in_image) (as, &ei, segbase, mapoff, ip, buf, buf_len, offp);
+
+ munmap (ei.image, ei.size);
+ ei.image = NULL;
+
+ return ret;
+}
+
+HIDDEN Elf_W (Shdr)*
+elf_w (find_section) (struct elf_image *ei, const char* secname)
+{
+ Elf_W (Ehdr) *ehdr = ei->image;
+ Elf_W (Shdr) *shdr;
+ char *strtab;
+ int i;
+
+ if (!elf_w (valid_object) (ei))
+ return 0;
+
+ shdr = elf_w (section_table) (ei);
+ if (!shdr)
+ return 0;
+
+ strtab = elf_w (string_table) (ei, ehdr->e_shstrndx);
+ if (!strtab)
+ return 0;
+
+ for (i = 0; i < ehdr->e_shnum; ++i)
+ {
+ if (strcmp (strtab + shdr->sh_name, secname) == 0)
+ {
+ if (shdr->sh_offset + shdr->sh_size > ei->size)
+ {
+ Debug (1, "section \"%s\" outside image? (0x%lu > 0x%lu)\n",
+ secname,
+ (unsigned long) shdr->sh_offset + shdr->sh_size,
+ (unsigned long) ei->size);
+ return 0;
+ }
+
+ Debug (16, "found section \"%s\" at 0x%lx\n",
+ secname, (unsigned long) shdr->sh_offset);
+ return shdr;
+ }
+
+ shdr = (Elf_W (Shdr) *) (((char *) shdr) + ehdr->e_shentsize);
+ }
+
+ /* section not found */
+ return 0;
+}
+
+/* Load a debug section, following .gnu_debuglink if appropriate
+ * Loads ei from file if not already mapped.
+ * If is_local, will also search sys directories /usr/local/dbg
+ *
+ * Returns 0 on success, failure otherwise.
+ * ei will be mapped to file or the located .gnu_debuglink from file
+ */
+HIDDEN int
+elf_w (load_debuglink) (const char* file, struct elf_image *ei, int is_local)
+{
+ int ret;
+ Elf_W (Shdr) *shdr;
+ Elf_W (Ehdr) *prev_image;
+ off_t prev_size;
+
+ if (!ei->image)
+ {
+ ret = elf_map_image(ei, file);
+ if (ret)
+ return ret;
+ }
+
+ prev_image = ei->image;
+ prev_size = ei->size;
+
+ /* Ignore separate debug files which contain a .gnu_debuglink section. */
+ if (is_local == -1) {
+ return 0;
+ }
+
+ shdr = elf_w (find_section) (ei, ".gnu_debuglink");
+ if (shdr) {
+ if (shdr->sh_size >= PATH_MAX ||
+ (shdr->sh_offset + shdr->sh_size > ei->size))
+ {
+ return 0;
+ }
+
+ {
+ char linkbuf[shdr->sh_size];
+ char *link = ((char *) ei->image) + shdr->sh_offset;
+ char *p;
+ static const char *debugdir = "/usr/lib/debug";
+ char basedir[strlen(file) + 1];
+ char newname[shdr->sh_size + strlen (debugdir) + strlen (file) + 9];
+
+ memcpy(linkbuf, link, shdr->sh_size);
+
+ if (memchr (linkbuf, 0, shdr->sh_size) == NULL)
+ return 0;
+
+ ei->image = NULL;
+
+ Debug(1, "Found debuglink section, following %s\n", linkbuf);
+
+ p = strrchr (file, '/');
+ if (p != NULL)
+ {
+ memcpy (basedir, file, p - file);
+ basedir[p - file] = '\0';
+ }
+ else
+ basedir[0] = 0;
+
+ strcpy (newname, basedir);
+ strcat (newname, "/");
+ strcat (newname, linkbuf);
+ ret = elf_w (load_debuglink) (newname, ei, -1);
+
+ if (ret == -1)
+ {
+ strcpy (newname, basedir);
+ strcat (newname, "/.debug/");
+ strcat (newname, linkbuf);
+ ret = elf_w (load_debuglink) (newname, ei, -1);
+ }
+
+ if (ret == -1 && is_local == 1)
+ {
+ strcpy (newname, debugdir);
+ strcat (newname, basedir);
+ strcat (newname, "/");
+ strcat (newname, linkbuf);
+ ret = elf_w (load_debuglink) (newname, ei, -1);
+ }
+
+ if (ret == -1)
+ {
+ /* No debuglink file found even though .gnu_debuglink existed */
+ ei->image = prev_image;
+ ei->size = prev_size;
+
+ return 0;
+ }
+ else
+ {
+ munmap (prev_image, prev_size);
+ }
+
+ return ret;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/elfxx.h b/src/pal/src/libunwind/src/elfxx.h
new file mode 100644
index 0000000000..830432c2ed
--- /dev/null
+++ b/src/pal/src/libunwind/src/elfxx.h
@@ -0,0 +1,101 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003, 2005 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+#include <sys/stat.h>
+
+#include "libunwind_i.h"
+
+#if ELF_CLASS == ELFCLASS32
+# define ELF_W(x) ELF32_##x
+# define Elf_W(x) Elf32_##x
+# define elf_w(x) _Uelf32_##x
+#else
+# define ELF_W(x) ELF64_##x
+# define Elf_W(x) Elf64_##x
+# define elf_w(x) _Uelf64_##x
+#endif
+
+extern int elf_w (get_proc_name) (unw_addr_space_t as,
+ pid_t pid, unw_word_t ip,
+ char *buf, size_t len,
+ unw_word_t *offp);
+
+extern int elf_w (get_proc_name_in_image) (unw_addr_space_t as,
+ struct elf_image *ei,
+ unsigned long segbase,
+ unsigned long mapoff,
+ unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp);
+
+extern Elf_W (Shdr)* elf_w (find_section) (struct elf_image *ei, const char* secname);
+extern int elf_w (load_debuglink) (const char* file, struct elf_image *ei, int is_local);
+
+static inline int
+elf_w (valid_object) (struct elf_image *ei)
+{
+ if (ei->size <= EI_VERSION)
+ return 0;
+
+ return (memcmp (ei->image, ELFMAG, SELFMAG) == 0
+ && ((uint8_t *) ei->image)[EI_CLASS] == ELF_CLASS
+ && ((uint8_t *) ei->image)[EI_VERSION] != EV_NONE
+ && ((uint8_t *) ei->image)[EI_VERSION] <= EV_CURRENT);
+}
+
+static inline int
+elf_map_image (struct elf_image *ei, const char *path)
+{
+ struct stat stat;
+ int fd;
+
+ fd = open (path, O_RDONLY);
+ if (fd < 0)
+ return -1;
+
+ if (fstat (fd, &stat) < 0)
+ {
+ close (fd);
+ return -1;
+ }
+
+ ei->size = stat.st_size;
+ ei->image = mmap (NULL, ei->size, PROT_READ, MAP_PRIVATE, fd, 0);
+ close (fd);
+ if (ei->image == MAP_FAILED)
+ return -1;
+
+ if (!elf_w (valid_object) (ei))
+ {
+ munmap(ei->image, ei->size);
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gapply_reg_state.c b/src/pal/src/libunwind/src/hppa/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gcreate_addr_space.c b/src/pal/src/libunwind/src/hppa/Gcreate_addr_space.c
new file mode 100644
index 0000000000..8a6cb8b4e6
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gcreate_addr_space.c
@@ -0,0 +1,54 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * hppa supports only big-endian.
+ */
+ if (byte_order != 0 && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gget_proc_info.c b/src/pal/src/libunwind/src/hppa/Gget_proc_info.c
new file mode 100644
index 0000000000..e10efcfca0
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gget_proc_info.c
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (dwarf_make_proc_info (&c->dwarf) < 0)
+ {
+ /* On hppa, some key routines such as _start() and _dl_start()
+ are missing DWARF unwind info. We don't want to fail in that
+ case, because those frames are uninteresting and just mark
+ the end of the frame-chain anyhow. */
+ memset (pi, 0, sizeof (*pi));
+ pi->start_ip = c->dwarf.ip;
+ pi->end_ip = c->dwarf.ip + 4;
+ return 0;
+ }
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gget_save_loc.c b/src/pal/src/libunwind/src/hppa/Gget_save_loc.c
new file mode 100644
index 0000000000..02dfa3084f
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gget_save_loc.c
@@ -0,0 +1,59 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ /* struct cursor *c = (struct cursor *) cursor; */
+ dwarf_loc_t loc;
+
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+
+#warning FIX ME!
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gglobal.c b/src/pal/src/libunwind/src/hppa/Gglobal.c
new file mode 100644
index 0000000000..351a5015d6
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gglobal.c
@@ -0,0 +1,55 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN define_lock (hppa_lock);
+HIDDEN int tdep_init_done;
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&hppa_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ hppa_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&hppa_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/hppa/Ginit.c b/src/pal/src/libunwind/src/hppa/Ginit.c
new file mode 100644
index 0000000000..461e4b93da
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Ginit.c
@@ -0,0 +1,194 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002, 2004 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+static inline void *
+uc_addr (ucontext_t *uc, int reg)
+{
+ void *addr;
+
+ if ((unsigned) (reg - UNW_HPPA_GR) < 32)
+ addr = &uc->uc_mcontext.sc_gr[reg - UNW_HPPA_GR];
+ else if ((unsigned) (reg - UNW_HPPA_FR) < 32)
+ addr = &uc->uc_mcontext.sc_fr[reg - UNW_HPPA_FR];
+ else
+ addr = NULL;
+ return addr;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+void *
+_Uhppa_uc_addr (ucontext_t *uc, int reg)
+{
+ return uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (12, "mem[%x] <- %x\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "mem[%x] -> %x\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = arg;
+
+ if ((unsigned int) (reg - UNW_HPPA_FR) < 32)
+ goto badreg;
+
+ addr = uc_addr (uc, reg);
+ if (!addr)
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) addr = *val;
+ Debug (12, "%s <- %x\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %x\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = arg;
+ unw_fpreg_t *addr;
+
+ if ((unsigned) (reg - UNW_HPPA_FR) > 32)
+ goto badreg;
+
+ addr = uc_addr (uc, reg);
+ if (!addr)
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %08x.%08x\n",
+ unw_regname (reg), val->raw.bits[1], val->raw.bits[0]);
+ *(unw_fpreg_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %08x.%08x\n",
+ unw_regname (reg), val->raw.bits[1], val->raw.bits[0]);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+hppa_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = hppa_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/hppa/Ginit_local.c b/src/pal/src/libunwind/src/hppa/Ginit_local.c
new file mode 100644
index 0000000000..1fdc7716fd
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Ginit_local.c
@@ -0,0 +1,77 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by ...
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common (unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = uc;
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/hppa/Ginit_remote.c b/src/pal/src/libunwind/src/hppa/Ginit_remote.c
new file mode 100644
index 0000000000..71096ce0e6
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Ginit_remote.c
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gis_signal_frame.c b/src/pal/src/libunwind/src/hppa/Gis_signal_frame.c
new file mode 100644
index 0000000000..addb551818
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gis_signal_frame.c
@@ -0,0 +1,74 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+#ifdef __linux__
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, w1, w2, w3, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ /* Check if IP points at sigreturn() sequence. On Linux, this normally is:
+
+ rt_sigreturn:
+ 0x34190000 ldi 0, %r25
+ 0x3414015a ldi __NR_rt_sigreturn,%r20
+ 0xe4008200 be,l 0x100(%sr2,%r0),%sr0,%r31
+ 0x08000240 nop
+
+ When a signal interrupts a system call, the first word is instead:
+
+ 0x34190002 ldi 1, %r25
+ */
+ ip = c->dwarf.ip;
+ if (!ip)
+ return 0;
+ if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0
+ || (ret = (*a->access_mem) (as, ip + 4, &w1, 0, arg)) < 0
+ || (ret = (*a->access_mem) (as, ip + 8, &w2, 0, arg)) < 0
+ || (ret = (*a->access_mem) (as, ip + 12, &w3, 0, arg)) < 0)
+ {
+ Debug (1, "failed to read sigreturn code (ret=%d)\n", ret);
+ return ret;
+ }
+ ret = ((w0 == 0x34190000 || w0 == 0x34190002)
+ && w1 == 0x3414015a && w2 == 0xe4008200 && w3 == 0x08000240);
+ Debug (1, "(cursor=%p, ip=0x%08lx) -> %d\n", c, (unsigned) ip, ret);
+ return ret;
+#else
+ printf ("%s: implement me\n", __FUNCTION__);
+#endif
+ return -UNW_ENOINFO;
+}
diff --git a/src/pal/src/libunwind/src/hppa/Greg_states_iterate.c b/src/pal/src/libunwind/src/hppa/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gregs.c b/src/pal/src/libunwind/src/hppa/Gregs.c
new file mode 100644
index 0000000000..da0542c81f
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gregs.c
@@ -0,0 +1,87 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ struct dwarf_loc loc;
+
+ switch (reg)
+ {
+ case UNW_HPPA_IP:
+ if (write)
+ c->dwarf.ip = *valp; /* update the IP cache */
+ if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip
+ || *valp >= c->dwarf.pi.end_ip))
+ c->dwarf.pi_valid = 0; /* new IP outside of current proc */
+ break;
+
+ case UNW_HPPA_CFA:
+ case UNW_HPPA_SP:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+ /* Do the exception-handling register remapping: */
+ case UNW_HPPA_EH0: reg = UNW_HPPA_GR + 20; break;
+ case UNW_HPPA_EH1: reg = UNW_HPPA_GR + 21; break;
+ case UNW_HPPA_EH2: reg = UNW_HPPA_GR + 22; break;
+ case UNW_HPPA_EH3: reg = UNW_HPPA_GR + 31; break;
+
+ default:
+ break;
+ }
+
+ if ((unsigned) (reg - UNW_HPPA_GR) >= 32)
+ return -UNW_EBADREG;
+
+ loc = c->dwarf.loc[reg];
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ struct dwarf_loc loc;
+
+ if ((unsigned) (reg - UNW_HPPA_FR) >= 32)
+ return -UNW_EBADREG;
+
+ loc = c->dwarf.loc[reg];
+
+ if (write)
+ return dwarf_putfp (&c->dwarf, loc, *valp);
+ else
+ return dwarf_getfp (&c->dwarf, loc, valp);
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gresume.c b/src/pal/src/libunwind/src/hppa/Gresume.c
new file mode 100644
index 0000000000..6c11f14036
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gresume.c
@@ -0,0 +1,145 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+#if defined(__linux)
+
+# include <sys/syscall.h>
+
+static NORETURN inline long
+my_rt_sigreturn (void *new_sp, int in_syscall)
+{
+ register unsigned long r25 __asm__ ("r25") = (in_syscall != 0);
+ register unsigned long r20 __asm__ ("r20") = SYS_rt_sigreturn;
+
+ __asm__ __volatile__ ("copy %0, %%sp\n"
+ "be,l 0x100(%%sr2,%%r0),%%sr0,%%r31\n"
+ "nop"
+ :
+ : "r"(new_sp), "r"(r20), "r"(r25)
+ : "memory");
+ abort ();
+}
+
+#endif /* __linux */
+
+HIDDEN inline int
+hppa_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+#if defined(__linux)
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = c->dwarf.as_arg;
+
+ /* Ensure c->pi is up-to-date. On PA-RISC, it's relatively common to be
+ missing DWARF unwind info. We don't want to fail in that case,
+ because the frame-chain still would let us do a backtrace at
+ least. */
+ dwarf_make_proc_info (&c->dwarf);
+
+ if (unlikely (c->sigcontext_format != HPPA_SCF_NONE))
+ {
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+
+ Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
+ my_rt_sigreturn (sc, (sc->sc_flags & PARISC_SC_FLAG_IN_SYSCALL) != 0);
+ }
+ else
+ {
+ Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
+ setcontext (uc);
+ }
+#else
+# warning Implement me!
+#endif
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+/* This routine is responsible for copying the register values in
+ cursor C and establishing them as the current machine state. */
+
+static inline int
+establish_machine_state (struct cursor *c)
+{
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *,
+ int write, void *);
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *,
+ int write, void *);
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ access_reg = as->acc.access_reg;
+ access_fpreg = as->acc.access_fpreg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ (*access_fpreg) (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ (*access_reg) (as, reg, &val, 1, arg);
+ }
+ }
+ return 0;
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if (!c->dwarf.ip)
+ {
+ /* This can happen easily when the frame-chain gets truncated
+ due to bad or missing unwind-info. */
+ Debug (1, "refusing to resume execution at address 0\n");
+ return -UNW_EINVAL;
+ }
+
+ if ((ret = establish_machine_state (c)) < 0)
+ return ret;
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/hppa/Gstep.c b/src/pal/src/libunwind/src/hppa/Gstep.c
new file mode 100644
index 0000000000..4fc8a8776b
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Gstep.c
@@ -0,0 +1,95 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret, i;
+
+ Debug (1, "(cursor=%p, ip=0x%08x)\n", c, (unsigned) c->dwarf.ip);
+
+ /* Try DWARF-based unwinding... */
+ ret = dwarf_step (&c->dwarf);
+
+ if (ret < 0 && ret != -UNW_ENOINFO)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ if (unlikely (ret < 0))
+ {
+ /* DWARF failed, let's see if we can follow the frame-chain
+ or skip over the signal trampoline. */
+
+ Debug (13, "dwarf_step() failed (ret=%d), trying fallback\n", ret);
+
+ if (unw_is_signal_frame (cursor))
+ {
+#ifdef __linux__
+ /* Assume that the trampoline is at the beginning of the
+ sigframe. */
+ unw_word_t ip, sc_addr = c->dwarf.ip + LINUX_RT_SIGFRAME_UC_OFF;
+ dwarf_loc_t iaoq_loc = DWARF_LOC (sc_addr + LINUX_SC_IAOQ_OFF, 0);
+
+ c->sigcontext_format = HPPA_SCF_LINUX_RT_SIGFRAME;
+ c->sigcontext_addr = sc_addr;
+
+ if ((ret = dwarf_get (&c->dwarf, iaoq_loc, &ip)) < 0)
+ {
+ Debug (2, "failed to read IAOQ[1] (ret=%d)\n", ret);
+ return ret;
+ }
+ c->dwarf.ip = ip & ~0x3; /* mask out the privilege level */
+
+ for (i = 0; i < 32; ++i)
+ {
+ c->dwarf.loc[UNW_HPPA_GR + i]
+ = DWARF_LOC (sc_addr + LINUX_SC_GR_OFF + 4*i, 0);
+ c->dwarf.loc[UNW_HPPA_FR + i]
+ = DWARF_LOC (sc_addr + LINUX_SC_FR_OFF + 4*i, 0);
+ }
+
+ if ((ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_HPPA_SP],
+ &c->dwarf.cfa)) < 0)
+ {
+ Debug (2, "failed to read SP (ret=%d)\n", ret);
+ return ret;
+ }
+#else
+# error Implement me!
+#endif
+ }
+ else
+ c->dwarf.ip = 0;
+ }
+ ret = (c->dwarf.ip == 0) ? 0 : 1;
+ Debug (2, "returning %d\n", ret);
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/hppa/Lapply_reg_state.c b/src/pal/src/libunwind/src/hppa/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lcreate_addr_space.c b/src/pal/src/libunwind/src/hppa/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lget_proc_info.c b/src/pal/src/libunwind/src/hppa/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lget_save_loc.c b/src/pal/src/libunwind/src/hppa/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lglobal.c b/src/pal/src/libunwind/src/hppa/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Linit.c b/src/pal/src/libunwind/src/hppa/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Linit_local.c b/src/pal/src/libunwind/src/hppa/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Linit_remote.c b/src/pal/src/libunwind/src/hppa/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lis_signal_frame.c b/src/pal/src/libunwind/src/hppa/Lis_signal_frame.c
new file mode 100644
index 0000000000..b9a7c4f51a
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lreg_states_iterate.c b/src/pal/src/libunwind/src/hppa/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lregs.c b/src/pal/src/libunwind/src/hppa/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lresume.c b/src/pal/src/libunwind/src/hppa/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/Lstep.c b/src/pal/src/libunwind/src/hppa/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/get_accessors.c b/src/pal/src/libunwind/src/hppa/get_accessors.c
new file mode 100644
index 0000000000..24795801b2
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/get_accessors.c
@@ -0,0 +1,38 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by ...
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN ALIAS(unw_get_accessors) unw_accessors_t *
+unw_get_accessors_int (unw_addr_space_t as);
+
+unw_accessors_t *
+unw_get_accessors (unw_addr_space_t as)
+{
+ if (!tdep_init_done)
+ tdep_init ();
+
+ return &as->acc;
+}
diff --git a/src/pal/src/libunwind/src/hppa/getcontext.S b/src/pal/src/libunwind/src/hppa/getcontext.S
new file mode 100644
index 0000000000..ec7554a025
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/getcontext.S
@@ -0,0 +1,74 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define SPILL(n) stw %r##n, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_GR_OFF+4*(n))(%r26)
+
+#include "offsets.h"
+
+ .align 4
+ .protected _Uhppa_getcontext
+ .global _Uhppa_getcontext
+ .proc
+ .callinfo
+_Uhppa_getcontext:
+ SPILL (2) /* return-pointer */
+ SPILL (3) /* frame pointer */
+ SPILL (4) /* 2nd-ary frame pointer */
+ SPILL (5) /* preserved register */
+ SPILL (6) /* preserved register */
+ SPILL (7) /* preserved register */
+ SPILL (8) /* preserved register */
+ SPILL (9) /* preserved register */
+ SPILL (10) /* preserved register */
+ SPILL (11) /* preserved register */
+ SPILL (12) /* preserved register */
+ SPILL (13) /* preserved register */
+ SPILL (14) /* preserved register */
+ SPILL (15) /* preserved register */
+ SPILL (16) /* preserved register */
+ SPILL (17) /* preserved register */
+ SPILL (18) /* preserved register */
+ SPILL (19) /* linkage-table register */
+ SPILL (27) /* global-data pointer */
+ SPILL (30) /* stack pointer */
+
+ ldo (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FR_OFF)(%r26), %r29
+ fstds,ma %fr12, 8(%r29)
+ fstds,ma %fr13, 8(%r29)
+ fstds,ma %fr14, 8(%r29)
+ fstds,ma %fr15, 8(%r29)
+ fstds,ma %fr16, 8(%r29)
+ fstds,ma %fr17, 8(%r29)
+ fstds,ma %fr18, 8(%r29)
+ fstds,ma %fr19, 8(%r29)
+ fstds,ma %fr20, 8(%r29)
+ fstds %fr21, 8(%r29)
+
+ bv,n %r0(%rp)
+ .procend
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/init.h b/src/pal/src/libunwind/src/hppa/init.h
new file mode 100644
index 0000000000..4e23b86132
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/init.h
@@ -0,0 +1,47 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by ...
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret;
+
+ c->dwarf.loc[UNW_HPPA_IP] = DWARF_REG_LOC (&c->dwarf, UNW_HPPA_IP);
+ c->dwarf.loc[UNW_HPPA_SP] = DWARF_REG_LOC (&c->dwarf, UNW_HPPA_SP);
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_HPPA_IP], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_HPPA_SP], &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/hppa/offsets.h b/src/pal/src/libunwind/src/hppa/offsets.h
new file mode 100644
index 0000000000..24e6453ac4
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/offsets.h
@@ -0,0 +1,17 @@
+#define LINUX_UC_FLAGS_OFF 0x000
+#define LINUX_UC_LINK_OFF 0x004
+#define LINUX_UC_STACK_OFF 0x008
+#define LINUX_UC_MCONTEXT_OFF 0x018
+#define LINUX_UC_SIGMASK_OFF 0x1b8
+
+#define LINUX_SC_FLAGS_OFF 0x000
+#define LINUX_SC_GR_OFF 0x004
+#define LINUX_SC_FR_OFF 0x088
+#define LINUX_SC_IASQ_OFF 0x188
+#define LINUX_SC_IAOQ_OFF 0x190
+#define LINUX_SC_SAR_OFF 0x198
+
+/* The signal frame contains 4 words of space for the sigreturn
+ trampoline, the siginfo structure, and then the sigcontext
+ structure. See include/asm-parisc/compat_rt_sigframe.h. */
+#define LINUX_RT_SIGFRAME_UC_OFF 0xac
diff --git a/src/pal/src/libunwind/src/hppa/regname.c b/src/pal/src/libunwind/src/hppa/regname.c
new file mode 100644
index 0000000000..5698a58ada
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/regname.c
@@ -0,0 +1,50 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
+ "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+ "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23",
+ "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31",
+ "ip",
+ "eh0", "eh1", "eh2", "eh3",
+ "cfa"
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/hppa/setcontext.S b/src/pal/src/libunwind/src/hppa/setcontext.S
new file mode 100644
index 0000000000..a36ea35cc6
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/setcontext.S
@@ -0,0 +1,77 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* The setcontext() in glibc is a no-op (as of 4 Dec 2004), so we have
+ to implement something useful on our own here. */
+
+#define FILL(n) ldw (LINUX_UC_MCONTEXT_OFF+LINUX_SC_GR_OFF+4*(n))(%r26),%r##n
+
+#include "offsets.h"
+
+ .align 4
+ .global _Uhppa_setcontext
+ .protected _Uhppa_setcontext
+ .proc
+ .callinfo
+_Uhppa_setcontext:
+ FILL (2) /* return-pointer */
+ FILL (3) /* frame pointer */
+ FILL (4) /* 2nd-ary frame pointer */
+ FILL (5) /* preserved register */
+ FILL (6) /* preserved register */
+ FILL (7) /* preserved register */
+ FILL (8) /* preserved register */
+ FILL (9) /* preserved register */
+ FILL (10) /* preserved register */
+ FILL (11) /* preserved register */
+ FILL (12) /* preserved register */
+ FILL (13) /* preserved register */
+ FILL (14) /* preserved register */
+ FILL (15) /* preserved register */
+ FILL (16) /* preserved register */
+ FILL (17) /* preserved register */
+ FILL (18) /* preserved register */
+ FILL (19) /* linkage-table register */
+ FILL (27) /* global-data pointer */
+ FILL (30) /* stack pointer */
+
+ ldo (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FR_OFF)(%r26), %r29
+ fldds,ma 8(%r29), %fr12
+ fldds,ma 8(%r29), %fr13
+ fldds,ma 8(%r29), %fr14
+ fldds,ma 8(%r29), %fr15
+ fldds,ma 8(%r29), %fr16
+ fldds,ma 8(%r29), %fr17
+ fldds,ma 8(%r29), %fr18
+ fldds,ma 8(%r29), %fr19
+ fldds,ma 8(%r29), %fr20
+ fldds 8(%r29), %fr21
+
+ bv,n %r0(%rp)
+ .procend
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/siglongjmp.S b/src/pal/src/libunwind/src/hppa/siglongjmp.S
new file mode 100644
index 0000000000..34878dbe8f
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/siglongjmp.S
@@ -0,0 +1,16 @@
+ /* Dummy implementation for now. */
+
+ .globl _UI_siglongjmp_cont
+ .globl _UI_longjmp_cont
+
+_UI_siglongjmp_cont:
+_UI_longjmp_cont:
+ .proc
+ .callinfo
+#warning fix me
+ bv %r0(%rp)
+ .procend
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/hppa/tables.c b/src/pal/src/libunwind/src/hppa/tables.c
new file mode 100644
index 0000000000..5104d4d342
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/tables.c
@@ -0,0 +1,43 @@
+#include "unwind_i.h"
+
+static inline int
+is_local_addr_space (unw_addr_space_t as)
+{
+ extern unw_addr_space_t _ULhppa_local_addr_space;
+
+ return (as == _Uhppa_local_addr_space
+#ifndef UNW_REMOTE_ONLY
+ || as == _ULhppa_local_addr_space
+#endif
+ );
+}
+
+HIDDEN int
+tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info, void *arg)
+{
+ printf ("%s: begging to get implemented...\n", __FUNCTION__);
+ return 0;
+}
+
+HIDDEN int
+tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di,
+ unw_proc_info_t *pi, int need_unwind_info, void *arg)
+{
+ printf ("%s: the biggest beggar of them all...\n", __FUNCTION__);
+ return 0;
+}
+
+HIDDEN void
+tdep_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg)
+{
+ if (!pi->unwind_info)
+ return;
+
+ if (!is_local_addr_space (as))
+ {
+ free (pi->unwind_info);
+ pi->unwind_info = NULL;
+ }
+}
diff --git a/src/pal/src/libunwind/src/hppa/unwind_i.h b/src/pal/src/libunwind/src/hppa/unwind_i.h
new file mode 100644
index 0000000000..cafeab57b8
--- /dev/null
+++ b/src/pal/src/libunwind/src/hppa/unwind_i.h
@@ -0,0 +1,47 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <stdint.h>
+
+#include <libunwind-hppa.h>
+
+#include "libunwind_i.h"
+
+#define hppa_lock UNW_OBJ(lock)
+#define hppa_local_resume UNW_OBJ(local_resume)
+#define hppa_local_addr_space_init UNW_OBJ(local_addr_space_init)
+#define hppa_scratch_loc UNW_OBJ(scratch_loc)
+#define setcontext UNW_ARCH_OBJ (setcontext)
+
+extern void hppa_local_addr_space_init (void);
+extern int hppa_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+extern dwarf_loc_t hppa_scratch_loc (struct cursor *c, unw_regnum_t reg);
+extern int setcontext (const ucontext_t *ucp);
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/ia64/Gapply_reg_state.c b/src/pal/src/libunwind/src/ia64/Gapply_reg_state.c
new file mode 100644
index 0000000000..b45d1b5d9c
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gapply_reg_state.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ // Needs dwarf support on ia64
+ // return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+ return -UNW_EINVAL;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gcreate_addr_space.c b/src/pal/src/libunwind/src/ia64/Gcreate_addr_space.c
new file mode 100644
index 0000000000..7ad29cbbd3
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gcreate_addr_space.c
@@ -0,0 +1,63 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * IA-64 supports only big or little-endian, not weird stuff like
+ * PDP_ENDIAN.
+ */
+ if (byte_order != 0
+ && byte_order != __LITTLE_ENDIAN
+ && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ if (byte_order == 0)
+ /* use host default: */
+ as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ else
+ as->big_endian = (byte_order == __BIG_ENDIAN);
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gfind_unwind_table.c b/src/pal/src/libunwind/src/ia64/Gfind_unwind_table.c
new file mode 100644
index 0000000000..9fd2707ace
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gfind_unwind_table.c
@@ -0,0 +1,143 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+#include <elf.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+
+#include "libunwind_i.h"
+#include "elf64.h"
+
+static unw_word_t
+find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base)
+{
+ Elf64_Off soff, str_soff;
+ Elf64_Ehdr *ehdr = edi->ei.image;
+ Elf64_Shdr *shdr;
+ Elf64_Shdr *str_shdr;
+ Elf64_Addr gp = 0;
+ char *strtab;
+ int i;
+
+ if (pdyn)
+ {
+ /* If we have a PT_DYNAMIC program header, fetch the gp-value
+ from the DT_PLTGOT entry. */
+ Elf64_Dyn *dyn = (Elf64_Dyn *) (pdyn->p_offset + (char *) edi->ei.image);
+ for (; dyn->d_tag != DT_NULL; ++dyn)
+ if (dyn->d_tag == DT_PLTGOT)
+ {
+ gp = (Elf64_Addr) dyn->d_un.d_ptr + load_base;
+ goto done;
+ }
+ }
+
+ /* Without a PT_DYAMIC header, lets try to look for a non-empty .opd
+ section. If there is such a section, we know it's full of
+ function descriptors, and we can simply pick up the gp from the
+ second word of the first entry in this table. */
+
+ soff = ehdr->e_shoff;
+ str_soff = soff + (ehdr->e_shstrndx * ehdr->e_shentsize);
+
+ if (soff + ehdr->e_shnum * ehdr->e_shentsize > edi->ei.size)
+ {
+ Debug (1, "section table outside of image? (%lu > %lu)",
+ soff + ehdr->e_shnum * ehdr->e_shentsize,
+ edi->ei.size);
+ goto done;
+ }
+
+ shdr = (Elf64_Shdr *) ((char *) edi->ei.image + soff);
+ str_shdr = (Elf64_Shdr *) ((char *) edi->ei.image + str_soff);
+ strtab = (char *) edi->ei.image + str_shdr->sh_offset;
+ for (i = 0; i < ehdr->e_shnum; ++i)
+ {
+ if (strcmp (strtab + shdr->sh_name, ".opd") == 0
+ && shdr->sh_size >= 16)
+ {
+ gp = ((Elf64_Addr *) ((char *) edi->ei.image + shdr->sh_offset))[1];
+ goto done;
+ }
+ shdr = (Elf64_Shdr *) (((char *) shdr) + ehdr->e_shentsize);
+ }
+
+ done:
+ Debug (16, "image at %p, gp = %lx\n", edi->ei.image, gp);
+ return gp;
+}
+
+int
+ia64_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as,
+ char *path, unw_word_t segbase, unw_word_t mapoff,
+ unw_word_t ip)
+{
+ Elf64_Phdr *phdr, *ptxt = NULL, *punw = NULL, *pdyn = NULL;
+ Elf64_Ehdr *ehdr;
+ int i;
+
+ if (!_Uelf64_valid_object (&edi->ei))
+ return -UNW_ENOINFO;
+
+ ehdr = edi->ei.image;
+ phdr = (Elf64_Phdr *) ((char *) edi->ei.image + ehdr->e_phoff);
+
+ for (i = 0; i < ehdr->e_phnum; ++i)
+ {
+ switch (phdr[i].p_type)
+ {
+ case PT_LOAD:
+ if (phdr[i].p_offset == mapoff)
+ ptxt = phdr + i;
+ break;
+
+ case PT_IA_64_UNWIND:
+ punw = phdr + i;
+ break;
+
+ case PT_DYNAMIC:
+ pdyn = phdr + i;
+ break;
+
+ default:
+ break;
+ }
+ }
+ if (!ptxt || !punw)
+ return 0;
+
+ edi->di_cache.start_ip = segbase;
+ edi->di_cache.end_ip = edi->di_cache.start_ip + ptxt->p_memsz;
+ edi->di_cache.gp = find_gp (edi, pdyn, segbase - ptxt->p_vaddr);
+ edi->di_cache.format = UNW_INFO_FORMAT_TABLE;
+ edi->di_cache.u.ti.name_ptr = 0;
+ edi->di_cache.u.ti.segbase = segbase;
+ edi->di_cache.u.ti.table_len = punw->p_memsz / sizeof (unw_word_t);
+ edi->di_cache.u.ti.table_data = (unw_word_t *)
+ ((char *) edi->ei.image + (punw->p_vaddr - ptxt->p_vaddr));
+ return 1;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gget_proc_info.c b/src/pal/src/libunwind/src/ia64/Gget_proc_info.c
new file mode 100644
index 0000000000..3ec82b9f82
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gget_proc_info.c
@@ -0,0 +1,38 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ if ((ret = ia64_make_proc_info (c)) < 0)
+ return ret;
+ *pi = c->pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gget_save_loc.c b/src/pal/src/libunwind/src/ia64/Gget_save_loc.c
new file mode 100644
index 0000000000..34efe99a75
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gget_save_loc.c
@@ -0,0 +1,168 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2003, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <assert.h>
+
+#include "rse.h"
+
+#include "offsets.h"
+#include "regs.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ ia64_loc_t loc, reg_loc;
+ uint8_t nat_bitnr;
+ int ret;
+
+ loc = IA64_NULL_LOC; /* default to "not saved" */
+
+ switch (reg)
+ {
+ /* frame registers */
+ case UNW_IA64_BSP:
+ case UNW_REG_SP:
+ default:
+ break;
+
+ case UNW_REG_IP:
+ loc = c->loc[IA64_REG_IP];
+ break;
+
+ /* preserved registers: */
+ case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7:
+ loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_GR + 4))];
+ break;
+
+ case UNW_IA64_NAT + 4 ... UNW_IA64_NAT + 7:
+ loc = c->loc[IA64_REG_NAT4 + (reg - (UNW_IA64_NAT + 4))];
+ reg_loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_NAT + 4))];
+ nat_bitnr = c->nat_bitnr[reg - (UNW_IA64_NAT + 4)];
+ if (IA64_IS_FP_LOC (reg_loc))
+ /* NaT bit saved as a NaTVal. */
+ loc = reg_loc;
+ break;
+
+ case UNW_IA64_FR + 2: loc = c->loc[IA64_REG_F2]; break;
+ case UNW_IA64_FR + 3: loc = c->loc[IA64_REG_F3]; break;
+ case UNW_IA64_FR + 4: loc = c->loc[IA64_REG_F4]; break;
+ case UNW_IA64_FR + 5: loc = c->loc[IA64_REG_F5]; break;
+ case UNW_IA64_FR + 16 ... UNW_IA64_FR + 31:
+ loc = c->loc[IA64_REG_F16 + (reg - (UNW_IA64_FR + 16))];
+ break;
+
+ case UNW_IA64_AR_BSP: loc = c->loc[IA64_REG_BSP]; break;
+ case UNW_IA64_AR_BSPSTORE: loc = c->loc[IA64_REG_BSPSTORE]; break;
+ case UNW_IA64_AR_PFS: loc = c->loc[IA64_REG_PFS]; break;
+ case UNW_IA64_AR_RNAT: loc = c->loc[IA64_REG_RNAT]; break;
+ case UNW_IA64_AR_UNAT: loc = c->loc[IA64_REG_UNAT]; break;
+ case UNW_IA64_AR_LC: loc = c->loc[IA64_REG_LC]; break;
+ case UNW_IA64_AR_FPSR: loc = c->loc[IA64_REG_FPSR]; break;
+ case UNW_IA64_BR + 1: loc = c->loc[IA64_REG_B1]; break;
+ case UNW_IA64_BR + 2: loc = c->loc[IA64_REG_B2]; break;
+ case UNW_IA64_BR + 3: loc = c->loc[IA64_REG_B3]; break;
+ case UNW_IA64_BR + 4: loc = c->loc[IA64_REG_B4]; break;
+ case UNW_IA64_BR + 5: loc = c->loc[IA64_REG_B5]; break;
+ case UNW_IA64_CFM: loc = c->cfm_loc; break;
+ case UNW_IA64_PR: loc = c->loc[IA64_REG_PR]; break;
+
+ case UNW_IA64_GR + 32 ... UNW_IA64_GR + 127: /* stacked reg */
+ reg = rotate_gr (c, reg - UNW_IA64_GR);
+ ret = ia64_get_stacked (c, reg, &loc, NULL);
+ if (ret < 0)
+ return ret;
+ break;
+
+ case UNW_IA64_NAT + 32 ... UNW_IA64_NAT + 127: /* stacked reg */
+ reg = rotate_gr (c, reg - UNW_IA64_NAT);
+ ret = ia64_get_stacked (c, reg, NULL, &loc);
+ break;
+
+ case UNW_IA64_AR_EC:
+ loc = c->cfm_loc;
+ break;
+
+ /* scratch & special registers: */
+
+ case UNW_IA64_GR + 0:
+ case UNW_IA64_GR + 1: /* global pointer */
+ case UNW_IA64_NAT + 0:
+ case UNW_IA64_NAT + 1: /* global pointer */
+ case UNW_IA64_FR + 0:
+ case UNW_IA64_FR + 1:
+ break;
+
+ case UNW_IA64_NAT + 2 ... UNW_IA64_NAT + 3:
+ case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31:
+ loc = ia64_scratch_loc (c, reg, &nat_bitnr);
+ break;
+
+ case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3:
+ case UNW_IA64_GR + 8 ... UNW_IA64_GR + 31:
+ case UNW_IA64_BR + 0:
+ case UNW_IA64_BR + 6:
+ case UNW_IA64_BR + 7:
+ case UNW_IA64_AR_RSC:
+ case UNW_IA64_AR_CSD:
+ case UNW_IA64_AR_SSD:
+ case UNW_IA64_AR_CCV:
+ loc = ia64_scratch_loc (c, reg, NULL);
+ break;
+
+ case UNW_IA64_FR + 6 ... UNW_IA64_FR + 15:
+ loc = ia64_scratch_loc (c, reg, NULL);
+ break;
+
+ case UNW_IA64_FR + 32 ... UNW_IA64_FR + 127:
+ reg = rotate_fr (c, reg - UNW_IA64_FR) + UNW_IA64_FR;
+ loc = ia64_scratch_loc (c, reg, NULL);
+ break;
+ }
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (IA64_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = IA64_GET_REG (loc);
+ sloc->extra.nat_bitnr = nat_bitnr;
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = IA64_GET_ADDR (loc);
+ sloc->extra.nat_bitnr = nat_bitnr;
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gglobal.c b/src/pal/src/libunwind/src/ia64/Gglobal.c
new file mode 100644
index 0000000000..5c6156f0e2
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gglobal.c
@@ -0,0 +1,122 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <assert.h>
+
+#include "unwind_i.h"
+
+HIDDEN struct ia64_global_unwind_state unw =
+ {
+ .lock = PTHREAD_MUTEX_INITIALIZER,
+ .save_order = {
+ IA64_REG_IP, IA64_REG_PFS, IA64_REG_PSP, IA64_REG_PR,
+ IA64_REG_UNAT, IA64_REG_LC, IA64_REG_FPSR, IA64_REG_PRI_UNAT_GR
+ },
+#if UNW_DEBUG
+ .preg_name = {
+ "pri_unat_gr", "pri_unat_mem", "psp", "bsp", "bspstore",
+ "ar.pfs", "ar.rnat", "rp",
+ "r4", "r5", "r6", "r7",
+ "nat4", "nat5", "nat6", "nat7",
+ "ar.unat", "pr", "ar.lc", "ar.fpsr",
+ "b1", "b2", "b3", "b4", "b5",
+ "f2", "f3", "f4", "f5",
+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
+ }
+#endif
+};
+
+HIDDEN void
+tdep_init (void)
+{
+ const uint8_t f1_bytes[16] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ const uint8_t nat_val_bytes[16] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xfe,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ const uint8_t int_val_bytes[16] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x3e,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ intrmask_t saved_mask;
+ uint8_t *lep, *bep;
+ long i;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&unw.lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ mempool_init (&unw.reg_state_pool, sizeof (struct ia64_reg_state), 0);
+ mempool_init (&unw.labeled_state_pool,
+ sizeof (struct ia64_labeled_state), 0);
+
+ unw.read_only.r0 = 0;
+ unw.read_only.f0.raw.bits[0] = 0;
+ unw.read_only.f0.raw.bits[1] = 0;
+
+ lep = (uint8_t *) &unw.read_only.f1_le + 16;
+ bep = (uint8_t *) &unw.read_only.f1_be;
+ for (i = 0; i < 16; ++i)
+ {
+ *--lep = f1_bytes[i];
+ *bep++ = f1_bytes[i];
+ }
+
+ lep = (uint8_t *) &unw.nat_val_le + 16;
+ bep = (uint8_t *) &unw.nat_val_be;
+ for (i = 0; i < 16; ++i)
+ {
+ *--lep = nat_val_bytes[i];
+ *bep++ = nat_val_bytes[i];
+ }
+
+ lep = (uint8_t *) &unw.int_val_le + 16;
+ bep = (uint8_t *) &unw.int_val_be;
+ for (i = 0; i < 16; ++i)
+ {
+ *--lep = int_val_bytes[i];
+ *bep++ = int_val_bytes[i];
+ }
+
+ assert (8*sizeof(unw_hash_index_t) >= IA64_LOG_UNW_HASH_SIZE);
+
+#ifndef UNW_REMOTE_ONLY
+ ia64_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&unw.lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/ia64/Ginit.c b/src/pal/src/libunwind/src/ia64/Ginit.c
new file mode 100644
index 0000000000..b09a2ad57c
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Ginit.c
@@ -0,0 +1,505 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+#ifdef HAVE_SYS_UC_ACCESS_H
+# include <sys/uc_access.h>
+#endif
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+#ifdef HAVE_SYS_UC_ACCESS_H
+
+#else /* !HAVE_SYS_UC_ACCESS_H */
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg, uint8_t *nat_bitnr)
+{
+ return inlined_uc_addr (uc, reg, nat_bitnr);
+}
+
+#endif /* !HAVE_SYS_UC_ACCESS_H */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (12, "mem[%lx] <- %lx\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "mem[%lx] -> %lx\n", addr, *val);
+ }
+ return 0;
+}
+
+#ifdef HAVE_SYS_UC_ACCESS_H
+
+#define SYSCALL_CFM_SAVE_REG 11 /* on a syscall, ar.pfs is saved in r11 */
+#define REASON_SYSCALL 0
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ ucontext_t *uc = arg;
+ unsigned int nat, mask;
+ uint64_t value;
+ uint16_t reason;
+ int ret;
+
+ __uc_get_reason (uc, &reason);
+
+ switch (reg)
+ {
+ case UNW_IA64_GR ... UNW_IA64_GR + 31:
+ if ((ret = __uc_get_grs (uc, (reg - UNW_IA64_GR), 1, &value, &nat)))
+ break;
+
+ if (write)
+ ret = __uc_set_grs (uc, (reg - UNW_IA64_GR), 1, val, nat);
+ else
+ *val = value;
+ break;
+
+ case UNW_IA64_NAT ... UNW_IA64_NAT + 31:
+ if ((ret = __uc_get_grs (uc, (reg - UNW_IA64_GR), 1, &value, &nat)))
+ break;
+
+ mask = 1 << (reg - UNW_IA64_GR);
+
+ if (write)
+ {
+ if (*val)
+ nat |= mask;
+ else
+ nat &= ~mask;
+ ret = __uc_set_grs (uc, (reg - UNW_IA64_GR), 1, &value, nat);
+ }
+ else
+ *val = (nat & mask) != 0;
+ break;
+
+ case UNW_IA64_AR ... UNW_IA64_AR + 127:
+ if (reg == UNW_IA64_AR_BSP)
+ {
+ if (write)
+ ret = __uc_set_ar (uc, (reg - UNW_IA64_AR), *val);
+ else
+ ret = __uc_get_ar (uc, (reg - UNW_IA64_AR), val);
+ }
+ else if (reg == UNW_IA64_AR_PFS && reason == REASON_SYSCALL)
+ {
+ /* As of HP-UX 11.22, getcontext() does not have unwind info
+ and because of that, we need to hack thins manually here.
+ Hopefully, this is OK because the HP-UX kernel also needs
+ to know where AR.PFS has been saved, so the use of
+ register r11 for this purpose is pretty much nailed
+ down. */
+ if (write)
+ ret = __uc_set_grs (uc, SYSCALL_CFM_SAVE_REG, 1, val, 0);
+ else
+ ret = __uc_get_grs (uc, SYSCALL_CFM_SAVE_REG, 1, val, &nat);
+ }
+ else
+ {
+ if (write)
+ ret = __uc_set_ar (uc, (reg - UNW_IA64_AR), *val);
+ else
+ ret = __uc_get_ar (uc, (reg - UNW_IA64_AR), val);
+ }
+ break;
+
+ case UNW_IA64_BR ... UNW_IA64_BR + 7:
+ if (write)
+ ret = __uc_set_brs (uc, (reg - UNW_IA64_BR), 1, val);
+ else
+ ret = __uc_get_brs (uc, (reg - UNW_IA64_BR), 1, val);
+ break;
+
+ case UNW_IA64_PR:
+ if (write)
+ ret = __uc_set_prs (uc, *val);
+ else
+ ret = __uc_get_prs (uc, val);
+ break;
+
+ case UNW_IA64_IP:
+ if (write)
+ ret = __uc_set_ip (uc, *val);
+ else
+ ret = __uc_get_ip (uc, val);
+ break;
+
+ case UNW_IA64_CFM:
+ if (write)
+ ret = __uc_set_cfm (uc, *val);
+ else
+ ret = __uc_get_cfm (uc, val);
+ break;
+
+ case UNW_IA64_FR ... UNW_IA64_FR + 127:
+ default:
+ ret = EINVAL;
+ break;
+ }
+
+ if (ret != 0)
+ {
+ Debug (1, "failed to %s %s (ret = %d)\n",
+ write ? "write" : "read", unw_regname (reg), ret);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ Debug (12, "%s <- %lx\n", unw_regname (reg), *val);
+ else
+ Debug (12, "%s -> %lx\n", unw_regname (reg), *val);
+ return 0;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = arg;
+ fp_regval_t fp_regval;
+ int ret;
+
+ switch (reg)
+ {
+ case UNW_IA64_FR ... UNW_IA64_FR + 127:
+ if (write)
+ {
+ memcpy (&fp_regval, val, sizeof (fp_regval));
+ ret = __uc_set_frs (uc, (reg - UNW_IA64_FR), 1, &fp_regval);
+ }
+ else
+ {
+ ret = __uc_get_frs (uc, (reg - UNW_IA64_FR), 1, &fp_regval);
+ memcpy (val, &fp_regval, sizeof (*val));
+ }
+ break;
+
+ default:
+ ret = EINVAL;
+ break;
+ }
+ if (ret != 0)
+ return -UNW_EBADREG;
+
+ return 0;
+}
+
+#else /* !HAVE_SYS_UC_ACCESS_H */
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr, mask;
+ ucontext_t *uc = arg;
+
+ if (reg >= UNW_IA64_NAT + 4 && reg <= UNW_IA64_NAT + 7)
+ {
+ mask = ((unw_word_t) 1) << (reg - UNW_IA64_NAT);
+ if (write)
+ {
+ if (*val)
+ uc->uc_mcontext.sc_nat |= mask;
+ else
+ uc->uc_mcontext.sc_nat &= ~mask;
+ }
+ else
+ *val = (uc->uc_mcontext.sc_nat & mask) != 0;
+
+ if (write)
+ Debug (12, "%s <- %lx\n", unw_regname (reg), *val);
+ else
+ Debug (12, "%s -> %lx\n", unw_regname (reg), *val);
+ return 0;
+ }
+
+ addr = tdep_uc_addr (uc, reg, NULL);
+ if (!addr)
+ goto badreg;
+
+ if (write)
+ {
+ if (ia64_read_only_reg (addr))
+ {
+ Debug (16, "attempt to write read-only register\n");
+ return -UNW_EREADONLYREG;
+ }
+ *addr = *val;
+ Debug (12, "%s <- %lx\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %lx\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = arg;
+ unw_fpreg_t *addr;
+
+ if (reg < UNW_IA64_FR || reg >= UNW_IA64_FR + 128)
+ goto badreg;
+
+ addr = tdep_uc_addr (uc, reg, NULL);
+ if (!addr)
+ goto badreg;
+
+ if (write)
+ {
+ if (ia64_read_only_reg (addr))
+ {
+ Debug (16, "attempt to write read-only register\n");
+ return -UNW_EREADONLYREG;
+ }
+ *addr = *val;
+ Debug (12, "%s <- %016lx.%016lx\n",
+ unw_regname (reg), val->raw.bits[1], val->raw.bits[0]);
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %016lx.%016lx\n",
+ unw_regname (reg), val->raw.bits[1], val->raw.bits[0]);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+#endif /* !HAVE_SYS_UC_ACCESS_H */
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+ia64_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+#if defined(__linux)
+ local_addr_space.abi = ABI_LINUX;
+#elif defined(__hpux)
+ local_addr_space.abi = ABI_HPUX;
+#endif
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = tdep_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = ia64_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+#ifndef UNW_LOCAL_ONLY
+
+HIDDEN int
+ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp,
+ int write)
+{
+#ifdef HAVE_SYS_UC_ACCESS_H
+ unw_word_t uc_addr = IA64_GET_AUX_ADDR (loc);
+ ucontext_t *ucp;
+ int ret;
+
+ Debug (16, "%s location %s\n",
+ write ? "writing" : "reading", ia64_strloc (loc));
+
+ if (c->as == unw_local_addr_space)
+ ucp = (ucontext_t *) uc_addr;
+ else
+ {
+ unw_word_t *dst, src;
+
+ /* Need to copy-in ucontext_t first. */
+ ucp = alloca (sizeof (ucontext_t));
+ if (!ucp)
+ return -UNW_ENOMEM;
+
+ /* For now, there is no non-HP-UX implementation of the
+ uc_access(3) interface. Because of that, we cannot, e.g.,
+ unwind an HP-UX program from a Linux program. Should that
+ become possible at some point in the future, the
+ copy-in/copy-out needs to be adjusted to do byte-swapping if
+ necessary. */
+ assert (c->as->big_endian == (__BYTE_ORDER == __BIG_ENDIAN));
+
+ dst = (unw_word_t *) ucp;
+ for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8)
+ if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg))
+ < 0)
+ return ret;
+ }
+
+ if (IA64_IS_REG_LOC (loc))
+ ret = access_reg (unw_local_addr_space, IA64_GET_REG (loc), valp, write,
+ ucp);
+ else
+ {
+ /* Must be an access to the RSE backing store in ucontext_t. */
+ unw_word_t addr = IA64_GET_ADDR (loc);
+
+ if (write)
+ ret = __uc_set_rsebs (ucp, (uint64_t *) addr, 1, valp);
+ else
+ ret = __uc_get_rsebs (ucp, (uint64_t *) addr, 1, valp);
+ if (ret != 0)
+ ret = -UNW_EBADREG;
+ }
+ if (ret < 0)
+ return ret;
+
+ if (write && c->as != unw_local_addr_space)
+ {
+ /* need to copy-out ucontext_t: */
+ unw_word_t dst, *src = (unw_word_t *) ucp;
+ for (dst = uc_addr; dst < uc_addr + sizeof (ucontext_t); dst += 8)
+ if ((ret = (*c->as->acc.access_mem) (c->as, dst, src++, 1, c->as_arg))
+ < 0)
+ return ret;
+ }
+ return 0;
+#else /* !HAVE_SYS_UC_ACCESS_H */
+ return -UNW_EINVAL;
+#endif /* !HAVE_SYS_UC_ACCESS_H */
+}
+
+HIDDEN int
+ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *valp,
+ int write)
+{
+#ifdef HAVE_SYS_UC_ACCESS_H
+ unw_word_t uc_addr = IA64_GET_AUX_ADDR (loc);
+ ucontext_t *ucp;
+ int ret;
+
+ if (c->as == unw_local_addr_space)
+ ucp = (ucontext_t *) uc_addr;
+ else
+ {
+ unw_word_t *dst, src;
+
+ /* Need to copy-in ucontext_t first. */
+ ucp = alloca (sizeof (ucontext_t));
+ if (!ucp)
+ return -UNW_ENOMEM;
+
+ /* For now, there is no non-HP-UX implementation of the
+ uc_access(3) interface. Because of that, we cannot, e.g.,
+ unwind an HP-UX program from a Linux program. Should that
+ become possible at some point in the future, the
+ copy-in/copy-out needs to be adjusted to do byte-swapping if
+ necessary. */
+ assert (c->as->big_endian == (__BYTE_ORDER == __BIG_ENDIAN));
+
+ dst = (unw_word_t *) ucp;
+ for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8)
+ if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg))
+ < 0)
+ return ret;
+ }
+
+ if ((ret = access_fpreg (unw_local_addr_space, IA64_GET_REG (loc), valp,
+ write, ucp)) < 0)
+ return ret;
+
+ if (write && c->as != unw_local_addr_space)
+ {
+ /* need to copy-out ucontext_t: */
+ unw_word_t dst, *src = (unw_word_t *) ucp;
+ for (dst = uc_addr; dst < uc_addr + sizeof (ucontext_t); dst += 8)
+ if ((ret = (*c->as->acc.access_mem) (c->as, dst, src++, 1, c->as_arg))
+ < 0)
+ return ret;
+ }
+ return 0;
+#else /* !HAVE_SYS_UC_ACCESS_H */
+ return -UNW_EINVAL;
+#endif /* !HAVE_SYS_UC_ACCESS_H */
+}
+
+#endif /* UNW_LOCAL_ONLY */
diff --git a/src/pal/src/libunwind/src/ia64/Ginit_local.c b/src/pal/src/libunwind/src/ia64/Ginit_local.c
new file mode 100644
index 0000000000..8fe1c679b2
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Ginit_local.c
@@ -0,0 +1,110 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2003, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static inline void
+set_as_arg (struct cursor *c, unw_context_t *uc)
+{
+#if defined(__linux) && defined(__KERNEL__)
+ c->task = current;
+ c->as_arg = &uc->sw;
+#else
+ c->as_arg = uc;
+#endif
+}
+
+static inline int
+get_initial_stack_pointers (struct cursor *c, unw_context_t *uc,
+ unw_word_t *sp, unw_word_t *bsp)
+{
+#if defined(__linux)
+ unw_word_t sol, bspstore;
+
+#ifdef __KERNEL__
+ sol = (uc->sw.ar_pfs >> 7) & 0x7f;
+ bspstore = uc->sw.ar_bspstore;
+ *sp = uc->ksp;
+# else
+ sol = (uc->uc_mcontext.sc_ar_pfs >> 7) & 0x7f;
+ bspstore = uc->uc_mcontext.sc_ar_bsp;
+ *sp = uc->uc_mcontext.sc_gr[12];
+# endif
+ *bsp = rse_skip_regs (bspstore, -sol);
+#elif defined(__hpux)
+ int ret;
+
+ if ((ret = ia64_get (c, IA64_REG_LOC (c, UNW_IA64_GR + 12), sp)) < 0
+ || (ret = ia64_get (c, IA64_REG_LOC (c, UNW_IA64_AR_BSP), bsp)) < 0)
+ return ret;
+#else
+# error Fix me.
+#endif
+ return 0;
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t sp, bsp;
+ int ret;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->as = unw_local_addr_space;
+ set_as_arg (c, uc);
+
+ if ((ret = get_initial_stack_pointers (c, uc, &sp, &bsp)) < 0)
+ return ret;
+
+ Debug (4, "initial bsp=%lx, sp=%lx\n", bsp, sp);
+
+ if ((ret = common_init (c, sp, bsp)) < 0)
+ return ret;
+
+#ifdef __hpux
+ /* On HP-UX, the context created by getcontext() points to the
+ getcontext() system call stub. Step over it: */
+ ret = unw_step (cursor);
+#endif
+ return ret;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/ia64/Ginit_remote.c b/src/pal/src/libunwind/src/ia64/Ginit_remote.c
new file mode 100644
index 0000000000..b570c7eab3
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Ginit_remote.c
@@ -0,0 +1,61 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002, 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t sp, bsp;
+ int ret;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if (as == unw_local_addr_space)
+ /* This special-casing is unfortunate and shouldn't be needed;
+ however, both Linux and HP-UX need to adjust the context a bit
+ before it's usable. Try to think of a cleaner way of doing
+ this. Not sure it's possible though, as long as we want to be
+ able to use the context returned by getcontext() et al. */
+ return unw_init_local (cursor, as_arg);
+
+ c->as = as;
+ c->as_arg = as_arg;
+
+ if ((ret = ia64_get (c, IA64_REG_LOC (c, UNW_IA64_GR + 12), &sp)) < 0
+ || (ret = ia64_get (c, IA64_REG_LOC (c, UNW_IA64_AR_BSP), &bsp)) < 0)
+ return ret;
+
+ return common_init (c, sp, bsp);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/ia64/Ginstall_cursor.S b/src/pal/src/libunwind/src/ia64/Ginstall_cursor.S
new file mode 100644
index 0000000000..6fb4401faa
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Ginstall_cursor.S
@@ -0,0 +1,348 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "ucontext_i.h"
+
+#ifdef UNW_LOCAL_ONLY
+# include "Lcursor_i.h"
+# define ia64_install_cursor _ULia64_install_cursor
+#else
+# include "Gcursor_i.h"
+# define ia64_install_cursor _Uia64_install_cursor
+#endif
+
+#define SYS_sigreturn 1181
+
+#ifndef UNW_REMOTE_ONLY
+
+/* ia64_install_cursor (const cursor *c, long pri_unat, long *extra,
+ long bspstore, long dirty_size, long *dirty_partition,
+ long dirty_rnat)
+
+ Restores the machine-state represented by C and thereby resumes execution
+ in that frame. If the frame or one of its descendants was interrupted
+ by a signal, all registers are restored (including the signal mask).
+ Otherwise, only the preserved registers, the global-pointer (r1), and
+ the exception-arguments (r15-r18) are restored. */
+
+#define pRet p6
+#define pSig p7
+
+ .align 32
+ .hidden ia64_install_cursor
+ .global ia64_install_cursor
+ .proc ia64_install_cursor
+ia64_install_cursor:
+ alloc r3 = ar.pfs, 7, 0, 0, 0
+ invala
+ add r2 = FR_LOC_OFF, in0
+ ;;
+
+ ld8 r16 = [r2], LOC_SIZE // r16 = loc[IA64_REG_FR16]
+ mov.m r10 = ar.rsc // (ar.rsc: ~ 12 cycle latency)
+ add r3 = FR_LOC_OFF + 16, in0
+ ;;
+
+ ld8 r17 = [r2], 2*LOC_SIZE // r17 = loc[IA64_REG_FR17]
+ ld8 r18 = [r3], 2*LOC_SIZE // r18 = loc[IA64_REG_FR18]
+ and r16 = -4, r16
+ ;;
+
+ ld8 r19 = [r2], 2*LOC_SIZE // r19 = loc[IA64_REG_FR19]
+ ld8 r20 = [r3], 2*LOC_SIZE // r20 = loc[IA64_REG_FR20]
+ and r17 = -4, r17
+ ;;
+
+ ldf.fill f16 = [r16] // f16 restored (don't touch no more)
+ ldf.fill f17 = [r17] // f17 restored (don't touch no more)
+ and r18 = -4, r18
+
+ ld8 r21 = [r2], 2*LOC_SIZE // r21 = loc[IA64_REG_FR21]
+ ld8 r22 = [r3], 2*LOC_SIZE // r22 = loc[IA64_REG_FR22]
+ and r19 = -4, r19
+ ;;
+
+ ldf.fill f18 = [r18] // f18 restored (don't touch no more)
+ ldf.fill f19 = [r19] // f19 restored (don't touch no more)
+ and r20 = -4, r20
+
+ ld8 r23 = [r2], 2*LOC_SIZE // r23 = loc[IA64_REG_FR23]
+ ld8 r24 = [r3], 2*LOC_SIZE // r24 = loc[IA64_REG_FR24]
+ and r21 = -4, r21
+ ;;
+
+ ldf.fill f20 = [r20] // f20 restored (don't touch no more)
+ ldf.fill f21 = [r21] // f21 restored (don't touch no more)
+ and r22 = -4, r22
+
+ ld8 r25 = [r2], 2*LOC_SIZE // r25 = loc[IA64_REG_FR25]
+ ld8 r26 = [r3], 2*LOC_SIZE // r26 = loc[IA64_REG_FR26]
+ and r23 = -4, r23
+ ;;
+
+ ldf.fill f22 = [r22] // f22 restored (don't touch no more)
+ ldf.fill f23 = [r23] // f23 restored (don't touch no more)
+ and r24 = -4, r24
+
+ ld8 r27 = [r2], 2*LOC_SIZE // r27 = loc[IA64_REG_FR27]
+ ld8 r28 = [r3], 2*LOC_SIZE // r28 = loc[IA64_REG_FR28]
+ and r25 = -4, r25
+ ;;
+
+ ldf.fill f24 = [r24] // f24 restored (don't touch no more)
+ ldf.fill f25 = [r25] // f25 restored (don't touch no more)
+ and r26 = -4, r26
+
+ ld8 r29 = [r2], 2*LOC_SIZE // r29 = loc[IA64_REG_FR29]
+ ld8 r30 = [r3], 2*LOC_SIZE // r30 = loc[IA64_REG_FR30]
+ and r27 = -4, r27
+ ;;
+
+ ldf.fill f26 = [r26] // f26 restored (don't touch no more)
+ ldf.fill f27 = [r27] // f27 restored (don't touch no more)
+ and r28 = -4, r28
+
+ ld8 r31 = [r2] // r31 = loc[IA64_REG_FR31]
+ mov.m ar.unat = in1
+ and r29 = -4, r29
+ ;;
+
+ ldf.fill f28 = [r28] // f28 restored (don't touch no more)
+ ldf.fill f29 = [r29] // f29 restored (don't touch no more)
+ and r30 = -4, r30
+
+ ld8 r1 = [in2], 8 // gp restored (don't touch no more)
+ add r8 = SIGCONTEXT_ADDR_OFF, in0
+ and r31 = -4, r31
+ ;;
+
+ ld8 r8 = [r8] // r8 = sigcontext_addr
+ and r11 = 0x1c, r10 // clear all but rsc.be and rsc.pl
+ add r2 = PFS_LOC_OFF, in0
+
+ ldf.fill f30 = [r30] // f30 restored (don't touch no more)
+ ldf.fill f31 = [r31] // f31 restored (don't touch no more)
+ add r3 = 8, in2
+ ;;
+
+ ld8.fill r4 = [in2], 16 // r4 restored (don't touch no more)
+ ld8.fill r5 = [r3], 16 // r5 restored (don't touch no more)
+ cmp.eq pRet, pSig = r0, r8 // sigcontext_addr == NULL?
+ ;;
+ ld8.fill r6 = [in2], 16 // r6 restored (don't touch no more)
+ ld8.fill r7 = [r3] // r7 restored (don't touch no more)
+ add r3 = IP_OFF, in0
+ ;;
+
+ ld8 r14 = [r2], (B1_LOC_OFF - PFS_LOC_OFF) // r14 = pfs_loc
+ ld8 r15 = [r3] // r15 = ip
+ add r3 = (B2_LOC_OFF - IP_OFF), r3
+ ;;
+
+ ld8 r16 = [r2], (B3_LOC_OFF - B1_LOC_OFF) // r16 = b1_loc
+ ld8 r17= [r3], (B4_LOC_OFF - B2_LOC_OFF) // r17 = b2_loc
+ and r14 = -4, r14
+ ;;
+
+ ld8 r18 = [r2], (B5_LOC_OFF - B3_LOC_OFF) // r18 = b3_loc
+ ld8 r19 = [r3], (F2_LOC_OFF - B4_LOC_OFF) // r19 = b4_loc
+ and r16 = -4, r16
+ ;;
+
+ ld8 r20 = [r2], (F3_LOC_OFF - B5_LOC_OFF) // r20 = b5_loc
+ ld8 r21 = [r3], (F4_LOC_OFF - F2_LOC_OFF) // r21 = f2_loc
+ and r17 = -4, r17
+ ;;
+
+ ld8 r16 = [r16] // r16 = *b1_loc
+ ld8 r17 = [r17] // r17 = *b2_loc
+ and r18 = -4, r18
+
+ ld8 r22 = [r2], (F5_LOC_OFF - F3_LOC_OFF) // r21 = f3_loc
+ ld8 r23 = [r3], (UNAT_LOC_OFF - F4_LOC_OFF) // r22 = f4_loc
+ and r19 = -4, r19
+ ;;
+
+ ld8 r18 = [r18] // r18 = *b3_loc
+ ld8 r19 = [r19] // r19 = *b4_loc
+ and r20 = -4, r20
+
+ ld8 r24 = [r2], (LC_LOC_OFF - F5_LOC_OFF) // r24 = f5_loc
+ ld8 r25 = [r3], (FPSR_LOC_OFF - UNAT_LOC_OFF) // r25 = unat_loc
+ and r21 = -4, r21
+ ;;
+
+ and r22 = -4, r22
+ and r23 = -4, r23
+ and r24 = -4, r24
+
+ ld8 r20 = [r20] // r20 = *b5_loc
+ ldf.fill f2 = [r21] // f2 restored (don't touch no more)
+ mov b1 = r16 // b1 restored (don't touch no more)
+ ;;
+
+ ldf.fill f3 = [r22] // f3 restored (don't touch no more)
+ ldf.fill f4 = [r23] // f4 restored (don't touch no more)
+ mov b2 = r17 // b2 restored (don't touch no more)
+
+ ld8 r26 = [r2], (RNAT_LOC_OFF - LC_LOC_OFF) // r26 = lc_loc
+ ld8 r27 = [r3] // r27 = fpsr_loc
+ and r25 = -4, r25
+
+ add r3 = (PSP_OFF - FPSR_LOC_OFF), r3
+ nop 0
+ nop 0
+ ;;
+
+ ldf.fill f5 = [r24] // f5 restored (don't touch no more)
+(pRet) ld8 r25 = [r25] // r25 = *unat_loc
+ mov b3 = r18 // b3 restored (don't touch no more)
+
+ ld8 r28 = [r2], (BSP_OFF - RNAT_LOC_OFF) // r28 = rnat_loc
+ ld8 r29 = [r3], (PR_OFF - PSP_OFF) // r29 = sp
+ mov b4 = r19 // b4 restored (don't touch no more)
+
+ and r26 = -4, r26
+ and r27 = -4, r27
+ mov b5 = r20 // b5 restored (don't touch no more)
+ ;;
+
+ ld8 r26 = [r26] // r26 = *lc_loc
+ ld8 r27 = [r27] // r27 = *fpsr_loc
+ and r28 = -4, r28
+
+ mov r30 = in3 // make backup-copy of new bsp
+ ld8 r31 = [r3] // r31 = pr
+ mov rp = r15
+ ;;
+
+ ld8 r28 = [r28] // r28 = rnat
+ mov.m ar.rsc = r11 // put RSE into enforced lazy mode
+ mov.i ar.lc = r26 // lc restored (don't touch no more)
+ ;;
+
+ loadrs // drop dirty partition
+ mov r9 = in2 // make backup-copy of &extra[r16]
+ cmp.eq p8, p0 = in4, r0 // dirty-size == 0?
+(p8) br.cond.dpnt.many .skip_load_dirty
+
+ mov r2 = in4 // make backup-copy of dirty_size
+ mov r15 = in5 // make backup-copy of dirty_partition
+ mov r16 = in6 // make backup-copy of dirty_rnat
+ ;;
+
+ alloc r3 = ar.pfs, 0, 0, 0, 0 // drop register frame
+ dep r11 = r2, r11, 16, 16
+ ;;
+ mov.m ar.bspstore = r15
+ ;;
+ mov.m ar.rnat = r16
+ mov.m ar.rsc = r11 // 14 cycles latency to loadrs
+ ;;
+ loadrs // loadup new dirty partition
+ ;;
+
+.skip_load_dirty:
+ mov.m ar.bspstore = r30 // restore register backing-store
+ add r3 = 8, r9 // r3 = &extra[r16]
+ ;;
+
+(pRet) mov.m ar.fpsr = r27 // fpsr restored (don't touch no more)
+ mov.m ar.rnat = r28
+(pSig) br.cond.dpnt.many .next
+
+/****** Return via br.ret: */
+
+ ld8 r14 = [r14] // r14 = *pfs_loc
+ ld8 r15 = [r9], 16 // r15 restored (don't touch no more)
+ mov pr = r31, -1 // pr restored (don't touch no more)
+ ;;
+
+ ld8 r16 = [r3], 16 // r16 restored (don't touch no more)
+ ld8 r17 = [r9] // r17 restored (don't touch no more)
+ nop.i 0
+ ;;
+
+ ld8 r18 = [r3] // r18 restored (don't touch no more)
+ mov.m ar.rsc = r10 // restore original ar.rsc
+ mov sp = r29
+
+ mov.m ar.unat = r25 // unat restored (don't touch no more)
+ mov.i ar.pfs = r14
+ br.ret.sptk.many rp
+ ;;
+
+/****** Return via sigreturn(): */
+
+.next: mov.m ar.rsc = r10 // restore original ar.rsc
+ add r2 = (SC_FR + 6*16), r8
+ add r3 = (SC_FR + 7*16), r8
+ ;;
+
+ ldf.fill f6 = [r2], 32
+ ldf.fill f7 = [r3], 32
+ nop 0
+ ;;
+
+ ldf.fill f8 = [r2], 32
+ ldf.fill f9 = [r3], 32
+ nop 0
+ ;;
+
+ ldf.fill f10 = [r2], 32
+ ldf.fill f11 = [r3], 32
+ nop 0
+ ;;
+
+ ldf.fill f12 = [r2], 32
+ ldf.fill f13 = [r3], 32
+ nop 0
+ ;;
+
+ ldf.fill f14 = [r2], 32
+ ldf.fill f15 = [r3], 32
+ mov sp = r29
+ ;;
+
+#if NEW_SYSCALL
+ add r2 = 8, tp;;
+ ld8 r2 = [r2]
+ mov r15 = SYS_sigreturn
+ mov b7 = r2
+ br.call.sptk.many b6 = b7
+ ;;
+#else
+ mov r15 = SYS_sigreturn
+ break 0x100000
+#endif
+ break 0 // bug out if sigreturn() returns
+
+ .endp ia64_install_cursor
+
+#endif /* !UNW_REMOTE_ONLY */
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Gis_signal_frame.c b/src/pal/src/libunwind/src/ia64/Gis_signal_frame.c
new file mode 100644
index 0000000000..e268a06299
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gis_signal_frame.c
@@ -0,0 +1,54 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct ia64_state_record sr;
+ int ret;
+
+ /* Crude and slow, but we need to peek ahead into the unwind
+ descriptors to find out if the current IP is inside the signal
+ trampoline. */
+ ret = ia64_fetch_proc_info (c, c->ip, 1);
+ if (ret < 0)
+ return ret;
+
+ ret = ia64_create_state_record (c, &sr);
+ if (ret < 0)
+ return ret;
+
+ /* For now, we assume that any non-zero abi marker implies a signal frame.
+ This should get us pretty far. */
+ ret = (sr.abi_marker != 0);
+
+ ia64_free_state_record (&sr);
+
+ Debug (1, "(cursor=%p, ip=0x%016lx) -> %d\n", c, c->ip, ret);
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gparser.c b/src/pal/src/libunwind/src/ia64/Gparser.c
new file mode 100644
index 0000000000..b1f0f4a118
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gparser.c
@@ -0,0 +1,1131 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+/* forward declaration: */
+static int create_state_record_for (struct cursor *c,
+ struct ia64_state_record *sr,
+ unw_word_t ip);
+
+typedef unsigned long unw_word;
+
+#define alloc_reg_state() (mempool_alloc (&unw.reg_state_pool))
+#define free_reg_state(rs) (mempool_free (&unw.reg_state_pool, rs))
+#define alloc_labeled_state() (mempool_alloc (&unw.labeled_state_pool))
+#define free_labeled_state(s) (mempool_free (&unw.labeled_state_pool, s))
+
+/* Routines to manipulate the state stack. */
+
+static inline void
+push (struct ia64_state_record *sr)
+{
+ struct ia64_reg_state *rs;
+
+ rs = alloc_reg_state ();
+ if (!rs)
+ {
+ print_error ("libunwind: cannot stack reg state!\n");
+ return;
+ }
+ memcpy (rs, &sr->curr, sizeof (*rs));
+ sr->curr.next = rs;
+}
+
+static void
+pop (struct ia64_state_record *sr)
+{
+ struct ia64_reg_state *rs = sr->curr.next;
+
+ if (!rs)
+ {
+ print_error ("libunwind: stack underflow!\n");
+ return;
+ }
+ memcpy (&sr->curr, rs, sizeof (*rs));
+ free_reg_state (rs);
+}
+
+/* Make a copy of the state stack. Non-recursive to avoid stack overflows. */
+static struct ia64_reg_state *
+dup_state_stack (struct ia64_reg_state *rs)
+{
+ struct ia64_reg_state *copy, *prev = NULL, *first = NULL;
+
+ while (rs)
+ {
+ copy = alloc_reg_state ();
+ if (!copy)
+ {
+ print_error ("unwind.dup_state_stack: out of memory\n");
+ return NULL;
+ }
+ memcpy (copy, rs, sizeof (*copy));
+ if (first)
+ prev->next = copy;
+ else
+ first = copy;
+ rs = rs->next;
+ prev = copy;
+ }
+ return first;
+}
+
+/* Free all stacked register states (but not RS itself). */
+static void
+free_state_stack (struct ia64_reg_state *rs)
+{
+ struct ia64_reg_state *p, *next;
+
+ for (p = rs->next; p != NULL; p = next)
+ {
+ next = p->next;
+ free_reg_state (p);
+ }
+ rs->next = NULL;
+}
+
+/* Unwind decoder routines */
+
+static enum ia64_pregnum CONST_ATTR
+decode_abreg (unsigned char abreg, int memory)
+{
+ switch (abreg)
+ {
+ case 0x04 ... 0x07:
+ return IA64_REG_R4 + (abreg - 0x04);
+ case 0x22 ... 0x25:
+ return IA64_REG_F2 + (abreg - 0x22);
+ case 0x30 ... 0x3f:
+ return IA64_REG_F16 + (abreg - 0x30);
+ case 0x41 ... 0x45:
+ return IA64_REG_B1 + (abreg - 0x41);
+ case 0x60:
+ return IA64_REG_PR;
+ case 0x61:
+ return IA64_REG_PSP;
+ case 0x62:
+ return memory ? IA64_REG_PRI_UNAT_MEM : IA64_REG_PRI_UNAT_GR;
+ case 0x63:
+ return IA64_REG_IP;
+ case 0x64:
+ return IA64_REG_BSP;
+ case 0x65:
+ return IA64_REG_BSPSTORE;
+ case 0x66:
+ return IA64_REG_RNAT;
+ case 0x67:
+ return IA64_REG_UNAT;
+ case 0x68:
+ return IA64_REG_FPSR;
+ case 0x69:
+ return IA64_REG_PFS;
+ case 0x6a:
+ return IA64_REG_LC;
+ default:
+ break;
+ }
+ Dprintf ("libunwind: bad abreg=0x%x\n", abreg);
+ return IA64_REG_LC;
+}
+
+static void
+set_reg (struct ia64_reg_info *reg, enum ia64_where where, int when,
+ unsigned long val)
+{
+ reg->val = val;
+ reg->where = where;
+ if (reg->when == IA64_WHEN_NEVER)
+ reg->when = when;
+}
+
+static void
+alloc_spill_area (unsigned long *offp, unsigned long regsize,
+ struct ia64_reg_info *lo, struct ia64_reg_info *hi)
+{
+ struct ia64_reg_info *reg;
+
+ for (reg = hi; reg >= lo; --reg)
+ {
+ if (reg->where == IA64_WHERE_SPILL_HOME)
+ {
+ reg->where = IA64_WHERE_PSPREL;
+ *offp -= regsize;
+ reg->val = *offp;
+ }
+ }
+}
+
+static inline void
+spill_next_when (struct ia64_reg_info **regp, struct ia64_reg_info *lim,
+ unw_word t)
+{
+ struct ia64_reg_info *reg;
+
+ for (reg = *regp; reg <= lim; ++reg)
+ {
+ if (reg->where == IA64_WHERE_SPILL_HOME)
+ {
+ reg->when = t;
+ *regp = reg + 1;
+ return;
+ }
+ }
+ Dprintf ("libunwind: excess spill!\n");
+}
+
+static inline void
+finish_prologue (struct ia64_state_record *sr)
+{
+ struct ia64_reg_info *reg;
+ unsigned long off;
+ int i;
+
+ /* First, resolve implicit register save locations (see Section
+ "11.4.2.3 Rules for Using Unwind Descriptors", rule 3). */
+ for (i = 0; i < (int) ARRAY_SIZE (unw.save_order); ++i)
+ {
+ reg = sr->curr.reg + unw.save_order[i];
+ if (reg->where == IA64_WHERE_GR_SAVE)
+ {
+ reg->where = IA64_WHERE_GR;
+ reg->val = sr->gr_save_loc++;
+ }
+ }
+
+ /* Next, compute when the fp, general, and branch registers get
+ saved. This must come before alloc_spill_area() because we need
+ to know which registers are spilled to their home locations. */
+
+ if (sr->imask)
+ {
+ unsigned char kind, mask = 0, *cp = sr->imask;
+ unsigned long t;
+ static const unsigned char limit[3] =
+ {
+ IA64_REG_F31, IA64_REG_R7, IA64_REG_B5
+ };
+ struct ia64_reg_info *(regs[3]);
+
+ regs[0] = sr->curr.reg + IA64_REG_F2;
+ regs[1] = sr->curr.reg + IA64_REG_R4;
+ regs[2] = sr->curr.reg + IA64_REG_B1;
+
+ for (t = 0; (int) t < sr->region_len; ++t)
+ {
+ if ((t & 3) == 0)
+ mask = *cp++;
+ kind = (mask >> 2 * (3 - (t & 3))) & 3;
+ if (kind > 0)
+ spill_next_when (&regs[kind - 1], sr->curr.reg + limit[kind - 1],
+ sr->region_start + t);
+ }
+ }
+
+ /* Next, lay out the memory stack spill area. */
+
+ if (sr->any_spills)
+ {
+ off = sr->spill_offset;
+ alloc_spill_area (&off, 16, sr->curr.reg + IA64_REG_F2,
+ sr->curr.reg + IA64_REG_F31);
+ alloc_spill_area (&off, 8, sr->curr.reg + IA64_REG_B1,
+ sr->curr.reg + IA64_REG_B5);
+ alloc_spill_area (&off, 8, sr->curr.reg + IA64_REG_R4,
+ sr->curr.reg + IA64_REG_R7);
+ }
+}
+
+/* Region header descriptors. */
+
+static void
+desc_prologue (int body, unw_word rlen, unsigned char mask,
+ unsigned char grsave, struct ia64_state_record *sr)
+{
+ int i, region_start;
+
+ if (!(sr->in_body || sr->first_region))
+ finish_prologue (sr);
+ sr->first_region = 0;
+
+ /* check if we're done: */
+ if (sr->when_target < sr->region_start + sr->region_len)
+ {
+ sr->done = 1;
+ return;
+ }
+
+ region_start = sr->region_start + sr->region_len;
+
+ for (i = 0; i < sr->epilogue_count; ++i)
+ pop (sr);
+ sr->epilogue_count = 0;
+ sr->when_sp_restored = IA64_WHEN_NEVER;
+
+ sr->region_start = region_start;
+ sr->region_len = rlen;
+ sr->in_body = body;
+
+ if (!body)
+ {
+ push (sr);
+
+ if (mask)
+ for (i = 0; i < 4; ++i)
+ {
+ if (mask & 0x8)
+ set_reg (sr->curr.reg + unw.save_order[i], IA64_WHERE_GR,
+ sr->region_start + sr->region_len - 1, grsave++);
+ mask <<= 1;
+ }
+ sr->gr_save_loc = grsave;
+ sr->any_spills = 0;
+ sr->imask = 0;
+ sr->spill_offset = 0x10; /* default to psp+16 */
+ }
+}
+
+/* Prologue descriptors. */
+
+static inline void
+desc_abi (unsigned char abi, unsigned char context,
+ struct ia64_state_record *sr)
+{
+ sr->abi_marker = (abi << 8) | context;
+}
+
+static inline void
+desc_br_gr (unsigned char brmask, unsigned char gr,
+ struct ia64_state_record *sr)
+{
+ int i;
+
+ for (i = 0; i < 5; ++i)
+ {
+ if (brmask & 1)
+ set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_GR,
+ sr->region_start + sr->region_len - 1, gr++);
+ brmask >>= 1;
+ }
+}
+
+static inline void
+desc_br_mem (unsigned char brmask, struct ia64_state_record *sr)
+{
+ int i;
+
+ for (i = 0; i < 5; ++i)
+ {
+ if (brmask & 1)
+ {
+ set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_SPILL_HOME,
+ sr->region_start + sr->region_len - 1, 0);
+ sr->any_spills = 1;
+ }
+ brmask >>= 1;
+ }
+}
+
+static inline void
+desc_frgr_mem (unsigned char grmask, unw_word frmask,
+ struct ia64_state_record *sr)
+{
+ int i;
+
+ for (i = 0; i < 4; ++i)
+ {
+ if ((grmask & 1) != 0)
+ {
+ set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME,
+ sr->region_start + sr->region_len - 1, 0);
+ sr->any_spills = 1;
+ }
+ grmask >>= 1;
+ }
+ for (i = 0; i < 20; ++i)
+ {
+ if ((frmask & 1) != 0)
+ {
+ int base = (i < 4) ? IA64_REG_F2 : IA64_REG_F16 - 4;
+ set_reg (sr->curr.reg + base + i, IA64_WHERE_SPILL_HOME,
+ sr->region_start + sr->region_len - 1, 0);
+ sr->any_spills = 1;
+ }
+ frmask >>= 1;
+ }
+}
+
+static inline void
+desc_fr_mem (unsigned char frmask, struct ia64_state_record *sr)
+{
+ int i;
+
+ for (i = 0; i < 4; ++i)
+ {
+ if ((frmask & 1) != 0)
+ {
+ set_reg (sr->curr.reg + IA64_REG_F2 + i, IA64_WHERE_SPILL_HOME,
+ sr->region_start + sr->region_len - 1, 0);
+ sr->any_spills = 1;
+ }
+ frmask >>= 1;
+ }
+}
+
+static inline void
+desc_gr_gr (unsigned char grmask, unsigned char gr,
+ struct ia64_state_record *sr)
+{
+ int i;
+
+ for (i = 0; i < 4; ++i)
+ {
+ if ((grmask & 1) != 0)
+ set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_GR,
+ sr->region_start + sr->region_len - 1, gr++);
+ grmask >>= 1;
+ }
+}
+
+static inline void
+desc_gr_mem (unsigned char grmask, struct ia64_state_record *sr)
+{
+ int i;
+
+ for (i = 0; i < 4; ++i)
+ {
+ if ((grmask & 1) != 0)
+ {
+ set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME,
+ sr->region_start + sr->region_len - 1, 0);
+ sr->any_spills = 1;
+ }
+ grmask >>= 1;
+ }
+}
+
+static inline void
+desc_mem_stack_f (unw_word t, unw_word size, struct ia64_state_record *sr)
+{
+ set_reg (sr->curr.reg + IA64_REG_PSP, IA64_WHERE_NONE,
+ sr->region_start + MIN ((int) t, sr->region_len - 1), 16 * size);
+}
+
+static inline void
+desc_mem_stack_v (unw_word t, struct ia64_state_record *sr)
+{
+ sr->curr.reg[IA64_REG_PSP].when =
+ sr->region_start + MIN ((int) t, sr->region_len - 1);
+}
+
+static inline void
+desc_reg_gr (unsigned char reg, unsigned char dst,
+ struct ia64_state_record *sr)
+{
+ set_reg (sr->curr.reg + reg, IA64_WHERE_GR,
+ sr->region_start + sr->region_len - 1, dst);
+}
+
+static inline void
+desc_reg_psprel (unsigned char reg, unw_word pspoff,
+ struct ia64_state_record *sr)
+{
+ set_reg (sr->curr.reg + reg, IA64_WHERE_PSPREL,
+ sr->region_start + sr->region_len - 1, 0x10 - 4 * pspoff);
+}
+
+static inline void
+desc_reg_sprel (unsigned char reg, unw_word spoff,
+ struct ia64_state_record *sr)
+{
+ set_reg (sr->curr.reg + reg, IA64_WHERE_SPREL,
+ sr->region_start + sr->region_len - 1, 4 * spoff);
+}
+
+static inline void
+desc_rp_br (unsigned char dst, struct ia64_state_record *sr)
+{
+ sr->return_link_reg = dst;
+}
+
+static inline void
+desc_reg_when (unsigned char regnum, unw_word t, struct ia64_state_record *sr)
+{
+ struct ia64_reg_info *reg = sr->curr.reg + regnum;
+
+ if (reg->where == IA64_WHERE_NONE)
+ reg->where = IA64_WHERE_GR_SAVE;
+ reg->when = sr->region_start + MIN ((int) t, sr->region_len - 1);
+}
+
+static inline void
+desc_spill_base (unw_word pspoff, struct ia64_state_record *sr)
+{
+ sr->spill_offset = 0x10 - 4 * pspoff;
+}
+
+static inline unsigned char *
+desc_spill_mask (unsigned char *imaskp, struct ia64_state_record *sr)
+{
+ sr->imask = imaskp;
+ return imaskp + (2 * sr->region_len + 7) / 8;
+}
+
+/* Body descriptors. */
+
+static inline void
+desc_epilogue (unw_word t, unw_word ecount, struct ia64_state_record *sr)
+{
+ sr->when_sp_restored = sr->region_start + sr->region_len - 1 - t;
+ sr->epilogue_count = ecount + 1;
+}
+
+static inline void
+desc_copy_state (unw_word label, struct ia64_state_record *sr)
+{
+ struct ia64_labeled_state *ls;
+
+ for (ls = sr->labeled_states; ls; ls = ls->next)
+ {
+ if (ls->label == label)
+ {
+ free_state_stack (&sr->curr);
+ memcpy (&sr->curr, &ls->saved_state, sizeof (sr->curr));
+ sr->curr.next = dup_state_stack (ls->saved_state.next);
+ return;
+ }
+ }
+ print_error ("libunwind: failed to find labeled state\n");
+}
+
+static inline void
+desc_label_state (unw_word label, struct ia64_state_record *sr)
+{
+ struct ia64_labeled_state *ls;
+
+ ls = alloc_labeled_state ();
+ if (!ls)
+ {
+ print_error ("unwind.desc_label_state(): out of memory\n");
+ return;
+ }
+ ls->label = label;
+ memcpy (&ls->saved_state, &sr->curr, sizeof (ls->saved_state));
+ ls->saved_state.next = dup_state_stack (sr->curr.next);
+
+ /* insert into list of labeled states: */
+ ls->next = sr->labeled_states;
+ sr->labeled_states = ls;
+}
+
+/* General descriptors. */
+
+static inline int
+desc_is_active (unsigned char qp, unw_word t, struct ia64_state_record *sr)
+{
+ if (sr->when_target <= sr->region_start + MIN ((int) t, sr->region_len - 1))
+ return 0;
+ if (qp > 0)
+ {
+ if ((sr->pr_val & ((unw_word_t) 1 << qp)) == 0)
+ return 0;
+ sr->pr_mask |= ((unw_word_t) 1 << qp);
+ }
+ return 1;
+}
+
+static inline void
+desc_restore_p (unsigned char qp, unw_word t, unsigned char abreg,
+ struct ia64_state_record *sr)
+{
+ struct ia64_reg_info *r;
+
+ if (!desc_is_active (qp, t, sr))
+ return;
+
+ r = sr->curr.reg + decode_abreg (abreg, 0);
+ r->where = IA64_WHERE_NONE;
+ r->when = IA64_WHEN_NEVER;
+ r->val = 0;
+}
+
+static inline void
+desc_spill_reg_p (unsigned char qp, unw_word t, unsigned char abreg,
+ unsigned char x, unsigned char ytreg,
+ struct ia64_state_record *sr)
+{
+ enum ia64_where where = IA64_WHERE_GR;
+ struct ia64_reg_info *r;
+
+ if (!desc_is_active (qp, t, sr))
+ return;
+
+ if (x)
+ where = IA64_WHERE_BR;
+ else if (ytreg & 0x80)
+ where = IA64_WHERE_FR;
+
+ r = sr->curr.reg + decode_abreg (abreg, 0);
+ r->where = where;
+ r->when = sr->region_start + MIN ((int) t, sr->region_len - 1);
+ r->val = (ytreg & 0x7f);
+}
+
+static inline void
+desc_spill_psprel_p (unsigned char qp, unw_word t, unsigned char abreg,
+ unw_word pspoff, struct ia64_state_record *sr)
+{
+ struct ia64_reg_info *r;
+
+ if (!desc_is_active (qp, t, sr))
+ return;
+
+ r = sr->curr.reg + decode_abreg (abreg, 1);
+ r->where = IA64_WHERE_PSPREL;
+ r->when = sr->region_start + MIN ((int) t, sr->region_len - 1);
+ r->val = 0x10 - 4 * pspoff;
+}
+
+static inline void
+desc_spill_sprel_p (unsigned char qp, unw_word t, unsigned char abreg,
+ unw_word spoff, struct ia64_state_record *sr)
+{
+ struct ia64_reg_info *r;
+
+ if (!desc_is_active (qp, t, sr))
+ return;
+
+ r = sr->curr.reg + decode_abreg (abreg, 1);
+ r->where = IA64_WHERE_SPREL;
+ r->when = sr->region_start + MIN ((int) t, sr->region_len - 1);
+ r->val = 4 * spoff;
+}
+
+#define UNW_DEC_BAD_CODE(code) \
+ print_error ("libunwind: unknown code encountered\n")
+
+/* Register names. */
+#define UNW_REG_BSP IA64_REG_BSP
+#define UNW_REG_BSPSTORE IA64_REG_BSPSTORE
+#define UNW_REG_FPSR IA64_REG_FPSR
+#define UNW_REG_LC IA64_REG_LC
+#define UNW_REG_PFS IA64_REG_PFS
+#define UNW_REG_PR IA64_REG_PR
+#define UNW_REG_RNAT IA64_REG_RNAT
+#define UNW_REG_PSP IA64_REG_PSP
+#define UNW_REG_RP IA64_REG_IP
+#define UNW_REG_UNAT IA64_REG_UNAT
+
+/* Region headers. */
+#define UNW_DEC_PROLOGUE_GR(fmt,r,m,gr,arg) desc_prologue(0,r,m,gr,arg)
+#define UNW_DEC_PROLOGUE(fmt,b,r,arg) desc_prologue(b,r,0,32,arg)
+
+/* Prologue descriptors. */
+#define UNW_DEC_ABI(fmt,a,c,arg) desc_abi(a,c,arg)
+#define UNW_DEC_BR_GR(fmt,b,g,arg) desc_br_gr(b,g,arg)
+#define UNW_DEC_BR_MEM(fmt,b,arg) desc_br_mem(b,arg)
+#define UNW_DEC_FRGR_MEM(fmt,g,f,arg) desc_frgr_mem(g,f,arg)
+#define UNW_DEC_FR_MEM(fmt,f,arg) desc_fr_mem(f,arg)
+#define UNW_DEC_GR_GR(fmt,m,g,arg) desc_gr_gr(m,g,arg)
+#define UNW_DEC_GR_MEM(fmt,m,arg) desc_gr_mem(m,arg)
+#define UNW_DEC_MEM_STACK_F(fmt,t,s,arg) desc_mem_stack_f(t,s,arg)
+#define UNW_DEC_MEM_STACK_V(fmt,t,arg) desc_mem_stack_v(t,arg)
+#define UNW_DEC_REG_GR(fmt,r,d,arg) desc_reg_gr(r,d,arg)
+#define UNW_DEC_REG_PSPREL(fmt,r,o,arg) desc_reg_psprel(r,o,arg)
+#define UNW_DEC_REG_SPREL(fmt,r,o,arg) desc_reg_sprel(r,o,arg)
+#define UNW_DEC_REG_WHEN(fmt,r,t,arg) desc_reg_when(r,t,arg)
+#define UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg) \
+ desc_reg_when(IA64_REG_PRI_UNAT_GR,t,arg)
+#define UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg) \
+ desc_reg_when(IA64_REG_PRI_UNAT_MEM,t,arg)
+#define UNW_DEC_PRIUNAT_GR(fmt,r,arg) \
+ desc_reg_gr(IA64_REG_PRI_UNAT_GR,r,arg)
+#define UNW_DEC_PRIUNAT_PSPREL(fmt,o,arg) \
+ desc_reg_psprel(IA64_REG_PRI_UNAT_MEM,o,arg)
+#define UNW_DEC_PRIUNAT_SPREL(fmt,o,arg) \
+ desc_reg_sprel(IA64_REG_PRI_UNAT_MEM,o,arg)
+#define UNW_DEC_RP_BR(fmt,d,arg) desc_rp_br(d,arg)
+#define UNW_DEC_SPILL_BASE(fmt,o,arg) desc_spill_base(o,arg)
+#define UNW_DEC_SPILL_MASK(fmt,m,arg) (m = desc_spill_mask(m,arg))
+
+/* Body descriptors. */
+#define UNW_DEC_EPILOGUE(fmt,t,c,arg) desc_epilogue(t,c,arg)
+#define UNW_DEC_COPY_STATE(fmt,l,arg) desc_copy_state(l,arg)
+#define UNW_DEC_LABEL_STATE(fmt,l,arg) desc_label_state(l,arg)
+
+/* General unwind descriptors. */
+#define UNW_DEC_SPILL_REG_P(f,p,t,a,x,y,arg) desc_spill_reg_p(p,t,a,x,y,arg)
+#define UNW_DEC_SPILL_REG(f,t,a,x,y,arg) desc_spill_reg_p(0,t,a,x,y,arg)
+#define UNW_DEC_SPILL_PSPREL_P(f,p,t,a,o,arg) \
+ desc_spill_psprel_p(p,t,a,o,arg)
+#define UNW_DEC_SPILL_PSPREL(f,t,a,o,arg) \
+ desc_spill_psprel_p(0,t,a,o,arg)
+#define UNW_DEC_SPILL_SPREL_P(f,p,t,a,o,arg) desc_spill_sprel_p(p,t,a,o,arg)
+#define UNW_DEC_SPILL_SPREL(f,t,a,o,arg) desc_spill_sprel_p(0,t,a,o,arg)
+#define UNW_DEC_RESTORE_P(f,p,t,a,arg) desc_restore_p(p,t,a,arg)
+#define UNW_DEC_RESTORE(f,t,a,arg) desc_restore_p(0,t,a,arg)
+
+#include "unwind_decoder.h"
+
+#ifdef _U_dyn_op
+
+/* parse dynamic unwind info */
+
+static struct ia64_reg_info *
+lookup_preg (int regnum, int memory, struct ia64_state_record *sr)
+{
+ int preg;
+
+ switch (regnum)
+ {
+ case UNW_IA64_AR_BSP: preg = IA64_REG_BSP; break;
+ case UNW_IA64_AR_BSPSTORE: preg = IA64_REG_BSPSTORE; break;
+ case UNW_IA64_AR_FPSR: preg = IA64_REG_FPSR; break;
+ case UNW_IA64_AR_LC: preg = IA64_REG_LC; break;
+ case UNW_IA64_AR_PFS: preg = IA64_REG_PFS; break;
+ case UNW_IA64_AR_RNAT: preg = IA64_REG_RNAT; break;
+ case UNW_IA64_AR_UNAT: preg = IA64_REG_UNAT; break;
+ case UNW_IA64_BR + 0: preg = IA64_REG_IP; break;
+ case UNW_IA64_PR: preg = IA64_REG_PR; break;
+ case UNW_IA64_SP: preg = IA64_REG_PSP; break;
+
+ case UNW_IA64_NAT:
+ if (memory)
+ preg = IA64_REG_PRI_UNAT_MEM;
+ else
+ preg = IA64_REG_PRI_UNAT_GR;
+ break;
+
+ case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7:
+ preg = IA64_REG_R4 + (regnum - (UNW_IA64_GR + 4));
+ break;
+
+ case UNW_IA64_BR + 1 ... UNW_IA64_BR + 5:
+ preg = IA64_REG_B1 + (regnum - UNW_IA64_BR);
+ break;
+
+ case UNW_IA64_FR + 2 ... UNW_IA64_FR + 5:
+ preg = IA64_REG_F2 + (regnum - (UNW_IA64_FR + 2));
+ break;
+
+ case UNW_IA64_FR + 16 ... UNW_IA64_FR + 31:
+ preg = IA64_REG_F16 + (regnum - (UNW_IA64_FR + 16));
+ break;
+
+ default:
+ Dprintf ("%s: invalid register number %d\n", __FUNCTION__, regnum);
+ return NULL;
+ }
+ return sr->curr.reg + preg;
+}
+
+/* An alias directive inside a region of length RLEN is interpreted to
+ mean that the region behaves exactly like the first RLEN
+ instructions at the aliased IP. RLEN=0 implies that the current
+ state matches exactly that of before the instruction at the aliased
+ IP is executed. */
+
+static int
+desc_alias (unw_dyn_op_t *op, struct cursor *c, struct ia64_state_record *sr)
+{
+ struct ia64_state_record orig_sr = *sr;
+ int i, ret, when, rlen = sr->region_len;
+ unw_word_t new_ip;
+
+ when = MIN (sr->when_target, rlen);
+ new_ip = op->val + ((when / 3) * 16 + (when % 3));
+
+ if ((ret = ia64_fetch_proc_info (c, new_ip, 1)) < 0)
+ return ret;
+
+ if ((ret = create_state_record_for (c, sr, new_ip)) < 0)
+ return ret;
+
+ sr->first_region = orig_sr.first_region;
+ sr->done = 0;
+ sr->any_spills |= orig_sr.any_spills;
+ sr->in_body = orig_sr.in_body;
+ sr->region_start = orig_sr.region_start;
+ sr->region_len = orig_sr.region_len;
+ if (sr->when_sp_restored != IA64_WHEN_NEVER)
+ sr->when_sp_restored = op->when + MIN (orig_sr.when_sp_restored, rlen);
+ sr->epilogue_count = orig_sr.epilogue_count;
+ sr->when_target = orig_sr.when_target;
+
+ for (i = 0; i < IA64_NUM_PREGS; ++i)
+ if (sr->curr.reg[i].when != IA64_WHEN_NEVER)
+ sr->curr.reg[i].when = op->when + MIN (sr->curr.reg[i].when, rlen);
+
+ ia64_free_state_record (sr);
+ sr->labeled_states = orig_sr.labeled_states;
+ sr->curr.next = orig_sr.curr.next;
+ return 0;
+}
+
+static inline int
+parse_dynamic (struct cursor *c, struct ia64_state_record *sr)
+{
+ unw_dyn_info_t *di = c->pi.unwind_info;
+ unw_dyn_proc_info_t *proc = &di->u.pi;
+ unw_dyn_region_info_t *r;
+ struct ia64_reg_info *ri;
+ enum ia64_where where;
+ int32_t when, len;
+ unw_dyn_op_t *op;
+ unw_word_t val;
+ int memory, ret;
+ int8_t qp;
+
+ for (r = proc->regions; r; r = r->next)
+ {
+ len = r->insn_count;
+ if (len < 0)
+ {
+ if (r->next)
+ {
+ Debug (1, "negative region length allowed in last region only!");
+ return -UNW_EINVAL;
+ }
+ len = -len;
+ /* hack old region info to set the start where we need it: */
+ sr->region_start = (di->end_ip - di->start_ip) / 0x10 * 3 - len;
+ sr->region_len = 0;
+ }
+ /* all regions are treated as prologue regions: */
+ desc_prologue (0, len, 0, 0, sr);
+
+ if (sr->done)
+ return 0;
+
+ for (op = r->op; op < r->op + r->op_count; ++op)
+ {
+ when = op->when;
+ val = op->val;
+ qp = op->qp;
+
+ if (!desc_is_active (qp, when, sr))
+ continue;
+
+ when = sr->region_start + MIN ((int) when, sr->region_len - 1);
+
+ switch (op->tag)
+ {
+ case UNW_DYN_SAVE_REG:
+ memory = 0;
+ if ((unsigned) (val - UNW_IA64_GR) < 128)
+ where = IA64_WHERE_GR;
+ else if ((unsigned) (val - UNW_IA64_FR) < 128)
+ where = IA64_WHERE_FR;
+ else if ((unsigned) (val - UNW_IA64_BR) < 8)
+ where = IA64_WHERE_BR;
+ else
+ {
+ Dprintf ("%s: can't save to register number %d\n",
+ __FUNCTION__, (int) op->reg);
+ return -UNW_EBADREG;
+ }
+ /* fall through */
+ update_reg_info:
+ ri = lookup_preg (op->reg, memory, sr);
+ if (!ri)
+ return -UNW_EBADREG;
+ ri->where = where;
+ ri->when = when;
+ ri->val = val;
+ break;
+
+ case UNW_DYN_SPILL_FP_REL:
+ memory = 1;
+ where = IA64_WHERE_PSPREL;
+ val = 0x10 - val;
+ goto update_reg_info;
+
+ case UNW_DYN_SPILL_SP_REL:
+ memory = 1;
+ where = IA64_WHERE_SPREL;
+ goto update_reg_info;
+
+ case UNW_DYN_ADD:
+ if (op->reg == UNW_IA64_SP)
+ {
+ if (val & 0xf)
+ {
+ Dprintf ("%s: frame-size %ld not an integer "
+ "multiple of 16\n",
+ __FUNCTION__, (long) op->val);
+ return -UNW_EINVAL;
+ }
+ desc_mem_stack_f (when, -((int64_t) val / 16), sr);
+ }
+ else
+ {
+ Dprintf ("%s: can only ADD to stack-pointer\n",
+ __FUNCTION__);
+ return -UNW_EBADREG;
+ }
+ break;
+
+ case UNW_DYN_POP_FRAMES:
+ sr->when_sp_restored = when;
+ sr->epilogue_count = op->val;
+ break;
+
+ case UNW_DYN_LABEL_STATE:
+ desc_label_state (op->val, sr);
+ break;
+
+ case UNW_DYN_COPY_STATE:
+ desc_copy_state (op->val, sr);
+ break;
+
+ case UNW_DYN_ALIAS:
+ if ((ret = desc_alias (op, c, sr)) < 0)
+ return ret;
+
+ case UNW_DYN_STOP:
+ goto end_of_ops;
+ }
+ }
+ end_of_ops:
+ ;
+ }
+ return 0;
+}
+#else
+# define parse_dynamic(c,sr) (-UNW_EINVAL)
+#endif /* _U_dyn_op */
+
+
+HIDDEN int
+ia64_fetch_proc_info (struct cursor *c, unw_word_t ip, int need_unwind_info)
+{
+ int ret, dynamic = 1;
+
+ if (c->pi_valid && !need_unwind_info)
+ return 0;
+
+ /* check dynamic info first --- it overrides everything else */
+ ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, need_unwind_info,
+ c->as_arg);
+ if (ret == -UNW_ENOINFO)
+ {
+ dynamic = 0;
+ ret = ia64_find_proc_info (c, ip, need_unwind_info);
+ }
+
+ c->pi_valid = 1;
+ c->pi_is_dynamic = dynamic;
+ return ret;
+}
+
+static inline void
+put_unwind_info (struct cursor *c, unw_proc_info_t *pi)
+{
+ if (!c->pi_valid)
+ return;
+
+ if (c->pi_is_dynamic)
+ unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
+ else
+ ia64_put_unwind_info (c, pi);
+}
+
+static int
+create_state_record_for (struct cursor *c, struct ia64_state_record *sr,
+ unw_word_t ip)
+{
+ unw_word_t predicates = c->pr;
+ struct ia64_reg_info *r;
+ uint8_t *dp, *desc_end;
+ int ret;
+
+ assert (c->pi_valid);
+
+ /* build state record */
+ memset (sr, 0, sizeof (*sr));
+ for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r)
+ r->when = IA64_WHEN_NEVER;
+ sr->pr_val = predicates;
+ sr->first_region = 1;
+
+ if (!c->pi.unwind_info)
+ {
+ /* No info, return default unwinder (leaf proc, no mem stack, no
+ saved regs), rp in b0, pfs in ar.pfs. */
+ Debug (1, "no unwind info for ip=0x%lx (gp=%lx)\n",
+ (long) ip, (long) c->pi.gp);
+ sr->curr.reg[IA64_REG_IP].where = IA64_WHERE_BR;
+ sr->curr.reg[IA64_REG_IP].when = -1;
+ sr->curr.reg[IA64_REG_IP].val = 0;
+ goto out;
+ }
+
+ sr->when_target = (3 * ((ip & ~(unw_word_t) 0xf) - c->pi.start_ip) / 16
+ + (ip & 0xf));
+
+ switch (c->pi.format)
+ {
+ case UNW_INFO_FORMAT_TABLE:
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+ dp = c->pi.unwind_info;
+ desc_end = dp + c->pi.unwind_info_size;
+ while (!sr->done && dp < desc_end)
+ dp = unw_decode (dp, sr->in_body, sr);
+ ret = 0;
+ break;
+
+ case UNW_INFO_FORMAT_DYNAMIC:
+ ret = parse_dynamic (c, sr);
+ break;
+
+ default:
+ ret = -UNW_EINVAL;
+ }
+
+ put_unwind_info (c, &c->pi);
+
+ if (ret < 0)
+ return ret;
+
+ if (sr->when_target > sr->when_sp_restored)
+ {
+ /* sp has been restored and all values on the memory stack below
+ psp also have been restored. */
+ sr->curr.reg[IA64_REG_PSP].val = 0;
+ sr->curr.reg[IA64_REG_PSP].where = IA64_WHERE_NONE;
+ sr->curr.reg[IA64_REG_PSP].when = IA64_WHEN_NEVER;
+ for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r)
+ if ((r->where == IA64_WHERE_PSPREL && r->val <= 0x10)
+ || r->where == IA64_WHERE_SPREL)
+ {
+ r->val = 0;
+ r->where = IA64_WHERE_NONE;
+ r->when = IA64_WHEN_NEVER;
+ }
+ }
+
+ /* If RP did't get saved, generate entry for the return link
+ register. */
+ if (sr->curr.reg[IA64_REG_IP].when >= sr->when_target)
+ {
+ sr->curr.reg[IA64_REG_IP].where = IA64_WHERE_BR;
+ sr->curr.reg[IA64_REG_IP].when = -1;
+ sr->curr.reg[IA64_REG_IP].val = sr->return_link_reg;
+ }
+
+ if (sr->when_target > sr->curr.reg[IA64_REG_BSP].when
+ && sr->when_target > sr->curr.reg[IA64_REG_BSPSTORE].when
+ && sr->when_target > sr->curr.reg[IA64_REG_RNAT].when)
+ {
+ Debug (8, "func 0x%lx may switch the register-backing-store\n",
+ c->pi.start_ip);
+ c->pi.flags |= UNW_PI_FLAG_IA64_RBS_SWITCH;
+ }
+ out:
+#if UNW_DEBUG
+ if (unwi_debug_level > 2)
+ {
+ Dprintf ("%s: state record for func 0x%lx, t=%u (flags=0x%lx):\n",
+ __FUNCTION__,
+ (long) c->pi.start_ip, sr->when_target, (long) c->pi.flags);
+ for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r)
+ {
+ if (r->where != IA64_WHERE_NONE || r->when != IA64_WHEN_NEVER)
+ {
+ Dprintf (" %s <- ", unw.preg_name[r - sr->curr.reg]);
+ switch (r->where)
+ {
+ case IA64_WHERE_GR:
+ Dprintf ("r%lu", (long) r->val);
+ break;
+ case IA64_WHERE_FR:
+ Dprintf ("f%lu", (long) r->val);
+ break;
+ case IA64_WHERE_BR:
+ Dprintf ("b%lu", (long) r->val);
+ break;
+ case IA64_WHERE_SPREL:
+ Dprintf ("[sp+0x%lx]", (long) r->val);
+ break;
+ case IA64_WHERE_PSPREL:
+ Dprintf ("[psp+0x%lx]", (long) r->val);
+ break;
+ case IA64_WHERE_NONE:
+ Dprintf ("%s+0x%lx",
+ unw.preg_name[r - sr->curr.reg], (long) r->val);
+ break;
+ default:
+ Dprintf ("BADWHERE(%d)", r->where);
+ break;
+ }
+ Dprintf ("\t\t%d\n", r->when);
+ }
+ }
+ }
+#endif
+ return 0;
+}
+
+/* The proc-info must be valid for IP before this routine can be
+ called. */
+HIDDEN int
+ia64_create_state_record (struct cursor *c, struct ia64_state_record *sr)
+{
+ return create_state_record_for (c, sr, c->ip);
+}
+
+HIDDEN int
+ia64_free_state_record (struct ia64_state_record *sr)
+{
+ struct ia64_labeled_state *ls, *next;
+
+ /* free labeled register states & stack: */
+
+ for (ls = sr->labeled_states; ls; ls = next)
+ {
+ next = ls->next;
+ free_state_stack (&ls->saved_state);
+ free_labeled_state (ls);
+ }
+ free_state_stack (&sr->curr);
+
+ return 0;
+}
+
+HIDDEN int
+ia64_make_proc_info (struct cursor *c)
+{
+ int ret, caching = c->as->caching_policy != UNW_CACHE_NONE;
+
+ if (!caching || ia64_get_cached_proc_info (c) < 0)
+ {
+ /* Lookup it up the slow way... */
+ if ((ret = ia64_fetch_proc_info (c, c->ip, 0)) < 0)
+ return ret;
+ if (caching)
+ ia64_cache_proc_info (c);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Grbs.c b/src/pal/src/libunwind/src/ia64/Grbs.c
new file mode 100644
index 0000000000..e7c01fe219
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Grbs.c
@@ -0,0 +1,319 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Logically, we like to think of the stack as a contiguous region of
+memory. Unfortunately, this logical view doesn't work for the
+register backing store, because the RSE is an asynchronous engine and
+because UNIX/Linux allow for stack-switching via sigaltstack(2).
+Specifically, this means that any given stacked register may or may
+not be backed up by memory in the current stack. If not, then the
+backing memory may be found in any of the "more inner" (younger)
+stacks. The routines in this file help manage the discontiguous
+nature of the register backing store. The routines are completely
+independent of UNIX/Linux, but each stack frame that switches the
+backing store is expected to reserve 4 words for use by libunwind. For
+example, in the Linux sigcontext, sc_fr[0] and sc_fr[1] serve this
+purpose. */
+
+#include "unwind_i.h"
+
+#if UNW_DEBUG
+
+HIDDEN const char *
+ia64_strloc (ia64_loc_t loc)
+{
+ static char buf[128];
+
+ if (IA64_IS_NULL_LOC (loc))
+ return "<null>";
+
+ buf[0] = '\0';
+
+ if (IA64_IS_MEMSTK_NAT (loc))
+ strcat (buf, "memstk_nat(");
+ if (IA64_IS_UC_LOC (loc))
+ strcat (buf, "uc(");
+ if (IA64_IS_FP_LOC (loc))
+ strcat (buf, "fp(");
+
+ if (IA64_IS_REG_LOC (loc))
+ sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc)));
+ else
+ sprintf (buf + strlen (buf), "0x%llx",
+ (unsigned long long) IA64_GET_ADDR (loc));
+
+ if (IA64_IS_FP_LOC (loc))
+ strcat (buf, ")");
+ if (IA64_IS_UC_LOC (loc))
+ strcat (buf, ")");
+ if (IA64_IS_MEMSTK_NAT (loc))
+ strcat (buf, ")");
+
+ return buf;
+}
+
+#endif /* UNW_DEBUG */
+
+HIDDEN int
+rbs_switch (struct cursor *c,
+ unw_word_t saved_bsp, unw_word_t saved_bspstore,
+ ia64_loc_t saved_rnat_loc)
+{
+ struct rbs_area *rbs = &c->rbs_area[c->rbs_curr];
+ unw_word_t lo, ndirty, rbs_base;
+ int ret;
+
+ Debug (10, "(left=%u, curr=%u)\n", c->rbs_left_edge, c->rbs_curr);
+
+ /* Calculate address "lo" at which the backing store starts: */
+ ndirty = rse_num_regs (saved_bspstore, saved_bsp);
+ lo = rse_skip_regs (c->bsp, -ndirty);
+
+ rbs->size = (rbs->end - lo);
+
+ /* If the previously-recorded rbs-area is empty we don't need to
+ track it and we can simply overwrite it... */
+ if (rbs->size)
+ {
+ Debug (10, "inner=[0x%lx-0x%lx)\n",
+ (long) (rbs->end - rbs->size), (long) rbs->end);
+
+ c->rbs_curr = (c->rbs_curr + 1) % ARRAY_SIZE (c->rbs_area);
+ rbs = c->rbs_area + c->rbs_curr;
+
+ if (c->rbs_curr == c->rbs_left_edge)
+ c->rbs_left_edge = (c->rbs_left_edge + 1) % ARRAY_SIZE (c->rbs_area);
+ }
+
+ if ((ret = rbs_get_base (c, saved_bspstore, &rbs_base)) < 0)
+ return ret;
+
+ rbs->end = saved_bspstore;
+ rbs->size = saved_bspstore - rbs_base;
+ rbs->rnat_loc = saved_rnat_loc;
+
+ c->bsp = saved_bsp;
+
+ Debug (10, "outer=[0x%llx-0x%llx), rnat@%s\n", (long long) rbs_base,
+ (long long) rbs->end, ia64_strloc (rbs->rnat_loc));
+ return 0;
+}
+
+HIDDEN int
+rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip,
+ ia64_loc_t *locp, ia64_loc_t *rnat_locp)
+{
+ unw_word_t nregs, bsp = c->bsp, curr = c->rbs_curr, n;
+ unw_word_t left_edge = c->rbs_left_edge;
+#if UNW_DEBUG
+ int reg = 32 + regs_to_skip;
+#endif
+
+ while (!rbs_contains (&c->rbs_area[curr], bsp))
+ {
+ if (curr == left_edge)
+ {
+ Debug (1, "could not find register r%d!\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ n = rse_num_regs (c->rbs_area[curr].end, bsp);
+ curr = (curr + ARRAY_SIZE (c->rbs_area) - 1) % ARRAY_SIZE (c->rbs_area);
+ bsp = rse_skip_regs (c->rbs_area[curr].end - c->rbs_area[curr].size, n);
+ }
+
+ while (1)
+ {
+ nregs = rse_num_regs (bsp, c->rbs_area[curr].end);
+
+ if (regs_to_skip < nregs)
+ {
+ /* found it: */
+ unw_word_t addr;
+
+ addr = rse_skip_regs (bsp, regs_to_skip);
+ if (locp)
+ *locp = rbs_loc (c->rbs_area + curr, addr);
+ if (rnat_locp)
+ *rnat_locp = rbs_get_rnat_loc (c->rbs_area + curr, addr);
+ return 0;
+ }
+
+ if (curr == left_edge)
+ {
+ Debug (1, "could not find register r%d!\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ regs_to_skip -= nregs;
+
+ curr = (curr + ARRAY_SIZE (c->rbs_area) - 1) % ARRAY_SIZE (c->rbs_area);
+ bsp = c->rbs_area[curr].end - c->rbs_area[curr].size;
+ }
+}
+
+#ifdef NEED_RBS_COVER_AND_FLUSH
+
+static inline int
+get_rnat (struct cursor *c, struct rbs_area *rbs, unw_word_t bsp,
+ unw_word_t *__restrict rnatp)
+{
+ ia64_loc_t rnat_locp = rbs_get_rnat_loc (rbs, bsp);
+
+ return ia64_get (c, rnat_locp, rnatp);
+}
+
+/* Simulate the effect of "cover" followed by a "flushrs" for the
+ target-frame. However, since the target-frame's backing store
+ may not have space for the registers that got spilled onto other
+ rbs-areas, we save those registers to DIRTY_PARTITION where
+ we can then load them via a single "loadrs".
+
+ This function returns the size of the dirty-partition that was
+ created or a negative error-code in case of error.
+
+ Note: This does not modify the rbs_area[] structure in any way. */
+HIDDEN int
+rbs_cover_and_flush (struct cursor *c, unw_word_t nregs,
+ unw_word_t *dirty_partition, unw_word_t *dirty_rnat,
+ unw_word_t *bspstore)
+{
+ unw_word_t n, src_mask, dst_mask, bsp, *dst, src_rnat, dst_rnat = 0;
+ unw_word_t curr = c->rbs_curr, left_edge = c->rbs_left_edge;
+ struct rbs_area *rbs = c->rbs_area + curr;
+ int ret;
+
+ bsp = c->bsp;
+ c->bsp = rse_skip_regs (bsp, nregs);
+
+ if (likely (rbs_contains (rbs, bsp)))
+ {
+ /* at least _some_ registers are on rbs... */
+ n = rse_num_regs (bsp, rbs->end);
+ if (likely (n >= nregs))
+ {
+ /* common case #1: all registers are on current rbs... */
+ /* got lucky: _all_ registers are on rbs... */
+ ia64_loc_t rnat_loc = rbs_get_rnat_loc (rbs, c->bsp);
+
+ *bspstore = c->bsp;
+
+ if (IA64_IS_REG_LOC (rnat_loc))
+ {
+ unw_word_t rnat_addr = (unw_word_t)
+ tdep_uc_addr (c->as_arg, UNW_IA64_AR_RNAT, NULL);
+ rnat_loc = IA64_LOC_ADDR (rnat_addr, 0);
+ }
+ c->loc[IA64_REG_RNAT] = rnat_loc;
+ return 0; /* all done */
+ }
+ nregs -= n; /* account for registers already on the rbs */
+
+ assert (rse_skip_regs (c->bsp, -nregs) == rse_skip_regs (rbs->end, 0));
+ }
+ else
+ /* Earlier frames also didn't get spilled; need to "loadrs" those,
+ too... */
+ nregs += rse_num_regs (rbs->end, bsp);
+
+ /* OK, we need to copy NREGS registers to the dirty partition. */
+
+ *bspstore = bsp = rbs->end;
+ c->loc[IA64_REG_RNAT] = rbs->rnat_loc;
+ assert (!IA64_IS_REG_LOC (rbs->rnat_loc));
+
+ dst = dirty_partition;
+
+ while (nregs > 0)
+ {
+ if (unlikely (!rbs_contains (rbs, bsp)))
+ {
+ /* switch to next non-empty rbs-area: */
+ do
+ {
+ if (curr == left_edge)
+ {
+ Debug (0, "rbs-underflow while flushing %lu regs, "
+ "bsp=0x%lx, dst=0x%p\n", (unsigned long) nregs,
+ (unsigned long) bsp, dst);
+ return -UNW_EBADREG;
+ }
+
+ assert (rse_num_regs (rbs->end, bsp) == 0);
+
+ curr = (curr + ARRAY_SIZE (c->rbs_area) - 1)
+ % ARRAY_SIZE (c->rbs_area);
+ rbs = c->rbs_area + curr;
+ bsp = rbs->end - rbs->size;
+ }
+ while (rbs->size == 0);
+
+ if ((ret = get_rnat (c, rbs, bsp, &src_rnat)) < 0)
+ return ret;
+ }
+
+ if (unlikely (rse_is_rnat_slot (bsp)))
+ {
+ bsp += 8;
+ if ((ret = get_rnat (c, rbs, bsp, &src_rnat)) < 0)
+ return ret;
+ }
+ if (unlikely (rse_is_rnat_slot ((unw_word_t) dst)))
+ {
+ *dst++ = dst_rnat;
+ dst_rnat = 0;
+ }
+
+ src_mask = ((unw_word_t) 1) << rse_slot_num (bsp);
+ dst_mask = ((unw_word_t) 1) << rse_slot_num ((unw_word_t) dst);
+
+ if (src_rnat & src_mask)
+ dst_rnat |= dst_mask;
+ else
+ dst_rnat &= ~dst_mask;
+
+ /* copy one slot: */
+ if ((ret = ia64_get (c, rbs_loc (rbs, bsp), dst)) < 0)
+ return ret;
+
+ /* advance to next slot: */
+ --nregs;
+ bsp += 8;
+ ++dst;
+ }
+ if (unlikely (rse_is_rnat_slot ((unw_word_t) dst)))
+ {
+ /* The LOADRS instruction loads "the N bytes below the current
+ BSP" but BSP can never point to an RNaT slot so if the last
+ destination word happens to be an RNaT slot, we need to write
+ that slot now. */
+ *dst++ = dst_rnat;
+ dst_rnat = 0;
+ }
+ *dirty_rnat = dst_rnat;
+ return (char *) dst - (char *) dirty_partition;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/ia64/Greg_states_iterate.c b/src/pal/src/libunwind/src/ia64/Greg_states_iterate.c
new file mode 100644
index 0000000000..3570740af1
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Greg_states_iterate.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ // Needs dwarf support on ia64
+ // return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+ return -UNW_EINVAL;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gregs.c b/src/pal/src/libunwind/src/ia64/Gregs.c
new file mode 100644
index 0000000000..ac6f738a6c
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gregs.c
@@ -0,0 +1,612 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+#include "regs.h"
+#include "unwind_i.h"
+
+static inline ia64_loc_t
+linux_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr)
+{
+#if !defined(UNW_LOCAL_ONLY) || defined(__linux)
+ unw_word_t addr = c->sigcontext_addr, flags, tmp_addr;
+ int i;
+
+ if (ia64_get_abi_marker (c) == ABI_MARKER_LINUX_SIGTRAMP
+ || ia64_get_abi_marker (c) == ABI_MARKER_OLD_LINUX_SIGTRAMP)
+ {
+ switch (reg)
+ {
+ case UNW_IA64_NAT + 2 ... UNW_IA64_NAT + 3:
+ case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31:
+ /* Linux sigcontext contains the NaT bit of scratch register
+ N in bit position N of the sc_nat member. */
+ *nat_bitnr = (reg - UNW_IA64_NAT);
+ addr += LINUX_SC_NAT_OFF;
+ break;
+
+ case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3:
+ case UNW_IA64_GR + 8 ... UNW_IA64_GR + 31:
+ addr += LINUX_SC_GR_OFF + 8 * (reg - UNW_IA64_GR);
+ break;
+
+ case UNW_IA64_FR + 6 ... UNW_IA64_FR + 15:
+ addr += LINUX_SC_FR_OFF + 16 * (reg - UNW_IA64_FR);
+ return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP);
+
+ case UNW_IA64_FR + 32 ... UNW_IA64_FR + 127:
+ if (ia64_get (c, IA64_LOC_ADDR (addr + LINUX_SC_FLAGS_OFF, 0),
+ &flags) < 0)
+ return IA64_NULL_LOC;
+
+ if (!(flags & IA64_SC_FLAG_FPH_VALID))
+ {
+ /* initialize fph partition: */
+ tmp_addr = addr + LINUX_SC_FR_OFF + 32*16;
+ for (i = 32; i < 128; ++i, tmp_addr += 16)
+ if (ia64_putfp (c, IA64_LOC_ADDR (tmp_addr, 0),
+ unw.read_only.f0) < 0)
+ return IA64_NULL_LOC;
+ /* mark fph partition as valid: */
+ if (ia64_put (c, IA64_LOC_ADDR (addr + LINUX_SC_FLAGS_OFF, 0),
+ flags | IA64_SC_FLAG_FPH_VALID) < 0)
+ return IA64_NULL_LOC;
+ }
+
+ addr += LINUX_SC_FR_OFF + 16 * (reg - UNW_IA64_FR);
+ return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP);
+
+ case UNW_IA64_BR + 0: addr += LINUX_SC_BR_OFF + 0; break;
+ case UNW_IA64_BR + 6: addr += LINUX_SC_BR_OFF + 6*8; break;
+ case UNW_IA64_BR + 7: addr += LINUX_SC_BR_OFF + 7*8; break;
+ case UNW_IA64_AR_RSC: addr += LINUX_SC_AR_RSC_OFF; break;
+ case UNW_IA64_AR_CSD: addr += LINUX_SC_AR_CSD_OFF; break;
+ case UNW_IA64_AR_SSD: addr += LINUX_SC_AR_SSD_OFF; break;
+ case UNW_IA64_AR_CCV: addr += LINUX_SC_AR_CCV; break;
+
+ default:
+ if (unw_is_fpreg (reg))
+ return IA64_FPREG_LOC (c, reg);
+ else
+ return IA64_REG_LOC (c, reg);
+ }
+ return IA64_LOC_ADDR (addr, 0);
+ }
+ else
+ {
+ int is_nat = 0;
+
+ if ((unsigned) (reg - UNW_IA64_NAT) < 128)
+ {
+ is_nat = 1;
+ reg -= (UNW_IA64_NAT - UNW_IA64_GR);
+ }
+ if (ia64_get_abi_marker (c) == ABI_MARKER_LINUX_INTERRUPT)
+ {
+ switch (reg)
+ {
+ case UNW_IA64_BR + 6 ... UNW_IA64_BR + 7:
+ addr += LINUX_PT_B6_OFF + 8 * (reg - (UNW_IA64_BR + 6));
+ break;
+
+ case UNW_IA64_AR_CSD: addr += LINUX_PT_CSD_OFF; break;
+ case UNW_IA64_AR_SSD: addr += LINUX_PT_SSD_OFF; break;
+
+ case UNW_IA64_GR + 8 ... UNW_IA64_GR + 11:
+ addr += LINUX_PT_R8_OFF + 8 * (reg - (UNW_IA64_GR + 8));
+ break;
+
+ case UNW_IA64_IP: addr += LINUX_PT_IIP_OFF; break;
+ case UNW_IA64_CFM: addr += LINUX_PT_IFS_OFF; break;
+ case UNW_IA64_AR_UNAT: addr += LINUX_PT_UNAT_OFF; break;
+ case UNW_IA64_AR_PFS: addr += LINUX_PT_PFS_OFF; break;
+ case UNW_IA64_AR_RSC: addr += LINUX_PT_RSC_OFF; break;
+ case UNW_IA64_AR_RNAT: addr += LINUX_PT_RNAT_OFF; break;
+ case UNW_IA64_AR_BSPSTORE: addr += LINUX_PT_BSPSTORE_OFF; break;
+ case UNW_IA64_PR: addr += LINUX_PT_PR_OFF; break;
+ case UNW_IA64_BR + 0: addr += LINUX_PT_B0_OFF; break;
+
+ case UNW_IA64_GR + 1:
+ /* The saved r1 value is valid only in the frame in which
+ it was saved; for everything else we need to look up
+ the appropriate gp value. */
+ if (c->sigcontext_addr != c->sp + 0x10)
+ return IA64_NULL_LOC;
+ addr += LINUX_PT_R1_OFF;
+ break;
+
+ case UNW_IA64_GR + 12: addr += LINUX_PT_R12_OFF; break;
+ case UNW_IA64_GR + 13: addr += LINUX_PT_R13_OFF; break;
+ case UNW_IA64_AR_FPSR: addr += LINUX_PT_FPSR_OFF; break;
+ case UNW_IA64_GR + 15: addr += LINUX_PT_R15_OFF; break;
+ case UNW_IA64_GR + 14: addr += LINUX_PT_R14_OFF; break;
+ case UNW_IA64_GR + 2: addr += LINUX_PT_R2_OFF; break;
+ case UNW_IA64_GR + 3: addr += LINUX_PT_R3_OFF; break;
+
+ case UNW_IA64_GR + 16 ... UNW_IA64_GR + 31:
+ addr += LINUX_PT_R16_OFF + 8 * (reg - (UNW_IA64_GR + 16));
+ break;
+
+ case UNW_IA64_AR_CCV: addr += LINUX_PT_CCV_OFF; break;
+
+ case UNW_IA64_FR + 6 ... UNW_IA64_FR + 11:
+ addr += LINUX_PT_F6_OFF + 16 * (reg - (UNW_IA64_FR + 6));
+ return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP);
+
+ default:
+ if (unw_is_fpreg (reg))
+ return IA64_FPREG_LOC (c, reg);
+ else
+ return IA64_REG_LOC (c, reg);
+ }
+ }
+ else if (ia64_get_abi_marker (c) == ABI_MARKER_OLD_LINUX_INTERRUPT)
+ {
+ switch (reg)
+ {
+ case UNW_IA64_GR + 1:
+ /* The saved r1 value is valid only in the frame in which
+ it was saved; for everything else we need to look up
+ the appropriate gp value. */
+ if (c->sigcontext_addr != c->sp + 0x10)
+ return IA64_NULL_LOC;
+ addr += LINUX_OLD_PT_R1_OFF;
+ break;
+
+ case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3:
+ addr += LINUX_OLD_PT_R2_OFF + 8 * (reg - (UNW_IA64_GR + 2));
+ break;
+
+ case UNW_IA64_GR + 8 ... UNW_IA64_GR + 11:
+ addr += LINUX_OLD_PT_R8_OFF + 8 * (reg - (UNW_IA64_GR + 8));
+ break;
+
+ case UNW_IA64_GR + 16 ... UNW_IA64_GR + 31:
+ addr += LINUX_OLD_PT_R16_OFF + 8 * (reg - (UNW_IA64_GR + 16));
+ break;
+
+ case UNW_IA64_FR + 6 ... UNW_IA64_FR + 9:
+ addr += LINUX_OLD_PT_F6_OFF + 16 * (reg - (UNW_IA64_FR + 6));
+ return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP);
+
+ case UNW_IA64_BR + 0: addr += LINUX_OLD_PT_B0_OFF; break;
+ case UNW_IA64_BR + 6: addr += LINUX_OLD_PT_B6_OFF; break;
+ case UNW_IA64_BR + 7: addr += LINUX_OLD_PT_B7_OFF; break;
+
+ case UNW_IA64_AR_RSC: addr += LINUX_OLD_PT_RSC_OFF; break;
+ case UNW_IA64_AR_CCV: addr += LINUX_OLD_PT_CCV_OFF; break;
+
+ default:
+ if (unw_is_fpreg (reg))
+ return IA64_FPREG_LOC (c, reg);
+ else
+ return IA64_REG_LOC (c, reg);
+ }
+ }
+ if (is_nat)
+ {
+ /* For Linux pt-regs structure, bit number is determined by
+ the UNaT slot number (as determined by st8.spill) and the
+ bits are saved wherever the (primary) UNaT was saved. */
+ *nat_bitnr = ia64_unat_slot_num (addr);
+ return c->loc[IA64_REG_PRI_UNAT_MEM];
+ }
+ return IA64_LOC_ADDR (addr, 0);
+ }
+#endif
+ return IA64_NULL_LOC;
+}
+
+static inline ia64_loc_t
+hpux_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr)
+{
+#if !defined(UNW_LOCAL_ONLY) || defined(__hpux)
+ return IA64_LOC_UC_REG (reg, c->sigcontext_addr);
+#else
+ return IA64_NULL_LOC;
+#endif
+}
+
+HIDDEN ia64_loc_t
+ia64_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr)
+{
+ if (c->sigcontext_addr)
+ {
+ if (ia64_get_abi (c) == ABI_LINUX)
+ return linux_scratch_loc (c, reg, nat_bitnr);
+ else if (ia64_get_abi (c) == ABI_HPUX)
+ return hpux_scratch_loc (c, reg, nat_bitnr);
+ else
+ return IA64_NULL_LOC;
+ }
+ else
+ return IA64_REG_LOC (c, reg);
+}
+
+static inline int
+update_nat (struct cursor *c, ia64_loc_t nat_loc, unw_word_t mask,
+ unw_word_t *valp, int write)
+{
+ unw_word_t nat_word;
+ int ret;
+
+ ret = ia64_get (c, nat_loc, &nat_word);
+ if (ret < 0)
+ return ret;
+
+ if (write)
+ {
+ if (*valp)
+ nat_word |= mask;
+ else
+ nat_word &= ~mask;
+ ret = ia64_put (c, nat_loc, nat_word);
+ }
+ else
+ *valp = (nat_word & mask) != 0;
+ return ret;
+}
+
+static int
+access_nat (struct cursor *c,
+ ia64_loc_t nat_loc, ia64_loc_t reg_loc, uint8_t nat_bitnr,
+ unw_word_t *valp, int write)
+{
+ unw_word_t mask = 0;
+ unw_fpreg_t tmp;
+ int ret;
+
+ if (IA64_IS_FP_LOC (reg_loc))
+ {
+ /* NaT bit is saved as a NaTVal. This happens when a general
+ register is saved to a floating-point register. */
+ if (write)
+ {
+ if (*valp)
+ {
+ if (ia64_is_big_endian (c))
+ ret = ia64_putfp (c, reg_loc, unw.nat_val_be);
+ else
+ ret = ia64_putfp (c, reg_loc, unw.nat_val_le);
+ }
+ else
+ {
+ unw_word_t *src, *dst;
+ unw_fpreg_t tmp;
+
+ ret = ia64_getfp (c, reg_loc, &tmp);
+ if (ret < 0)
+ return ret;
+
+ /* Reset the exponent to 0x1003e so that the significand
+ will be interpreted as an integer value. */
+ src = (unw_word_t *) &unw.int_val_be;
+ dst = (unw_word_t *) &tmp;
+ if (!ia64_is_big_endian (c))
+ ++src, ++dst;
+ *dst = *src;
+
+ ret = ia64_putfp (c, reg_loc, tmp);
+ }
+ }
+ else
+ {
+ ret = ia64_getfp (c, reg_loc, &tmp);
+ if (ret < 0)
+ return ret;
+
+ if (ia64_is_big_endian (c))
+ *valp = (memcmp (&tmp, &unw.nat_val_be, sizeof (tmp)) == 0);
+ else
+ *valp = (memcmp (&tmp, &unw.nat_val_le, sizeof (tmp)) == 0);
+ }
+ return ret;
+ }
+
+ if ((IA64_IS_REG_LOC (nat_loc)
+ && (unsigned) (IA64_GET_REG (nat_loc) - UNW_IA64_NAT) < 128)
+ || IA64_IS_UC_LOC (reg_loc))
+ {
+ if (write)
+ return ia64_put (c, nat_loc, *valp);
+ else
+ return ia64_get (c, nat_loc, valp);
+ }
+
+ if (IA64_IS_NULL_LOC (nat_loc))
+ {
+ /* NaT bit is not saved. This happens if a general register is
+ saved to a branch register. Since the NaT bit gets lost, we
+ need to drop it here, too. Note that if the NaT bit had been
+ set when the save occurred, it would have caused a NaT
+ consumption fault. */
+ if (write)
+ {
+ if (*valp)
+ return -UNW_EBADREG; /* can't set NaT bit */
+ }
+ else
+ *valp = 0;
+ return 0;
+ }
+
+ mask = (unw_word_t) 1 << nat_bitnr;
+ return update_nat (c, nat_loc, mask, valp, write);
+}
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ ia64_loc_t loc, reg_loc, nat_loc;
+ unw_word_t mask, val;
+ uint8_t nat_bitnr;
+ int ret;
+
+ switch (reg)
+ {
+ /* frame registers: */
+
+ case UNW_IA64_BSP:
+ if (write)
+ c->bsp = *valp;
+ else
+ *valp = c->bsp;
+ return 0;
+
+ case UNW_REG_SP:
+ if (write)
+ c->sp = *valp;
+ else
+ *valp = c->sp;
+ return 0;
+
+ case UNW_REG_IP:
+ if (write)
+ {
+ c->ip = *valp; /* also update the IP cache */
+ if (c->pi_valid && (*valp < c->pi.start_ip || *valp >= c->pi.end_ip))
+ c->pi_valid = 0; /* new IP outside of current proc */
+ }
+ loc = c->loc[IA64_REG_IP];
+ break;
+
+ /* preserved registers: */
+
+ case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7:
+ loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_GR + 4))];
+ break;
+
+ case UNW_IA64_NAT + 4 ... UNW_IA64_NAT + 7:
+ loc = c->loc[IA64_REG_NAT4 + (reg - (UNW_IA64_NAT + 4))];
+ reg_loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_NAT + 4))];
+ nat_bitnr = c->nat_bitnr[reg - (UNW_IA64_NAT + 4)];
+ return access_nat (c, loc, reg_loc, nat_bitnr, valp, write);
+
+ case UNW_IA64_AR_BSP: loc = c->loc[IA64_REG_BSP]; break;
+ case UNW_IA64_AR_BSPSTORE: loc = c->loc[IA64_REG_BSPSTORE]; break;
+ case UNW_IA64_AR_PFS: loc = c->loc[IA64_REG_PFS]; break;
+ case UNW_IA64_AR_RNAT: loc = c->loc[IA64_REG_RNAT]; break;
+ case UNW_IA64_AR_UNAT: loc = c->loc[IA64_REG_UNAT]; break;
+ case UNW_IA64_AR_LC: loc = c->loc[IA64_REG_LC]; break;
+ case UNW_IA64_AR_FPSR: loc = c->loc[IA64_REG_FPSR]; break;
+ case UNW_IA64_BR + 1: loc = c->loc[IA64_REG_B1]; break;
+ case UNW_IA64_BR + 2: loc = c->loc[IA64_REG_B2]; break;
+ case UNW_IA64_BR + 3: loc = c->loc[IA64_REG_B3]; break;
+ case UNW_IA64_BR + 4: loc = c->loc[IA64_REG_B4]; break;
+ case UNW_IA64_BR + 5: loc = c->loc[IA64_REG_B5]; break;
+
+ case UNW_IA64_CFM:
+ if (write)
+ c->cfm = *valp; /* also update the CFM cache */
+ loc = c->cfm_loc;
+ break;
+
+ case UNW_IA64_PR:
+ /*
+ * Note: broad-side access to the predicates is NOT rotated
+ * (i.e., it is done as if CFM.rrb.pr == 0.
+ */
+ if (write)
+ {
+ c->pr = *valp; /* update the predicate cache */
+ return ia64_put (c, c->loc[IA64_REG_PR], *valp);
+ }
+ else
+ return ia64_get (c, c->loc[IA64_REG_PR], valp);
+
+ case UNW_IA64_GR + 32 ... UNW_IA64_GR + 127: /* stacked reg */
+ reg = rotate_gr (c, reg - UNW_IA64_GR);
+ if (reg < 0)
+ return -UNW_EBADREG;
+ ret = ia64_get_stacked (c, reg, &loc, NULL);
+ if (ret < 0)
+ return ret;
+ break;
+
+ case UNW_IA64_NAT + 32 ... UNW_IA64_NAT + 127: /* stacked reg */
+ reg = rotate_gr (c, reg - UNW_IA64_NAT);
+ if (reg < 0)
+ return -UNW_EBADREG;
+ ret = ia64_get_stacked (c, reg, &loc, &nat_loc);
+ if (ret < 0)
+ return ret;
+ assert (!IA64_IS_REG_LOC (loc));
+ mask = (unw_word_t) 1 << rse_slot_num (IA64_GET_ADDR (loc));
+ return update_nat (c, nat_loc, mask, valp, write);
+
+ case UNW_IA64_AR_EC:
+ if ((ret = ia64_get (c, c->ec_loc, &val)) < 0)
+ return ret;
+
+ if (write)
+ {
+ val = ((val & ~((unw_word_t) 0x3f << 52)) | ((*valp & 0x3f) << 52));
+ return ia64_put (c, c->ec_loc, val);
+ }
+ else
+ {
+ *valp = (val >> 52) & 0x3f;
+ return 0;
+ }
+
+ /* scratch & special registers: */
+
+ case UNW_IA64_GR + 0:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = 0;
+ return 0;
+
+ case UNW_IA64_NAT + 0:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = 0;
+ return 0;
+
+ case UNW_IA64_NAT + 1:
+ case UNW_IA64_NAT + 2 ... UNW_IA64_NAT + 3:
+ case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31:
+ loc = ia64_scratch_loc (c, reg, &nat_bitnr);
+ if (IA64_IS_NULL_LOC (loc) && reg == UNW_IA64_NAT + 1)
+ {
+ /* access to GP */
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = 0;
+ return 0;
+ }
+ if (!(IA64_IS_REG_LOC (loc) || IA64_IS_UC_LOC (loc)
+ || IA64_IS_FP_LOC (loc)))
+ /* We're dealing with a NaT bit stored in memory. */
+ return update_nat(c, loc, (unw_word_t) 1 << nat_bitnr, valp, write);
+ break;
+
+ case UNW_IA64_GR + 15 ... UNW_IA64_GR + 18:
+ mask = 1 << (reg - (UNW_IA64_GR + 15));
+ if (write)
+ {
+ c->eh_args[reg - (UNW_IA64_GR + 15)] = *valp;
+ c->eh_valid_mask |= mask;
+ return 0;
+ }
+ else if ((c->eh_valid_mask & mask) != 0)
+ {
+ *valp = c->eh_args[reg - (UNW_IA64_GR + 15)];
+ return 0;
+ }
+ else
+ loc = ia64_scratch_loc (c, reg, NULL);
+ break;
+
+ case UNW_IA64_GR + 1: /* global pointer */
+ case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3:
+ case UNW_IA64_GR + 8 ... UNW_IA64_GR + 14:
+ case UNW_IA64_GR + 19 ... UNW_IA64_GR + 31:
+ case UNW_IA64_BR + 0:
+ case UNW_IA64_BR + 6:
+ case UNW_IA64_BR + 7:
+ case UNW_IA64_AR_RSC:
+ case UNW_IA64_AR_CSD:
+ case UNW_IA64_AR_SSD:
+ case UNW_IA64_AR_CCV:
+ loc = ia64_scratch_loc (c, reg, NULL);
+ if (IA64_IS_NULL_LOC (loc) && reg == UNW_IA64_GR + 1)
+ {
+ /* access to GP */
+ if (write)
+ return -UNW_EREADONLYREG;
+
+ /* ensure c->pi is up-to-date: */
+ if ((ret = ia64_make_proc_info (c)) < 0)
+ return ret;
+ *valp = c->pi.gp;
+ return 0;
+ }
+ break;
+
+ default:
+ Debug (1, "bad register number %d\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return ia64_put (c, loc, *valp);
+ else
+ return ia64_get (c, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, int reg, unw_fpreg_t *valp,
+ int write)
+{
+ ia64_loc_t loc;
+
+ switch (reg)
+ {
+ case UNW_IA64_FR + 0:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = unw.read_only.f0;
+ return 0;
+
+ case UNW_IA64_FR + 1:
+ if (write)
+ return -UNW_EREADONLYREG;
+
+ if (ia64_is_big_endian (c))
+ *valp = unw.read_only.f1_be;
+ else
+ *valp = unw.read_only.f1_le;
+ return 0;
+
+ case UNW_IA64_FR + 2: loc = c->loc[IA64_REG_F2]; break;
+ case UNW_IA64_FR + 3: loc = c->loc[IA64_REG_F3]; break;
+ case UNW_IA64_FR + 4: loc = c->loc[IA64_REG_F4]; break;
+ case UNW_IA64_FR + 5: loc = c->loc[IA64_REG_F5]; break;
+
+ case UNW_IA64_FR + 16 ... UNW_IA64_FR + 31:
+ loc = c->loc[IA64_REG_F16 + (reg - (UNW_IA64_FR + 16))];
+ break;
+
+ case UNW_IA64_FR + 6 ... UNW_IA64_FR + 15:
+ loc = ia64_scratch_loc (c, reg, NULL);
+ break;
+
+ case UNW_IA64_FR + 32 ... UNW_IA64_FR + 127:
+ reg = rotate_fr (c, reg - UNW_IA64_FR) + UNW_IA64_FR;
+ loc = ia64_scratch_loc (c, reg, NULL);
+ break;
+
+ default:
+ Debug (1, "bad register number %d\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return ia64_putfp (c, loc, *valp);
+ else
+ return ia64_getfp (c, loc, valp);
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gresume.c b/src/pal/src/libunwind/src/ia64/Gresume.c
new file mode 100644
index 0000000000..68fe8a659e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gresume.c
@@ -0,0 +1,274 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+static inline int
+local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+#if defined(__linux)
+ unw_word_t dirty_partition[2048]; /* AR.RSC.LOADRS is a 14-bit field */
+ unw_word_t val, sol, sof, pri_unat, n, pfs, bspstore, dirty_rnat;
+ struct cursor *c = (struct cursor *) cursor;
+ struct
+ {
+ unw_word_t r1;
+ unw_word_t r4;
+ unw_word_t r5;
+ unw_word_t r6;
+ unw_word_t r7;
+ unw_word_t r15;
+ unw_word_t r16;
+ unw_word_t r17;
+ unw_word_t r18;
+ }
+ extra;
+ int ret, dirty_size;
+# define GET_NAT(n) \
+ do \
+ { \
+ ret = tdep_access_reg (c, UNW_IA64_NAT + (n), &val, 0); \
+ if (ret < 0) \
+ return ret; \
+ if (val) \
+ pri_unat |= (unw_word_t) 1 << n; \
+ } \
+ while (0)
+
+ /* ensure c->pi is up-to-date: */
+ if ((ret = ia64_make_proc_info (c)) < 0)
+ return ret;
+
+ /* Copy contents of r4-r7 into "extra", so that their values end up
+ contiguous, so we can use a single (primary-) UNaT value. */
+ if ((ret = ia64_get (c, c->loc[IA64_REG_R4], &extra.r4)) < 0
+ || (ret = ia64_get (c, c->loc[IA64_REG_R5], &extra.r5)) < 0
+ || (ret = ia64_get (c, c->loc[IA64_REG_R6], &extra.r6)) < 0
+ || (ret = ia64_get (c, c->loc[IA64_REG_R7], &extra.r7)) < 0)
+ return ret;
+
+ /* Form the primary UNaT value: */
+ pri_unat = 0;
+ GET_NAT (4); GET_NAT(5);
+ GET_NAT (6); GET_NAT(7);
+ n = (((uintptr_t) &extra.r4) / 8 - 4) % 64;
+ pri_unat = (pri_unat << n) | (pri_unat >> (64 - n));
+
+ if (unlikely (c->sigcontext_addr))
+ {
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+# define PR_SCRATCH 0xffc0 /* p6-p15 are scratch */
+# define PR_PRESERVED (~(PR_SCRATCH | 1))
+
+ /* We're returning to a frame that was (either directly or
+ indirectly) interrupted by a signal. We have to restore
+ _both_ "preserved" and "scratch" registers. That doesn't
+ leave us any registers to work with, and the only way we can
+ achieve this is by doing a sigreturn().
+
+ Note: it might be tempting to think that we don't have to
+ restore the scratch registers when returning to a frame that
+ was indirectly interrupted by a signal. However, that is not
+ safe because that frame and its descendants could have been
+ using a special convention that stores "preserved" state in
+ scratch registers. For example, the Linux fsyscall
+ convention does this with r11 (to save ar.pfs) and b6 (to
+ save "rp"). */
+
+ sc->sc_gr[12] = c->psp;
+ c->psp = c->sigcontext_addr - c->sigcontext_off;
+
+ sof = (c->cfm & 0x7f);
+ if ((dirty_size = rbs_cover_and_flush (c, sof, dirty_partition,
+ &dirty_rnat, &bspstore)) < 0)
+ return dirty_size;
+
+ /* Clear the "in-syscall" flag, because in general we won't be
+ returning to the interruption-point and we need all registers
+ restored. */
+ sc->sc_flags &= ~IA64_SC_FLAG_IN_SYSCALL;
+ sc->sc_ip = c->ip;
+ sc->sc_cfm = c->cfm & (((unw_word_t) 1 << 38) - 1);
+ sc->sc_pr = (c->pr & ~PR_SCRATCH) | (sc->sc_pr & ~PR_PRESERVED);
+ if ((ret = ia64_get (c, c->loc[IA64_REG_PFS], &sc->sc_ar_pfs)) < 0
+ || (ret = ia64_get (c, c->loc[IA64_REG_FPSR], &sc->sc_ar_fpsr)) < 0
+ || (ret = ia64_get (c, c->loc[IA64_REG_UNAT], &sc->sc_ar_unat)) < 0)
+ return ret;
+
+ sc->sc_gr[1] = c->pi.gp;
+ if (c->eh_valid_mask & 0x1) sc->sc_gr[15] = c->eh_args[0];
+ if (c->eh_valid_mask & 0x2) sc->sc_gr[16] = c->eh_args[1];
+ if (c->eh_valid_mask & 0x4) sc->sc_gr[17] = c->eh_args[2];
+ if (c->eh_valid_mask & 0x8) sc->sc_gr[18] = c->eh_args[3];
+ Debug (9, "sc: r15=%lx,r16=%lx,r17=%lx,r18=%lx\n",
+ (long) sc->sc_gr[15], (long) sc->sc_gr[16],
+ (long) sc->sc_gr[17], (long) sc->sc_gr[18]);
+ }
+ else
+ {
+ /* Account for the fact that _Uia64_install_context() will
+ return via br.ret, which will decrement bsp by size-of-locals. */
+ if ((ret = ia64_get (c, c->loc[IA64_REG_PFS], &pfs)) < 0)
+ return ret;
+ sol = (pfs >> 7) & 0x7f;
+ if ((dirty_size = rbs_cover_and_flush (c, sol, dirty_partition,
+ &dirty_rnat, &bspstore)) < 0)
+ return dirty_size;
+
+ extra.r1 = c->pi.gp;
+ extra.r15 = c->eh_args[0];
+ extra.r16 = c->eh_args[1];
+ extra.r17 = c->eh_args[2];
+ extra.r18 = c->eh_args[3];
+ Debug (9, "extra: r15=%lx,r16=%lx,r17=%lx,r18=%lx\n",
+ (long) extra.r15, (long) extra.r16,
+ (long) extra.r17, (long) extra.r18);
+ }
+ Debug (8, "resuming at ip=%lx\n", (long) c->ip);
+ ia64_install_cursor (c, pri_unat, (unw_word_t *) &extra,
+ bspstore, dirty_size, dirty_partition + dirty_size/8,
+ dirty_rnat);
+#elif defined(__hpux)
+ struct cursor *c = (struct cursor *) cursor;
+
+ setcontext (c->as_arg); /* should not return */
+#endif
+ return -UNW_EINVAL;
+}
+
+HIDDEN int
+ia64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ return local_resume (as, cursor, arg);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+#ifndef UNW_LOCAL_ONLY
+
+static inline int
+remote_install_cursor (struct cursor *c)
+{
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *,
+ int write, void *);
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *,
+ int write, void *);
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+#if defined(__linux) && !defined(UNW_REMOTE_ONLY)
+ if (c->as == unw_local_addr_space)
+ {
+ /* Take a short-cut: we directly resume out of the cursor and
+ all we need to do is make sure that all locations point to
+ memory, not registers. Furthermore, R4-R7 and NAT4-NAT7 are
+ taken care of by ia64_local_resume() so they don't need to be
+ handled here. */
+# define MEMIFY(preg, reg) \
+ do { \
+ if (IA64_IS_REG_LOC (c->loc[(preg)])) \
+ c->loc[(preg)] = IA64_LOC_ADDR ((unw_word_t) \
+ tdep_uc_addr(c->as_arg, (reg), \
+ NULL), 0); \
+ } while (0)
+ MEMIFY (IA64_REG_PR, UNW_IA64_PR);
+ MEMIFY (IA64_REG_PFS, UNW_IA64_AR_PFS);
+ MEMIFY (IA64_REG_RNAT, UNW_IA64_AR_RNAT);
+ MEMIFY (IA64_REG_UNAT, UNW_IA64_AR_UNAT);
+ MEMIFY (IA64_REG_LC, UNW_IA64_AR_LC);
+ MEMIFY (IA64_REG_FPSR, UNW_IA64_AR_FPSR);
+ MEMIFY (IA64_REG_IP, UNW_IA64_BR + 0);
+ MEMIFY (IA64_REG_B1, UNW_IA64_BR + 1);
+ MEMIFY (IA64_REG_B2, UNW_IA64_BR + 2);
+ MEMIFY (IA64_REG_B3, UNW_IA64_BR + 3);
+ MEMIFY (IA64_REG_B4, UNW_IA64_BR + 4);
+ MEMIFY (IA64_REG_B5, UNW_IA64_BR + 5);
+ MEMIFY (IA64_REG_F2, UNW_IA64_FR + 2);
+ MEMIFY (IA64_REG_F3, UNW_IA64_FR + 3);
+ MEMIFY (IA64_REG_F4, UNW_IA64_FR + 4);
+ MEMIFY (IA64_REG_F5, UNW_IA64_FR + 5);
+ MEMIFY (IA64_REG_F16, UNW_IA64_FR + 16);
+ MEMIFY (IA64_REG_F17, UNW_IA64_FR + 17);
+ MEMIFY (IA64_REG_F18, UNW_IA64_FR + 18);
+ MEMIFY (IA64_REG_F19, UNW_IA64_FR + 19);
+ MEMIFY (IA64_REG_F20, UNW_IA64_FR + 20);
+ MEMIFY (IA64_REG_F21, UNW_IA64_FR + 21);
+ MEMIFY (IA64_REG_F22, UNW_IA64_FR + 22);
+ MEMIFY (IA64_REG_F23, UNW_IA64_FR + 23);
+ MEMIFY (IA64_REG_F24, UNW_IA64_FR + 24);
+ MEMIFY (IA64_REG_F25, UNW_IA64_FR + 25);
+ MEMIFY (IA64_REG_F26, UNW_IA64_FR + 26);
+ MEMIFY (IA64_REG_F27, UNW_IA64_FR + 27);
+ MEMIFY (IA64_REG_F28, UNW_IA64_FR + 28);
+ MEMIFY (IA64_REG_F29, UNW_IA64_FR + 29);
+ MEMIFY (IA64_REG_F30, UNW_IA64_FR + 30);
+ MEMIFY (IA64_REG_F31, UNW_IA64_FR + 31);
+ }
+ else
+#endif /* __linux && !UNW_REMOTE_ONLY */
+ {
+ access_reg = c->as->acc.access_reg;
+ access_fpreg = c->as->acc.access_fpreg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ (*access_fpreg) (c->as, reg, &fpval, 1, c->as_arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ (*access_reg) (c->as, reg, &val, 1, c->as_arg);
+ }
+ }
+ }
+ return (*c->as->acc.resume) (c->as, (unw_cursor_t *) c, c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->ip);
+
+#ifdef UNW_LOCAL_ONLY
+ return local_resume (c->as, cursor, c->as_arg);
+#else
+ return remote_install_cursor (c);
+#endif
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gscript.c b/src/pal/src/libunwind/src/ia64/Gscript.c
new file mode 100644
index 0000000000..526aeaf299
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gscript.c
@@ -0,0 +1,765 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+#include "regs.h"
+#include "unwind_i.h"
+
+enum ia64_script_insn_opcode
+ {
+ IA64_INSN_INC_PSP, /* psp += val */
+ IA64_INSN_LOAD_PSP, /* psp = *psp_loc */
+ IA64_INSN_ADD_PSP, /* s[dst] = (s.psp + val) */
+ IA64_INSN_ADD_PSP_NAT, /* like above, but with NaT info */
+ IA64_INSN_ADD_SP, /* s[dst] = (s.sp + val) */
+ IA64_INSN_ADD_SP_NAT, /* like above, but with NaT info */
+ IA64_INSN_MOVE, /* s[dst] = s[val] */
+ IA64_INSN_MOVE_NAT, /* like above, but with NaT info */
+ IA64_INSN_MOVE_NO_NAT, /* like above, but clear NaT info */
+ IA64_INSN_MOVE_STACKED, /* s[dst] = rse_skip(*s.bsp_loc, val) */
+ IA64_INSN_MOVE_STACKED_NAT, /* like above, but with NaT info */
+ IA64_INSN_MOVE_SCRATCH, /* s[dst] = scratch reg "val" */
+ IA64_INSN_MOVE_SCRATCH_NAT, /* like above, but with NaT info */
+ IA64_INSN_MOVE_SCRATCH_NO_NAT /* like above, but clear NaT info */
+ };
+
+#if defined(HAVE___THREAD) && HAVE___THREAD
+static __thread struct ia64_script_cache ia64_per_thread_cache =
+ {
+#ifdef HAVE_ATOMIC_OPS_H
+ .busy = AO_TS_INITIALIZER
+#else
+ .lock = PTHREAD_MUTEX_INITIALIZER
+#endif
+ };
+#endif
+
+static inline unw_hash_index_t CONST_ATTR
+hash (unw_word_t ip)
+{
+ /* based on (sqrt(5)/2-1)*2^64 */
+# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL)
+
+ return (ip >> 4) * magic >> (64 - IA64_LOG_UNW_HASH_SIZE);
+}
+
+static inline long
+cache_match (struct ia64_script *script, unw_word_t ip, unw_word_t pr)
+{
+ if (ip == script->ip && ((pr ^ script->pr_val) & script->pr_mask) == 0)
+ return 1;
+ return 0;
+}
+
+static inline void
+flush_script_cache (struct ia64_script_cache *cache)
+{
+ int i;
+
+ cache->lru_head = IA64_UNW_CACHE_SIZE - 1;
+ cache->lru_tail = 0;
+
+ for (i = 0; i < IA64_UNW_CACHE_SIZE; ++i)
+ {
+ if (i > 0)
+ cache->buckets[i].lru_chain = (i - 1);
+ cache->buckets[i].coll_chain = -1;
+ cache->buckets[i].ip = 0;
+ }
+ for (i = 0; i<IA64_UNW_HASH_SIZE; ++i)
+ cache->hash[i] = -1;
+}
+
+static inline struct ia64_script_cache *
+get_script_cache (unw_addr_space_t as, intrmask_t *saved_maskp)
+{
+ struct ia64_script_cache *cache = &as->global_cache;
+ unw_caching_policy_t caching = as->caching_policy;
+
+ if (caching == UNW_CACHE_NONE)
+ return NULL;
+
+#ifdef HAVE_ATOMIC_H
+ if (!spin_trylock_irqsave (&cache->busy, *saved_maskp))
+ return NULL;
+#else
+# if defined(HAVE___THREAD) && HAVE___THREAD
+ if (as->caching_policy == UNW_CACHE_PER_THREAD)
+ cache = &ia64_per_thread_cache;
+# endif
+# ifdef HAVE_ATOMIC_OPS_H
+ if (AO_test_and_set (&cache->busy) == AO_TS_SET)
+ return NULL;
+# else
+ if (likely (caching == UNW_CACHE_GLOBAL))
+ {
+ Debug (16, "acquiring lock\n");
+ lock_acquire (&cache->lock, *saved_maskp);
+ }
+# endif
+#endif
+
+ if (atomic_read (&as->cache_generation) != atomic_read (&cache->generation))
+ {
+ flush_script_cache (cache);
+ cache->generation = as->cache_generation;
+ }
+ return cache;
+}
+
+static inline void
+put_script_cache (unw_addr_space_t as, struct ia64_script_cache *cache,
+ intrmask_t *saved_maskp)
+{
+ assert (as->caching_policy != UNW_CACHE_NONE);
+
+ Debug (16, "unmasking signals/interrupts and releasing lock\n");
+#ifdef HAVE_ATOMIC_H
+ spin_unlock_irqrestore (&cache->busy, *saved_maskp);
+#else
+# ifdef HAVE_ATOMIC_OPS_H
+ AO_CLEAR (&cache->busy);
+# else
+ if (likely (as->caching_policy == UNW_CACHE_GLOBAL))
+ lock_release (&cache->lock, *saved_maskp);
+# endif
+#endif
+}
+
+static struct ia64_script *
+script_lookup (struct ia64_script_cache *cache, struct cursor *c)
+{
+ struct ia64_script *script = cache->buckets + c->hint;
+ unsigned short index;
+ unw_word_t ip, pr;
+
+ ip = c->ip;
+ pr = c->pr;
+
+ if (cache_match (script, ip, pr))
+ return script;
+
+ index = cache->hash[hash (ip)];
+ if (index >= IA64_UNW_CACHE_SIZE)
+ return 0;
+
+ script = cache->buckets + index;
+ while (1)
+ {
+ if (cache_match (script, ip, pr))
+ {
+ /* update hint; no locking needed: single-word writes are atomic */
+ c->hint = cache->buckets[c->prev_script].hint =
+ (script - cache->buckets);
+ return script;
+ }
+ if (script->coll_chain >= IA64_UNW_HASH_SIZE)
+ return 0;
+ script = cache->buckets + script->coll_chain;
+ }
+}
+
+static inline void
+script_init (struct ia64_script *script, unw_word_t ip)
+{
+ script->ip = ip;
+ script->hint = 0;
+ script->count = 0;
+ script->abi_marker = 0;
+}
+
+static inline struct ia64_script *
+script_new (struct ia64_script_cache *cache, unw_word_t ip)
+{
+ struct ia64_script *script, *prev, *tmp;
+ unw_hash_index_t index;
+ unsigned short head;
+
+ head = cache->lru_head;
+ script = cache->buckets + head;
+ cache->lru_head = script->lru_chain;
+
+ /* re-insert script at the tail of the LRU chain: */
+ cache->buckets[cache->lru_tail].lru_chain = head;
+ cache->lru_tail = head;
+
+ /* remove the old script from the hash table (if it's there): */
+ if (script->ip)
+ {
+ index = hash (script->ip);
+ tmp = cache->buckets + cache->hash[index];
+ prev = 0;
+ while (1)
+ {
+ if (tmp == script)
+ {
+ if (prev)
+ prev->coll_chain = tmp->coll_chain;
+ else
+ cache->hash[index] = tmp->coll_chain;
+ break;
+ }
+ else
+ prev = tmp;
+ if (tmp->coll_chain >= IA64_UNW_CACHE_SIZE)
+ /* old script wasn't in the hash-table */
+ break;
+ tmp = cache->buckets + tmp->coll_chain;
+ }
+ }
+
+ /* enter new script in the hash table */
+ index = hash (ip);
+ script->coll_chain = cache->hash[index];
+ cache->hash[index] = script - cache->buckets;
+
+ script_init (script, ip);
+ return script;
+}
+
+static inline void
+script_finalize (struct ia64_script *script, struct cursor *c,
+ struct ia64_state_record *sr)
+{
+ script->pr_mask = sr->pr_mask;
+ script->pr_val = sr->pr_val;
+ script->pi = c->pi;
+}
+
+static inline void
+script_emit (struct ia64_script *script, struct ia64_script_insn insn)
+{
+ if (script->count >= IA64_MAX_SCRIPT_LEN)
+ {
+ Dprintf ("%s: script exceeds maximum size of %u instructions!\n",
+ __FUNCTION__, IA64_MAX_SCRIPT_LEN);
+ return;
+ }
+ script->insn[script->count++] = insn;
+}
+
+static void
+compile_reg (struct ia64_state_record *sr, int i, struct ia64_reg_info *r,
+ struct ia64_script *script)
+{
+ enum ia64_script_insn_opcode opc;
+ unsigned long val, rval;
+ struct ia64_script_insn insn;
+ long is_preserved_gr;
+
+ if (r->where == IA64_WHERE_NONE || r->when >= sr->when_target)
+ return;
+
+ opc = IA64_INSN_MOVE;
+ val = rval = r->val;
+ is_preserved_gr = (i >= IA64_REG_R4 && i <= IA64_REG_R7);
+
+ if (r->where == IA64_WHERE_GR)
+ {
+ /* Handle most common case first... */
+ if (rval >= 32)
+ {
+ /* register got spilled to a stacked register */
+ if (is_preserved_gr)
+ opc = IA64_INSN_MOVE_STACKED_NAT;
+ else
+ opc = IA64_INSN_MOVE_STACKED;
+ val = rval;
+ }
+ else if (rval >= 4 && rval <= 7)
+ {
+ /* register got spilled to a preserved register */
+ val = IA64_REG_R4 + (rval - 4);
+ if (is_preserved_gr)
+ opc = IA64_INSN_MOVE_NAT;
+ }
+ else
+ {
+ /* register got spilled to a scratch register */
+ if (is_preserved_gr)
+ opc = IA64_INSN_MOVE_SCRATCH_NAT;
+ else
+ opc = IA64_INSN_MOVE_SCRATCH;
+ val = UNW_IA64_GR + rval;
+ }
+ }
+ else
+ {
+ switch (r->where)
+ {
+ case IA64_WHERE_FR:
+ /* Note: There is no need to handle NaT-bit info here
+ (indepent of is_preserved_gr), because for floating-point
+ NaTs are represented as NaTVal, so the NaT-info never
+ needs to be consulated. */
+ if (rval >= 2 && rval <= 5)
+ val = IA64_REG_F2 + (rval - 2);
+ else if (rval >= 16 && rval <= 31)
+ val = IA64_REG_F16 + (rval - 16);
+ else
+ {
+ opc = IA64_INSN_MOVE_SCRATCH;
+ val = UNW_IA64_FR + rval;
+ }
+ break;
+
+ case IA64_WHERE_BR:
+ if (rval >= 1 && rval <= 5)
+ {
+ val = IA64_REG_B1 + (rval - 1);
+ if (is_preserved_gr)
+ opc = IA64_INSN_MOVE_NO_NAT;
+ }
+ else
+ {
+ opc = IA64_INSN_MOVE_SCRATCH;
+ if (is_preserved_gr)
+ opc = IA64_INSN_MOVE_SCRATCH_NO_NAT;
+ val = UNW_IA64_BR + rval;
+ }
+ break;
+
+ case IA64_WHERE_SPREL:
+ if (is_preserved_gr)
+ opc = IA64_INSN_ADD_SP_NAT;
+ else
+ {
+ opc = IA64_INSN_ADD_SP;
+ if (i >= IA64_REG_F2 && i <= IA64_REG_F31)
+ val |= IA64_LOC_TYPE_FP;
+ }
+ break;
+
+ case IA64_WHERE_PSPREL:
+ if (is_preserved_gr)
+ opc = IA64_INSN_ADD_PSP_NAT;
+ else
+ {
+ opc = IA64_INSN_ADD_PSP;
+ if (i >= IA64_REG_F2 && i <= IA64_REG_F31)
+ val |= IA64_LOC_TYPE_FP;
+ }
+ break;
+
+ default:
+ Dprintf ("%s: register %u has unexpected `where' value of %u\n",
+ __FUNCTION__, i, r->where);
+ break;
+ }
+ }
+ insn.opc = opc;
+ insn.dst = i;
+ insn.val = val;
+ script_emit (script, insn);
+
+ if (i == IA64_REG_PSP)
+ {
+ /* c->psp must contain the _value_ of the previous sp, not it's
+ save-location. We get this by dereferencing the value we
+ just stored in loc[IA64_REG_PSP]: */
+ insn.opc = IA64_INSN_LOAD_PSP;
+ script_emit (script, insn);
+ }
+}
+
+/* Sort the registers which got saved in decreasing order of WHEN
+ value. This is needed to ensure that the save-locations are
+ updated in the proper order. For example, suppose r4 gets spilled
+ to memory and then r5 gets saved in r4. In this case, we need to
+ update the save location of r5 before the one of r4. */
+
+static inline int
+sort_regs (struct ia64_state_record *sr, int regorder[])
+{
+ int r, i, j, max, max_reg, max_when, num_regs = 0;
+
+ assert (IA64_REG_BSP == 3);
+
+ for (r = IA64_REG_BSP; r < IA64_NUM_PREGS; ++r)
+ {
+ if (sr->curr.reg[r].where == IA64_WHERE_NONE
+ || sr->curr.reg[r].when >= sr->when_target)
+ continue;
+
+ regorder[num_regs++] = r;
+ }
+
+ /* Simple insertion-sort. Involves about N^2/2 comparisons and N
+ exchanges. N is often small (say, 2-5) so a fancier sorting
+ algorithm may not be worthwhile. */
+
+ for (i = max = 0; i < num_regs - 1; ++i)
+ {
+ max_reg = regorder[max];
+ max_when = sr->curr.reg[max_reg].when;
+
+ for (j = i + 1; j < num_regs; ++j)
+ if (sr->curr.reg[regorder[j]].when > max_when)
+ {
+ max = j;
+ max_reg = regorder[j];
+ max_when = sr->curr.reg[max_reg].when;
+ }
+ if (i != max)
+ {
+ regorder[max] = regorder[i];
+ regorder[i] = max_reg;
+ }
+ }
+ return num_regs;
+}
+
+/* Build an unwind script that unwinds from state OLD_STATE to the
+ entrypoint of the function that called OLD_STATE. */
+
+static inline int
+build_script (struct cursor *c, struct ia64_script *script)
+{
+ int num_regs, i, ret, regorder[IA64_NUM_PREGS - 3];
+ struct ia64_reg_info *pri_unat;
+ struct ia64_state_record sr;
+ struct ia64_script_insn insn;
+
+ ret = ia64_create_state_record (c, &sr);
+ if (ret < 0)
+ return ret;
+
+ /* First, compile the update for IA64_REG_PSP. This is important
+ because later save-locations may depend on it's correct (updated)
+ value. Fixed-size frames are handled specially and variable-size
+ frames get handled via the normal compile_reg(). */
+
+ if (sr.when_target > sr.curr.reg[IA64_REG_PSP].when
+ && (sr.curr.reg[IA64_REG_PSP].where == IA64_WHERE_NONE)
+ && sr.curr.reg[IA64_REG_PSP].val != 0)
+ {
+ /* new psp is psp plus frame size */
+ insn.opc = IA64_INSN_INC_PSP;
+ insn.val = sr.curr.reg[IA64_REG_PSP].val; /* frame size */
+ script_emit (script, insn);
+ }
+ else
+ compile_reg (&sr, IA64_REG_PSP, sr.curr.reg + IA64_REG_PSP, script);
+
+ /* Second, compile the update for the primary UNaT, if any: */
+
+ if (sr.when_target >= sr.curr.reg[IA64_REG_PRI_UNAT_GR].when
+ || sr.when_target >= sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when)
+ {
+ if (sr.when_target < sr.curr.reg[IA64_REG_PRI_UNAT_GR].when)
+ /* (primary) NaT bits were saved to memory only */
+ pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_MEM;
+ else if (sr.when_target < sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when)
+ /* (primary) NaT bits were saved to a register only */
+ pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_GR;
+ else if (sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when >
+ sr.curr.reg[IA64_REG_PRI_UNAT_GR].when)
+ /* (primary) NaT bits were last saved to memory */
+ pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_MEM;
+ else
+ /* (primary) NaT bits were last saved to a register */
+ pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_GR;
+
+ /* Note: we always store the final primary-UNaT location in UNAT_MEM. */
+ compile_reg (&sr, IA64_REG_PRI_UNAT_MEM, pri_unat, script);
+ }
+
+ /* Third, compile the other register in decreasing order of WHEN values. */
+
+ num_regs = sort_regs (&sr, regorder);
+ for (i = 0; i < num_regs; ++i)
+ compile_reg (&sr, regorder[i], sr.curr.reg + regorder[i], script);
+
+ script->abi_marker = sr.abi_marker;
+ script_finalize (script, c, &sr);
+
+ ia64_free_state_record (&sr);
+ return 0;
+}
+
+static inline void
+set_nat_info (struct cursor *c, unsigned long dst,
+ ia64_loc_t nat_loc, uint8_t bitnr)
+{
+ assert (dst >= IA64_REG_R4 && dst <= IA64_REG_R7);
+
+ c->loc[dst - IA64_REG_R4 + IA64_REG_NAT4] = nat_loc;
+ c->nat_bitnr[dst - IA64_REG_R4] = bitnr;
+}
+
+/* Apply the unwinding actions represented by OPS and update SR to
+ reflect the state that existed upon entry to the function that this
+ unwinder represents. */
+
+static inline int
+run_script (struct ia64_script *script, struct cursor *c)
+{
+ struct ia64_script_insn *ip, *limit, next_insn;
+ ia64_loc_t loc, nat_loc;
+ unsigned long opc, dst;
+ uint8_t nat_bitnr;
+ unw_word_t val;
+ int ret;
+
+ c->pi = script->pi;
+ ip = script->insn;
+ limit = script->insn + script->count;
+ next_insn = *ip;
+ c->abi_marker = script->abi_marker;
+
+ while (ip++ < limit)
+ {
+ opc = next_insn.opc;
+ dst = next_insn.dst;
+ val = next_insn.val;
+ next_insn = *ip;
+
+ /* This is by far the most common operation: */
+ if (likely (opc == IA64_INSN_MOVE_STACKED))
+ {
+ if ((ret = ia64_get_stacked (c, val, &loc, NULL)) < 0)
+ return ret;
+ }
+ else
+ switch (opc)
+ {
+ case IA64_INSN_INC_PSP:
+ c->psp += val;
+ continue;
+
+ case IA64_INSN_LOAD_PSP:
+ if ((ret = ia64_get (c, c->loc[IA64_REG_PSP], &c->psp)) < 0)
+ return ret;
+ continue;
+
+ case IA64_INSN_ADD_PSP:
+ loc = IA64_LOC_ADDR (c->psp + val, (val & IA64_LOC_TYPE_FP));
+ break;
+
+ case IA64_INSN_ADD_SP:
+ loc = IA64_LOC_ADDR (c->sp + val, (val & IA64_LOC_TYPE_FP));
+ break;
+
+ case IA64_INSN_MOVE_NO_NAT:
+ set_nat_info (c, dst, IA64_NULL_LOC, 0);
+ case IA64_INSN_MOVE:
+ loc = c->loc[val];
+ break;
+
+ case IA64_INSN_MOVE_SCRATCH_NO_NAT:
+ set_nat_info (c, dst, IA64_NULL_LOC, 0);
+ case IA64_INSN_MOVE_SCRATCH:
+ loc = ia64_scratch_loc (c, val, NULL);
+ break;
+
+ case IA64_INSN_ADD_PSP_NAT:
+ loc = IA64_LOC_ADDR (c->psp + val, 0);
+ assert (!IA64_IS_REG_LOC (loc));
+ set_nat_info (c, dst,
+ c->loc[IA64_REG_PRI_UNAT_MEM],
+ ia64_unat_slot_num (IA64_GET_ADDR (loc)));
+ break;
+
+ case IA64_INSN_ADD_SP_NAT:
+ loc = IA64_LOC_ADDR (c->sp + val, 0);
+ assert (!IA64_IS_REG_LOC (loc));
+ set_nat_info (c, dst,
+ c->loc[IA64_REG_PRI_UNAT_MEM],
+ ia64_unat_slot_num (IA64_GET_ADDR (loc)));
+ break;
+
+ case IA64_INSN_MOVE_NAT:
+ loc = c->loc[val];
+ set_nat_info (c, dst,
+ c->loc[val - IA64_REG_R4 + IA64_REG_NAT4],
+ c->nat_bitnr[val - IA64_REG_R4]);
+ break;
+
+ case IA64_INSN_MOVE_STACKED_NAT:
+ if ((ret = ia64_get_stacked (c, val, &loc, &nat_loc)) < 0)
+ return ret;
+ assert (!IA64_IS_REG_LOC (loc));
+ set_nat_info (c, dst, nat_loc, rse_slot_num (IA64_GET_ADDR (loc)));
+ break;
+
+ case IA64_INSN_MOVE_SCRATCH_NAT:
+ loc = ia64_scratch_loc (c, val, NULL);
+ nat_loc = ia64_scratch_loc (c, val + (UNW_IA64_NAT - UNW_IA64_GR),
+ &nat_bitnr);
+ set_nat_info (c, dst, nat_loc, nat_bitnr);
+ break;
+ }
+ c->loc[dst] = loc;
+ }
+ return 0;
+}
+
+static int
+uncached_find_save_locs (struct cursor *c)
+{
+ struct ia64_script script;
+ int ret = 0;
+
+ if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0)
+ return ret;
+
+ script_init (&script, c->ip);
+ if ((ret = build_script (c, &script)) < 0)
+ {
+ if (ret != -UNW_ESTOPUNWIND)
+ Dprintf ("%s: failed to build unwind script for ip %lx\n",
+ __FUNCTION__, (long) c->ip);
+ return ret;
+ }
+ return run_script (&script, c);
+}
+
+HIDDEN int
+ia64_find_save_locs (struct cursor *c)
+{
+ struct ia64_script_cache *cache = NULL;
+ struct ia64_script *script = NULL;
+ intrmask_t saved_mask;
+ int ret = 0;
+
+ if (c->as->caching_policy == UNW_CACHE_NONE)
+ return uncached_find_save_locs (c);
+
+ cache = get_script_cache (c->as, &saved_mask);
+ if (!cache)
+ {
+ Debug (1, "contention on script-cache; doing uncached lookup\n");
+ return uncached_find_save_locs (c);
+ }
+ {
+ script = script_lookup (cache, c);
+ Debug (8, "ip %lx %s in script cache\n", (long) c->ip,
+ script ? "hit" : "missed");
+
+ if (!script || (script->count == 0 && !script->pi.unwind_info))
+ {
+ if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0)
+ goto out;
+ }
+
+ if (!script)
+ {
+ script = script_new (cache, c->ip);
+ if (!script)
+ {
+ Dprintf ("%s: failed to create unwind script\n", __FUNCTION__);
+ ret = -UNW_EUNSPEC;
+ goto out;
+ }
+ }
+ cache->buckets[c->prev_script].hint = script - cache->buckets;
+
+ if (script->count == 0)
+ ret = build_script (c, script);
+
+ assert (script->count > 0);
+
+ c->hint = script->hint;
+ c->prev_script = script - cache->buckets;
+
+ if (ret < 0)
+ {
+ if (ret != -UNW_ESTOPUNWIND)
+ Dprintf ("%s: failed to locate/build unwind script for ip %lx\n",
+ __FUNCTION__, (long) c->ip);
+ goto out;
+ }
+
+ ret = run_script (script, c);
+ }
+ out:
+ put_script_cache (c->as, cache, &saved_mask);
+ return ret;
+}
+
+HIDDEN void
+ia64_validate_cache (unw_addr_space_t as, void *arg)
+{
+#ifndef UNW_REMOTE_ONLY
+ if (as == unw_local_addr_space && ia64_local_validate_cache (as, arg) == 1)
+ return;
+#endif
+
+#ifndef UNW_LOCAL_ONLY
+ /* local info is up-to-date, check dynamic info. */
+ unwi_dyn_validate_cache (as, arg);
+#endif
+}
+
+HIDDEN int
+ia64_cache_proc_info (struct cursor *c)
+{
+ struct ia64_script_cache *cache;
+ struct ia64_script *script;
+ intrmask_t saved_mask;
+ int ret = 0;
+
+ cache = get_script_cache (c->as, &saved_mask);
+ if (!cache)
+ return ret; /* cache is busy */
+
+ /* Re-check to see if a cache entry has been added in the meantime: */
+ script = script_lookup (cache, c);
+ if (script)
+ goto out;
+
+ script = script_new (cache, c->ip);
+ if (!script)
+ {
+ Dprintf ("%s: failed to create unwind script\n", __FUNCTION__);
+ ret = -UNW_EUNSPEC;
+ goto out;
+ }
+
+ script->pi = c->pi;
+
+ out:
+ put_script_cache (c->as, cache, &saved_mask);
+ return ret;
+}
+
+HIDDEN int
+ia64_get_cached_proc_info (struct cursor *c)
+{
+ struct ia64_script_cache *cache;
+ struct ia64_script *script;
+ intrmask_t saved_mask;
+
+ cache = get_script_cache (c->as, &saved_mask);
+ if (!cache)
+ return -UNW_ENOINFO; /* cache is busy */
+ {
+ script = script_lookup (cache, c);
+ if (script)
+ c->pi = script->pi;
+ }
+ put_script_cache (c->as, cache, &saved_mask);
+ return script ? 0 : -UNW_ENOINFO;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gstep.c b/src/pal/src/libunwind/src/ia64/Gstep.c
new file mode 100644
index 0000000000..df4ecb8796
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gstep.c
@@ -0,0 +1,359 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+#include "unwind_i.h"
+
+static inline int
+linux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc,
+ unw_word_t *num_regsp)
+{
+#if defined(UNW_LOCAL_ONLY) && !defined(__linux)
+ return -UNW_EINVAL;
+#else
+ unw_word_t sc_addr;
+ int ret;
+
+ if ((ret = ia64_get (c, IA64_LOC_ADDR (c->sp + 0x10
+ + LINUX_SIGFRAME_ARG2_OFF, 0),
+ &sc_addr)) < 0)
+ return ret;
+
+ c->sigcontext_addr = sc_addr;
+
+ if (!IA64_IS_REG_LOC (c->loc[IA64_REG_IP])
+ && IA64_GET_ADDR (c->loc[IA64_REG_IP]) == sc_addr + LINUX_SC_BR_OFF + 8)
+ {
+ /* Linux kernels before 2.4.19 and 2.5.10 had buggy
+ unwind info for sigtramp. Fix it up here. */
+ c->loc[IA64_REG_IP] = IA64_LOC_ADDR (sc_addr + LINUX_SC_IP_OFF, 0);
+ c->cfm_loc = IA64_LOC_ADDR (sc_addr + LINUX_SC_CFM_OFF, 0);
+ }
+
+ /* do what can't be described by unwind directives: */
+ c->loc[IA64_REG_PFS] = IA64_LOC_ADDR (sc_addr + LINUX_SC_AR_PFS_OFF, 0);
+ c->ec_loc = prev_cfm_loc;
+ *num_regsp = c->cfm & 0x7f; /* size of frame */
+ return 0;
+#endif
+}
+
+static inline int
+linux_interrupt (struct cursor *c, ia64_loc_t prev_cfm_loc,
+ unw_word_t *num_regsp, int marker)
+{
+#if defined(UNW_LOCAL_ONLY) && !(defined(__linux) && defined(__KERNEL__))
+ return -UNW_EINVAL;
+#else
+ unw_word_t sc_addr, num_regs;
+ ia64_loc_t pfs_loc;
+
+ sc_addr = c->sigcontext_addr = c->sp + 0x10;
+
+ if ((c->pr & (1UL << LINUX_PT_P_NONSYS)) != 0)
+ num_regs = c->cfm & 0x7f;
+ else
+ num_regs = 0;
+
+ /* do what can't be described by unwind directives: */
+ if (marker == ABI_MARKER_OLD_LINUX_INTERRUPT)
+ pfs_loc = IA64_LOC_ADDR (sc_addr + LINUX_OLD_PT_PFS_OFF, 0);
+ else
+ pfs_loc = IA64_LOC_ADDR (sc_addr + LINUX_PT_PFS_OFF, 0);
+ c->loc[IA64_REG_PFS] = pfs_loc;
+ c->ec_loc = prev_cfm_loc;
+ *num_regsp = num_regs; /* size of frame */
+ return 0;
+#endif
+}
+
+static inline int
+hpux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc,
+ unw_word_t *num_regsp)
+{
+#if defined(UNW_LOCAL_ONLY) && !defined(__hpux)
+ return -UNW_EINVAL;
+#else
+ unw_word_t sc_addr, bsp, bspstore;
+ ia64_loc_t sc_loc;
+ int ret, i;
+
+ /* HP-UX passes the address of ucontext_t in r32: */
+ if ((ret = ia64_get_stacked (c, 32, &sc_loc, NULL)) < 0)
+ return ret;
+ if ((ret = ia64_get (c, sc_loc, &sc_addr)) < 0)
+ return ret;
+
+ c->sigcontext_addr = sc_addr;
+
+ /* Now mark all (preserved) registers as coming from the
+ signal context: */
+ c->cfm_loc = IA64_LOC_UC_REG (UNW_IA64_CFM, sc_addr);
+ c->loc[IA64_REG_PRI_UNAT_MEM] = IA64_NULL_LOC;
+ c->loc[IA64_REG_PSP] = IA64_LOC_UC_REG (UNW_IA64_GR + 12, sc_addr);
+ c->loc[IA64_REG_BSP] = IA64_LOC_UC_REG (UNW_IA64_AR_BSP, sc_addr);
+ c->loc[IA64_REG_BSPSTORE] = IA64_LOC_UC_REG (UNW_IA64_AR_BSPSTORE, sc_addr);
+ c->loc[IA64_REG_PFS] = IA64_LOC_UC_REG (UNW_IA64_AR_PFS, sc_addr);
+ c->loc[IA64_REG_RNAT] = IA64_LOC_UC_REG (UNW_IA64_AR_RNAT, sc_addr);
+ c->loc[IA64_REG_IP] = IA64_LOC_UC_REG (UNW_IA64_IP, sc_addr);
+ c->loc[IA64_REG_R4] = IA64_LOC_UC_REG (UNW_IA64_GR + 4, sc_addr);
+ c->loc[IA64_REG_R5] = IA64_LOC_UC_REG (UNW_IA64_GR + 5, sc_addr);
+ c->loc[IA64_REG_R6] = IA64_LOC_UC_REG (UNW_IA64_GR + 6, sc_addr);
+ c->loc[IA64_REG_R7] = IA64_LOC_UC_REG (UNW_IA64_GR + 7, sc_addr);
+ c->loc[IA64_REG_NAT4] = IA64_LOC_UC_REG (UNW_IA64_NAT + 4, sc_addr);
+ c->loc[IA64_REG_NAT5] = IA64_LOC_UC_REG (UNW_IA64_NAT + 5, sc_addr);
+ c->loc[IA64_REG_NAT6] = IA64_LOC_UC_REG (UNW_IA64_NAT + 6, sc_addr);
+ c->loc[IA64_REG_NAT7] = IA64_LOC_UC_REG (UNW_IA64_NAT + 7, sc_addr);
+ c->loc[IA64_REG_UNAT] = IA64_LOC_UC_REG (UNW_IA64_AR_UNAT, sc_addr);
+ c->loc[IA64_REG_PR] = IA64_LOC_UC_REG (UNW_IA64_PR, sc_addr);
+ c->loc[IA64_REG_LC] = IA64_LOC_UC_REG (UNW_IA64_AR_LC, sc_addr);
+ c->loc[IA64_REG_FPSR] = IA64_LOC_UC_REG (UNW_IA64_AR_FPSR, sc_addr);
+ c->loc[IA64_REG_B1] = IA64_LOC_UC_REG (UNW_IA64_BR + 1, sc_addr);
+ c->loc[IA64_REG_B2] = IA64_LOC_UC_REG (UNW_IA64_BR + 2, sc_addr);
+ c->loc[IA64_REG_B3] = IA64_LOC_UC_REG (UNW_IA64_BR + 3, sc_addr);
+ c->loc[IA64_REG_B4] = IA64_LOC_UC_REG (UNW_IA64_BR + 4, sc_addr);
+ c->loc[IA64_REG_B5] = IA64_LOC_UC_REG (UNW_IA64_BR + 5, sc_addr);
+ c->loc[IA64_REG_F2] = IA64_LOC_UC_REG (UNW_IA64_FR + 2, sc_addr);
+ c->loc[IA64_REG_F3] = IA64_LOC_UC_REG (UNW_IA64_FR + 3, sc_addr);
+ c->loc[IA64_REG_F4] = IA64_LOC_UC_REG (UNW_IA64_FR + 4, sc_addr);
+ c->loc[IA64_REG_F5] = IA64_LOC_UC_REG (UNW_IA64_FR + 5, sc_addr);
+ for (i = 0; i < 16; ++i)
+ c->loc[IA64_REG_F16 + i] = IA64_LOC_UC_REG (UNW_IA64_FR + 16 + i, sc_addr);
+
+ c->pi.flags |= UNW_PI_FLAG_IA64_RBS_SWITCH;
+
+ /* update the CFM cache: */
+ if ((ret = ia64_get (c, c->cfm_loc, &c->cfm)) < 0)
+ return ret;
+ /* update the PSP cache: */
+ if ((ret = ia64_get (c, c->loc[IA64_REG_PSP], &c->psp)) < 0)
+ return ret;
+
+ if ((ret = ia64_get (c, c->loc[IA64_REG_BSP], &bsp)) < 0
+ || (ret = ia64_get (c, c->loc[IA64_REG_BSPSTORE], &bspstore)) < 0)
+ return ret;
+ if (bspstore < bsp)
+ /* Dirty partition got spilled into the ucontext_t structure
+ itself. We'll need to access it via uc_access(3). */
+ rbs_switch (c, bsp, bspstore, IA64_LOC_UC_ADDR (bsp | 0x1f8, 0));
+
+ c->ec_loc = prev_cfm_loc;
+
+ *num_regsp = 0;
+ return 0;
+#endif
+}
+
+
+static inline int
+check_rbs_switch (struct cursor *c)
+{
+ unw_word_t saved_bsp, saved_bspstore, loadrs, ndirty;
+ int ret = 0;
+
+ saved_bsp = c->bsp;
+ if (c->pi.flags & UNW_PI_FLAG_IA64_RBS_SWITCH)
+ {
+ /* Got ourselves a frame that has saved ar.bspstore, ar.bsp,
+ and ar.rnat, so we're all set for rbs-switching: */
+ if ((ret = ia64_get (c, c->loc[IA64_REG_BSP], &saved_bsp)) < 0
+ || (ret = ia64_get (c, c->loc[IA64_REG_BSPSTORE], &saved_bspstore)))
+ return ret;
+ }
+ else if ((c->abi_marker == ABI_MARKER_LINUX_SIGTRAMP
+ || c->abi_marker == ABI_MARKER_OLD_LINUX_SIGTRAMP)
+ && !IA64_IS_REG_LOC (c->loc[IA64_REG_BSP])
+ && (IA64_GET_ADDR (c->loc[IA64_REG_BSP])
+ == c->sigcontext_addr + LINUX_SC_AR_BSP_OFF))
+ {
+ /* When Linux delivers a signal on an alternate stack, it
+ does things a bit differently from what the unwind
+ conventions allow us to describe: instead of saving
+ ar.rnat, ar.bsp, and ar.bspstore, it saves the former two
+ plus the "loadrs" value. Because of this, we need to
+ detect & record a potential rbs-area switch
+ manually... */
+
+ /* If ar.bsp has been saved already AND the current bsp is
+ not equal to the saved value, then we know for sure that
+ we're past the point where the backing store has been
+ switched (and before the point where it's restored). */
+ if ((ret = ia64_get (c, IA64_LOC_ADDR (c->sigcontext_addr
+ + LINUX_SC_AR_BSP_OFF, 0),
+ &saved_bsp) < 0)
+ || (ret = ia64_get (c, IA64_LOC_ADDR (c->sigcontext_addr
+ + LINUX_SC_LOADRS_OFF, 0),
+ &loadrs) < 0))
+ return ret;
+ loadrs >>= 16;
+ ndirty = rse_num_regs (c->bsp - loadrs, c->bsp);
+ saved_bspstore = rse_skip_regs (saved_bsp, -ndirty);
+ }
+
+ if (saved_bsp == c->bsp)
+ return 0;
+
+ return rbs_switch (c, saved_bsp, saved_bspstore, c->loc[IA64_REG_RNAT]);
+}
+
+static inline int
+update_frame_state (struct cursor *c)
+{
+ unw_word_t prev_ip, prev_sp, prev_bsp, ip, num_regs;
+ ia64_loc_t prev_cfm_loc;
+ int ret;
+
+ prev_cfm_loc = c->cfm_loc;
+ prev_ip = c->ip;
+ prev_sp = c->sp;
+ prev_bsp = c->bsp;
+
+ /* Update the IP cache (do this first: if we reach the end of the
+ frame-chain, the rest of the info may not be valid/useful
+ anymore. */
+ ret = ia64_get (c, c->loc[IA64_REG_IP], &ip);
+ if (ret < 0)
+ return ret;
+ c->ip = ip;
+
+ if ((ip & 0xc) != 0)
+ {
+ /* don't let obviously bad addresses pollute the cache */
+ Debug (1, "rejecting bad ip=0x%lx\n", (long) c->ip);
+ return -UNW_EINVALIDIP;
+ }
+
+ c->cfm_loc = c->loc[IA64_REG_PFS];
+ /* update the CFM cache: */
+ ret = ia64_get (c, c->cfm_loc, &c->cfm);
+ if (ret < 0)
+ return ret;
+
+ /* Normally, AR.EC is stored in the CFM save-location. That
+ save-location contains the full function-state as defined by
+ AR.PFS. However, interruptions only save the frame-marker, not
+ any other info in CFM. Instead, AR.EC gets saved on the first
+ call by the interruption-handler. Thus, interruption-related
+ frames need to track the _previous_ CFM save-location since
+ that's were AR.EC is saved. We support this by setting ec_loc to
+ cfm_loc by default and giving frames marked with an ABI-marker
+ the chance to override this value with prev_cfm_loc. */
+ c->ec_loc = c->cfm_loc;
+
+ num_regs = 0;
+ if (unlikely (c->abi_marker))
+ {
+ c->last_abi_marker = c->abi_marker;
+ switch (ia64_get_abi_marker (c))
+ {
+ case ABI_MARKER_LINUX_SIGTRAMP:
+ case ABI_MARKER_OLD_LINUX_SIGTRAMP:
+ ia64_set_abi (c, ABI_LINUX);
+ if ((ret = linux_sigtramp (c, prev_cfm_loc, &num_regs)) < 0)
+ return ret;
+ break;
+
+ case ABI_MARKER_OLD_LINUX_INTERRUPT:
+ case ABI_MARKER_LINUX_INTERRUPT:
+ ia64_set_abi (c, ABI_LINUX);
+ if ((ret = linux_interrupt (c, prev_cfm_loc, &num_regs,
+ c->abi_marker)) < 0)
+ return ret;
+ break;
+
+ case ABI_MARKER_HP_UX_SIGTRAMP:
+ ia64_set_abi (c, ABI_HPUX);
+ if ((ret = hpux_sigtramp (c, prev_cfm_loc, &num_regs)) < 0)
+ return ret;
+ break;
+
+ default:
+ Debug (1, "unknown ABI marker: ABI=%u, context=%u\n",
+ c->abi_marker >> 8, c->abi_marker & 0xff);
+ return -UNW_EINVAL;
+ }
+ Debug (12, "sigcontext_addr=%lx (ret=%d)\n",
+ (unsigned long) c->sigcontext_addr, ret);
+
+ c->sigcontext_off = c->sigcontext_addr - c->sp;
+
+ /* update the IP cache: */
+ if ((ret = ia64_get (c, c->loc[IA64_REG_IP], &ip)) < 0)
+ return ret;
+ c->ip = ip;
+ if (ip == 0)
+ /* end of frame-chain reached */
+ return 0;
+ }
+ else
+ num_regs = (c->cfm >> 7) & 0x7f; /* size of locals */
+
+ if (!IA64_IS_NULL_LOC (c->loc[IA64_REG_BSP]))
+ {
+ ret = check_rbs_switch (c);
+ if (ret < 0)
+ return ret;
+ }
+
+ c->bsp = rse_skip_regs (c->bsp, -num_regs);
+
+ c->sp = c->psp;
+ c->abi_marker = 0;
+
+ if (c->ip == prev_ip && c->sp == prev_sp && c->bsp == prev_bsp)
+ {
+ Dprintf ("%s: ip, sp, and bsp unchanged; stopping here (ip=0x%lx)\n",
+ __FUNCTION__, (long) ip);
+ return -UNW_EBADFRAME;
+ }
+
+ /* as we unwind, the saved ar.unat becomes the primary unat: */
+ c->loc[IA64_REG_PRI_UNAT_MEM] = c->loc[IA64_REG_UNAT];
+
+ /* restore the predicates: */
+ ret = ia64_get (c, c->loc[IA64_REG_PR], &c->pr);
+ if (ret < 0)
+ return ret;
+
+ c->pi_valid = 0;
+ return 0;
+}
+
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->ip);
+
+ if ((ret = ia64_find_save_locs (c)) >= 0
+ && (ret = update_frame_state (c)) >= 0)
+ ret = (c->ip == 0) ? 0 : 1;
+
+ Debug (2, "returning %d (ip=0x%016lx)\n", ret, (unsigned long) c->ip);
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/ia64/Gtables.c b/src/pal/src/libunwind/src/ia64/Gtables.c
new file mode 100644
index 0000000000..f5e8f2d8f4
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Gtables.c
@@ -0,0 +1,731 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2001-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stddef.h>
+
+#include "unwind_i.h"
+
+#ifdef HAVE_IA64INTRIN_H
+# include <ia64intrin.h>
+#endif
+
+extern unw_addr_space_t _ULia64_local_addr_space;
+
+struct ia64_table_entry
+ {
+ uint64_t start_offset;
+ uint64_t end_offset;
+ uint64_t info_offset;
+ };
+
+#ifdef UNW_LOCAL_ONLY
+
+static inline int
+is_local_addr_space (unw_addr_space_t as)
+{
+ return 1;
+}
+
+static inline int
+read_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *valp, void *arg)
+{
+ *valp = *(unw_word_t *) addr;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+
+static inline int
+is_local_addr_space (unw_addr_space_t as)
+{
+ return as == unw_local_addr_space;
+}
+
+static inline int
+read_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *valp, void *arg)
+{
+ unw_accessors_t *a = unw_get_accessors_int (as);
+
+ return (*a->access_mem) (as, addr, valp, 0, arg);
+}
+
+/* Helper macro for reading an ia64_table_entry from remote memory. */
+#define remote_read(addr, member) \
+ (*a->access_mem) (as, (addr) + offsetof (struct ia64_table_entry, \
+ member), &member, 0, arg)
+
+/* Lookup an unwind-table entry in remote memory. Returns 1 if an
+ entry is found, 0 if no entry is found, negative if an error
+ occurred reading remote memory. */
+static int
+remote_lookup (unw_addr_space_t as,
+ unw_word_t table, size_t table_size, unw_word_t rel_ip,
+ struct ia64_table_entry *e, void *arg)
+{
+ unw_word_t e_addr = 0, start_offset, end_offset, info_offset;
+ unw_accessors_t *a = unw_get_accessors_int (as);
+ unsigned long lo, hi, mid;
+ int ret;
+
+ /* do a binary search for right entry: */
+ for (lo = 0, hi = table_size / sizeof (struct ia64_table_entry); lo < hi;)
+ {
+ mid = (lo + hi) / 2;
+ e_addr = table + mid * sizeof (struct ia64_table_entry);
+ if ((ret = remote_read (e_addr, start_offset)) < 0)
+ return ret;
+
+ if (rel_ip < start_offset)
+ hi = mid;
+ else
+ {
+ if ((ret = remote_read (e_addr, end_offset)) < 0)
+ return ret;
+
+ if (rel_ip >= end_offset)
+ lo = mid + 1;
+ else
+ break;
+ }
+ }
+ if (rel_ip < start_offset || rel_ip >= end_offset)
+ return 0;
+ e->start_offset = start_offset;
+ e->end_offset = end_offset;
+
+ if ((ret = remote_read (e_addr, info_offset)) < 0)
+ return ret;
+ e->info_offset = info_offset;
+ return 1;
+}
+
+HIDDEN void
+tdep_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg)
+{
+ if (!pi->unwind_info)
+ return;
+
+ if (is_local_addr_space (as))
+ {
+ free (pi->unwind_info);
+ pi->unwind_info = NULL;
+ }
+}
+
+unw_word_t
+_Uia64_find_dyn_list (unw_addr_space_t as, unw_dyn_info_t *di, void *arg)
+{
+ unw_word_t hdr_addr, info_addr, hdr, directives, pers, cookie, off;
+ unw_word_t start_offset, end_offset, info_offset, segbase;
+ struct ia64_table_entry *e;
+ size_t table_size;
+ unw_word_t gp = di->gp;
+ int ret;
+
+ switch (di->format)
+ {
+ case UNW_INFO_FORMAT_DYNAMIC:
+ default:
+ return 0;
+
+ case UNW_INFO_FORMAT_TABLE:
+ e = (struct ia64_table_entry *) di->u.ti.table_data;
+ table_size = di->u.ti.table_len * sizeof (di->u.ti.table_data[0]);
+ segbase = di->u.ti.segbase;
+ if (table_size < sizeof (struct ia64_table_entry))
+ return 0;
+ start_offset = e[0].start_offset;
+ end_offset = e[0].end_offset;
+ info_offset = e[0].info_offset;
+ break;
+
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+ {
+ unw_accessors_t *a = unw_get_accessors_int (as);
+ unw_word_t e_addr = di->u.rti.table_data;
+
+ table_size = di->u.rti.table_len * sizeof (unw_word_t);
+ segbase = di->u.rti.segbase;
+ if (table_size < sizeof (struct ia64_table_entry))
+ return 0;
+
+ if ( (ret = remote_read (e_addr, start_offset) < 0)
+ || (ret = remote_read (e_addr, end_offset) < 0)
+ || (ret = remote_read (e_addr, info_offset) < 0))
+ return ret;
+ }
+ break;
+ }
+
+ if (start_offset != end_offset)
+ /* dyn-list entry cover a zero-length "procedure" and should be
+ first entry (note: technically a binary could contain code
+ below the segment base, but this doesn't happen for normal
+ binaries and certainly doesn't happen when libunwind is a
+ separate shared object. For weird cases, the application may
+ have to provide its own (slower) version of this routine. */
+ return 0;
+
+ hdr_addr = info_offset + segbase;
+ info_addr = hdr_addr + 8;
+
+ /* read the header word: */
+ if ((ret = read_mem (as, hdr_addr, &hdr, arg)) < 0)
+ return ret;
+
+ if (IA64_UNW_VER (hdr) != 1
+ || IA64_UNW_FLAG_EHANDLER (hdr) || IA64_UNW_FLAG_UHANDLER (hdr))
+ /* dyn-list entry must be version 1 and doesn't have ehandler
+ or uhandler */
+ return 0;
+
+ if (IA64_UNW_LENGTH (hdr) != 1)
+ /* dyn-list entry must consist of a single word of NOP directives */
+ return 0;
+
+ if ( ((ret = read_mem (as, info_addr, &directives, arg)) < 0)
+ || ((ret = read_mem (as, info_addr + 0x08, &pers, arg)) < 0)
+ || ((ret = read_mem (as, info_addr + 0x10, &cookie, arg)) < 0)
+ || ((ret = read_mem (as, info_addr + 0x18, &off, arg)) < 0))
+ return 0;
+
+ if (directives != 0 || pers != 0
+ || (!as->big_endian && cookie != 0x7473696c2d6e7964ULL)
+ || ( as->big_endian && cookie != 0x64796e2d6c697374ULL))
+ return 0;
+
+ /* OK, we ran the gauntlet and found it: */
+ return off + gp;
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+static inline const struct ia64_table_entry *
+lookup (struct ia64_table_entry *table, size_t table_size, unw_word_t rel_ip)
+{
+ const struct ia64_table_entry *e = 0;
+ unsigned long lo, hi, mid;
+
+ /* do a binary search for right entry: */
+ for (lo = 0, hi = table_size / sizeof (struct ia64_table_entry); lo < hi;)
+ {
+ mid = (lo + hi) / 2;
+ e = table + mid;
+ if (rel_ip < e->start_offset)
+ hi = mid;
+ else if (rel_ip >= e->end_offset)
+ lo = mid + 1;
+ else
+ break;
+ }
+ if (rel_ip < e->start_offset || rel_ip >= e->end_offset)
+ return NULL;
+ return e;
+}
+
+int
+unw_search_ia64_unwind_table (unw_addr_space_t as, unw_word_t ip,
+ unw_dyn_info_t *di, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ unw_word_t addr, hdr_addr, info_addr, info_end_addr, hdr, *wp;
+ const struct ia64_table_entry *e = NULL;
+ unw_word_t handler_offset, segbase = 0;
+ int ret, is_local;
+#ifndef UNW_LOCAL_ONLY
+ struct ia64_table_entry ent;
+#endif
+
+ assert ((di->format == UNW_INFO_FORMAT_TABLE
+ || di->format == UNW_INFO_FORMAT_REMOTE_TABLE)
+ && (ip >= di->start_ip && ip < di->end_ip));
+
+ pi->flags = 0;
+ pi->unwind_info = 0;
+ pi->handler = 0;
+
+ if (likely (di->format == UNW_INFO_FORMAT_TABLE))
+ {
+ segbase = di->u.ti.segbase;
+ e = lookup ((struct ia64_table_entry *) di->u.ti.table_data,
+ di->u.ti.table_len * sizeof (unw_word_t),
+ ip - segbase);
+ }
+#ifndef UNW_LOCAL_ONLY
+ else
+ {
+ segbase = di->u.rti.segbase;
+ if ((ret = remote_lookup (as, di->u.rti.table_data,
+ di->u.rti.table_len * sizeof (unw_word_t),
+ ip - segbase, &ent, arg)) < 0)
+ return ret;
+ if (ret)
+ e = &ent;
+ }
+#endif
+ if (!e)
+ {
+ /* IP is inside this table's range, but there is no explicit
+ unwind info => use default conventions (i.e., this is NOT an
+ error). */
+ memset (pi, 0, sizeof (*pi));
+ pi->start_ip = 0;
+ pi->end_ip = 0;
+ pi->gp = di->gp;
+ pi->lsda = 0;
+ return 0;
+ }
+
+ pi->start_ip = e->start_offset + segbase;
+ pi->end_ip = e->end_offset + segbase;
+
+ hdr_addr = e->info_offset + segbase;
+ info_addr = hdr_addr + 8;
+
+ /* Read the header word. Note: the actual unwind-info is always
+ assumed to reside in memory, independent of whether di->format is
+ UNW_INFO_FORMAT_TABLE or UNW_INFO_FORMAT_REMOTE_TABLE. */
+
+ if ((ret = read_mem (as, hdr_addr, &hdr, arg)) < 0)
+ return ret;
+
+ if (IA64_UNW_VER (hdr) != 1)
+ {
+ Debug (1, "Unknown header version %ld (hdr word=0x%lx @ 0x%lx)\n",
+ IA64_UNW_VER (hdr), (unsigned long) hdr,
+ (unsigned long) hdr_addr);
+ return -UNW_EBADVERSION;
+ }
+
+ info_end_addr = info_addr + 8 * IA64_UNW_LENGTH (hdr);
+
+ is_local = is_local_addr_space (as);
+
+ /* If we must have the unwind-info, return it. Also, if we are in
+ the local address-space, return the unwind-info because it's so
+ cheap to do so and it may come in handy later on. */
+ if (need_unwind_info || is_local)
+ {
+ pi->unwind_info_size = 8 * IA64_UNW_LENGTH (hdr);
+
+ if (is_local)
+ pi->unwind_info = (void *) (uintptr_t) info_addr;
+ else
+ {
+ /* Internalize unwind info. Note: since we're doing this
+ only for non-local address spaces, there is no
+ signal-safety issue and it is OK to use malloc()/free(). */
+ pi->unwind_info = malloc (8 * IA64_UNW_LENGTH (hdr));
+ if (!pi->unwind_info)
+ return -UNW_ENOMEM;
+
+ wp = (unw_word_t *) pi->unwind_info;
+ for (addr = info_addr; addr < info_end_addr; addr += 8, ++wp)
+ {
+ if ((ret = read_mem (as, addr, wp, arg)) < 0)
+ {
+ free (pi->unwind_info);
+ return ret;
+ }
+ }
+ }
+ }
+
+ if (IA64_UNW_FLAG_EHANDLER (hdr) || IA64_UNW_FLAG_UHANDLER (hdr))
+ {
+ /* read the personality routine address (address is gp-relative): */
+ if ((ret = read_mem (as, info_end_addr, &handler_offset, arg)) < 0)
+ return ret;
+ Debug (4, "handler ptr @ offset=%lx, gp=%lx\n", handler_offset, di->gp);
+ if ((read_mem (as, handler_offset + di->gp, &pi->handler, arg)) < 0)
+ return ret;
+ }
+ pi->lsda = info_end_addr + 8;
+ pi->gp = di->gp;
+ pi->format = di->format;
+ return 0;
+}
+
+#ifndef UNW_REMOTE_ONLY
+
+# if defined(HAVE_DL_ITERATE_PHDR)
+# include <link.h>
+# include <stdlib.h>
+
+# if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) \
+ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && !defined(DT_CONFIG))
+# error You need GLIBC 2.2.4 or later on IA-64 Linux
+# endif
+
+# if defined(HAVE_GETUNWIND)
+ extern unsigned long getunwind (void *buf, size_t len);
+# else /* HAVE_GETUNWIND */
+# include <unistd.h>
+# include <sys/syscall.h>
+# ifndef __NR_getunwind
+# define __NR_getunwind 1215
+# endif
+
+static unsigned long
+getunwind (void *buf, size_t len)
+{
+ return syscall (SYS_getunwind, buf, len);
+}
+
+# endif /* HAVE_GETUNWIND */
+
+static unw_dyn_info_t kernel_table;
+
+static int
+get_kernel_table (unw_dyn_info_t *di)
+{
+ struct ia64_table_entry *ktab, *etab;
+ size_t size;
+
+ Debug (16, "getting kernel table");
+
+ size = getunwind (NULL, 0);
+ ktab = sos_alloc (size);
+ if (!ktab)
+ {
+ Dprintf (__FILE__".%s: failed to allocate %zu bytes",
+ __FUNCTION__, size);
+ return -UNW_ENOMEM;
+ }
+ getunwind (ktab, size);
+
+ /* Determine length of kernel's unwind table & relocate its entries. */
+ for (etab = ktab; etab->start_offset; ++etab)
+ etab->info_offset += (uint64_t) ktab;
+
+ di->format = UNW_INFO_FORMAT_TABLE;
+ di->gp = 0;
+ di->start_ip = ktab[0].start_offset;
+ di->end_ip = etab[-1].end_offset;
+ di->u.ti.name_ptr = (unw_word_t) "<kernel>";
+ di->u.ti.segbase = 0;
+ di->u.ti.table_len = ((char *) etab - (char *) ktab) / sizeof (unw_word_t);
+ di->u.ti.table_data = (unw_word_t *) ktab;
+
+ Debug (16, "found table `%s': [%lx-%lx) segbase=%lx len=%lu\n",
+ (char *) di->u.ti.name_ptr, di->start_ip, di->end_ip,
+ di->u.ti.segbase, di->u.ti.table_len);
+ return 0;
+}
+
+# ifndef UNW_LOCAL_ONLY
+
+/* This is exported for the benefit of libunwind-ptrace.a. */
+int
+_Uia64_get_kernel_table (unw_dyn_info_t *di)
+{
+ int ret;
+
+ if (!kernel_table.u.ti.table_data)
+ if ((ret = get_kernel_table (&kernel_table)) < 0)
+ return ret;
+
+ memcpy (di, &kernel_table, sizeof (*di));
+ return 0;
+}
+
+# endif /* !UNW_LOCAL_ONLY */
+
+static inline unsigned long
+current_gp (void)
+{
+# if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+ register unsigned long gp __asm__("gp");
+ return gp;
+# elif HAVE_IA64INTRIN_H
+ return __getReg (_IA64_REG_GP);
+# else
+# error Implement me.
+# endif
+}
+
+static int
+callback (struct dl_phdr_info *info, size_t size, void *ptr)
+{
+ unw_dyn_info_t *di = ptr;
+ const Elf64_Phdr *phdr, *p_unwind, *p_dynamic, *p_text;
+ long n;
+ Elf64_Addr load_base, segbase = 0;
+
+ /* Make sure struct dl_phdr_info is at least as big as we need. */
+ if (size < offsetof (struct dl_phdr_info, dlpi_phnum)
+ + sizeof (info->dlpi_phnum))
+ return -1;
+
+ Debug (16, "checking `%s' (load_base=%lx)\n",
+ info->dlpi_name, info->dlpi_addr);
+
+ phdr = info->dlpi_phdr;
+ load_base = info->dlpi_addr;
+ p_text = NULL;
+ p_unwind = NULL;
+ p_dynamic = NULL;
+
+ /* See if PC falls into one of the loaded segments. Find the unwind
+ segment at the same time. */
+ for (n = info->dlpi_phnum; --n >= 0; phdr++)
+ {
+ if (phdr->p_type == PT_LOAD)
+ {
+ Elf64_Addr vaddr = phdr->p_vaddr + load_base;
+ if (di->u.ti.segbase >= vaddr
+ && di->u.ti.segbase < vaddr + phdr->p_memsz)
+ p_text = phdr;
+ }
+ else if (phdr->p_type == PT_IA_64_UNWIND)
+ p_unwind = phdr;
+ else if (phdr->p_type == PT_DYNAMIC)
+ p_dynamic = phdr;
+ }
+ if (!p_text || !p_unwind)
+ return 0;
+
+ if (likely (p_unwind->p_vaddr >= p_text->p_vaddr
+ && p_unwind->p_vaddr < p_text->p_vaddr + p_text->p_memsz))
+ /* normal case: unwind table is inside text segment */
+ segbase = p_text->p_vaddr + load_base;
+ else
+ {
+ /* Special case: unwind table is in some other segment; this
+ happens for the Linux kernel's gate DSO, for example. */
+ phdr = info->dlpi_phdr;
+ for (n = info->dlpi_phnum; --n >= 0; phdr++)
+ {
+ if (phdr->p_type == PT_LOAD && p_unwind->p_vaddr >= phdr->p_vaddr
+ && p_unwind->p_vaddr < phdr->p_vaddr + phdr->p_memsz)
+ {
+ segbase = phdr->p_vaddr + load_base;
+ break;
+ }
+ }
+ }
+
+ if (p_dynamic)
+ {
+ /* For dynamicly linked executables and shared libraries,
+ DT_PLTGOT is the gp value for that object. */
+ Elf64_Dyn *dyn = (Elf64_Dyn *)(p_dynamic->p_vaddr + load_base);
+ for (; dyn->d_tag != DT_NULL; ++dyn)
+ if (dyn->d_tag == DT_PLTGOT)
+ {
+ /* On IA-64, _DYNAMIC is writable and GLIBC has relocated it. */
+ di->gp = dyn->d_un.d_ptr;
+ break;
+ }
+ }
+ else
+ /* Otherwise this is a static executable with no _DYNAMIC.
+ The gp is constant program-wide. */
+ di->gp = current_gp();
+ di->format = UNW_INFO_FORMAT_TABLE;
+ di->start_ip = p_text->p_vaddr + load_base;
+ di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz;
+ di->u.ti.name_ptr = (unw_word_t) info->dlpi_name;
+ di->u.ti.table_data = (void *) (p_unwind->p_vaddr + load_base);
+ di->u.ti.table_len = p_unwind->p_memsz / sizeof (unw_word_t);
+ di->u.ti.segbase = segbase;
+
+ Debug (16, "found table `%s': segbase=%lx, len=%lu, gp=%lx, "
+ "table_data=%p\n", (char *) di->u.ti.name_ptr, di->u.ti.segbase,
+ di->u.ti.table_len, di->gp, di->u.ti.table_data);
+ return 1;
+}
+
+# ifdef HAVE_DL_PHDR_REMOVALS_COUNTER
+
+static inline int
+validate_cache (unw_addr_space_t as)
+{
+ /* Note: we don't need to serialize here with respect to
+ dl_iterate_phdr() because if somebody were to remove an object
+ that is required to complete the unwind on whose behalf we're
+ validating the cache here, we'd be hosed anyhow. What we're
+ guarding against here is the case where library FOO gets mapped,
+ unwind info for FOO gets cached, FOO gets unmapped, BAR gets
+ mapped in the place where FOO was and then we unwind across a
+ function in FOO. Since no thread can execute in BAR before FOO
+ has been removed, we are guaranteed that
+ dl_phdr_removals_counter() would have been incremented before we
+ get here. */
+ unsigned long long removals = dl_phdr_removals_counter ();
+
+ if (removals == as->shared_object_removals)
+ return 1;
+
+ as->shared_object_removals = removals;
+ unw_flush_cache (as, 0, 0);
+ return -1;
+}
+
+# else /* !HAVE_DL_PHDR_REMOVALS_COUNTER */
+
+/* Check whether any phdrs have been removed since we last flushed the
+ cache. If so we flush the cache and return -1, if not, we do
+ nothing and return 1. */
+
+static int
+check_callback (struct dl_phdr_info *info, size_t size, void *ptr)
+{
+# ifdef HAVE_STRUCT_DL_PHDR_INFO_DLPI_SUBS
+ unw_addr_space_t as = ptr;
+
+ if (size <
+ offsetof (struct dl_phdr_info, dlpi_subs) + sizeof (info->dlpi_subs))
+ /* It would be safer to flush the cache here, but that would
+ disable caching for older libc's which would be incompatible
+ with the behavior of older versions of libunwind so we return 1
+ instead and hope nobody runs into stale cache info... */
+ return 1;
+
+ if (info->dlpi_subs == as->shared_object_removals)
+ return 1;
+
+ as->shared_object_removals = info->dlpi_subs;
+ unw_flush_cache (as, 0, 0);
+ return -1; /* indicate that there were removals */
+# else
+ return 1;
+# endif
+}
+
+static inline int
+validate_cache (unw_addr_space_t as)
+{
+ intrmask_t saved_mask;
+ int ret;
+
+ SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask);
+ ret = dl_iterate_phdr (check_callback, as);
+ SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL);
+ return ret;
+}
+
+# endif /* HAVE_DL_PHDR_REMOVALS_COUNTER */
+
+# elif defined(HAVE_DLMODINFO)
+ /* Support for HP-UX-style dlmodinfo() */
+# include <dlfcn.h>
+
+static inline int
+validate_cache (unw_addr_space_t as)
+{
+ return 1;
+}
+
+# endif /* !HAVE_DLMODINFO */
+
+HIDDEN int
+tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info, void *arg)
+{
+# if defined(HAVE_DL_ITERATE_PHDR)
+ unw_dyn_info_t di, *dip = &di;
+ intrmask_t saved_mask;
+ int ret;
+
+ di.u.ti.segbase = ip; /* this is cheap... */
+
+ SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask);
+ ret = dl_iterate_phdr (callback, &di);
+ SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL);
+
+ if (ret <= 0)
+ {
+ if (!kernel_table.u.ti.table_data)
+ {
+ if ((ret = get_kernel_table (&kernel_table)) < 0)
+ return ret;
+ }
+ if (ip < kernel_table.start_ip || ip >= kernel_table.end_ip)
+ return -UNW_ENOINFO;
+ dip = &kernel_table;
+ }
+# elif defined(HAVE_DLMODINFO)
+# define UNWIND_TBL_32BIT 0x8000000000000000
+ struct load_module_desc lmd;
+ unw_dyn_info_t di, *dip = &di;
+ struct unwind_header
+ {
+ uint64_t header_version;
+ uint64_t start_offset;
+ uint64_t end_offset;
+ }
+ *uhdr;
+
+ if (!dlmodinfo (ip, &lmd, sizeof (lmd), NULL, 0, 0))
+ return -UNW_ENOINFO;
+
+ di.format = UNW_INFO_FORMAT_TABLE;
+ di.start_ip = lmd.text_base;
+ di.end_ip = lmd.text_base + lmd.text_size;
+ di.gp = lmd.linkage_ptr;
+ di.u.ti.name_ptr = 0; /* no obvious table-name available */
+ di.u.ti.segbase = lmd.text_base;
+
+ uhdr = (struct unwind_header *) lmd.unwind_base;
+
+ if ((uhdr->header_version & ~UNWIND_TBL_32BIT) != 1
+ && (uhdr->header_version & ~UNWIND_TBL_32BIT) != 2)
+ {
+ Debug (1, "encountered unknown unwind header version %ld\n",
+ (long) (uhdr->header_version & ~UNWIND_TBL_32BIT));
+ return -UNW_EBADVERSION;
+ }
+ if (uhdr->header_version & UNWIND_TBL_32BIT)
+ {
+ Debug (1, "32-bit unwind tables are not supported yet\n");
+ return -UNW_EINVAL;
+ }
+
+ di.u.ti.table_data = (unw_word_t *) (di.u.ti.segbase + uhdr->start_offset);
+ di.u.ti.table_len = ((uhdr->end_offset - uhdr->start_offset)
+ / sizeof (unw_word_t));
+
+ Debug (16, "found table `%s': segbase=%lx, len=%lu, gp=%lx, "
+ "table_data=%p\n", (char *) di.u.ti.name_ptr, di.u.ti.segbase,
+ di.u.ti.table_len, di.gp, di.u.ti.table_data);
+# endif
+
+ /* now search the table: */
+ return tdep_search_unwind_table (as, ip, dip, pi, need_unwind_info, arg);
+}
+
+/* Returns 1 if the cache is up-to-date or -1 if the cache contained
+ stale data and had to be flushed. */
+
+HIDDEN int
+ia64_local_validate_cache (unw_addr_space_t as, void *arg)
+{
+ return validate_cache (as);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/ia64/Lapply_reg_state.c b/src/pal/src/libunwind/src/ia64/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lcreate_addr_space.c b/src/pal/src/libunwind/src/ia64/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lfind_unwind_table.c b/src/pal/src/libunwind/src/ia64/Lfind_unwind_table.c
new file mode 100644
index 0000000000..68e269f1d7
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lfind_unwind_table.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gfind_unwind_table.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lget_proc_info.c b/src/pal/src/libunwind/src/ia64/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lget_save_loc.c b/src/pal/src/libunwind/src/ia64/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lglobal.c b/src/pal/src/libunwind/src/ia64/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Linit.c b/src/pal/src/libunwind/src/ia64/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Linit_local.c b/src/pal/src/libunwind/src/ia64/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Linit_remote.c b/src/pal/src/libunwind/src/ia64/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Linstall_cursor.S b/src/pal/src/libunwind/src/ia64/Linstall_cursor.S
new file mode 100644
index 0000000000..8c72339725
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Linstall_cursor.S
@@ -0,0 +1,6 @@
+#define UNW_LOCAL_ONLY
+#include "Ginstall_cursor.S"
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lis_signal_frame.c b/src/pal/src/libunwind/src/ia64/Lis_signal_frame.c
new file mode 100644
index 0000000000..b9a7c4f51a
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lparser.c b/src/pal/src/libunwind/src/ia64/Lparser.c
new file mode 100644
index 0000000000..f23aaf48e9
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lparser.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gparser.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lrbs.c b/src/pal/src/libunwind/src/ia64/Lrbs.c
new file mode 100644
index 0000000000..a91b5f2979
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lrbs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Grbs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lreg_states_iterate.c b/src/pal/src/libunwind/src/ia64/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lregs.c b/src/pal/src/libunwind/src/ia64/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lresume.c b/src/pal/src/libunwind/src/ia64/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lscript.c b/src/pal/src/libunwind/src/ia64/Lscript.c
new file mode 100644
index 0000000000..57b926bf80
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lscript.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gscript.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Lstep.c b/src/pal/src/libunwind/src/ia64/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/Ltables.c b/src/pal/src/libunwind/src/ia64/Ltables.c
new file mode 100644
index 0000000000..876b0aac03
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/Ltables.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gtables.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/NOTES b/src/pal/src/libunwind/src/ia64/NOTES
new file mode 100644
index 0000000000..a5805e8345
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/NOTES
@@ -0,0 +1,65 @@
+- the frame state consists of the following:
+
+ - ip current instruction pointer
+ - sp current stack pointer value
+ - bsp current backing store pointer
+ - cfm current frame mask
+
+ these are derived from the next younger (more deeply nested) frame
+ as follows:
+
+ - ip == saved return-link (may be b0 or an alternate branch-reg)
+ - sp == if younger frame has a fixed-sized frame, sp + size-of-frame,
+ else saved sp
+ - cfm == saved ar.pfs
+ - bsp == if ar.bsp has been saved, saved ar.bsp, otherwise,
+ ar.bsp \ominus saved ar.pfs.pfm.sol
+
+The unwind cursor should represent the machine state as it existed at
+the address contained in register ip. This state consists of the
+*current* frame state and the save locations in the next younger
+frame.
+
+An unwind script current takes the old save locations and updates them
+for the next older frame. With the new setup, we need to update the
+frame state first, without updating the other save locations. For this
+to work, we need the following info:
+
+ - save location of return-link
+ - save location of ar.pfs
+ - save location of bsp (if it has been saved)
+ - size of stack frame (fixed case) or save location of sp
+
+
+setup:
+
+ func: ...
+ ...
+ ...
+ br.call foo <-- call site
+ ... <-- ip
+ ...
+
+initial state:
+
+ The unwind cursor represents the (preserved) machine state
+ as it existed at "ip".
+
+ Evaluating the unwind descriptors for "ip" yields the following
+ info:
+
+ - frame size at call site (or previous sp)
+ - what registers where saved where by func before
+ the call site was reached
+
+
+ Note that there is some procedure info that needs to be obtained
+ for the new "ip" which is contained in the unwind descriptors.
+ Specifically, the following is needed:
+
+ - procedure's start address
+ - personality address
+ - pointer to language-specific data area
+
+ This info is stored in a separate proc_info structure and needs
+ to be obtained right after running the unwind script for func.
diff --git a/src/pal/src/libunwind/src/ia64/dyn_info_list.S b/src/pal/src/libunwind/src/ia64/dyn_info_list.S
new file mode 100644
index 0000000000..31265f66a0
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/dyn_info_list.S
@@ -0,0 +1,26 @@
+#ifndef UNW_REMOTE_ONLY
+
+/*
+ * Create a special unwind-table entry which makes it easy for an
+ * unwinder to locate the dynamic registration list. The special
+ * entry covers address range [0-0) and is therefore guaranteed to be
+ * the first in the unwind-table.
+ */
+ .global _U_dyn_info_list
+ .hidden _U_dyn_info_list
+
+ .section .IA_64.unwind_info,"a","progbits"
+.info: data8 (1<<48) | 1 /* v1, length==1 (8-byte word) */
+ data8 0 /* 8 empty .prologue directives (nops) */
+ data8 0 /* personality routine (ignored) */
+ string "dyn-list" /* lsda */
+ data8 @gprel(_U_dyn_info_list)
+
+ .section .IA_64.unwind, "a", "progbits"
+ data8 0, 0, @segrel(.info)
+
+#endif
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/getcontext.S b/src/pal/src/libunwind/src/ia64/getcontext.S
new file mode 100644
index 0000000000..d8da732acc
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/getcontext.S
@@ -0,0 +1,177 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "ucontext_i.h"
+
+#define GR(n) (SC_GR + (n)*8)
+#define BR(n) (SC_BR + (n)*8)
+#define FR(n) (SC_FR + (n)*16)
+
+/* This should be compatible to the libc's getcontext(), except that
+ the sc->sc_mask field is always cleared and that the name is
+ prefixed with _Uia64_ so we don't step on the application's
+ name-space. */
+
+ .align 32
+ .protected _Uia64_getcontext
+ .global _Uia64_getcontext
+ .proc _Uia64_getcontext
+_Uia64_getcontext:
+ .prologue
+ alloc rPFS = ar.pfs, 1, 0, 0, 0 // M2
+ mov rPR = pr // I0, 2 cycles
+ add r2 = GR(1), in0 // I1
+ ;;
+
+ .save ar.unat, rUNAT
+ mov.m rUNAT = ar.unat // M2, 5 cycles
+ .body
+ st8.spill [r2] = r1, (SC_FLAGS - GR(1)) // M3
+ dep.z rFLAGS = -1, IA64_SC_FLAG_SYNCHRONOUS_BIT, 1 // I0, 1 cycle
+ ;;
+
+ mov.m rRSC = ar.rsc // M2, 12 cyc.
+ st8 [r2] = rFLAGS, (SC_PR - SC_FLAGS) // M3
+ add r3 = FR(2), in0
+ ;;
+
+ mov.m rBSP = ar.bsp // M2, 12 cyc.
+ st8 [r2] = rPR, (GR(12) - SC_PR) // M3
+ add r8 = FR(16), in0
+ ;;
+
+ mov.m rFPSR = ar.fpsr // M2, 12 cyc.
+ st8.spill [r2] = r12, (GR(4) - GR(12)) // M3
+ add r9 = FR(24), in0
+ ;;
+
+ stf.spill [r3] = f2 // M2
+ stf.spill [r8] = f16 // M3
+ add r3 = GR(7), in0
+ ;;
+
+ flushrs // M0
+ stf.spill [r9] = f24, (FR(31) - FR(24)) // M2
+ mov rB0 = b0 // I0, 2 cycles
+ ;;
+
+ stf.spill [r9] = f31 // M2
+ st8.spill [r2] = r4, (GR(5) - GR(4)) // M3, bank 1
+ mov rB1 = b1 // I0, 2 cycles
+ ;;
+
+.mem.offset 0,0; st8.spill [r2] = r5, (GR(6) - GR(5)) // M4, bank 0
+.mem.offset 8,0; st8.spill [r3] = r7, (BR(0) - GR(7)) // M3, bank 0
+ mov rB2 = b2 // I0, 2 cycles
+ ;;
+
+ st8.spill [r2] = r6, (BR(1) - GR(6)) // M2, bank 1
+ st8 [r3] = rB0, (BR(4) - BR(0)) // M3, bank 1
+ mov rB4 = b4 // I0, 2 cycles
+ ;;
+
+ mov.m rNAT = ar.unat // M2, 5 cycles
+ st8 [r2] = rB1, (BR(2) - BR(1)) // M3, bank 0
+ mov rB3 = b3
+ ;;
+
+ st8 [r2] = rB2, (BR(3) - BR(2)) // M2, bank 1
+ st8 [r3] = rB4, (SC_LC - BR(4)) // M3, bank 1
+ mov rB5 = b5 // I0, 2 cycles
+ ;;
+
+ and rTMP = ~0x3, rRSC // M0
+ add rPOS = GR(0), in0 // rPOS <- &sc_gr[0] // M1
+ mov.i rLC = ar.lc // I0, 2 cycles
+ ;;
+
+ mov.m ar.rsc = rTMP // put RSE into lazy mode // M2, ? cycles
+ st8 [r2] = rB3, (BR(5) - BR(3)) // M3, bank 0
+ extr.u rPOS = rPOS, 3, 6 // get NaT bitnr for r0 // I0
+ ;;
+
+ mov.m rRNAT = ar.rnat // M2, 5 cycles
+ st8 [r2] = rB5, (SC_PFS - BR(5)) // M3, bank 0
+ sub rCPOS = 64, rPOS // I0
+ ;;
+
+ st8 [r2] = rPFS, (SC_UNAT - SC_PFS) // M2
+ st8 [r3] = rLC, (SC_BSP - SC_LC) // M3
+ shr.u rTMP = rNAT, rPOS // I0, 3 cycles
+ ;;
+
+ st8 [r2] = rUNAT, (SC_FPSR - SC_UNAT) // M2
+ st8 [r3] = rBSP // M3
+ add r8 = FR(3), in0
+ ;;
+
+ st8 [r2] = rFPSR, (SC_RNAT - SC_FPSR) // M2
+ stf.spill [r8] = f3, (FR(4) - FR(3)) // M3
+ add r9 = FR(5), in0
+ ;;
+
+ stf.spill [r8] = f4, (FR(17) - FR(4)) // M2
+ stf.spill [r9] = f5, (FR(19) - FR(5)) // M3
+ shl rNAT = rNAT, rCPOS // I0, 3 cycles
+ ;;
+
+ st8 [r2] = rRNAT, (SC_NAT - SC_RNAT) // M2
+ stf.spill [r8] = f17, (FR(18) - FR(17)) // M3
+ nop.i 0
+ ;;
+
+ stf.spill [r8] = f18, (FR(20) - FR(18)) // M2
+ stf.spill [r9] = f19, (FR(21) - FR(19)) // M3
+ nop.i 0
+ ;;
+
+ stf.spill [r8] = f20, (FR(22) - FR(20)) // M2
+ stf.spill [r9] = f21, (FR(23) - FR(21)) // M3
+ or rNAT = rNAT, rTMP // I0
+ ;;
+
+ st8 [r2] = rNAT // M2
+ stf.spill [r8] = f22, (FR(25) - FR(22)) // M3
+ ;;
+ stf.spill [r9] = f23, (FR(26) - FR(23)) // M2
+ stf.spill [r8] = f25, (FR(27) - FR(25)) // M3
+ ;;
+ stf.spill [r9] = f26, (FR(28) - FR(26)) // M2
+ stf.spill [r8] = f27, (FR(29) - FR(27)) // M3
+ ;;
+ mov.m ar.rsc = rRSC // restore RSE mode // M2
+ stf.spill [r9] = f28, (FR(30) - FR(28)) // M3
+ ;;
+ mov.m ar.unat = rUNAT // restore caller's UNaT // M2
+ stf.spill [r8] = f29 // M3
+ ;;
+ stf.spill [r9] = f30 // M2
+ mov r8 = 0
+ br.ret.sptk.many rp
+ .endp _Uia64_getcontext
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/init.h b/src/pal/src/libunwind/src/ia64/init.h
new file mode 100644
index 0000000000..6628a1d888
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/init.h
@@ -0,0 +1,132 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static ALWAYS_INLINE int
+common_init (struct cursor *c, unw_word_t sp, unw_word_t bsp)
+{
+ unw_word_t bspstore, rbs_base;
+ int ret;
+
+ if (c->as->caching_policy != UNW_CACHE_NONE)
+ /* ensure cache doesn't have any stale contents: */
+ ia64_validate_cache (c->as, c->as_arg);
+
+ c->cfm_loc = IA64_REG_LOC (c, UNW_IA64_CFM);
+ c->loc[IA64_REG_BSP] = IA64_NULL_LOC;
+ c->loc[IA64_REG_BSPSTORE] = IA64_REG_LOC (c, UNW_IA64_AR_BSPSTORE);
+ c->loc[IA64_REG_PFS] = IA64_REG_LOC (c, UNW_IA64_AR_PFS);
+ c->loc[IA64_REG_RNAT] = IA64_REG_LOC (c, UNW_IA64_AR_RNAT);
+ c->loc[IA64_REG_IP] = IA64_REG_LOC (c, UNW_IA64_IP);
+ c->loc[IA64_REG_PRI_UNAT_MEM] = IA64_NULL_LOC; /* no primary UNaT location */
+ c->loc[IA64_REG_UNAT] = IA64_REG_LOC (c, UNW_IA64_AR_UNAT);
+ c->loc[IA64_REG_PR] = IA64_REG_LOC (c, UNW_IA64_PR);
+ c->loc[IA64_REG_LC] = IA64_REG_LOC (c, UNW_IA64_AR_LC);
+ c->loc[IA64_REG_FPSR] = IA64_REG_LOC (c, UNW_IA64_AR_FPSR);
+
+ c->loc[IA64_REG_R4] = IA64_REG_LOC (c, UNW_IA64_GR + 4);
+ c->loc[IA64_REG_R5] = IA64_REG_LOC (c, UNW_IA64_GR + 5);
+ c->loc[IA64_REG_R6] = IA64_REG_LOC (c, UNW_IA64_GR + 6);
+ c->loc[IA64_REG_R7] = IA64_REG_LOC (c, UNW_IA64_GR + 7);
+
+ c->loc[IA64_REG_NAT4] = IA64_REG_NAT_LOC (c, UNW_IA64_NAT + 4, &c->nat_bitnr[0]);
+ c->loc[IA64_REG_NAT5] = IA64_REG_NAT_LOC (c, UNW_IA64_NAT + 5, &c->nat_bitnr[1]);
+ c->loc[IA64_REG_NAT6] = IA64_REG_NAT_LOC (c, UNW_IA64_NAT + 6, &c->nat_bitnr[2]);
+ c->loc[IA64_REG_NAT7] = IA64_REG_NAT_LOC (c, UNW_IA64_NAT + 7, &c->nat_bitnr[3]);
+
+ c->loc[IA64_REG_B1] = IA64_REG_LOC (c, UNW_IA64_BR + 1);
+ c->loc[IA64_REG_B2] = IA64_REG_LOC (c, UNW_IA64_BR + 2);
+ c->loc[IA64_REG_B3] = IA64_REG_LOC (c, UNW_IA64_BR + 3);
+ c->loc[IA64_REG_B4] = IA64_REG_LOC (c, UNW_IA64_BR + 4);
+ c->loc[IA64_REG_B5] = IA64_REG_LOC (c, UNW_IA64_BR + 5);
+
+ c->loc[IA64_REG_F2] = IA64_FPREG_LOC (c, UNW_IA64_FR + 2);
+ c->loc[IA64_REG_F3] = IA64_FPREG_LOC (c, UNW_IA64_FR + 3);
+ c->loc[IA64_REG_F4] = IA64_FPREG_LOC (c, UNW_IA64_FR + 4);
+ c->loc[IA64_REG_F5] = IA64_FPREG_LOC (c, UNW_IA64_FR + 5);
+ c->loc[IA64_REG_F16] = IA64_FPREG_LOC (c, UNW_IA64_FR + 16);
+ c->loc[IA64_REG_F17] = IA64_FPREG_LOC (c, UNW_IA64_FR + 17);
+ c->loc[IA64_REG_F18] = IA64_FPREG_LOC (c, UNW_IA64_FR + 18);
+ c->loc[IA64_REG_F19] = IA64_FPREG_LOC (c, UNW_IA64_FR + 19);
+ c->loc[IA64_REG_F20] = IA64_FPREG_LOC (c, UNW_IA64_FR + 20);
+ c->loc[IA64_REG_F21] = IA64_FPREG_LOC (c, UNW_IA64_FR + 21);
+ c->loc[IA64_REG_F22] = IA64_FPREG_LOC (c, UNW_IA64_FR + 22);
+ c->loc[IA64_REG_F23] = IA64_FPREG_LOC (c, UNW_IA64_FR + 23);
+ c->loc[IA64_REG_F24] = IA64_FPREG_LOC (c, UNW_IA64_FR + 24);
+ c->loc[IA64_REG_F25] = IA64_FPREG_LOC (c, UNW_IA64_FR + 25);
+ c->loc[IA64_REG_F26] = IA64_FPREG_LOC (c, UNW_IA64_FR + 26);
+ c->loc[IA64_REG_F27] = IA64_FPREG_LOC (c, UNW_IA64_FR + 27);
+ c->loc[IA64_REG_F28] = IA64_FPREG_LOC (c, UNW_IA64_FR + 28);
+ c->loc[IA64_REG_F29] = IA64_FPREG_LOC (c, UNW_IA64_FR + 29);
+ c->loc[IA64_REG_F30] = IA64_FPREG_LOC (c, UNW_IA64_FR + 30);
+ c->loc[IA64_REG_F31] = IA64_FPREG_LOC (c, UNW_IA64_FR + 31);
+
+ ret = ia64_get (c, c->loc[IA64_REG_IP], &c->ip);
+ if (ret < 0)
+ return ret;
+
+ ret = ia64_get (c, c->cfm_loc, &c->cfm);
+ if (ret < 0)
+ return ret;
+
+ ret = ia64_get (c, c->loc[IA64_REG_PR], &c->pr);
+ if (ret < 0)
+ return ret;
+
+ c->sp = c->psp = sp;
+ c->bsp = bsp;
+
+ ret = ia64_get (c, c->loc[IA64_REG_BSPSTORE], &bspstore);
+ if (ret < 0)
+ return ret;
+
+ c->rbs_curr = c->rbs_left_edge = 0;
+
+ /* Try to find a base of the register backing-store. We may default
+ to a reasonable value (e.g., half the address-space down from
+ bspstore). If the BSPSTORE looks corrupt, we fail. */
+ if ((ret = rbs_get_base (c, bspstore, &rbs_base)) < 0)
+ return ret;
+
+ c->rbs_area[0].end = bspstore;
+ c->rbs_area[0].size = bspstore - rbs_base;
+ c->rbs_area[0].rnat_loc = IA64_REG_LOC (c, UNW_IA64_AR_RNAT);
+ Debug (10, "initial rbs-area: [0x%llx-0x%llx), rnat@%s\n",
+ (long long) rbs_base, (long long) c->rbs_area[0].end,
+ ia64_strloc (c->rbs_area[0].rnat_loc));
+
+ c->pi.flags = 0;
+
+ c->sigcontext_addr = 0;
+ c->abi_marker = 0;
+ c->last_abi_marker = 0;
+
+ c->hint = 0;
+ c->prev_script = 0;
+ c->eh_valid_mask = 0;
+ c->pi_valid = 0;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ia64/longjmp.S b/src/pal/src/libunwind/src/ia64/longjmp.S
new file mode 100644
index 0000000000..2a2f286594
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/longjmp.S
@@ -0,0 +1,42 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .global _UI_longjmp_cont
+
+ .align 32
+ .proc longjmp_continuation
+longjmp_continuation:
+_UI_longjmp_cont: // non-function label for {sig,}longjmp.c
+ .prologue
+ .save rp, r15
+ .body
+ mov rp = r15
+ mov r8 = r16
+ br.sptk.many rp
+ .endp longjmp_continuation
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/mk_cursor_i b/src/pal/src/libunwind/src/ia64/mk_cursor_i
new file mode 100755
index 0000000000..9211f91bbb
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/mk_cursor_i
@@ -0,0 +1,7 @@
+#!/bin/sh
+test -z "$1" && exit 1
+echo "/* GENERATED */"
+echo "#ifndef cursor_i_h"
+echo "#define cursor_i_h"
+sed -ne 's/^->"\(\S*\)" \(\d*\)/#define \1 \2/p' < $1 || exit $?
+echo "#endif"
diff --git a/src/pal/src/libunwind/src/ia64/offsets.h b/src/pal/src/libunwind/src/ia64/offsets.h
new file mode 100644
index 0000000000..5ab7f8b31e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/offsets.h
@@ -0,0 +1,137 @@
+/* Linux-specific definitions: */
+
+/* Define various structure offsets to simplify cross-compilation. */
+
+/* The first three 64-bit words in a signal frame contain the signal
+ number, siginfo pointer, and sigcontext pointer passed to the
+ signal handler. We use this to locate the sigcontext pointer. */
+
+#define LINUX_SIGFRAME_ARG2_OFF 0x10
+
+#define LINUX_SC_FLAGS_OFF 0x000
+#define LINUX_SC_NAT_OFF 0x008
+#define LINUX_SC_STACK_OFF 0x010
+#define LINUX_SC_IP_OFF 0x028
+#define LINUX_SC_CFM_OFF 0x030
+#define LINUX_SC_UM_OFF 0x038
+#define LINUX_SC_AR_RSC_OFF 0x040
+#define LINUX_SC_AR_BSP_OFF 0x048
+#define LINUX_SC_AR_RNAT_OFF 0x050
+#define LINUX_SC_AR_CCV 0x058
+#define LINUX_SC_AR_UNAT_OFF 0x060
+#define LINUX_SC_AR_FPSR_OFF 0x068
+#define LINUX_SC_AR_PFS_OFF 0x070
+#define LINUX_SC_AR_LC_OFF 0x078
+#define LINUX_SC_PR_OFF 0x080
+#define LINUX_SC_BR_OFF 0x088
+#define LINUX_SC_GR_OFF 0x0c8
+#define LINUX_SC_FR_OFF 0x1d0
+#define LINUX_SC_RBS_BASE_OFF 0x9d0
+#define LINUX_SC_LOADRS_OFF 0x9d8
+#define LINUX_SC_AR_CSD_OFF 0x9e0
+#define LINUX_SC_AR_SSD_OFF 0x9e8
+#define LINUX_SC_MASK 0xa50
+
+/* Layout of old Linux kernel interrupt frame (struct pt_regs). */
+
+#define LINUX_OLD_PT_IPSR_OFF 0x000
+#define LINUX_OLD_PT_IIP_OFF 0x008
+#define LINUX_OLD_PT_IFS_OFF 0x010
+#define LINUX_OLD_PT_UNAT_OFF 0x018
+#define LINUX_OLD_PT_PFS_OFF 0x020
+#define LINUX_OLD_PT_RSC_OFF 0x028
+#define LINUX_OLD_PT_RNAT_OFF 0x030
+#define LINUX_OLD_PT_BSPSTORE_OFF 0x038
+#define LINUX_OLD_PT_PR_OFF 0x040
+#define LINUX_OLD_PT_B6_OFF 0x048
+#define LINUX_OLD_PT_LOADRS_OFF 0x050
+#define LINUX_OLD_PT_R1_OFF 0x058
+#define LINUX_OLD_PT_R2_OFF 0x060
+#define LINUX_OLD_PT_R3_OFF 0x068
+#define LINUX_OLD_PT_R12_OFF 0x070
+#define LINUX_OLD_PT_R13_OFF 0x078
+#define LINUX_OLD_PT_R14_OFF 0x080
+#define LINUX_OLD_PT_R15_OFF 0x088
+#define LINUX_OLD_PT_R8_OFF 0x090
+#define LINUX_OLD_PT_R9_OFF 0x098
+#define LINUX_OLD_PT_R10_OFF 0x0a0
+#define LINUX_OLD_PT_R11_OFF 0x0a8
+#define LINUX_OLD_PT_R16_OFF 0x0b0
+#define LINUX_OLD_PT_R17_OFF 0x0b8
+#define LINUX_OLD_PT_R18_OFF 0x0c0
+#define LINUX_OLD_PT_R19_OFF 0x0c8
+#define LINUX_OLD_PT_R20_OFF 0x0d0
+#define LINUX_OLD_PT_R21_OFF 0x0d8
+#define LINUX_OLD_PT_R22_OFF 0x0e0
+#define LINUX_OLD_PT_R23_OFF 0x0e8
+#define LINUX_OLD_PT_R24_OFF 0x0f0
+#define LINUX_OLD_PT_R25_OFF 0x0f8
+#define LINUX_OLD_PT_R26_OFF 0x100
+#define LINUX_OLD_PT_R27_OFF 0x108
+#define LINUX_OLD_PT_R28_OFF 0x110
+#define LINUX_OLD_PT_R29_OFF 0x118
+#define LINUX_OLD_PT_R30_OFF 0x120
+#define LINUX_OLD_PT_R31_OFF 0x128
+#define LINUX_OLD_PT_CCV_OFF 0x130
+#define LINUX_OLD_PT_FPSR_OFF 0x138
+#define LINUX_OLD_PT_B0_OFF 0x140
+#define LINUX_OLD_PT_B7_OFF 0x148
+#define LINUX_OLD_PT_F6_OFF 0x150
+#define LINUX_OLD_PT_F7_OFF 0x160
+#define LINUX_OLD_PT_F8_OFF 0x170
+#define LINUX_OLD_PT_F9_OFF 0x180
+
+/* Layout of new Linux kernel interrupt frame (struct pt_regs). */
+
+#define LINUX_PT_B6_OFF 0
+#define LINUX_PT_B7_OFF 8
+#define LINUX_PT_CSD_OFF 16
+#define LINUX_PT_SSD_OFF 24
+#define LINUX_PT_R8_OFF 32
+#define LINUX_PT_R9_OFF 40
+#define LINUX_PT_R10_OFF 48
+#define LINUX_PT_R11_OFF 56
+#define LINUX_PT_IPSR_OFF 64
+#define LINUX_PT_IIP_OFF 72
+#define LINUX_PT_IFS_OFF 80
+#define LINUX_PT_UNAT_OFF 88
+#define LINUX_PT_PFS_OFF 96
+#define LINUX_PT_RSC_OFF 104
+#define LINUX_PT_RNAT_OFF 112
+#define LINUX_PT_BSPSTORE_OFF 120
+#define LINUX_PT_PR_OFF 128
+#define LINUX_PT_B0_OFF 136
+#define LINUX_PT_LOADRS_OFF 144
+#define LINUX_PT_R1_OFF 152
+#define LINUX_PT_R12_OFF 160
+#define LINUX_PT_R13_OFF 168
+#define LINUX_PT_FPSR_OFF 176
+#define LINUX_PT_R15_OFF 184
+#define LINUX_PT_R14_OFF 192
+#define LINUX_PT_R2_OFF 200
+#define LINUX_PT_R3_OFF 208
+#define LINUX_PT_R16_OFF 216
+#define LINUX_PT_R17_OFF 224
+#define LINUX_PT_R18_OFF 232
+#define LINUX_PT_R19_OFF 240
+#define LINUX_PT_R20_OFF 248
+#define LINUX_PT_R21_OFF 256
+#define LINUX_PT_R22_OFF 264
+#define LINUX_PT_R23_OFF 272
+#define LINUX_PT_R24_OFF 280
+#define LINUX_PT_R25_OFF 288
+#define LINUX_PT_R26_OFF 296
+#define LINUX_PT_R27_OFF 304
+#define LINUX_PT_R28_OFF 312
+#define LINUX_PT_R29_OFF 320
+#define LINUX_PT_R30_OFF 328
+#define LINUX_PT_R31_OFF 336
+#define LINUX_PT_CCV_OFF 344
+#define LINUX_PT_F6_OFF 352
+#define LINUX_PT_F7_OFF 368
+#define LINUX_PT_F8_OFF 384
+#define LINUX_PT_F9_OFF 400
+#define LINUX_PT_F10_OFF 416
+#define LINUX_PT_F11_OFF 432
+
+#define LINUX_PT_P_NONSYS 5 /* must match pNonSys in entry.h */
diff --git a/src/pal/src/libunwind/src/ia64/regname.c b/src/pal/src/libunwind/src/ia64/regname.c
new file mode 100644
index 0000000000..3636df87de
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/regname.c
@@ -0,0 +1,189 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Logically, we like to think of the stack as a contiguous region of
+memory. Unfortunately, this logical view doesn't work for the
+register backing store, because the RSE is an asynchronous engine and
+because UNIX/Linux allow for stack-switching via sigaltstack(2).
+Specifically, this means that any given stacked register may or may
+not be backed up by memory in the current stack. If not, then the
+backing memory may be found in any of the "more inner" (younger)
+stacks. The routines in this file help manage the discontiguous
+nature of the register backing store. The routines are completely
+independent of UNIX/Linux, but each stack frame that switches the
+backing store is expected to reserve 4 words for use by libunwind. For
+example, in the Linux sigcontext, sc_fr[0] and sc_fr[1] serve this
+purpose. */
+
+#include "libunwind_i.h"
+
+/* Maintain the register names as a single string to keep the number
+ of dynamic relocations in the shared object to a minimum. */
+
+#define regname_len 9
+#define regname_str \
+ "r0\0\0\0\0\0\0\0r1\0\0\0\0\0\0\0r2\0\0\0\0\0\0\0r3\0\0\0\0\0\0\0" \
+ "r4\0\0\0\0\0\0\0r5\0\0\0\0\0\0\0r6\0\0\0\0\0\0\0r7\0\0\0\0\0\0\0" \
+ "r8\0\0\0\0\0\0\0r9\0\0\0\0\0\0\0r10\0\0\0\0\0\0r11\0\0\0\0\0\0" \
+ "r12\0\0\0\0\0\0r13\0\0\0\0\0\0r14\0\0\0\0\0\0r15\0\0\0\0\0\0" \
+ "r16\0\0\0\0\0\0r17\0\0\0\0\0\0r18\0\0\0\0\0\0r19\0\0\0\0\0\0" \
+ "r20\0\0\0\0\0\0r21\0\0\0\0\0\0r22\0\0\0\0\0\0r23\0\0\0\0\0\0" \
+ "r24\0\0\0\0\0\0r25\0\0\0\0\0\0r26\0\0\0\0\0\0r27\0\0\0\0\0\0" \
+ "r28\0\0\0\0\0\0r29\0\0\0\0\0\0r30\0\0\0\0\0\0r31\0\0\0\0\0\0" \
+ "r32\0\0\0\0\0\0r33\0\0\0\0\0\0r34\0\0\0\0\0\0r35\0\0\0\0\0\0" \
+ "r36\0\0\0\0\0\0r37\0\0\0\0\0\0r38\0\0\0\0\0\0r39\0\0\0\0\0\0" \
+ "r40\0\0\0\0\0\0r41\0\0\0\0\0\0r42\0\0\0\0\0\0r43\0\0\0\0\0\0" \
+ "r44\0\0\0\0\0\0r45\0\0\0\0\0\0r46\0\0\0\0\0\0r47\0\0\0\0\0\0" \
+ "r48\0\0\0\0\0\0r49\0\0\0\0\0\0r50\0\0\0\0\0\0r51\0\0\0\0\0\0" \
+ "r52\0\0\0\0\0\0r53\0\0\0\0\0\0r54\0\0\0\0\0\0r55\0\0\0\0\0\0" \
+ "r56\0\0\0\0\0\0r57\0\0\0\0\0\0r58\0\0\0\0\0\0r59\0\0\0\0\0\0" \
+ "r60\0\0\0\0\0\0r61\0\0\0\0\0\0r62\0\0\0\0\0\0r63\0\0\0\0\0\0" \
+ "r64\0\0\0\0\0\0r65\0\0\0\0\0\0r66\0\0\0\0\0\0r67\0\0\0\0\0\0" \
+ "r68\0\0\0\0\0\0r69\0\0\0\0\0\0r70\0\0\0\0\0\0r71\0\0\0\0\0\0" \
+ "r72\0\0\0\0\0\0r73\0\0\0\0\0\0r74\0\0\0\0\0\0r75\0\0\0\0\0\0" \
+ "r76\0\0\0\0\0\0r77\0\0\0\0\0\0r78\0\0\0\0\0\0r79\0\0\0\0\0\0" \
+ "r80\0\0\0\0\0\0r81\0\0\0\0\0\0r82\0\0\0\0\0\0r83\0\0\0\0\0\0" \
+ "r84\0\0\0\0\0\0r85\0\0\0\0\0\0r86\0\0\0\0\0\0r87\0\0\0\0\0\0" \
+ "r88\0\0\0\0\0\0r89\0\0\0\0\0\0r90\0\0\0\0\0\0r91\0\0\0\0\0\0" \
+ "r92\0\0\0\0\0\0r93\0\0\0\0\0\0r94\0\0\0\0\0\0r95\0\0\0\0\0\0" \
+ "r96\0\0\0\0\0\0r97\0\0\0\0\0\0r98\0\0\0\0\0\0r99\0\0\0\0\0\0" \
+ "r100\0\0\0\0\0r101\0\0\0\0\0r102\0\0\0\0\0r103\0\0\0\0\0" \
+ "r104\0\0\0\0\0r105\0\0\0\0\0r106\0\0\0\0\0r107\0\0\0\0\0" \
+ "r108\0\0\0\0\0r109\0\0\0\0\0r110\0\0\0\0\0r111\0\0\0\0\0" \
+ "r112\0\0\0\0\0r113\0\0\0\0\0r114\0\0\0\0\0r115\0\0\0\0\0" \
+ "r116\0\0\0\0\0r117\0\0\0\0\0r118\0\0\0\0\0r119\0\0\0\0\0" \
+ "r120\0\0\0\0\0r121\0\0\0\0\0r122\0\0\0\0\0r123\0\0\0\0\0" \
+ "r124\0\0\0\0\0r125\0\0\0\0\0r126\0\0\0\0\0r127\0\0\0\0\0" \
+ "nat0\0\0\0\0\0nat1\0\0\0\0\0nat2\0\0\0\0\0nat3\0\0\0\0\0" \
+ "nat4\0\0\0\0\0nat5\0\0\0\0\0nat6\0\0\0\0\0nat7\0\0\0\0\0" \
+ "nat8\0\0\0\0\0nat9\0\0\0\0\0nat10\0\0\0\0nat11\0\0\0\0" \
+ "nat12\0\0\0\0nat13\0\0\0\0nat14\0\0\0\0nat15\0\0\0\0" \
+ "nat16\0\0\0\0nat17\0\0\0\0nat18\0\0\0\0nat19\0\0\0\0" \
+ "nat20\0\0\0\0nat21\0\0\0\0nat22\0\0\0\0nat23\0\0\0\0" \
+ "nat24\0\0\0\0nat25\0\0\0\0nat26\0\0\0\0nat27\0\0\0\0" \
+ "nat28\0\0\0\0nat29\0\0\0\0nat30\0\0\0\0nat31\0\0\0\0" \
+ "nat32\0\0\0\0nat33\0\0\0\0nat34\0\0\0\0nat35\0\0\0\0" \
+ "nat36\0\0\0\0nat37\0\0\0\0nat38\0\0\0\0nat39\0\0\0\0" \
+ "nat40\0\0\0\0nat41\0\0\0\0nat42\0\0\0\0nat43\0\0\0\0" \
+ "nat44\0\0\0\0nat45\0\0\0\0nat46\0\0\0\0nat47\0\0\0\0" \
+ "nat48\0\0\0\0nat49\0\0\0\0nat50\0\0\0\0nat51\0\0\0\0" \
+ "nat52\0\0\0\0nat53\0\0\0\0nat54\0\0\0\0nat55\0\0\0\0" \
+ "nat56\0\0\0\0nat57\0\0\0\0nat58\0\0\0\0nat59\0\0\0\0" \
+ "nat60\0\0\0\0nat61\0\0\0\0nat62\0\0\0\0nat63\0\0\0\0" \
+ "nat64\0\0\0\0nat65\0\0\0\0nat66\0\0\0\0nat67\0\0\0\0" \
+ "nat68\0\0\0\0nat69\0\0\0\0nat70\0\0\0\0nat71\0\0\0\0" \
+ "nat72\0\0\0\0nat73\0\0\0\0nat74\0\0\0\0nat75\0\0\0\0" \
+ "nat76\0\0\0\0nat77\0\0\0\0nat78\0\0\0\0nat79\0\0\0\0" \
+ "nat80\0\0\0\0nat81\0\0\0\0nat82\0\0\0\0nat83\0\0\0\0" \
+ "nat84\0\0\0\0nat85\0\0\0\0nat86\0\0\0\0nat87\0\0\0\0" \
+ "nat88\0\0\0\0nat89\0\0\0\0nat90\0\0\0\0nat91\0\0\0\0" \
+ "nat92\0\0\0\0nat93\0\0\0\0nat94\0\0\0\0nat95\0\0\0\0" \
+ "nat96\0\0\0\0nat97\0\0\0\0nat98\0\0\0\0nat99\0\0\0\0" \
+ "nat100\0\0\0nat101\0\0\0nat102\0\0\0nat103\0\0\0" \
+ "nat104\0\0\0nat105\0\0\0nat106\0\0\0nat107\0\0\0" \
+ "nat108\0\0\0nat109\0\0\0nat110\0\0\0nat111\0\0\0" \
+ "nat112\0\0\0nat113\0\0\0nat114\0\0\0nat115\0\0\0" \
+ "nat116\0\0\0nat117\0\0\0nat118\0\0\0nat119\0\0\0" \
+ "nat120\0\0\0nat121\0\0\0nat122\0\0\0nat123\0\0\0" \
+ "nat124\0\0\0nat125\0\0\0nat126\0\0\0nat127\0\0\0" \
+ "f0\0\0\0\0\0\0\0f1\0\0\0\0\0\0\0f2\0\0\0\0\0\0\0f3\0\0\0\0\0\0\0" \
+ "f4\0\0\0\0\0\0\0f5\0\0\0\0\0\0\0f6\0\0\0\0\0\0\0f7\0\0\0\0\0\0\0" \
+ "f8\0\0\0\0\0\0\0f9\0\0\0\0\0\0\0f10\0\0\0\0\0\0f11\0\0\0\0\0\0" \
+ "f12\0\0\0\0\0\0f13\0\0\0\0\0\0f14\0\0\0\0\0\0f15\0\0\0\0\0\0" \
+ "f16\0\0\0\0\0\0f17\0\0\0\0\0\0f18\0\0\0\0\0\0f19\0\0\0\0\0\0" \
+ "f20\0\0\0\0\0\0f21\0\0\0\0\0\0f22\0\0\0\0\0\0f23\0\0\0\0\0\0" \
+ "f24\0\0\0\0\0\0f25\0\0\0\0\0\0f26\0\0\0\0\0\0f27\0\0\0\0\0\0" \
+ "f28\0\0\0\0\0\0f29\0\0\0\0\0\0f30\0\0\0\0\0\0f31\0\0\0\0\0\0" \
+ "f32\0\0\0\0\0\0f33\0\0\0\0\0\0f34\0\0\0\0\0\0f35\0\0\0\0\0\0" \
+ "f36\0\0\0\0\0\0f37\0\0\0\0\0\0f38\0\0\0\0\0\0f39\0\0\0\0\0\0" \
+ "f40\0\0\0\0\0\0f41\0\0\0\0\0\0f42\0\0\0\0\0\0f43\0\0\0\0\0\0" \
+ "f44\0\0\0\0\0\0f45\0\0\0\0\0\0f46\0\0\0\0\0\0f47\0\0\0\0\0\0" \
+ "f48\0\0\0\0\0\0f49\0\0\0\0\0\0f50\0\0\0\0\0\0f51\0\0\0\0\0\0" \
+ "f52\0\0\0\0\0\0f53\0\0\0\0\0\0f54\0\0\0\0\0\0f55\0\0\0\0\0\0" \
+ "f56\0\0\0\0\0\0f57\0\0\0\0\0\0f58\0\0\0\0\0\0f59\0\0\0\0\0\0" \
+ "f60\0\0\0\0\0\0f61\0\0\0\0\0\0f62\0\0\0\0\0\0f63\0\0\0\0\0\0" \
+ "f64\0\0\0\0\0\0f65\0\0\0\0\0\0f66\0\0\0\0\0\0f67\0\0\0\0\0\0" \
+ "f68\0\0\0\0\0\0f69\0\0\0\0\0\0f70\0\0\0\0\0\0f71\0\0\0\0\0\0" \
+ "f72\0\0\0\0\0\0f73\0\0\0\0\0\0f74\0\0\0\0\0\0f75\0\0\0\0\0\0" \
+ "f76\0\0\0\0\0\0f77\0\0\0\0\0\0f78\0\0\0\0\0\0f79\0\0\0\0\0\0" \
+ "f80\0\0\0\0\0\0f81\0\0\0\0\0\0f82\0\0\0\0\0\0f83\0\0\0\0\0\0" \
+ "f84\0\0\0\0\0\0f85\0\0\0\0\0\0f86\0\0\0\0\0\0f87\0\0\0\0\0\0" \
+ "f88\0\0\0\0\0\0f89\0\0\0\0\0\0f90\0\0\0\0\0\0f91\0\0\0\0\0\0" \
+ "f92\0\0\0\0\0\0f93\0\0\0\0\0\0f94\0\0\0\0\0\0f95\0\0\0\0\0\0" \
+ "f96\0\0\0\0\0\0f97\0\0\0\0\0\0f98\0\0\0\0\0\0f99\0\0\0\0\0\0" \
+ "f100\0\0\0\0\0f101\0\0\0\0\0f102\0\0\0\0\0f103\0\0\0\0\0" \
+ "f104\0\0\0\0\0f105\0\0\0\0\0f106\0\0\0\0\0f107\0\0\0\0\0" \
+ "f108\0\0\0\0\0f109\0\0\0\0\0f110\0\0\0\0\0f111\0\0\0\0\0" \
+ "f112\0\0\0\0\0f113\0\0\0\0\0f114\0\0\0\0\0f115\0\0\0\0\0" \
+ "f116\0\0\0\0\0f117\0\0\0\0\0f118\0\0\0\0\0f119\0\0\0\0\0" \
+ "f120\0\0\0\0\0f121\0\0\0\0\0f122\0\0\0\0\0f123\0\0\0\0\0" \
+ "f124\0\0\0\0\0f125\0\0\0\0\0f126\0\0\0\0\0f127\0\0\0\0\0" \
+ "ar0\0\0\0\0\0\0ar1\0\0\0\0\0\0ar2\0\0\0\0\0\0ar3\0\0\0\0\0\0" \
+ "ar4\0\0\0\0\0\0ar5\0\0\0\0\0\0ar6\0\0\0\0\0\0ar7\0\0\0\0\0\0" \
+ "ar8\0\0\0\0\0\0ar9\0\0\0\0\0\0ar10\0\0\0\0\0ar11\0\0\0\0\0" \
+ "ar12\0\0\0\0\0ar13\0\0\0\0\0ar14\0\0\0\0\0ar15\0\0\0\0\0" \
+ "rsc\0\0\0\0\0\0bsp\0\0\0\0\0\0bspstore\0rnat\0\0\0\0\0" \
+ "ar20\0\0\0\0\0ar21\0\0\0\0\0ar22\0\0\0\0\0ar23\0\0\0\0\0" \
+ "ar24\0\0\0\0\0ar25\0\0\0\0\0ar26\0\0\0\0\0ar27\0\0\0\0\0" \
+ "ar28\0\0\0\0\0ar29\0\0\0\0\0ar30\0\0\0\0\0ar31\0\0\0\0\0" \
+ "ccv\0\0\0\0\0\0ar33\0\0\0\0\0ar34\0\0\0\0\0ar35\0\0\0\0\0" \
+ "unat\0\0\0\0\0ar37\0\0\0\0\0ar38\0\0\0\0\0ar39\0\0\0\0\0" \
+ "fpsr\0\0\0\0\0ar41\0\0\0\0\0ar42\0\0\0\0\0ar43\0\0\0\0\0" \
+ "ar44\0\0\0\0\0ar45\0\0\0\0\0ar46\0\0\0\0\0ar47\0\0\0\0\0" \
+ "ar48\0\0\0\0\0ar49\0\0\0\0\0ar50\0\0\0\0\0ar51\0\0\0\0\0" \
+ "ar52\0\0\0\0\0ar53\0\0\0\0\0ar54\0\0\0\0\0ar55\0\0\0\0\0" \
+ "ar56\0\0\0\0\0ar57\0\0\0\0\0ar58\0\0\0\0\0ar59\0\0\0\0\0" \
+ "ar60\0\0\0\0\0ar61\0\0\0\0\0ar62\0\0\0\0\0ar63\0\0\0\0\0" \
+ "pfs\0\0\0\0\0\0lc\0\0\0\0\0\0\0ec\0\0\0\0\0\0\0ar67\0\0\0\0\0" \
+ "ar68\0\0\0\0\0ar69\0\0\0\0\0ar70\0\0\0\0\0ar71\0\0\0\0\0" \
+ "ar72\0\0\0\0\0ar73\0\0\0\0\0ar74\0\0\0\0\0ar75\0\0\0\0\0" \
+ "ar76\0\0\0\0\0ar77\0\0\0\0\0ar78\0\0\0\0\0ar79\0\0\0\0\0" \
+ "ar80\0\0\0\0\0ar81\0\0\0\0\0ar82\0\0\0\0\0ar83\0\0\0\0\0" \
+ "ar84\0\0\0\0\0ar85\0\0\0\0\0ar86\0\0\0\0\0ar87\0\0\0\0\0" \
+ "ar88\0\0\0\0\0ar89\0\0\0\0\0ar90\0\0\0\0\0ar91\0\0\0\0\0" \
+ "ar92\0\0\0\0\0ar93\0\0\0\0\0ar94\0\0\0\0\0ar95\0\0\0\0\0" \
+ "ar96\0\0\0\0\0ar97\0\0\0\0\0ar98\0\0\0\0\0ar99\0\0\0\0\0" \
+ "ar100\0\0\0\0ar101\0\0\0\0ar102\0\0\0\0ar103\0\0\0\0" \
+ "ar104\0\0\0\0ar105\0\0\0\0ar106\0\0\0\0ar107\0\0\0\0" \
+ "ar108\0\0\0\0ar109\0\0\0\0ar110\0\0\0\0ar111\0\0\0\0" \
+ "ar112\0\0\0\0ar113\0\0\0\0ar114\0\0\0\0ar115\0\0\0\0" \
+ "ar116\0\0\0\0ar117\0\0\0\0ar118\0\0\0\0ar119\0\0\0\0" \
+ "ar120\0\0\0\0ar121\0\0\0\0ar122\0\0\0\0ar123\0\0\0\0" \
+ "ar124\0\0\0\0ar125\0\0\0\0ar126\0\0\0\0ar127\0\0\0\0" \
+ "rp\0\0\0\0\0\0\0b1\0\0\0\0\0\0\0b2\0\0\0\0\0\0\0b3\0\0\0\0\0\0\0" \
+ "b4\0\0\0\0\0\0\0b5\0\0\0\0\0\0\0b6\0\0\0\0\0\0\0b7\0\0\0\0\0\0\0" \
+ "pr\0\0\0\0\0\0\0cfm\0\0\0\0\0\0bsp\0\0\0\0\0\0ip\0\0\0\0\0\0\0" \
+ "sp\0\0\0\0\0\0\0"
+
+#define NREGS ((int) (sizeof (regname_str) - 1) / regname_len)
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < NREGS)
+ return regname_str + reg * regname_len;
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/ia64/regs.h b/src/pal/src/libunwind/src/ia64/regs.h
new file mode 100644
index 0000000000..a22a818776
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/regs.h
@@ -0,0 +1,73 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+/* Apply rotation to a general register. REG must be in the range 0-127. */
+
+static inline int
+rotate_gr (struct cursor *c, int reg)
+{
+ unsigned int rrb_gr, sor;
+ int preg;
+
+ sor = 8 * ((c->cfm >> 14) & 0xf);
+ rrb_gr = (c->cfm >> 18) & 0x7f;
+
+ if ((unsigned) (reg - 32) >= sor)
+ preg = reg;
+ else
+ {
+ preg = reg + rrb_gr; /* apply rotation */
+ if ((unsigned) (preg - 32) >= sor)
+ preg -= sor; /* wrap around */
+ }
+ if (sor)
+ Debug (15, "sor=%u rrb.gr=%u, r%d -> r%d\n", sor, rrb_gr, reg, preg);
+ return preg;
+}
+
+/* Apply rotation to a floating-point register. The number REG must
+ be in the range of 0-127. */
+
+static inline int
+rotate_fr (struct cursor *c, int reg)
+{
+ unsigned int rrb_fr;
+ int preg;
+
+ rrb_fr = (c->cfm >> 25) & 0x7f;
+ if (reg < 32)
+ preg = reg; /* register not part of the rotating partition */
+ else
+ {
+ preg = reg + rrb_fr; /* apply rotation */
+ if (preg > 127)
+ preg -= 96; /* wrap around */
+ }
+ if (rrb_fr)
+ Debug (15, "rrb.fr=%u, f%d -> f%d\n", rrb_fr, reg, preg);
+ return preg;
+}
diff --git a/src/pal/src/libunwind/src/ia64/setjmp.S b/src/pal/src/libunwind/src/ia64/setjmp.S
new file mode 100644
index 0000000000..384615b840
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/setjmp.S
@@ -0,0 +1,51 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "jmpbuf.h"
+
+ .align 32
+
+ .global _setjmp
+
+ .proc _setjmp
+
+_setjmp:
+ mov r2 = ar.bsp
+ st8 [r32] = r12 // jmp_buf[JB_SP] = sp
+ mov r3 = rp
+
+ adds r16 = JB_RP*8, r32
+ adds r17 = JB_BSP*8, r32
+ mov r8 = 0
+ ;;
+ st8 [r16] = r3 // jmp_buf[JB_RP] = rp
+ st8 [r17] = r2 // jmp_buf[JB_BSP] = bsp
+ br.ret.sptk.many rp
+
+ .endp _setjmp
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/siglongjmp.S b/src/pal/src/libunwind/src/ia64/siglongjmp.S
new file mode 100644
index 0000000000..d77b43753b
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/siglongjmp.S
@@ -0,0 +1,69 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define SIG_SETMASK 2
+
+ .global _UI_siglongjmp_cont
+ .global sigprocmask
+
+ .align 32
+ .proc siglongjmp_continuation
+siglongjmp_continuation:
+_UI_siglongjmp_cont: // non-function label for siglongjmp.c
+ .prologue
+ .save rp, r15
+ .body
+ nop 0
+ nop 0
+ br.call.sptk.many b6 = .next
+ ;;
+ .prologue
+ .save ar.pfs, r33
+.next: alloc loc1 = ar.pfs, 0, 3, 3, 0
+ /*
+ * Note: we can use the scratch stack are because the caller
+ * of sigsetjmp() by definition is not a leaf-procedure.
+ */
+ st8 [sp] = r17 // store signal mask
+ .save rp, loc0
+ mov loc0 = r15 // final continuation point
+ ;;
+ .body
+ mov loc2 = r16 // value to return in r8
+
+ mov out0 = SIG_SETMASK
+ mov out1 = sp
+ mov out2 = r0
+ br.call.sptk.many rp = sigprocmask
+ ;;
+ mov rp = loc0
+ mov ar.pfs = loc1
+ mov r8 = loc2
+ br.ret.sptk.many rp
+ .endp siglongjmp_continuation
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/sigsetjmp.S b/src/pal/src/libunwind/src/ia64/sigsetjmp.S
new file mode 100644
index 0000000000..02f7af4b37
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/sigsetjmp.S
@@ -0,0 +1,69 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "jmpbuf.h"
+
+#define SIG_BLOCK 0
+
+ .align 32
+
+ .global __sigsetjmp
+ .global sigprocmask
+
+ .proc __sigsetjmp
+
+__sigsetjmp:
+ .prologue
+ .save ar.pfs, r35
+ alloc loc1 = ar.pfs, 2, 3, 3, 0
+ add out2 = JB_MASK*8, in0
+ .save rp, loc0
+ mov loc0 = rp
+ mov out0 = SIG_BLOCK
+ .body
+ ;;
+ cmp.ne p6, p0 = in1, r0
+ mov out1 = r0
+ mov loc2 = ar.bsp
+(p6) br.call.sptk.many rp = sigprocmask // sigjmp_buf[JB_MASK] = sigmask
+ ;;
+
+ add r16 = JB_MASK_SAVED*8, in0
+ st8 [in0] = sp, (JB_RP-JB_SP)*8 // sigjmp_buf[JB_SP] = sp
+ mov r8 = 0
+ ;;
+ st8 [in0] = loc0, (JB_BSP-JB_RP)*8 // sigjmp_buf[JB_RP] = rp
+ st8 [r16] = in1 // sigjmp_buf[JB_MASK_SAVED] = savemask
+ mov rp = loc0
+ ;;
+ st8 [in0] = loc2 // sigjmp_buf[JB_BSP] = bsp
+ mov.i ar.pfs = loc1
+ br.ret.sptk.many rp
+
+ .endp __sigsetjmp
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ia64/ucontext_i.h b/src/pal/src/libunwind/src/ia64/ucontext_i.h
new file mode 100644
index 0000000000..ea32c8aaa0
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/ucontext_i.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 2002 Hewlett-Packard Co.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Constants shared between setcontext() and getcontext(). Don't
+ install this header file. */
+
+#define SIG_BLOCK 0
+#define SIG_UNBLOCK 1
+#define SIG_SETMASK 2
+
+#define IA64_SC_FLAG_SYNCHRONOUS_BIT 63
+
+#define SC_FLAGS 0x000
+#define SC_NAT 0x008
+#define SC_BSP 0x048
+#define SC_RNAT 0x050
+#define SC_UNAT 0x060
+#define SC_FPSR 0x068
+#define SC_PFS 0x070
+#define SC_LC 0x078
+#define SC_PR 0x080
+#define SC_BR 0x088
+#define SC_GR 0x0c8
+#define SC_FR 0x1d0
+#define SC_MASK 0x9d0
+
+
+#define rTMP r10
+#define rPOS r11
+#define rCPOS r14
+#define rNAT r15
+#define rFLAGS r16
+
+#define rB5 r18
+#define rB4 r19
+#define rB3 r20
+#define rB2 r21
+#define rB1 r22
+#define rB0 r23
+#define rRSC r24
+#define rBSP r25
+#define rRNAT r26
+#define rUNAT r27
+#define rFPSR r28
+#define rPFS r29
+#define rLC r30
+#define rPR r31
diff --git a/src/pal/src/libunwind/src/ia64/unwind_decoder.h b/src/pal/src/libunwind/src/ia64/unwind_decoder.h
new file mode 100644
index 0000000000..7fd41740de
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/unwind_decoder.h
@@ -0,0 +1,477 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/*
+ * Generic IA-64 unwind info decoder.
+ *
+ * This file is used both by the Linux kernel and objdump. Please keep
+ * the two copies of this file in sync.
+ *
+ * You need to customize the decoder by defining the following
+ * macros/constants before including this file:
+ *
+ * Types:
+ * unw_word Unsigned integer type with at least 64 bits
+ *
+ * Register names:
+ * UNW_REG_BSP
+ * UNW_REG_BSPSTORE
+ * UNW_REG_FPSR
+ * UNW_REG_LC
+ * UNW_REG_PFS
+ * UNW_REG_PR
+ * UNW_REG_RNAT
+ * UNW_REG_PSP
+ * UNW_REG_RP
+ * UNW_REG_UNAT
+ *
+ * Decoder action macros:
+ * UNW_DEC_BAD_CODE(code)
+ * UNW_DEC_ABI(fmt,abi,context,arg)
+ * UNW_DEC_BR_GR(fmt,brmask,gr,arg)
+ * UNW_DEC_BR_MEM(fmt,brmask,arg)
+ * UNW_DEC_COPY_STATE(fmt,label,arg)
+ * UNW_DEC_EPILOGUE(fmt,t,ecount,arg)
+ * UNW_DEC_FRGR_MEM(fmt,grmask,frmask,arg)
+ * UNW_DEC_FR_MEM(fmt,frmask,arg)
+ * UNW_DEC_GR_GR(fmt,grmask,gr,arg)
+ * UNW_DEC_GR_MEM(fmt,grmask,arg)
+ * UNW_DEC_LABEL_STATE(fmt,label,arg)
+ * UNW_DEC_MEM_STACK_F(fmt,t,size,arg)
+ * UNW_DEC_MEM_STACK_V(fmt,t,arg)
+ * UNW_DEC_PRIUNAT_GR(fmt,r,arg)
+ * UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg)
+ * UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg)
+ * UNW_DEC_PRIUNAT_WHEN_PSPREL(fmt,pspoff,arg)
+ * UNW_DEC_PRIUNAT_WHEN_SPREL(fmt,spoff,arg)
+ * UNW_DEC_PROLOGUE(fmt,body,rlen,arg)
+ * UNW_DEC_PROLOGUE_GR(fmt,rlen,mask,grsave,arg)
+ * UNW_DEC_REG_PSPREL(fmt,reg,pspoff,arg)
+ * UNW_DEC_REG_REG(fmt,src,dst,arg)
+ * UNW_DEC_REG_SPREL(fmt,reg,spoff,arg)
+ * UNW_DEC_REG_WHEN(fmt,reg,t,arg)
+ * UNW_DEC_RESTORE(fmt,t,abreg,arg)
+ * UNW_DEC_RESTORE_P(fmt,qp,t,abreg,arg)
+ * UNW_DEC_SPILL_BASE(fmt,pspoff,arg)
+ * UNW_DEC_SPILL_MASK(fmt,imaskp,arg)
+ * UNW_DEC_SPILL_PSPREL(fmt,t,abreg,pspoff,arg)
+ * UNW_DEC_SPILL_PSPREL_P(fmt,qp,t,abreg,pspoff,arg)
+ * UNW_DEC_SPILL_REG(fmt,t,abreg,x,ytreg,arg)
+ * UNW_DEC_SPILL_REG_P(fmt,qp,t,abreg,x,ytreg,arg)
+ * UNW_DEC_SPILL_SPREL(fmt,t,abreg,spoff,arg)
+ * UNW_DEC_SPILL_SPREL_P(fmt,qp,t,abreg,pspoff,arg)
+ */
+
+static unw_word
+unw_decode_uleb128 (unsigned char **dpp)
+{
+ unsigned shift = 0;
+ unw_word byte, result = 0;
+ unsigned char *bp = *dpp;
+
+ while (1)
+ {
+ byte = *bp++;
+ result |= (byte & 0x7f) << shift;
+ if ((byte & 0x80) == 0)
+ break;
+ shift += 7;
+ }
+ *dpp = bp;
+ return result;
+}
+
+static unsigned char *
+unw_decode_x1 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unsigned char byte1, abreg;
+ unw_word t, off;
+
+ byte1 = *dp++;
+ t = unw_decode_uleb128 (&dp);
+ off = unw_decode_uleb128 (&dp);
+ abreg = (byte1 & 0x7f);
+ if (byte1 & 0x80)
+ UNW_DEC_SPILL_SPREL(X1, t, abreg, off, arg);
+ else
+ UNW_DEC_SPILL_PSPREL(X1, t, abreg, off, arg);
+ return dp;
+}
+
+static unsigned char *
+unw_decode_x2 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unsigned char byte1, byte2, abreg, x, ytreg;
+ unw_word t;
+
+ byte1 = *dp++; byte2 = *dp++;
+ t = unw_decode_uleb128 (&dp);
+ abreg = (byte1 & 0x7f);
+ ytreg = byte2;
+ x = (byte1 >> 7) & 1;
+ if ((byte1 & 0x80) == 0 && ytreg == 0)
+ UNW_DEC_RESTORE(X2, t, abreg, arg);
+ else
+ UNW_DEC_SPILL_REG(X2, t, abreg, x, ytreg, arg);
+ return dp;
+}
+
+static unsigned char *
+unw_decode_x3 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unsigned char byte1, byte2, abreg, qp;
+ unw_word t, off;
+
+ byte1 = *dp++; byte2 = *dp++;
+ t = unw_decode_uleb128 (&dp);
+ off = unw_decode_uleb128 (&dp);
+
+ qp = (byte1 & 0x3f);
+ abreg = (byte2 & 0x7f);
+
+ if (byte1 & 0x80)
+ UNW_DEC_SPILL_SPREL_P(X3, qp, t, abreg, off, arg);
+ else
+ UNW_DEC_SPILL_PSPREL_P(X3, qp, t, abreg, off, arg);
+ return dp;
+}
+
+static unsigned char *
+unw_decode_x4 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unsigned char byte1, byte2, byte3, qp, abreg, x, ytreg;
+ unw_word t;
+
+ byte1 = *dp++; byte2 = *dp++; byte3 = *dp++;
+ t = unw_decode_uleb128 (&dp);
+
+ qp = (byte1 & 0x3f);
+ abreg = (byte2 & 0x7f);
+ x = (byte2 >> 7) & 1;
+ ytreg = byte3;
+
+ if ((byte2 & 0x80) == 0 && byte3 == 0)
+ UNW_DEC_RESTORE_P(X4, qp, t, abreg, arg);
+ else
+ UNW_DEC_SPILL_REG_P(X4, qp, t, abreg, x, ytreg, arg);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_r1 (unsigned char *dp, unsigned char code, void *arg)
+{
+ int body = (code & 0x20) != 0;
+ unw_word rlen;
+
+ rlen = (code & 0x1f);
+ UNW_DEC_PROLOGUE(R1, body, rlen, arg);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_r2 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unsigned char byte1, mask, grsave;
+ unw_word rlen;
+
+ byte1 = *dp++;
+
+ mask = ((code & 0x7) << 1) | ((byte1 >> 7) & 1);
+ grsave = (byte1 & 0x7f);
+ rlen = unw_decode_uleb128 (&dp);
+ UNW_DEC_PROLOGUE_GR(R2, rlen, mask, grsave, arg);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_r3 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unw_word rlen;
+
+ rlen = unw_decode_uleb128 (&dp);
+ UNW_DEC_PROLOGUE(R3, ((code & 0x3) == 1), rlen, arg);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_p1 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unsigned char brmask = (code & 0x1f);
+
+ UNW_DEC_BR_MEM(P1, brmask, arg);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_p2_p5 (unsigned char *dp, unsigned char code, void *arg)
+{
+ if ((code & 0x10) == 0)
+ {
+ unsigned char byte1 = *dp++;
+
+ UNW_DEC_BR_GR(P2, ((code & 0xf) << 1) | ((byte1 >> 7) & 1),
+ (byte1 & 0x7f), arg);
+ }
+ else if ((code & 0x08) == 0)
+ {
+ unsigned char byte1 = *dp++, r, dst;
+
+ r = ((code & 0x7) << 1) | ((byte1 >> 7) & 1);
+ dst = (byte1 & 0x7f);
+ switch (r)
+ {
+ case 0: UNW_DEC_REG_GR(P3, UNW_REG_PSP, dst, arg); break;
+ case 1: UNW_DEC_REG_GR(P3, UNW_REG_RP, dst, arg); break;
+ case 2: UNW_DEC_REG_GR(P3, UNW_REG_PFS, dst, arg); break;
+ case 3: UNW_DEC_REG_GR(P3, UNW_REG_PR, dst, arg); break;
+ case 4: UNW_DEC_REG_GR(P3, UNW_REG_UNAT, dst, arg); break;
+ case 5: UNW_DEC_REG_GR(P3, UNW_REG_LC, dst, arg); break;
+ case 6: UNW_DEC_RP_BR(P3, dst, arg); break;
+ case 7: UNW_DEC_REG_GR(P3, UNW_REG_RNAT, dst, arg); break;
+ case 8: UNW_DEC_REG_GR(P3, UNW_REG_BSP, dst, arg); break;
+ case 9: UNW_DEC_REG_GR(P3, UNW_REG_BSPSTORE, dst, arg); break;
+ case 10: UNW_DEC_REG_GR(P3, UNW_REG_FPSR, dst, arg); break;
+ case 11: UNW_DEC_PRIUNAT_GR(P3, dst, arg); break;
+ default: UNW_DEC_BAD_CODE(r); break;
+ }
+ }
+ else if ((code & 0x7) == 0)
+ UNW_DEC_SPILL_MASK(P4, dp, arg);
+ else if ((code & 0x7) == 1)
+ {
+ unw_word grmask, frmask, byte1, byte2, byte3;
+
+ byte1 = *dp++; byte2 = *dp++; byte3 = *dp++;
+ grmask = ((byte1 >> 4) & 0xf);
+ frmask = ((byte1 & 0xf) << 16) | (byte2 << 8) | byte3;
+ UNW_DEC_FRGR_MEM(P5, grmask, frmask, arg);
+ }
+ else
+ UNW_DEC_BAD_CODE(code);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_p6 (unsigned char *dp, unsigned char code, void *arg)
+{
+ int gregs = (code & 0x10) != 0;
+ unsigned char mask = (code & 0x0f);
+
+ if (gregs)
+ UNW_DEC_GR_MEM(P6, mask, arg);
+ else
+ UNW_DEC_FR_MEM(P6, mask, arg);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_p7_p10 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unsigned char r, byte1, byte2;
+ unw_word t, size;
+
+ if ((code & 0x10) == 0)
+ {
+ r = (code & 0xf);
+ t = unw_decode_uleb128 (&dp);
+ switch (r)
+ {
+ case 0:
+ size = unw_decode_uleb128 (&dp);
+ UNW_DEC_MEM_STACK_F(P7, t, size, arg);
+ break;
+
+ case 1: UNW_DEC_MEM_STACK_V(P7, t, arg); break;
+ case 2: UNW_DEC_SPILL_BASE(P7, t, arg); break;
+ case 3: UNW_DEC_REG_SPREL(P7, UNW_REG_PSP, t, arg); break;
+ case 4: UNW_DEC_REG_WHEN(P7, UNW_REG_RP, t, arg); break;
+ case 5: UNW_DEC_REG_PSPREL(P7, UNW_REG_RP, t, arg); break;
+ case 6: UNW_DEC_REG_WHEN(P7, UNW_REG_PFS, t, arg); break;
+ case 7: UNW_DEC_REG_PSPREL(P7, UNW_REG_PFS, t, arg); break;
+ case 8: UNW_DEC_REG_WHEN(P7, UNW_REG_PR, t, arg); break;
+ case 9: UNW_DEC_REG_PSPREL(P7, UNW_REG_PR, t, arg); break;
+ case 10: UNW_DEC_REG_WHEN(P7, UNW_REG_LC, t, arg); break;
+ case 11: UNW_DEC_REG_PSPREL(P7, UNW_REG_LC, t, arg); break;
+ case 12: UNW_DEC_REG_WHEN(P7, UNW_REG_UNAT, t, arg); break;
+ case 13: UNW_DEC_REG_PSPREL(P7, UNW_REG_UNAT, t, arg); break;
+ case 14: UNW_DEC_REG_WHEN(P7, UNW_REG_FPSR, t, arg); break;
+ case 15: UNW_DEC_REG_PSPREL(P7, UNW_REG_FPSR, t, arg); break;
+ default: UNW_DEC_BAD_CODE(r); break;
+ }
+ }
+ else
+ {
+ switch (code & 0xf)
+ {
+ case 0x0: /* p8 */
+ {
+ r = *dp++;
+ t = unw_decode_uleb128 (&dp);
+ switch (r)
+ {
+ case 1: UNW_DEC_REG_SPREL(P8, UNW_REG_RP, t, arg); break;
+ case 2: UNW_DEC_REG_SPREL(P8, UNW_REG_PFS, t, arg); break;
+ case 3: UNW_DEC_REG_SPREL(P8, UNW_REG_PR, t, arg); break;
+ case 4: UNW_DEC_REG_SPREL(P8, UNW_REG_LC, t, arg); break;
+ case 5: UNW_DEC_REG_SPREL(P8, UNW_REG_UNAT, t, arg); break;
+ case 6: UNW_DEC_REG_SPREL(P8, UNW_REG_FPSR, t, arg); break;
+ case 7: UNW_DEC_REG_WHEN(P8, UNW_REG_BSP, t, arg); break;
+ case 8: UNW_DEC_REG_PSPREL(P8, UNW_REG_BSP, t, arg); break;
+ case 9: UNW_DEC_REG_SPREL(P8, UNW_REG_BSP, t, arg); break;
+ case 10: UNW_DEC_REG_WHEN(P8, UNW_REG_BSPSTORE, t, arg); break;
+ case 11: UNW_DEC_REG_PSPREL(P8, UNW_REG_BSPSTORE, t, arg); break;
+ case 12: UNW_DEC_REG_SPREL(P8, UNW_REG_BSPSTORE, t, arg); break;
+ case 13: UNW_DEC_REG_WHEN(P8, UNW_REG_RNAT, t, arg); break;
+ case 14: UNW_DEC_REG_PSPREL(P8, UNW_REG_RNAT, t, arg); break;
+ case 15: UNW_DEC_REG_SPREL(P8, UNW_REG_RNAT, t, arg); break;
+ case 16: UNW_DEC_PRIUNAT_WHEN_GR(P8, t, arg); break;
+ case 17: UNW_DEC_PRIUNAT_PSPREL(P8, t, arg); break;
+ case 18: UNW_DEC_PRIUNAT_SPREL(P8, t, arg); break;
+ case 19: UNW_DEC_PRIUNAT_WHEN_MEM(P8, t, arg); break;
+ default: UNW_DEC_BAD_CODE(r); break;
+ }
+ }
+ break;
+
+ case 0x1:
+ byte1 = *dp++; byte2 = *dp++;
+ UNW_DEC_GR_GR(P9, (byte1 & 0xf), (byte2 & 0x7f), arg);
+ break;
+
+ case 0xf: /* p10 */
+ byte1 = *dp++; byte2 = *dp++;
+ UNW_DEC_ABI(P10, byte1, byte2, arg);
+ break;
+
+ case 0x9:
+ return unw_decode_x1 (dp, code, arg);
+
+ case 0xa:
+ return unw_decode_x2 (dp, code, arg);
+
+ case 0xb:
+ return unw_decode_x3 (dp, code, arg);
+
+ case 0xc:
+ return unw_decode_x4 (dp, code, arg);
+
+ default:
+ UNW_DEC_BAD_CODE(code);
+ break;
+ }
+ }
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_b1 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unw_word label = (code & 0x1f);
+
+ if ((code & 0x20) != 0)
+ UNW_DEC_COPY_STATE(B1, label, arg);
+ else
+ UNW_DEC_LABEL_STATE(B1, label, arg);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_b2 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unw_word t;
+
+ t = unw_decode_uleb128 (&dp);
+ UNW_DEC_EPILOGUE(B2, t, (code & 0x1f), arg);
+ return dp;
+}
+
+static inline unsigned char *
+unw_decode_b3_x4 (unsigned char *dp, unsigned char code, void *arg)
+{
+ unw_word t, ecount, label;
+
+ if ((code & 0x10) == 0)
+ {
+ t = unw_decode_uleb128 (&dp);
+ ecount = unw_decode_uleb128 (&dp);
+ UNW_DEC_EPILOGUE(B3, t, ecount, arg);
+ }
+ else if ((code & 0x07) == 0)
+ {
+ label = unw_decode_uleb128 (&dp);
+ if ((code & 0x08) != 0)
+ UNW_DEC_COPY_STATE(B4, label, arg);
+ else
+ UNW_DEC_LABEL_STATE(B4, label, arg);
+ }
+ else
+ switch (code & 0x7)
+ {
+ case 1: return unw_decode_x1 (dp, code, arg);
+ case 2: return unw_decode_x2 (dp, code, arg);
+ case 3: return unw_decode_x3 (dp, code, arg);
+ case 4: return unw_decode_x4 (dp, code, arg);
+ default: UNW_DEC_BAD_CODE(code); break;
+ }
+ return dp;
+}
+
+typedef unsigned char *(*unw_decoder) (unsigned char *, unsigned char, void *);
+
+/*
+ * Decode one descriptor and return address of next descriptor.
+ */
+static inline unsigned char *
+unw_decode (unsigned char *dp, int inside_body, void *arg)
+{
+ unsigned char code, primary;
+
+ code = *dp++;
+ primary = code >> 5;
+
+ if (primary < 2)
+ dp = unw_decode_r1 (dp, code, arg);
+ else if (primary == 2)
+ dp = unw_decode_r2 (dp, code, arg);
+ else if (primary == 3)
+ dp = unw_decode_r3 (dp, code, arg);
+ else if (inside_body)
+ switch (primary)
+ {
+ case 4:
+ case 5: dp = unw_decode_b1 (dp, code, arg); break;
+ case 6: dp = unw_decode_b2 (dp, code, arg); break;
+ case 7: dp = unw_decode_b3_x4 (dp, code, arg); break;
+ }
+ else
+ switch (primary)
+ {
+ case 4: dp = unw_decode_p1 (dp, code, arg); break;
+ case 5: dp = unw_decode_p2_p5 (dp, code, arg); break;
+ case 6: dp = unw_decode_p6 (dp, code, arg); break;
+ case 7: dp = unw_decode_p7_p10 (dp, code, arg); break;
+ }
+ return dp;
+}
diff --git a/src/pal/src/libunwind/src/ia64/unwind_i.h b/src/pal/src/libunwind/src/ia64/unwind_i.h
new file mode 100644
index 0000000000..8ccbb46c93
--- /dev/null
+++ b/src/pal/src/libunwind/src/ia64/unwind_i.h
@@ -0,0 +1,633 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <string.h>
+#include <inttypes.h>
+
+#include <libunwind-ia64.h>
+
+#include "rse.h"
+
+#include "libunwind_i.h"
+
+#define IA64_UNW_VER(x) ((x) >> 48)
+#define IA64_UNW_FLAG_MASK ((unw_word_t) 0x0000ffff00000000ULL)
+#define IA64_UNW_FLAG_OSMASK ((unw_word_t) 0x0000f00000000000ULL)
+#define IA64_UNW_FLAG_EHANDLER(x) ((x) & (unw_word_t) 0x0000000100000000ULL)
+#define IA64_UNW_FLAG_UHANDLER(x) ((x) & (unw_word_t) 0x0000000200000000ULL)
+#define IA64_UNW_LENGTH(x) ((x) & (unw_word_t) 0x00000000ffffffffULL)
+
+#ifdef MIN
+# undef MIN
+#endif
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+#if !defined(HAVE_SYS_UC_ACCESS_H) && !defined(UNW_REMOTE_ONLY)
+
+static ALWAYS_INLINE void *
+inlined_uc_addr (ucontext_t *uc, int reg, uint8_t *nat_bitnr)
+{
+ unw_word_t reg_addr;
+ void *addr;
+
+ switch (reg)
+ {
+ case UNW_IA64_GR + 0: addr = &unw.read_only.r0; break;
+ case UNW_IA64_NAT + 0: addr = &unw.read_only.r0; break;
+ case UNW_IA64_FR + 0: addr = &unw.read_only.f0; break;
+ case UNW_IA64_FR + 1:
+ if (__BYTE_ORDER == __BIG_ENDIAN)
+ addr = &unw.read_only.f1_be;
+ else
+ addr = &unw.read_only.f1_le;
+ break;
+ case UNW_IA64_IP: addr = &uc->uc_mcontext.sc_br[0]; break;
+ case UNW_IA64_CFM: addr = &uc->uc_mcontext.sc_ar_pfs; break;
+ case UNW_IA64_AR_RNAT: addr = &uc->uc_mcontext.sc_ar_rnat; break;
+ case UNW_IA64_AR_UNAT: addr = &uc->uc_mcontext.sc_ar_unat; break;
+ case UNW_IA64_AR_LC: addr = &uc->uc_mcontext.sc_ar_lc; break;
+ case UNW_IA64_AR_FPSR: addr = &uc->uc_mcontext.sc_ar_fpsr; break;
+ case UNW_IA64_PR: addr = &uc->uc_mcontext.sc_pr; break;
+ case UNW_IA64_AR_BSPSTORE: addr = &uc->uc_mcontext.sc_ar_bsp; break;
+
+ case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7:
+ case UNW_IA64_GR + 12:
+ addr = &uc->uc_mcontext.sc_gr[reg - UNW_IA64_GR];
+ break;
+
+ case UNW_IA64_NAT + 4 ... UNW_IA64_NAT + 7:
+ case UNW_IA64_NAT + 12:
+ addr = &uc->uc_mcontext.sc_nat;
+ reg_addr = (unw_word_t) &uc->uc_mcontext.sc_gr[reg - UNW_IA64_NAT];
+ *nat_bitnr = reg - UNW_IA64_NAT;
+ break;
+
+ case UNW_IA64_BR + 1 ... UNW_IA64_BR + 5:
+ addr = &uc->uc_mcontext.sc_br[reg - UNW_IA64_BR];
+ break;
+
+ case UNW_IA64_FR+ 2 ... UNW_IA64_FR+ 5:
+ case UNW_IA64_FR+16 ... UNW_IA64_FR+31:
+ addr = &uc->uc_mcontext.sc_fr[reg - UNW_IA64_FR];
+ break;
+
+ default:
+ addr = NULL;
+ }
+ return addr;
+}
+
+static inline void *
+uc_addr (ucontext_t *uc, int reg, uint8_t *nat_bitnr)
+{
+ if (__builtin_constant_p (reg))
+ return inlined_uc_addr (uc, reg, nat_bitnr);
+ else
+ return tdep_uc_addr (uc, reg, nat_bitnr);
+}
+
+/* Return TRUE if ADDR points inside unw.read_only_reg. */
+
+static inline long
+ia64_read_only_reg (void *addr)
+{
+ return ((unsigned long) ((char *) addr - (char *) &unw.read_only)
+ < sizeof (unw.read_only));
+}
+
+#endif /* !defined(HAVE_SYS_UC_ACCESS_H) && !defined(UNW_REMOTE_ONLY) */
+
+/* Bits 0 and 1 of a location are used to encode its type:
+ bit 0: set if location uses floating-point format.
+ bit 1: set if location is a NaT bit on memory stack. */
+
+#define IA64_LOC_TYPE_FP (1 << 0)
+#define IA64_LOC_TYPE_MEMSTK_NAT (1 << 1)
+
+#ifdef UNW_LOCAL_ONLY
+#define IA64_LOC_REG(r,t) (((r) << 2) | (t))
+#define IA64_LOC_ADDR(a,t) (((a) & ~0x3) | (t))
+#define IA64_LOC_UC_ADDR(a,t) IA64_LOC_ADDR(a, t)
+#define IA64_NULL_LOC (0)
+
+#define IA64_GET_REG(l) ((l) >> 2)
+#define IA64_GET_ADDR(l) ((l) & ~0x3)
+#define IA64_IS_NULL_LOC(l) ((l) == 0)
+#define IA64_IS_FP_LOC(l) (((l) & IA64_LOC_TYPE_FP) != 0)
+#define IA64_IS_MEMSTK_NAT(l) (((l) & IA64_LOC_TYPE_MEMSTK_NAT) != 0)
+#define IA64_IS_REG_LOC(l) 0
+#define IA64_IS_UC_LOC(l) 0
+
+#define IA64_REG_LOC(c,r) ((unw_word_t) uc_addr((c)->as_arg, r, NULL))
+#define IA64_REG_NAT_LOC(c,r,n) ((unw_word_t) uc_addr((c)->as_arg, r, n))
+#define IA64_FPREG_LOC(c,r) \
+ ((unw_word_t) uc_addr((c)->as_arg, (r), NULL) | IA64_LOC_TYPE_FP)
+
+# define ia64_find_proc_info(c,ip,n) \
+ tdep_find_proc_info(unw_local_addr_space, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define ia64_put_unwind_info(c, pi) do { ; } while (0)
+
+/* Note: the register accessors (ia64_{get,set}{,fp}()) must check for
+ NULL locations because uc_addr() returns NULL for unsaved
+ registers. */
+
+static inline int
+ia64_getfp (struct cursor *c, unw_word_t loc, unw_fpreg_t *val)
+{
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ Debug (16, "access to unsaved register\n");
+ return -UNW_EBADREG;
+ }
+ *val = *(unw_fpreg_t *) IA64_GET_ADDR (loc);
+ return 0;
+}
+
+static inline int
+ia64_putfp (struct cursor *c, unw_word_t loc, unw_fpreg_t val)
+{
+ unw_fpreg_t *addr = (unw_fpreg_t *) IA64_GET_ADDR (loc);
+
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ Debug (16, "access to unsaved register\n");
+ return -UNW_EBADREG;
+ }
+ else if (ia64_read_only_reg (addr))
+ {
+ Debug (16, "attempt to read-only register\n");
+ return -UNW_EREADONLYREG;
+ }
+ *addr = val;
+ return 0;
+}
+
+static inline int
+ia64_get (struct cursor *c, unw_word_t loc, unw_word_t *val)
+{
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ Debug (16, "access to unsaved register\n");
+ return -UNW_EBADREG;
+ }
+ *val = *(unw_word_t *) IA64_GET_ADDR (loc);
+ return 0;
+}
+
+static inline int
+ia64_put (struct cursor *c, unw_word_t loc, unw_word_t val)
+{
+ unw_word_t *addr = (unw_word_t *) IA64_GET_ADDR (loc);
+
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ Debug (16, "access to unsaved register\n");
+ return -UNW_EBADREG;
+ }
+ else if (ia64_read_only_reg (addr))
+ {
+ Debug (16, "attempt to read-only register\n");
+ return -UNW_EREADONLYREG;
+ }
+ *addr = val;
+ return 0;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+
+/* Bits 0 and 1 of the second word (w1) of a location are used
+ to further distinguish what location we're dealing with:
+
+ bit 0: set if the location is a register
+ bit 1: set of the location is accessed via uc_access(3) */
+#define IA64_LOC_TYPE_REG (1 << 0)
+#define IA64_LOC_TYPE_UC (1 << 1)
+
+#define IA64_LOC_REG(r,t) ((ia64_loc_t) { ((r) << 2) | (t), \
+ IA64_LOC_TYPE_REG })
+#define IA64_LOC_ADDR(a,t) ((ia64_loc_t) { ((a) & ~0x3) | (t), 0 })
+#define IA64_LOC_UC_ADDR(a,t) ((ia64_loc_t) { ((a) & ~0x3) | (t), \
+ IA64_LOC_TYPE_UC })
+#define IA64_LOC_UC_REG(r,a) ((ia64_loc_t) { ((r) << 2), \
+ ((a) | IA64_LOC_TYPE_REG \
+ | IA64_LOC_TYPE_UC) })
+#define IA64_NULL_LOC ((ia64_loc_t) { 0, 0 })
+
+#define IA64_GET_REG(l) ((l).w0 >> 2)
+#define IA64_GET_ADDR(l) ((l).w0 & ~0x3)
+#define IA64_GET_AUX_ADDR(l) ((l).w1 & ~0x3)
+#define IA64_IS_NULL_LOC(l) (((l).w0 | (l).w1) == 0)
+#define IA64_IS_FP_LOC(l) (((l).w0 & IA64_LOC_TYPE_FP) != 0)
+#define IA64_IS_MEMSTK_NAT(l) (((l).w0 & IA64_LOC_TYPE_MEMSTK_NAT) != 0)
+#define IA64_IS_REG_LOC(l) (((l).w1 & IA64_LOC_TYPE_REG) != 0)
+#define IA64_IS_UC_LOC(l) (((l).w1 & IA64_LOC_TYPE_UC) != 0)
+
+#define IA64_REG_LOC(c,r) IA64_LOC_REG ((r), 0)
+#define IA64_REG_NAT_LOC(c,r,n) IA64_LOC_REG ((r), 0)
+#define IA64_FPREG_LOC(c,r) IA64_LOC_REG ((r), IA64_LOC_TYPE_FP)
+
+# define ia64_find_proc_info(c,ip,n) \
+ (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \
+ (c)->as_arg)
+# define ia64_put_unwind_info(c,pi) \
+ (*(c)->as->acc.put_unwind_info)((c)->as, (pi), (c)->as_arg)
+
+#define ia64_uc_access_reg UNW_OBJ(uc_access_reg)
+#define ia64_uc_access_fpreg UNW_OBJ(uc_access_fpreg)
+
+extern int ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc,
+ unw_word_t *valp, int write);
+extern int ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc,
+ unw_fpreg_t *valp, int write);
+
+static inline int
+ia64_getfp (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *val)
+{
+ unw_word_t addr;
+ int ret;
+
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ Debug (16, "access to unsaved register\n");
+ return -UNW_EBADREG;
+ }
+
+ if (IA64_IS_UC_LOC (loc))
+ return ia64_uc_access_fpreg (c, loc, val, 0);
+
+ if (IA64_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, IA64_GET_REG (loc),
+ val, 0, c->as_arg);
+
+ addr = IA64_GET_ADDR (loc);
+ ret = (*c->as->acc.access_mem) (c->as, addr + 0, &val->raw.bits[0], 0,
+ c->as_arg);
+ if (ret < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 8, &val->raw.bits[1], 0,
+ c->as_arg);
+}
+
+static inline int
+ia64_putfp (struct cursor *c, ia64_loc_t loc, unw_fpreg_t val)
+{
+ unw_word_t addr;
+ int ret;
+
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ Debug (16, "access to unsaved register\n");
+ return -UNW_EBADREG;
+ }
+
+ if (IA64_IS_UC_LOC (loc))
+ return ia64_uc_access_fpreg (c, loc, &val, 1);
+
+ if (IA64_IS_REG_LOC (loc))
+ return (*c->as->acc.access_fpreg) (c->as, IA64_GET_REG (loc), &val, 1,
+ c->as_arg);
+
+ addr = IA64_GET_ADDR (loc);
+ ret = (*c->as->acc.access_mem) (c->as, addr + 0, &val.raw.bits[0], 1,
+ c->as_arg);
+ if (ret < 0)
+ return ret;
+
+ return (*c->as->acc.access_mem) (c->as, addr + 8, &val.raw.bits[1], 1,
+ c->as_arg);
+}
+
+/* Get the 64 data bits from location LOC. If bit 0 is cleared, LOC
+ is a memory address, otherwise it is a register number. If the
+ register is a floating-point register, the 64 bits are read from
+ the significand bits. */
+
+static inline int
+ia64_get (struct cursor *c, ia64_loc_t loc, unw_word_t *val)
+{
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ Debug (16, "access to unsaved register\n");
+ return -UNW_EBADREG;
+ }
+
+ if (IA64_IS_FP_LOC (loc))
+ {
+ unw_fpreg_t tmp;
+ int ret;
+
+ ret = ia64_getfp (c, loc, &tmp);
+ if (ret < 0)
+ return ret;
+
+ if (c->as->big_endian)
+ *val = tmp.raw.bits[1];
+ else
+ *val = tmp.raw.bits[0];
+ return 0;
+ }
+
+ if (IA64_IS_UC_LOC (loc))
+ return ia64_uc_access_reg (c, loc, val, 0);
+
+ if (IA64_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg)(c->as, IA64_GET_REG (loc), val, 0,
+ c->as_arg);
+ else
+ return (*c->as->acc.access_mem)(c->as, IA64_GET_ADDR (loc), val, 0,
+ c->as_arg);
+}
+
+static inline int
+ia64_put (struct cursor *c, ia64_loc_t loc, unw_word_t val)
+{
+ if (IA64_IS_NULL_LOC (loc))
+ {
+ Debug (16, "access to unsaved register\n");
+ return -UNW_EBADREG;
+ }
+
+ if (IA64_IS_FP_LOC (loc))
+ {
+ unw_fpreg_t tmp;
+
+ memset (&tmp, 0, sizeof (tmp));
+ if (c->as->big_endian)
+ tmp.raw.bits[1] = val;
+ else
+ tmp.raw.bits[0] = val;
+ return ia64_putfp (c, loc, tmp);
+ }
+
+ if (IA64_IS_UC_LOC (loc))
+ return ia64_uc_access_reg (c, loc, &val, 1);
+
+ if (IA64_IS_REG_LOC (loc))
+ return (*c->as->acc.access_reg)(c->as, IA64_GET_REG (loc), &val, 1,
+ c->as_arg);
+ else
+ return (*c->as->acc.access_mem)(c->as, IA64_GET_ADDR (loc), &val, 1,
+ c->as_arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+struct ia64_unwind_block
+ {
+ unw_word_t header;
+ unw_word_t desc[0]; /* unwind descriptors */
+
+ /* Personality routine and language-specific data follow behind
+ descriptors. */
+ };
+
+enum ia64_where
+ {
+ IA64_WHERE_NONE, /* register isn't saved at all */
+ IA64_WHERE_GR, /* register is saved in a general register */
+ IA64_WHERE_FR, /* register is saved in a floating-point register */
+ IA64_WHERE_BR, /* register is saved in a branch register */
+ IA64_WHERE_SPREL, /* register is saved on memstack (sp-relative) */
+ IA64_WHERE_PSPREL, /* register is saved on memstack (psp-relative) */
+
+ /* At the end of each prologue these locations get resolved to
+ IA64_WHERE_PSPREL and IA64_WHERE_GR, respectively: */
+
+ IA64_WHERE_SPILL_HOME, /* register is saved in its spill home */
+ IA64_WHERE_GR_SAVE /* register is saved in next general register */
+ };
+
+#define IA64_WHEN_NEVER 0x7fffffff
+
+struct ia64_reg_info
+ {
+ unw_word_t val; /* save location: register number or offset */
+ enum ia64_where where; /* where the register gets saved */
+ int when; /* when the register gets saved */
+ };
+
+struct ia64_labeled_state; /* opaque structure */
+
+struct ia64_reg_state
+ {
+ struct ia64_reg_state *next; /* next (outer) element on state stack */
+ struct ia64_reg_info reg[IA64_NUM_PREGS]; /* register save locations */
+ };
+
+struct ia64_state_record
+ {
+ unsigned int first_region : 1; /* is this the first region? */
+ unsigned int done : 1; /* are we done scanning descriptors? */
+ unsigned int any_spills : 1; /* got any register spills? */
+ unsigned int in_body : 1; /* are we inside prologue or body? */
+ uint8_t *imask; /* imask of spill_mask record or NULL */
+ uint16_t abi_marker;
+
+ unw_word_t pr_val; /* predicate values */
+ unw_word_t pr_mask; /* predicate mask */
+
+ long spill_offset; /* psp-relative offset for spill base */
+ int region_start;
+ int region_len;
+ int when_sp_restored;
+ int epilogue_count;
+ int when_target;
+
+ uint8_t gr_save_loc; /* next save register */
+ uint8_t return_link_reg; /* branch register used as return pointer */
+
+ struct ia64_labeled_state *labeled_states;
+ struct ia64_reg_state curr;
+ };
+
+struct ia64_labeled_state
+ {
+ struct ia64_labeled_state *next; /* next label (or NULL) */
+ unsigned long label; /* label for this state */
+ struct ia64_reg_state saved_state;
+ };
+
+/* Convenience macros: */
+#define ia64_make_proc_info UNW_OBJ(make_proc_info)
+#define ia64_fetch_proc_info UNW_OBJ(fetch_proc_info)
+#define ia64_create_state_record UNW_OBJ(create_state_record)
+#define ia64_free_state_record UNW_OBJ(free_state_record)
+#define ia64_find_save_locs UNW_OBJ(find_save_locs)
+#define ia64_validate_cache UNW_OBJ(ia64_validate_cache)
+#define ia64_local_validate_cache UNW_OBJ(ia64_local_validate_cache)
+#define ia64_per_thread_cache UNW_OBJ(per_thread_cache)
+#define ia64_scratch_loc UNW_OBJ(scratch_loc)
+#define ia64_local_resume UNW_OBJ(local_resume)
+#define ia64_local_addr_space_init UNW_OBJ(local_addr_space_init)
+#define ia64_strloc UNW_OBJ(strloc)
+#define ia64_install_cursor UNW_OBJ(install_cursor)
+#define rbs_switch UNW_OBJ(rbs_switch)
+#define rbs_find_stacked UNW_OBJ(rbs_find_stacked)
+
+extern int ia64_make_proc_info (struct cursor *c);
+extern int ia64_fetch_proc_info (struct cursor *c, unw_word_t ip,
+ int need_unwind_info);
+/* The proc-info must be valid for IP before this routine can be
+ called: */
+extern int ia64_create_state_record (struct cursor *c,
+ struct ia64_state_record *sr);
+extern int ia64_free_state_record (struct ia64_state_record *sr);
+extern int ia64_find_save_locs (struct cursor *c);
+extern void ia64_validate_cache (unw_addr_space_t as, void *arg);
+extern int ia64_local_validate_cache (unw_addr_space_t as, void *arg);
+extern void ia64_local_addr_space_init (void);
+extern ia64_loc_t ia64_scratch_loc (struct cursor *c, unw_regnum_t reg,
+ uint8_t *nat_bitnr);
+
+extern NORETURN void ia64_install_cursor (struct cursor *c,
+ unw_word_t pri_unat,
+ unw_word_t *extra,
+ unw_word_t bspstore,
+ unw_word_t dirty_size,
+ unw_word_t *dirty_partition,
+ unw_word_t dirty_rnat);
+extern int ia64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+extern int rbs_switch (struct cursor *c,
+ unw_word_t saved_bsp, unw_word_t saved_bspstore,
+ ia64_loc_t saved_rnat_loc);
+extern int rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip,
+ ia64_loc_t *locp, ia64_loc_t *rnat_locp);
+
+#ifndef UNW_REMOTE_ONLY
+# define NEED_RBS_COVER_AND_FLUSH
+# define rbs_cover_and_flush UNW_OBJ(rbs_cover_and_flush)
+ extern int rbs_cover_and_flush (struct cursor *c, unw_word_t nregs,
+ unw_word_t *dirty_partition,
+ unw_word_t *dirty_rnat,
+ unw_word_t *bspstore);
+#endif
+
+/* Warning: ia64_strloc() is for debugging only and it is NOT re-entrant! */
+extern const char *ia64_strloc (ia64_loc_t loc);
+
+/* Return true if the register-backing store is inside a ucontext_t
+ that needs to be accessed via uc_access(3). */
+
+static inline int
+rbs_on_uc (struct rbs_area *rbs)
+{
+ return IA64_IS_UC_LOC (rbs->rnat_loc) && !IA64_IS_REG_LOC (rbs->rnat_loc);
+}
+
+/* Return true if BSP points to a word that's stored on register
+ backing-store RBS. */
+static inline int
+rbs_contains (struct rbs_area *rbs, unw_word_t bsp)
+{
+ int result;
+
+ /* Caveat: this takes advantage of unsigned arithmetic. The full
+ test is (bsp >= rbs->end - rbs->size) && (bsp < rbs->end). We
+ take advantage of the fact that -n == ~n + 1. */
+ result = bsp - rbs->end > ~rbs->size;
+ Debug (16, "0x%lx in [0x%lx-0x%lx) => %d\n",
+ (long) bsp, (long) (rbs->end - rbs->size), (long) rbs->end, result);
+ return result;
+}
+
+static inline ia64_loc_t
+rbs_get_rnat_loc (struct rbs_area *rbs, unw_word_t bsp)
+{
+ unw_word_t rnat_addr = rse_rnat_addr (bsp);
+ ia64_loc_t rnat_loc;
+
+ if (rbs_contains (rbs, rnat_addr))
+ {
+ if (rbs_on_uc (rbs))
+ rnat_loc = IA64_LOC_UC_ADDR (rnat_addr, 0);
+ else
+ rnat_loc = IA64_LOC_ADDR (rnat_addr, 0);
+ }
+ else
+ rnat_loc = rbs->rnat_loc;
+ return rnat_loc;
+}
+
+static inline ia64_loc_t
+rbs_loc (struct rbs_area *rbs, unw_word_t bsp)
+{
+ if (rbs_on_uc (rbs))
+ return IA64_LOC_UC_ADDR (bsp, 0);
+ else
+ return IA64_LOC_ADDR (bsp, 0);
+}
+
+static inline int
+ia64_get_stacked (struct cursor *c, unw_word_t reg,
+ ia64_loc_t *locp, ia64_loc_t *rnat_locp)
+{
+ struct rbs_area *rbs = c->rbs_area + c->rbs_curr;
+ unw_word_t addr, regs_to_skip = reg - 32;
+ int ret = 0;
+
+ assert (reg >= 32 && reg < 128);
+
+ addr = rse_skip_regs (c->bsp, regs_to_skip);
+ if (locp)
+ *locp = rbs_loc (rbs, addr);
+ if (rnat_locp)
+ *rnat_locp = rbs_get_rnat_loc (rbs, addr);
+
+ if (!rbs_contains (rbs, addr))
+ ret = rbs_find_stacked (c, regs_to_skip, locp, rnat_locp);
+ return ret;
+}
+
+/* The UNaT slot # calculation is identical to the one for RNaT slots,
+ but for readability/clarity, we don't want to use
+ ia64_rnat_slot_num() directly. */
+#define ia64_unat_slot_num(addr) rse_slot_num(addr)
+
+/* The following are helper macros which makes it easier for libunwind
+ to be used in the kernel. They allow the kernel to optimize away
+ any unused code without littering everything with #ifdefs. */
+#define ia64_is_big_endian(c) ((c)->as->big_endian)
+#define ia64_get_abi(c) ((c)->as->abi)
+#define ia64_set_abi(c, v) ((c)->as->abi = (v))
+#define ia64_get_abi_marker(c) ((c)->last_abi_marker)
+
+/* XXX should be in glibc: */
+#ifndef IA64_SC_FLAG_ONSTACK
+# define IA64_SC_FLAG_ONSTACK_BIT 0 /* running on signal stack? */
+# define IA64_SC_FLAG_IN_SYSCALL_BIT 1 /* did signal interrupt a syscall? */
+# define IA64_SC_FLAG_FPH_VALID_BIT 2 /* is state in f[32]-f[127] valid? */
+
+# define IA64_SC_FLAG_ONSTACK (1 << IA64_SC_FLAG_ONSTACK_BIT)
+# define IA64_SC_FLAG_IN_SYSCALL (1 << IA64_SC_FLAG_IN_SYSCALL_BIT)
+# define IA64_SC_FLAG_FPH_VALID (1 << IA64_SC_FLAG_FPH_VALID_BIT)
+#endif
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/libunwind-generic.pc.in b/src/pal/src/libunwind/src/libunwind-generic.pc.in
new file mode 100644
index 0000000000..1f3baffe5b
--- /dev/null
+++ b/src/pal/src/libunwind/src/libunwind-generic.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libunwind-generic
+Description: libunwind generic library
+Version: @VERSION@
+Requires: libunwind
+Libs: -L${libdir} -lunwind-generic
+Cflags: -I${includedir}
diff --git a/src/pal/src/libunwind/src/mi/Gdestroy_addr_space.c b/src/pal/src/libunwind/src/mi/Gdestroy_addr_space.c
new file mode 100644
index 0000000000..504558e1a7
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gdestroy_addr_space.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+void
+unw_destroy_addr_space (unw_addr_space_t as)
+{
+#ifndef UNW_LOCAL_ONLY
+# if UNW_DEBUG
+ memset (as, 0, sizeof (*as));
+# endif
+ free (as);
+#endif
+}
diff --git a/src/pal/src/libunwind/src/mi/Gdyn-extract.c b/src/pal/src/libunwind/src/mi/Gdyn-extract.c
new file mode 100644
index 0000000000..5f7682e650
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gdyn-extract.c
@@ -0,0 +1,64 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+HIDDEN int
+unwi_extract_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, unw_dyn_info_t *di,
+ int need_unwind_info, void *arg)
+{
+ pi->start_ip = di->start_ip;
+ pi->end_ip = di->end_ip;
+ pi->gp = di->gp;
+ pi->format = di->format;
+ switch (di->format)
+ {
+ case UNW_INFO_FORMAT_DYNAMIC:
+ pi->handler = di->u.pi.handler;
+ pi->lsda = 0;
+ pi->flags = di->u.pi.flags;
+ pi->unwind_info_size = 0;
+ if (need_unwind_info)
+ pi->unwind_info = di;
+ else
+ pi->unwind_info = NULL;
+ return 0;
+
+ case UNW_INFO_FORMAT_TABLE:
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+ case UNW_INFO_FORMAT_ARM_EXIDX:
+ case UNW_INFO_FORMAT_IP_OFFSET:
+#ifdef tdep_search_unwind_table
+ /* call platform-specific search routine: */
+ return tdep_search_unwind_table (as, ip, di, pi, need_unwind_info, arg);
+#else
+ /* fall through */
+#endif
+ default:
+ break;
+ }
+ return -UNW_EINVAL;
+}
diff --git a/src/pal/src/libunwind/src/mi/Gdyn-remote.c b/src/pal/src/libunwind/src/mi/Gdyn-remote.c
new file mode 100644
index 0000000000..40a5ad8b5a
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gdyn-remote.c
@@ -0,0 +1,326 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "libunwind_i.h"
+#include "remote.h"
+
+static void
+free_regions (unw_dyn_region_info_t *region)
+{
+ if (region->next)
+ free_regions (region->next);
+ free (region);
+}
+
+static int
+intern_op (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
+ unw_dyn_op_t *op, void *arg)
+{
+ int ret;
+
+ if ((ret = fetch8 (as, a, addr, &op->tag, arg)) < 0
+ || (ret = fetch8 (as, a, addr, &op->qp, arg)) < 0
+ || (ret = fetch16 (as, a, addr, &op->reg, arg)) < 0
+ || (ret = fetch32 (as, a, addr, &op->when, arg)) < 0
+ || (ret = fetchw (as, a, addr, &op->val, arg)) < 0)
+ return ret;
+ return 0;
+}
+
+static int
+intern_regions (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, unw_dyn_region_info_t **regionp, void *arg)
+{
+ uint32_t insn_count, op_count, i;
+ unw_dyn_region_info_t *region;
+ unw_word_t next_addr;
+ int ret;
+
+ *regionp = NULL;
+
+ if (!*addr)
+ return 0; /* NULL region-list */
+
+ if ((ret = fetchw (as, a, addr, &next_addr, arg)) < 0
+ || (ret = fetch32 (as, a, addr, (int32_t *) &insn_count, arg)) < 0
+ || (ret = fetch32 (as, a, addr, (int32_t *) &op_count, arg)) < 0)
+ return ret;
+
+ region = calloc (1, _U_dyn_region_info_size (op_count));
+ if (!region)
+ {
+ ret = -UNW_ENOMEM;
+ goto out;
+ }
+
+ region->insn_count = insn_count;
+ region->op_count = op_count;
+ for (i = 0; i < op_count; ++i)
+ if ((ret = intern_op (as, a, addr, region->op + i, arg)) < 0)
+ goto out;
+
+ if (next_addr)
+ if ((ret = intern_regions (as, a, &next_addr, &region->next, arg)) < 0)
+ goto out;
+
+ *regionp = region;
+ return 0;
+
+ out:
+ if (region)
+ free_regions (region);
+ return ret;
+}
+
+static int
+intern_array (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, unw_word_t table_len, unw_word_t **table_data,
+ void *arg)
+{
+ unw_word_t i, *data = calloc (table_len, WSIZE);
+ int ret = 0;
+
+ if (!data)
+ {
+ ret = -UNW_ENOMEM;
+ goto out;
+ }
+
+ for (i = 0; i < table_len; ++i)
+ if (fetchw (as, a, addr, data + i, arg) < 0)
+ goto out;
+
+ *table_data = data;
+ return 0;
+
+ out:
+ if (data)
+ free (data);
+ return ret;
+}
+
+static void
+free_dyn_info (unw_dyn_info_t *di)
+{
+ switch (di->format)
+ {
+ case UNW_INFO_FORMAT_DYNAMIC:
+ if (di->u.pi.regions)
+ {
+ free_regions (di->u.pi.regions);
+ di->u.pi.regions = NULL;
+ }
+ break;
+
+ case UNW_INFO_FORMAT_TABLE:
+ if (di->u.ti.table_data)
+ {
+ free (di->u.ti.table_data);
+ di->u.ti.table_data = NULL;
+ }
+ break;
+
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+ default:
+ break;
+ }
+}
+
+static int
+intern_dyn_info (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t *addr, unw_dyn_info_t *di, void *arg)
+{
+ unw_word_t first_region;
+ int ret;
+
+ switch (di->format)
+ {
+ case UNW_INFO_FORMAT_DYNAMIC:
+ if ((ret = fetchw (as, a, addr, &di->u.pi.name_ptr, arg)) < 0
+ || (ret = fetchw (as, a, addr, &di->u.pi.handler, arg)) < 0
+ || (ret = fetch32 (as, a, addr,
+ (int32_t *) &di->u.pi.flags, arg)) < 0)
+ goto out;
+ *addr += 4; /* skip over pad0 */
+ if ((ret = fetchw (as, a, addr, &first_region, arg)) < 0
+ || (ret = intern_regions (as, a, &first_region, &di->u.pi.regions,
+ arg)) < 0)
+ goto out;
+ break;
+
+ case UNW_INFO_FORMAT_TABLE:
+ if ((ret = fetchw (as, a, addr, &di->u.ti.name_ptr, arg)) < 0
+ || (ret = fetchw (as, a, addr, &di->u.ti.segbase, arg)) < 0
+ || (ret = fetchw (as, a, addr, &di->u.ti.table_len, arg)) < 0
+ || (ret = intern_array (as, a, addr, di->u.ti.table_len,
+ &di->u.ti.table_data, arg)) < 0)
+ goto out;
+ break;
+
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+ if ((ret = fetchw (as, a, addr, &di->u.rti.name_ptr, arg)) < 0
+ || (ret = fetchw (as, a, addr, &di->u.rti.segbase, arg)) < 0
+ || (ret = fetchw (as, a, addr, &di->u.rti.table_len, arg)) < 0
+ || (ret = fetchw (as, a, addr, &di->u.rti.table_data, arg)) < 0)
+ goto out;
+ break;
+
+ default:
+ ret = -UNW_ENOINFO;
+ goto out;
+ }
+ return 0;
+
+ out:
+ free_dyn_info (di);
+ return ret;
+}
+
+HIDDEN int
+unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ unw_accessors_t *a = unw_get_accessors_int (as);
+ unw_word_t dyn_list_addr, addr, next_addr, gen1, gen2, start_ip, end_ip;
+ unw_dyn_info_t *di = NULL;
+ int ret;
+
+ if (as->dyn_info_list_addr)
+ dyn_list_addr = as->dyn_info_list_addr;
+ else
+ {
+ if ((*a->get_dyn_info_list_addr) (as, &dyn_list_addr, arg) < 0)
+ return -UNW_ENOINFO;
+ if (as->caching_policy != UNW_CACHE_NONE)
+ as->dyn_info_list_addr = dyn_list_addr;
+ }
+
+ do
+ {
+ addr = dyn_list_addr;
+
+ ret = -UNW_ENOINFO;
+
+ if (fetchw (as, a, &addr, &gen1, arg) < 0
+ || fetchw (as, a, &addr, &next_addr, arg) < 0)
+ return ret;
+
+ for (addr = next_addr; addr != 0; addr = next_addr)
+ {
+ if (fetchw (as, a, &addr, &next_addr, arg) < 0)
+ goto recheck; /* only fail if generation # didn't change */
+
+ addr += WSIZE; /* skip over prev_addr */
+
+ if (fetchw (as, a, &addr, &start_ip, arg) < 0
+ || fetchw (as, a, &addr, &end_ip, arg) < 0)
+ goto recheck; /* only fail if generation # didn't change */
+
+ if (ip >= start_ip && ip < end_ip)
+ {
+ if (!di)
+ di = calloc (1, sizeof (*di));
+
+ di->start_ip = start_ip;
+ di->end_ip = end_ip;
+
+ if (fetchw (as, a, &addr, &di->gp, arg) < 0
+ || fetch32 (as, a, &addr, &di->format, arg) < 0)
+ goto recheck; /* only fail if generation # didn't change */
+
+ addr += 4; /* skip over padding */
+
+ if (need_unwind_info
+ && intern_dyn_info (as, a, &addr, di, arg) < 0)
+ goto recheck; /* only fail if generation # didn't change */
+
+ if (unwi_extract_dynamic_proc_info (as, ip, pi, di,
+ need_unwind_info, arg) < 0)
+ {
+ free_dyn_info (di);
+ goto recheck; /* only fail if generation # didn't change */
+ }
+ ret = 0; /* OK, found it */
+ break;
+ }
+ }
+
+ /* Re-check generation number to ensure the data we have is
+ consistent. */
+ recheck:
+ addr = dyn_list_addr;
+ if (fetchw (as, a, &addr, &gen2, arg) < 0)
+ return ret;
+ }
+ while (gen1 != gen2);
+
+ if (ret < 0 && di)
+ free (di);
+
+ return ret;
+}
+
+HIDDEN void
+unwi_dyn_remote_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi,
+ void *arg)
+{
+ if (!pi->unwind_info)
+ return;
+
+ free_dyn_info (pi->unwind_info);
+ free (pi->unwind_info);
+ pi->unwind_info = NULL;
+}
+
+/* Returns 1 if the cache is up-to-date or -1 if the cache contained
+ stale data and had to be flushed. */
+
+HIDDEN int
+unwi_dyn_validate_cache (unw_addr_space_t as, void *arg)
+{
+ unw_word_t addr, gen;
+ unw_accessors_t *a;
+
+ if (!as->dyn_info_list_addr)
+ /* If we don't have the dyn_info_list_addr, we don't have anything
+ in the cache. */
+ return 0;
+
+ a = unw_get_accessors_int (as);
+ addr = as->dyn_info_list_addr;
+
+ if (fetchw (as, a, &addr, &gen, arg) < 0)
+ return 1;
+
+ if (gen == as->dyn_generation)
+ return 1;
+
+ unw_flush_cache (as, 0, 0);
+ as->dyn_generation = gen;
+ return -1;
+}
diff --git a/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c b/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c
new file mode 100644
index 0000000000..98d3501286
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gfind_dynamic_proc_info.c
@@ -0,0 +1,91 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+static inline int
+local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ return -UNW_ENOINFO;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static inline int
+local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ unw_dyn_info_list_t *list;
+ unw_dyn_info_t *di;
+
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+ if (!_U_dyn_info_list_addr)
+ return -UNW_ENOINFO;
+#endif
+
+ list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr ();
+ for (di = list->first; di; di = di->next)
+ if (ip >= di->start_ip && ip < di->end_ip)
+ return unwi_extract_dynamic_proc_info (as, ip, pi, di, need_unwind_info,
+ arg);
+ return -UNW_ENOINFO;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+#ifdef UNW_LOCAL_ONLY
+
+static inline int
+remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ return -UNW_ENOINFO;
+}
+
+#else /* !UNW_LOCAL_ONLY */
+
+static inline int
+remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ return unwi_dyn_remote_find_proc_info (as, ip, pi, need_unwind_info, arg);
+}
+
+#endif /* !UNW_LOCAL_ONLY */
+
+HIDDEN int
+unwi_find_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, int need_unwind_info,
+ void *arg)
+{
+ if (as == unw_local_addr_space)
+ return local_find_proc_info (as, ip, pi, need_unwind_info, arg);
+ else
+ return remote_find_proc_info (as, ip, pi, need_unwind_info, arg);
+}
diff --git a/src/pal/src/libunwind/src/mi/Gget_accessors.c b/src/pal/src/libunwind/src/mi/Gget_accessors.c
new file mode 100644
index 0000000000..31a6fbaf02
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gget_accessors.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002, 2004-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+HIDDEN ALIAS(unw_get_accessors) unw_accessors_t *
+unw_get_accessors_int (unw_addr_space_t as);
+
+unw_accessors_t *
+unw_get_accessors (unw_addr_space_t as)
+{
+ if (!tdep_init_done)
+ tdep_init ();
+ return &as->acc;
+}
diff --git a/src/pal/src/libunwind/src/mi/Gget_fpreg.c b/src/pal/src/libunwind/src/mi/Gget_fpreg.c
new file mode 100644
index 0000000000..f32b128625
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gget_fpreg.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_get_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t *valp)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return tdep_access_fpreg (c, regnum, valp, 0);
+}
diff --git a/src/pal/src/libunwind/src/mi/Gget_proc_info_by_ip.c b/src/pal/src/libunwind/src/mi/Gget_proc_info_by_ip.c
new file mode 100644
index 0000000000..2697ff84e7
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gget_proc_info_by_ip.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_get_proc_info_by_ip (unw_addr_space_t as, unw_word_t ip,
+ unw_proc_info_t *pi, void *as_arg)
+{
+ unw_accessors_t *a = unw_get_accessors_int (as);
+ int ret;
+
+ ret = unwi_find_dynamic_proc_info (as, ip, pi, 0, as_arg);
+ if (ret == -UNW_ENOINFO)
+ ret = (*a->find_proc_info) (as, ip, pi, 0, as_arg);
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/mi/Gget_proc_name.c b/src/pal/src/libunwind/src/mi/Gget_proc_name.c
new file mode 100644
index 0000000000..840d9007f4
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gget_proc_name.c
@@ -0,0 +1,118 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+#include "remote.h"
+
+static inline int
+intern_string (unw_addr_space_t as, unw_accessors_t *a,
+ unw_word_t addr, char *buf, size_t buf_len, void *arg)
+{
+ size_t i;
+ int ret;
+
+ for (i = 0; i < buf_len; ++i)
+ {
+ if ((ret = fetch8 (as, a, &addr, (int8_t *) buf + i, arg)) < 0)
+ return ret;
+
+ if (buf[i] == '\0')
+ return 0; /* copied full string; return success */
+ }
+ buf[buf_len - 1] = '\0'; /* ensure string is NUL terminated */
+ return -UNW_ENOMEM;
+}
+
+static inline int
+get_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp, void *arg)
+{
+ unw_accessors_t *a = unw_get_accessors_int (as);
+ unw_proc_info_t pi;
+ int ret;
+
+ buf[0] = '\0'; /* always return a valid string, even if it's empty */
+
+ ret = unwi_find_dynamic_proc_info (as, ip, &pi, 1, arg);
+ if (ret == 0)
+ {
+ unw_dyn_info_t *di = pi.unwind_info;
+
+ if (offp)
+ *offp = ip - pi.start_ip;
+
+ switch (di->format)
+ {
+ case UNW_INFO_FORMAT_DYNAMIC:
+ ret = intern_string (as, a, di->u.pi.name_ptr, buf, buf_len, arg);
+ break;
+
+ case UNW_INFO_FORMAT_TABLE:
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+ /* XXX should we create a fake name, e.g.: "tablenameN",
+ where N is the index of the function in the table??? */
+ ret = -UNW_ENOINFO;
+ break;
+
+ default:
+ ret = -UNW_EINVAL;
+ break;
+ }
+ unwi_put_dynamic_unwind_info (as, &pi, arg);
+ return ret;
+ }
+
+ if (ret != -UNW_ENOINFO)
+ return ret;
+
+ /* not a dynamic procedure, try to lookup static procedure name: */
+
+ if (a->get_proc_name)
+ return (*a->get_proc_name) (as, ip, buf, buf_len, offp, arg);
+
+ return -UNW_ENOINFO;
+}
+
+int
+unw_get_proc_name (unw_cursor_t *cursor, char *buf, size_t buf_len,
+ unw_word_t *offp)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t ip;
+ int error;
+
+ ip = tdep_get_ip (c);
+#if !defined(__ia64__)
+ if (c->dwarf.use_prev_instr)
+ --ip;
+#endif
+ error = get_proc_name (tdep_get_as (c), ip, buf, buf_len, offp,
+ tdep_get_as_arg (c));
+#if !defined(__ia64__)
+ if (c->dwarf.use_prev_instr && offp != NULL && error == 0)
+ *offp += 1;
+#endif
+ return error;
+}
diff --git a/src/pal/src/libunwind/src/mi/Gget_reg.c b/src/pal/src/libunwind/src/mi/Gget_reg.c
new file mode 100644
index 0000000000..9fc725c9c8
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gget_reg.c
@@ -0,0 +1,41 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_get_reg (unw_cursor_t *cursor, int regnum, unw_word_t *valp)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ // We can get the IP value directly without needing a lookup.
+ if (regnum == UNW_REG_IP)
+ {
+ *valp = tdep_get_ip (c);
+ return 0;
+ }
+
+ return tdep_access_reg (c, regnum, valp, 0);
+}
diff --git a/src/pal/src/libunwind/src/mi/Gput_dynamic_unwind_info.c b/src/pal/src/libunwind/src/mi/Gput_dynamic_unwind_info.c
new file mode 100644
index 0000000000..ca377c98a8
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gput_dynamic_unwind_info.c
@@ -0,0 +1,55 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+HIDDEN void
+unwi_put_dynamic_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi,
+ void *arg)
+{
+ switch (pi->format)
+ {
+ case UNW_INFO_FORMAT_DYNAMIC:
+#ifndef UNW_LOCAL_ONLY
+# ifdef UNW_REMOTE_ONLY
+ unwi_dyn_remote_put_unwind_info (as, pi, arg);
+# else
+ if (as != unw_local_addr_space)
+ unwi_dyn_remote_put_unwind_info (as, pi, arg);
+# endif
+#endif
+ break;
+
+ case UNW_INFO_FORMAT_TABLE:
+ case UNW_INFO_FORMAT_REMOTE_TABLE:
+#ifdef tdep_put_unwind_info
+ tdep_put_unwind_info (as, pi, arg);
+ break;
+#endif
+ /* fall through */
+ default:
+ break;
+ }
+}
diff --git a/src/pal/src/libunwind/src/mi/Gset_cache_size.c b/src/pal/src/libunwind/src/mi/Gset_cache_size.c
new file mode 100644
index 0000000000..07b282e2c1
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gset_cache_size.c
@@ -0,0 +1,72 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2014
+ Contributed by Milian Wolff <address@hidden>
+ and Dave Watson <dade.watson@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_set_cache_size (unw_addr_space_t as, size_t size, int flag)
+{
+ size_t power = 1;
+ unsigned short log_size = 0;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ if (flag != 0)
+ return -1;
+
+ /* Currently not supported for per-thread cache due to memory leak */
+ /* A pthread-key destructor would work, but is not signal safe */
+#if defined(HAVE___THREAD) && HAVE___THREAD
+ return -1;
+#endif
+
+ /* Round up to next power of two, slowly but portably */
+ while(power < size)
+ {
+ power *= 2;
+ log_size++;
+ /* Largest size currently supported by rs_cache */
+ if (log_size >= 15)
+ break;
+ }
+
+#if !defined(__ia64__)
+ if (log_size == as->global_cache.log_size)
+ return 0; /* no change */
+
+ as->global_cache.log_size = log_size;
+#endif
+
+ /* Ensure caches are empty (and initialized). */
+ unw_flush_cache (as, 0, 0);
+#ifdef __ia64__
+ return 0;
+#else
+ /* Synchronously purge cache, to ensure memory is allocated */
+ return dwarf_flush_rs_cache(&as->global_cache);
+#endif
+}
diff --git a/src/pal/src/libunwind/src/mi/Gset_caching_policy.c b/src/pal/src/libunwind/src/mi/Gset_caching_policy.c
new file mode 100644
index 0000000000..aa3d237146
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gset_caching_policy.c
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy)
+{
+ if (!tdep_init_done)
+ tdep_init ();
+
+#if !(defined(HAVE___THREAD) && HAVE___THREAD)
+ if (policy == UNW_CACHE_PER_THREAD)
+ policy = UNW_CACHE_GLOBAL;
+#endif
+
+ if (policy == as->caching_policy)
+ return 0; /* no change */
+
+ as->caching_policy = policy;
+ /* Ensure caches are empty (and initialized). */
+ unw_flush_cache (as, 0, 0);
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/mi/Gset_fpreg.c b/src/pal/src/libunwind/src/mi/Gset_fpreg.c
new file mode 100644
index 0000000000..8c37afd226
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gset_fpreg.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_set_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t val)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return tdep_access_fpreg (c, regnum, &val, 1);
+}
diff --git a/src/pal/src/libunwind/src/mi/Gset_reg.c b/src/pal/src/libunwind/src/mi/Gset_reg.c
new file mode 100644
index 0000000000..b1b1770337
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Gset_reg.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_set_reg (unw_cursor_t *cursor, int regnum, unw_word_t valp)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return tdep_access_reg (c, regnum, &valp, 1);
+}
diff --git a/src/pal/src/libunwind/src/mi/Ldestroy_addr_space.c b/src/pal/src/libunwind/src/mi/Ldestroy_addr_space.c
new file mode 100644
index 0000000000..5bf9364bc7
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Ldestroy_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gdestroy_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Ldyn-extract.c b/src/pal/src/libunwind/src/mi/Ldyn-extract.c
new file mode 100644
index 0000000000..1802f865f7
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Ldyn-extract.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gdyn-extract.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Ldyn-remote.c b/src/pal/src/libunwind/src/mi/Ldyn-remote.c
new file mode 100644
index 0000000000..260722a04b
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Ldyn-remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gdyn-remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lfind_dynamic_proc_info.c b/src/pal/src/libunwind/src/mi/Lfind_dynamic_proc_info.c
new file mode 100644
index 0000000000..bc88e1c53f
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lfind_dynamic_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gfind_dynamic_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lget_accessors.c b/src/pal/src/libunwind/src/mi/Lget_accessors.c
new file mode 100644
index 0000000000..555e37f30d
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lget_accessors.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_accessors.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lget_fpreg.c b/src/pal/src/libunwind/src/mi/Lget_fpreg.c
new file mode 100644
index 0000000000..e3be441437
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lget_fpreg.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_fpreg.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lget_proc_info_by_ip.c b/src/pal/src/libunwind/src/mi/Lget_proc_info_by_ip.c
new file mode 100644
index 0000000000..96910d83e4
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lget_proc_info_by_ip.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info_by_ip.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lget_proc_name.c b/src/pal/src/libunwind/src/mi/Lget_proc_name.c
new file mode 100644
index 0000000000..378097b57a
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lget_proc_name.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_name.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lget_reg.c b/src/pal/src/libunwind/src/mi/Lget_reg.c
new file mode 100644
index 0000000000..effe8a8063
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lget_reg.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_reg.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lput_dynamic_unwind_info.c b/src/pal/src/libunwind/src/mi/Lput_dynamic_unwind_info.c
new file mode 100644
index 0000000000..99597cd5fa
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lput_dynamic_unwind_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gput_dynamic_unwind_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lset_cache_size.c b/src/pal/src/libunwind/src/mi/Lset_cache_size.c
new file mode 100644
index 0000000000..670f64d3a9
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lset_cache_size.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gset_cache_size.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lset_caching_policy.c b/src/pal/src/libunwind/src/mi/Lset_caching_policy.c
new file mode 100644
index 0000000000..cc18816b37
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lset_caching_policy.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gset_caching_policy.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lset_fpreg.c b/src/pal/src/libunwind/src/mi/Lset_fpreg.c
new file mode 100644
index 0000000000..2497d404f4
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lset_fpreg.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gset_fpreg.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/Lset_reg.c b/src/pal/src/libunwind/src/mi/Lset_reg.c
new file mode 100644
index 0000000000..c7a872b016
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/Lset_reg.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gset_reg.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mi/_ReadSLEB.c b/src/pal/src/libunwind/src/mi/_ReadSLEB.c
new file mode 100644
index 0000000000..c041e37a05
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/_ReadSLEB.c
@@ -0,0 +1,25 @@
+#include <libunwind.h>
+
+unw_word_t
+_ReadSLEB (unsigned char **dpp)
+{
+ unsigned shift = 0;
+ unw_word_t byte, result = 0;
+ unsigned char *bp = *dpp;
+
+ while (1)
+ {
+ byte = *bp++;
+ result |= (byte & 0x7f) << shift;
+ shift += 7;
+ if ((byte & 0x80) == 0)
+ break;
+ }
+
+ if (shift < 8 * sizeof (unw_word_t) && (byte & 0x40) != 0)
+ /* sign-extend negative value */
+ result |= ((unw_word_t) -1) << shift;
+
+ *dpp = bp;
+ return result;
+}
diff --git a/src/pal/src/libunwind/src/mi/_ReadULEB.c b/src/pal/src/libunwind/src/mi/_ReadULEB.c
new file mode 100644
index 0000000000..116f3e19bc
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/_ReadULEB.c
@@ -0,0 +1,20 @@
+#include <libunwind.h>
+
+unw_word_t
+_ReadULEB (unsigned char **dpp)
+{
+ unsigned shift = 0;
+ unw_word_t byte, result = 0;
+ unsigned char *bp = *dpp;
+
+ while (1)
+ {
+ byte = *bp++;
+ result |= (byte & 0x7f) << shift;
+ if ((byte & 0x80) == 0)
+ break;
+ shift += 7;
+ }
+ *dpp = bp;
+ return result;
+}
diff --git a/src/pal/src/libunwind/src/mi/backtrace.c b/src/pal/src/libunwind/src/mi/backtrace.c
new file mode 100644
index 0000000000..c7aa2bdcdc
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/backtrace.c
@@ -0,0 +1,81 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef UNW_REMOTE_ONLY
+
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#include <libunwind_i.h>
+#include <string.h>
+
+/* See glibc manual for a description of this function. */
+
+static ALWAYS_INLINE int
+slow_backtrace (void **buffer, int size, unw_context_t *uc)
+{
+ unw_cursor_t cursor;
+ unw_word_t ip;
+ int n = 0;
+
+ if (unlikely (unw_init_local (&cursor, uc) < 0))
+ return 0;
+
+ while (unw_step (&cursor) > 0)
+ {
+ if (n >= size)
+ return n;
+
+ if (unw_get_reg (&cursor, UNW_REG_IP, &ip) < 0)
+ return n;
+ buffer[n++] = (void *) (uintptr_t) ip;
+ }
+ return n;
+}
+
+int
+unw_backtrace (void **buffer, int size)
+{
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ int n = size;
+
+ tdep_getcontext_trace (&uc);
+
+ if (unlikely (unw_init_local (&cursor, &uc) < 0))
+ return 0;
+
+ if (unlikely (tdep_trace (&cursor, buffer, &n) < 0))
+ {
+ unw_getcontext (&uc);
+ return slow_backtrace (buffer, size, &uc);
+ }
+
+ return n;
+}
+
+extern int backtrace (void **buffer, int size)
+ WEAK ALIAS(unw_backtrace);
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/mi/dyn-cancel.c b/src/pal/src/libunwind/src/mi/dyn-cancel.c
new file mode 100644
index 0000000000..9d7472d5fd
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/dyn-cancel.c
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+void
+_U_dyn_cancel (unw_dyn_info_t *di)
+{
+ mutex_lock (&_U_dyn_info_list_lock);
+ {
+ ++_U_dyn_info_list.generation;
+
+ if (di->prev)
+ di->prev->next = di->next;
+ else
+ _U_dyn_info_list.first = di->next;
+
+ if (di->next)
+ di->next->prev = di->prev;
+ }
+ mutex_unlock (&_U_dyn_info_list_lock);
+
+ di->next = di->prev = NULL;
+}
diff --git a/src/pal/src/libunwind/src/mi/dyn-info-list.c b/src/pal/src/libunwind/src/mi/dyn-info-list.c
new file mode 100644
index 0000000000..1c7c55090a
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/dyn-info-list.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+unw_word_t
+_U_dyn_info_list_addr (void)
+{
+ return (unw_word_t) (uintptr_t) &_U_dyn_info_list;
+}
diff --git a/src/pal/src/libunwind/src/mi/dyn-register.c b/src/pal/src/libunwind/src/mi/dyn-register.c
new file mode 100644
index 0000000000..efdad3de07
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/dyn-register.c
@@ -0,0 +1,44 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+HIDDEN define_lock (_U_dyn_info_list_lock);
+
+void
+_U_dyn_register (unw_dyn_info_t *di)
+{
+ mutex_lock (&_U_dyn_info_list_lock);
+ {
+ ++_U_dyn_info_list.generation;
+
+ di->next = _U_dyn_info_list.first;
+ di->prev = NULL;
+ if (di->next)
+ di->next->prev = di;
+ _U_dyn_info_list.first = di;
+ }
+ mutex_unlock (&_U_dyn_info_list_lock);
+}
diff --git a/src/pal/src/libunwind/src/mi/flush_cache.c b/src/pal/src/libunwind/src/mi/flush_cache.c
new file mode 100644
index 0000000000..cbd93e1a11
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/flush_cache.c
@@ -0,0 +1,59 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+void
+unw_flush_cache (unw_addr_space_t as, unw_word_t lo, unw_word_t hi)
+{
+#if !UNW_TARGET_IA64
+ struct unw_debug_frame_list *w = as->debug_frames;
+#endif
+
+ /* clear dyn_info_list_addr cache: */
+ as->dyn_info_list_addr = 0;
+
+#if !UNW_TARGET_IA64
+ for (; w; w = w->next)
+ {
+ if (w->index)
+ free (w->index);
+ free (w->debug_frame);
+ }
+ as->debug_frames = NULL;
+#endif
+
+ /* This lets us flush caches lazily. The implementation currently
+ ignores the flush range arguments (lo-hi). This is OK because
+ unw_flush_cache() is allowed to flush more than the requested
+ range. */
+
+#ifdef HAVE_FETCH_AND_ADD
+ fetch_and_add1 (&as->cache_generation);
+#else
+# warning unw_flush_cache(): need a way to atomically increment an integer.
+ ++as->cache_generation;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/mi/init.c b/src/pal/src/libunwind/src/mi/init.c
new file mode 100644
index 0000000000..60a48c5892
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/init.c
@@ -0,0 +1,60 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+HIDDEN intrmask_t unwi_full_mask;
+
+static const char rcsid[] UNUSED =
+ "$Id: " PACKAGE_STRING " --- report bugs to " PACKAGE_BUGREPORT " $";
+
+#if UNW_DEBUG
+
+/* Must not be declared HIDDEN because libunwind.so and
+ libunwind-PLATFORM.so will both define their own copies of this
+ variable and we want to use only one or the other when both
+ libraries are loaded. */
+long unwi_debug_level;
+
+#endif /* UNW_DEBUG */
+
+HIDDEN void
+mi_init (void)
+{
+#if UNW_DEBUG
+ const char *str = getenv ("UNW_DEBUG_LEVEL");
+
+ if (str)
+ unwi_debug_level = atoi (str);
+
+ if (unwi_debug_level > 0)
+ {
+ setbuf (stdout, NULL);
+ setbuf (stderr, NULL);
+ }
+#endif
+
+ assert (sizeof (struct cursor) <= sizeof (unw_cursor_t));
+}
diff --git a/src/pal/src/libunwind/src/mi/mempool.c b/src/pal/src/libunwind/src/mi/mempool.c
new file mode 100644
index 0000000000..536b64e815
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/mempool.c
@@ -0,0 +1,184 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2003, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+/* From GCC docs: ``Gcc also provides a target specific macro
+ * __BIGGEST_ALIGNMENT__, which is the largest alignment ever used for any data
+ * type on the target machine you are compiling for.'' */
+#ifdef __BIGGEST_ALIGNMENT__
+# define MAX_ALIGN __BIGGEST_ALIGNMENT__
+#else
+/* Crude hack to check that MAX_ALIGN is power-of-two.
+ * sizeof(long double) = 12 on i386. */
+# define MAX_ALIGN_(n) (n < 8 ? 8 : \
+ n < 16 ? 16 : n)
+# define MAX_ALIGN MAX_ALIGN_(sizeof (long double))
+#endif
+
+static char sos_memory[SOS_MEMORY_SIZE] ALIGNED(MAX_ALIGN);
+static size_t sos_memory_freepos;
+static size_t pg_size;
+
+HIDDEN void *
+sos_alloc (size_t size)
+{
+ size_t pos;
+
+ size = UNW_ALIGN(size, MAX_ALIGN);
+
+#if defined(__GNUC__) && defined(HAVE_FETCH_AND_ADD)
+ /* Assume `sos_memory' is suitably aligned. */
+ assert(((uintptr_t) &sos_memory[0] & (MAX_ALIGN-1)) == 0);
+
+ pos = fetch_and_add (&sos_memory_freepos, size);
+#else
+ static define_lock (sos_lock);
+ intrmask_t saved_mask;
+
+ lock_acquire (&sos_lock, saved_mask);
+ {
+ /* No assumptions about `sos_memory' alignment. */
+ if (sos_memory_freepos == 0)
+ {
+ unsigned align = UNW_ALIGN((uintptr_t) &sos_memory[0], MAX_ALIGN)
+ - (uintptr_t) &sos_memory[0];
+ sos_memory_freepos = align;
+ }
+ pos = sos_memory_freepos;
+ sos_memory_freepos += size;
+ }
+ lock_release (&sos_lock, saved_mask);
+#endif
+
+ assert (((uintptr_t) &sos_memory[pos] & (MAX_ALIGN-1)) == 0);
+ assert ((pos+size) <= SOS_MEMORY_SIZE);
+
+ return &sos_memory[pos];
+}
+
+/* Must be called while holding the mempool lock. */
+
+static void
+free_object (struct mempool *pool, void *object)
+{
+ struct object *obj = object;
+
+ obj->next = pool->free_list;
+ pool->free_list = obj;
+ ++pool->num_free;
+}
+
+static void
+add_memory (struct mempool *pool, char *mem, size_t size, size_t obj_size)
+{
+ char *obj;
+
+ for (obj = mem; obj <= mem + size - obj_size; obj += obj_size)
+ free_object (pool, obj);
+}
+
+static void
+expand (struct mempool *pool)
+{
+ size_t size;
+ char *mem;
+
+ size = pool->chunk_size;
+ GET_MEMORY (mem, size);
+ if (!mem)
+ {
+ size = UNW_ALIGN(pool->obj_size, pg_size);
+ GET_MEMORY (mem, size);
+ if (!mem)
+ {
+ /* last chance: try to allocate one object from the SOS memory */
+ size = pool->obj_size;
+ mem = sos_alloc (size);
+ }
+ }
+ add_memory (pool, mem, size, pool->obj_size);
+}
+
+HIDDEN void
+mempool_init (struct mempool *pool, size_t obj_size, size_t reserve)
+{
+ if (pg_size == 0)
+ pg_size = getpagesize ();
+
+ memset (pool, 0, sizeof (*pool));
+
+ lock_init (&pool->lock);
+
+ /* round object-size up to integer multiple of MAX_ALIGN */
+ obj_size = UNW_ALIGN(obj_size, MAX_ALIGN);
+
+ if (!reserve)
+ {
+ reserve = pg_size / obj_size / 4;
+ if (!reserve)
+ reserve = 16;
+ }
+
+ pool->obj_size = obj_size;
+ pool->reserve = reserve;
+ pool->chunk_size = UNW_ALIGN(2*reserve*obj_size, pg_size);
+
+ expand (pool);
+}
+
+HIDDEN void *
+mempool_alloc (struct mempool *pool)
+{
+ intrmask_t saved_mask;
+ struct object *obj;
+
+ lock_acquire (&pool->lock, saved_mask);
+ {
+ if (pool->num_free <= pool->reserve)
+ expand (pool);
+
+ assert (pool->num_free > 0);
+
+ --pool->num_free;
+ obj = pool->free_list;
+ pool->free_list = obj->next;
+ }
+ lock_release (&pool->lock, saved_mask);
+ return obj;
+}
+
+HIDDEN void
+mempool_free (struct mempool *pool, void *object)
+{
+ intrmask_t saved_mask;
+
+ lock_acquire (&pool->lock, saved_mask);
+ {
+ free_object (pool, object);
+ }
+ lock_release (&pool->lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/mi/strerror.c b/src/pal/src/libunwind/src/mi/strerror.c
new file mode 100644
index 0000000000..2cec73d1db
--- /dev/null
+++ b/src/pal/src/libunwind/src/mi/strerror.c
@@ -0,0 +1,51 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 BEA Systems
+ Contributed by Thomas Hallgren <thallgre@bea.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+/* Returns the text corresponding to the given err_code or the
+ text "invalid error code" if the err_code is invalid. */
+const char *
+unw_strerror (int err_code)
+{
+ const char *cp;
+ unw_error_t error = (unw_error_t)-err_code;
+ switch (error)
+ {
+ case UNW_ESUCCESS: cp = "no error"; break;
+ case UNW_EUNSPEC: cp = "unspecified (general) error"; break;
+ case UNW_ENOMEM: cp = "out of memory"; break;
+ case UNW_EBADREG: cp = "bad register number"; break;
+ case UNW_EREADONLYREG: cp = "attempt to write read-only register"; break;
+ case UNW_ESTOPUNWIND: cp = "stop unwinding"; break;
+ case UNW_EINVALIDIP: cp = "invalid IP"; break;
+ case UNW_EBADFRAME: cp = "bad frame"; break;
+ case UNW_EINVAL: cp = "unsupported operation or bad value"; break;
+ case UNW_EBADVERSION: cp = "unwind info has unsupported version"; break;
+ case UNW_ENOINFO: cp = "no unwind info found"; break;
+ default: cp = "invalid error code";
+ }
+ return cp;
+}
diff --git a/src/pal/src/libunwind/src/mips/Gapply_reg_state.c b/src/pal/src/libunwind/src/mips/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/mips/Gcreate_addr_space.c b/src/pal/src/libunwind/src/mips/Gcreate_addr_space.c
new file mode 100644
index 0000000000..493d03db66
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gcreate_addr_space.c
@@ -0,0 +1,66 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * MIPS supports only big or little-endian, not weird stuff like
+ * PDP_ENDIAN.
+ */
+ if (byte_order != 0
+ && byte_order != __LITTLE_ENDIAN
+ && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ if (byte_order == 0)
+ /* use host default: */
+ as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ else
+ as->big_endian = (byte_order == __BIG_ENDIAN);
+
+ /* FIXME! There is no way to specify the ABI. */
+ as->abi = UNW_MIPS_ABI_O32;
+ as->addr_size = 4;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/mips/Gget_proc_info.c b/src/pal/src/libunwind/src/mips/Gget_proc_info.c
new file mode 100644
index 0000000000..7b84be87b9
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gget_proc_info.c
@@ -0,0 +1,41 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ /* We can only unwind using Dwarf into on MIPS: return failure code
+ if it's not present. */
+ ret = dwarf_make_proc_info (&c->dwarf);
+ if (ret < 0)
+ return ret;
+
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/mips/Gget_save_loc.c b/src/pal/src/libunwind/src/mips/Gget_save_loc.c
new file mode 100644
index 0000000000..c21f9b06d0
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gget_save_loc.c
@@ -0,0 +1,100 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+/* FIXME for MIPS. */
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ dwarf_loc_t loc;
+
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+
+ switch (reg)
+ {
+ case UNW_MIPS_R0:
+ case UNW_MIPS_R1:
+ case UNW_MIPS_R2:
+ case UNW_MIPS_R3:
+ case UNW_MIPS_R4:
+ case UNW_MIPS_R5:
+ case UNW_MIPS_R6:
+ case UNW_MIPS_R7:
+ case UNW_MIPS_R8:
+ case UNW_MIPS_R9:
+ case UNW_MIPS_R10:
+ case UNW_MIPS_R11:
+ case UNW_MIPS_R12:
+ case UNW_MIPS_R13:
+ case UNW_MIPS_R14:
+ case UNW_MIPS_R15:
+ case UNW_MIPS_R16:
+ case UNW_MIPS_R17:
+ case UNW_MIPS_R18:
+ case UNW_MIPS_R19:
+ case UNW_MIPS_R20:
+ case UNW_MIPS_R21:
+ case UNW_MIPS_R22:
+ case UNW_MIPS_R23:
+ case UNW_MIPS_R24:
+ case UNW_MIPS_R25:
+ case UNW_MIPS_R26:
+ case UNW_MIPS_R27:
+ case UNW_MIPS_R28:
+ case UNW_MIPS_R29:
+ case UNW_MIPS_R30:
+ case UNW_MIPS_R31:
+ case UNW_MIPS_PC:
+ loc = c->dwarf.loc[reg - UNW_MIPS_R0];
+ break;
+
+ default:
+ break;
+ }
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/mips/Gglobal.c b/src/pal/src/libunwind/src/mips/Gglobal.c
new file mode 100644
index 0000000000..fa9478eebe
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gglobal.c
@@ -0,0 +1,55 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (mips_lock);
+HIDDEN int tdep_init_done;
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&mips_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ mips_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&mips_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/mips/Ginit.c b/src/pal/src/libunwind/src/mips/Ginit.c
new file mode 100644
index 0000000000..3df170c754
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Ginit.c
@@ -0,0 +1,210 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+/* Return the address of the 64-bit slot in UC for REG (even for o32,
+ where registers are 32-bit, the slots are still 64-bit). */
+
+static inline void *
+uc_addr (ucontext_t *uc, int reg)
+{
+ if (reg >= UNW_MIPS_R0 && reg < UNW_MIPS_R0 + 32)
+ return &uc->uc_mcontext.gregs[reg - UNW_MIPS_R0];
+ else if (reg == UNW_MIPS_PC)
+ return &uc->uc_mcontext.pc;
+ else
+ return NULL;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg)
+{
+ char *addr = uc_addr (uc, reg);
+
+ if (((reg >= UNW_MIPS_R0 && reg <= UNW_MIPS_R31) || reg == UNW_MIPS_PC)
+ && tdep_big_endian (unw_local_addr_space)
+ && unw_local_addr_space->abi == UNW_MIPS_ABI_O32)
+ addr += 4;
+
+ return addr;
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (16, "mem[%llx] <- %llx\n", (long long) addr, (long long) *val);
+ *(unw_word_t *) (intptr_t) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) (intptr_t) addr;
+ Debug (16, "mem[%llx] -> %llx\n", (long long) addr, (long long) *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = arg;
+
+ if (unw_is_fpreg (reg))
+ goto badreg;
+
+ Debug (16, "reg = %s\n", unw_regname (reg));
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) (intptr_t) addr = (mips_reg_t) *val;
+ Debug (12, "%s <- %llx\n", unw_regname (reg), (long long) *val);
+ }
+ else
+ {
+ *val = (mips_reg_t) *(unw_word_t *) (intptr_t) addr;
+ Debug (12, "%s -> %llx\n", unw_regname (reg), (long long) *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = arg;
+ unw_fpreg_t *addr;
+
+ if (!unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ *(unw_fpreg_t *) (intptr_t) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) (intptr_t) addr;
+ Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+
+ return elf_w (get_proc_name) (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+mips_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+#if _MIPS_SIM == _ABIO32
+ local_addr_space.abi = UNW_MIPS_ABI_O32;
+#elif _MIPS_SIM == _ABIN32
+ local_addr_space.abi = UNW_MIPS_ABI_N32;
+#elif _MIPS_SIM == _ABI64
+ local_addr_space.abi = UNW_MIPS_ABI_N64;
+#else
+# error Unsupported ABI
+#endif
+ local_addr_space.addr_size = sizeof (void *);
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = NULL; /* mips_local_resume? FIXME! */
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/mips/Ginit_local.c b/src/pal/src/libunwind/src/mips/Ginit_local.c
new file mode 100644
index 0000000000..f3153b5ba0
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Ginit_local.c
@@ -0,0 +1,76 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = uc;
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local(unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/mips/Ginit_remote.c b/src/pal/src/libunwind/src/mips/Ginit_remote.c
new file mode 100644
index 0000000000..9b8ba5b89d
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Ginit_remote.c
@@ -0,0 +1,45 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/mips/Gis_signal_frame.c b/src/pal/src/libunwind/src/mips/Gis_signal_frame.c
new file mode 100644
index 0000000000..c0e3b98368
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gis_signal_frame.c
@@ -0,0 +1,78 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2015 Imagination Technologies Limited
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include <stdio.h>
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, w1, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ ip = c->dwarf.ip;
+
+ /* syscall */
+ if ((ret = (*a->access_mem) (as, ip + 4, &w1, 0, arg)) < 0)
+ return 0;
+ if ((w1 & 0xffffffff) != 0x0c)
+ return 0;
+
+ /* li v0, 0x1061 (rt) or li v0, 0x1017 */
+ if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0)
+ return 0;
+
+ switch (c->dwarf.as->abi)
+ {
+ case UNW_MIPS_ABI_O32:
+ switch (w0 & 0xffffffff)
+ {
+ case 0x24021061:
+ return 1;
+ case 0x24021017:
+ return 2;
+ default:
+ return 0;
+ }
+ case UNW_MIPS_ABI_N64:
+ switch (w0 & 0xffffffff)
+ {
+ case 0x2402145b:
+ return 1;
+ default:
+ return 0;
+ }
+ default:
+ return 0;
+ }
+}
diff --git a/src/pal/src/libunwind/src/mips/Greg_states_iterate.c b/src/pal/src/libunwind/src/mips/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/mips/Gregs.c b/src/pal/src/libunwind/src/mips/Gregs.c
new file mode 100644
index 0000000000..95194022d2
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gregs.c
@@ -0,0 +1,105 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+/* FIXME: The following is probably unfinished and/or at least partly bogus. */
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ dwarf_loc_t loc = DWARF_NULL_LOC;
+
+ switch (reg)
+ {
+ case UNW_MIPS_R0:
+ case UNW_MIPS_R1:
+ case UNW_MIPS_R2:
+ case UNW_MIPS_R3:
+ case UNW_MIPS_R4:
+ case UNW_MIPS_R5:
+ case UNW_MIPS_R6:
+ case UNW_MIPS_R7:
+ case UNW_MIPS_R8:
+ case UNW_MIPS_R9:
+ case UNW_MIPS_R10:
+ case UNW_MIPS_R11:
+ case UNW_MIPS_R12:
+ case UNW_MIPS_R13:
+ case UNW_MIPS_R14:
+ case UNW_MIPS_R15:
+ case UNW_MIPS_R16:
+ case UNW_MIPS_R17:
+ case UNW_MIPS_R18:
+ case UNW_MIPS_R19:
+ case UNW_MIPS_R20:
+ case UNW_MIPS_R21:
+ case UNW_MIPS_R22:
+ case UNW_MIPS_R23:
+ case UNW_MIPS_R24:
+ case UNW_MIPS_R25:
+ case UNW_MIPS_R26:
+ case UNW_MIPS_R27:
+ case UNW_MIPS_R28:
+ case UNW_MIPS_R29:
+ case UNW_MIPS_R30:
+ case UNW_MIPS_R31:
+ loc = c->dwarf.loc[reg - UNW_MIPS_R0];
+ break;
+
+ case UNW_MIPS_PC:
+ if (write)
+ c->dwarf.ip = *valp; /* update the IP cache */
+ loc = c->dwarf.loc[reg];
+ break;
+
+ case UNW_MIPS_CFA:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+ /* FIXME: IP? Copro & shadow registers? */
+
+ default:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+/* FIXME for MIPS. */
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
diff --git a/src/pal/src/libunwind/src/mips/Gresume.c b/src/pal/src/libunwind/src/mips/Gresume.c
new file mode 100644
index 0000000000..cb70abc8c5
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gresume.c
@@ -0,0 +1,45 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* FIXME for MIPS. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+HIDDEN inline int
+mips_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ return -UNW_EINVAL;
+}
diff --git a/src/pal/src/libunwind/src/mips/Gstep.c b/src/pal/src/libunwind/src/mips/Gstep.c
new file mode 100644
index 0000000000..937136aef1
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Gstep.c
@@ -0,0 +1,132 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2015 Imagination Technologies Limited
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+static int
+mips_handle_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t sc_addr, sp_addr = c->dwarf.cfa;
+ unw_word_t ra, fp;
+ int ret;
+
+ switch (unw_is_signal_frame (cursor)) {
+ case 1:
+ sc_addr = sp_addr + LINUX_SF_TRAMP_SIZE + sizeof (siginfo_t) +
+ LINUX_UC_MCONTEXT_OFF;
+ break;
+ case 2:
+ sc_addr = sp_addr + LINUX_UC_MCONTEXT_OFF;
+ break;
+ default:
+ return -UNW_EUNSPEC;
+ }
+
+ if (tdep_big_endian(c->dwarf.as))
+ sc_addr += 4;
+
+ c->sigcontext_addr = sc_addr;
+
+ /* Update the dwarf cursor. */
+ c->dwarf.loc[UNW_MIPS_R0] = DWARF_LOC (sc_addr + LINUX_SC_R0_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R1] = DWARF_LOC (sc_addr + LINUX_SC_R1_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R2] = DWARF_LOC (sc_addr + LINUX_SC_R2_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R3] = DWARF_LOC (sc_addr + LINUX_SC_R3_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R4] = DWARF_LOC (sc_addr + LINUX_SC_R4_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R5] = DWARF_LOC (sc_addr + LINUX_SC_R5_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R6] = DWARF_LOC (sc_addr + LINUX_SC_R6_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R7] = DWARF_LOC (sc_addr + LINUX_SC_R7_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R8] = DWARF_LOC (sc_addr + LINUX_SC_R8_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R9] = DWARF_LOC (sc_addr + LINUX_SC_R9_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R10] = DWARF_LOC (sc_addr + LINUX_SC_R10_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R11] = DWARF_LOC (sc_addr + LINUX_SC_R11_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R12] = DWARF_LOC (sc_addr + LINUX_SC_R12_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R13] = DWARF_LOC (sc_addr + LINUX_SC_R13_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R14] = DWARF_LOC (sc_addr + LINUX_SC_R14_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R15] = DWARF_LOC (sc_addr + LINUX_SC_R15_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R16] = DWARF_LOC (sc_addr + LINUX_SC_R16_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R17] = DWARF_LOC (sc_addr + LINUX_SC_R17_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R18] = DWARF_LOC (sc_addr + LINUX_SC_R18_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R19] = DWARF_LOC (sc_addr + LINUX_SC_R19_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R20] = DWARF_LOC (sc_addr + LINUX_SC_R20_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R21] = DWARF_LOC (sc_addr + LINUX_SC_R21_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R22] = DWARF_LOC (sc_addr + LINUX_SC_R22_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R23] = DWARF_LOC (sc_addr + LINUX_SC_R23_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R24] = DWARF_LOC (sc_addr + LINUX_SC_R24_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R25] = DWARF_LOC (sc_addr + LINUX_SC_R25_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R26] = DWARF_LOC (sc_addr + LINUX_SC_R26_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R27] = DWARF_LOC (sc_addr + LINUX_SC_R27_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R28] = DWARF_LOC (sc_addr + LINUX_SC_R28_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R29] = DWARF_LOC (sc_addr + LINUX_SC_R29_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R30] = DWARF_LOC (sc_addr + LINUX_SC_R30_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_R31] = DWARF_LOC (sc_addr + LINUX_SC_R31_OFF, 0);
+ c->dwarf.loc[UNW_MIPS_PC] = DWARF_LOC (sc_addr + LINUX_SC_PC_OFF, 0);
+
+ /* Set SP/CFA and PC/IP. */
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_MIPS_R29], &c->dwarf.cfa);
+
+ if ((ret = dwarf_get(&c->dwarf, DWARF_LOC(sc_addr + LINUX_SC_PC_OFF, 0),
+ &c->dwarf.ip)) < 0)
+ return ret;
+
+ if ((ret = dwarf_get(&c->dwarf, DWARF_LOC(sc_addr + LINUX_SC_R31_OFF, 0),
+ &ra)) < 0)
+ return ret;
+ if ((ret = dwarf_get(&c->dwarf, DWARF_LOC(sc_addr + LINUX_SC_R30_OFF, 0),
+ &fp)) < 0)
+ return ret;
+
+ Debug (2, "SH (ip=0x%016llx, ra=0x%016llx, sp=0x%016llx, fp=0x%016llx)\n",
+ (unsigned long long)c->dwarf.ip, (unsigned long long)ra,
+ (unsigned long long)c->dwarf.cfa, (unsigned long long)fp);
+
+ c->dwarf.pi_valid = 0;
+ c->dwarf.use_prev_instr = 0;
+
+ return 1;
+}
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ ret = mips_handle_signal_frame (cursor);
+ if (ret < 0)
+ /* Not a signal frame, try DWARF-based unwinding. */
+ ret = dwarf_step (&c->dwarf);
+
+ if (unlikely (ret == -UNW_ESTOPUNWIND))
+ return ret;
+
+ /* Dwarf unwinding didn't work, stop. */
+ if (unlikely (ret < 0))
+ return 0;
+
+ return (c->dwarf.ip == 0) ? 0 : 1;
+}
diff --git a/src/pal/src/libunwind/src/mips/Lapply_reg_state.c b/src/pal/src/libunwind/src/mips/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lcreate_addr_space.c b/src/pal/src/libunwind/src/mips/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lget_proc_info.c b/src/pal/src/libunwind/src/mips/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lget_save_loc.c b/src/pal/src/libunwind/src/mips/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lglobal.c b/src/pal/src/libunwind/src/mips/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Linit.c b/src/pal/src/libunwind/src/mips/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Linit_local.c b/src/pal/src/libunwind/src/mips/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Linit_remote.c b/src/pal/src/libunwind/src/mips/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lis_signal_frame.c b/src/pal/src/libunwind/src/mips/Lis_signal_frame.c
new file mode 100644
index 0000000000..b9a7c4f51a
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lreg_states_iterate.c b/src/pal/src/libunwind/src/mips/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lregs.c b/src/pal/src/libunwind/src/mips/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lresume.c b/src/pal/src/libunwind/src/mips/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/Lstep.c b/src/pal/src/libunwind/src/mips/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/mips/elfxx.c b/src/pal/src/libunwind/src/mips/elfxx.c
new file mode 100644
index 0000000000..07d3d12b94
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/elfxx.c
@@ -0,0 +1,27 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+#include "../src/elfxx.c"
diff --git a/src/pal/src/libunwind/src/mips/gen-offsets.c b/src/pal/src/libunwind/src/mips/gen-offsets.c
new file mode 100644
index 0000000000..448f694532
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/gen-offsets.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stddef.h>
+#include <ucontext.h>
+
+#define UC(N,X) \
+ printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))
+
+#define SC(N,X) \
+ printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))
+
+int
+main (void)
+{
+ printf (
+"/* Linux-specific definitions: */\n\n"
+
+"/* Define various structure offsets to simplify cross-compilation. */\n\n"
+
+"/* Offsets for MIPS Linux \"ucontext_t\": */\n\n");
+
+ UC ("FLAGS", uc_flags);
+ UC ("LINK", uc_link);
+ UC ("STACK", uc_stack);
+ UC ("MCONTEXT", uc_mcontext);
+ UC ("SIGMASK", uc_sigmask);
+
+ UC ("MCONTEXT_GREGS", uc_mcontext.gregs);
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/mips/getcontext.S b/src/pal/src/libunwind/src/mips/getcontext.S
new file mode 100644
index 0000000000..d1dbd57932
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/getcontext.S
@@ -0,0 +1,93 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+#include <endian.h>
+
+ .text
+
+#if _MIPS_SIM == _ABIO32
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define OFFSET 4
+# else
+# define OFFSET 0
+# endif
+# define SREG(X) \
+ sw $X, (LINUX_UC_MCONTEXT_GREGS + 8 * X + OFFSET) ($4); \
+ sra $1, $X, 31; \
+ sw $1, (LINUX_UC_MCONTEXT_GREGS + 8 * X + 4 - OFFSET) ($4)
+/* Yes, we save the return address to PC. */
+# define SPC \
+ sw $31, (LINUX_UC_MCONTEXT_PC + OFFSET) ($4); \
+ sra $1, $31, 31; \
+ sw $1, (LINUX_UC_MCONTEXT_PC + 4 - OFFSET) ($4)
+#else
+# define SREG(X) sd $X, (LINUX_UC_MCONTEXT_GREGS + 8 * X) ($4)
+# define SPC sd $31, (LINUX_UC_MCONTEXT_PC) ($4)
+#endif
+
+ .global _Umips_getcontext
+ .type _Umips_getcontext, %function
+ # This is a stub version of getcontext() for MIPS which only stores core
+ # registers.
+_Umips_getcontext:
+ .set noat
+ SREG (1)
+ SREG (0)
+ SREG (2)
+ SREG (3)
+ SREG (4)
+ SREG (5)
+ SREG (6)
+ SREG (7)
+ SREG (8)
+ SREG (9)
+ SREG (10)
+ SREG (11)
+ SREG (12)
+ SREG (13)
+ SREG (14)
+ SREG (15)
+ SREG (16)
+ SREG (17)
+ SREG (18)
+ SREG (19)
+ SREG (20)
+ SREG (21)
+ SREG (22)
+ SREG (23)
+ SREG (24)
+ SREG (25)
+ SREG (26)
+ SREG (27)
+ SREG (28)
+ SREG (29)
+ SREG (30)
+ SREG (31)
+ SPC
+ li $2, 0
+ j $31
+
+ .size _Umips_getcontext, .-_Umips_getcontext
diff --git a/src/pal/src/libunwind/src/mips/init.h b/src/pal/src/libunwind/src/mips/init.h
new file mode 100644
index 0000000000..30c193a18f
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/init.h
@@ -0,0 +1,59 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret, i;
+
+ for (i = 0; i < 32; i++)
+ c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, UNW_MIPS_R0 + i);
+ for (i = 32; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ c->dwarf.loc[UNW_MIPS_PC] = DWARF_REG_LOC (&c->dwarf, UNW_MIPS_PC);
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_MIPS_PC], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_MIPS_R29),
+ &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ /* FIXME: Initialisation for other registers. */
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/mips/is_fpreg.c b/src/pal/src/libunwind/src/mips/is_fpreg.c
new file mode 100644
index 0000000000..a92dd5ece7
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/is_fpreg.c
@@ -0,0 +1,35 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+/* FIXME: I'm not sure if libunwind's GP/FP register distinction is very useful
+ on MIPS. */
+
+int
+unw_is_fpreg (int regnum)
+{
+ /* FIXME: Support FP. */
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/mips/offsets.h b/src/pal/src/libunwind/src/mips/offsets.h
new file mode 100644
index 0000000000..b506051367
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/offsets.h
@@ -0,0 +1,86 @@
+/* Linux-specific definitions: */
+
+/* Define various structure offsets to simplify cross-compilation. */
+
+/* FIXME: Currently these are only used in getcontext.S, which is only used
+ for a local unwinder, so we can use the compile-time ABI. At a later date
+ we will want all three here, to use for signal handlers. Also, because
+ of the three ABIs, gen-offsets.c can not quite generate this file. */
+
+/* Offsets for MIPS Linux "ucontext_t": */
+
+/* First 24 bytes in sigframe are argument save space and padding for
+what used to be signal trampolines. Ref: arch/mips/kernel/signal.c */
+#define LINUX_SF_TRAMP_SIZE 0x18
+
+#if _MIPS_SIM == _ABIO32
+
+# define LINUX_UC_FLAGS_OFF 0x0
+# define LINUX_UC_LINK_OFF 0x4
+# define LINUX_UC_STACK_OFF 0x8
+# define LINUX_UC_MCONTEXT_OFF 0x18
+# define LINUX_UC_SIGMASK_OFF 0x268
+# define LINUX_UC_MCONTEXT_PC 0x20
+# define LINUX_UC_MCONTEXT_GREGS 0x28
+
+#elif _MIPS_SIM == _ABIN32
+
+# define LINUX_UC_FLAGS_OFF 0x0
+# define LINUX_UC_LINK_OFF 0x4
+# define LINUX_UC_STACK_OFF 0x8
+# define LINUX_UC_MCONTEXT_OFF 0x18
+# define LINUX_UC_SIGMASK_OFF 0x270
+# define LINUX_UC_MCONTEXT_PC 0x258
+# define LINUX_UC_MCONTEXT_GREGS 0x18
+
+#elif _MIPS_SIM == _ABI64
+
+# define LINUX_UC_FLAGS_OFF 0x0
+# define LINUX_UC_LINK_OFF 0x8
+# define LINUX_UC_STACK_OFF 0x10
+# define LINUX_UC_MCONTEXT_OFF 0x28
+# define LINUX_UC_SIGMASK_OFF 0x280
+# define LINUX_UC_MCONTEXT_PC 0x268
+# define LINUX_UC_MCONTEXT_GREGS 0x28
+
+#else
+
+#error Unsupported ABI
+
+#endif
+
+#define LINUX_SC_R0_OFF (LINUX_UC_MCONTEXT_GREGS - LINUX_UC_MCONTEXT_OFF)
+#define LINUX_SC_R1_OFF (LINUX_SC_R0_OFF + 1*8)
+#define LINUX_SC_R2_OFF (LINUX_SC_R0_OFF + 2*8)
+#define LINUX_SC_R3_OFF (LINUX_SC_R0_OFF + 3*8)
+#define LINUX_SC_R4_OFF (LINUX_SC_R0_OFF + 4*8)
+#define LINUX_SC_R5_OFF (LINUX_SC_R0_OFF + 5*8)
+#define LINUX_SC_R6_OFF (LINUX_SC_R0_OFF + 6*8)
+#define LINUX_SC_R7_OFF (LINUX_SC_R0_OFF + 7*8)
+#define LINUX_SC_R8_OFF (LINUX_SC_R0_OFF + 8*8)
+#define LINUX_SC_R9_OFF (LINUX_SC_R0_OFF + 9*8)
+#define LINUX_SC_R10_OFF (LINUX_SC_R0_OFF + 10*8)
+#define LINUX_SC_R11_OFF (LINUX_SC_R0_OFF + 11*8)
+#define LINUX_SC_R12_OFF (LINUX_SC_R0_OFF + 12*8)
+#define LINUX_SC_R13_OFF (LINUX_SC_R0_OFF + 13*8)
+#define LINUX_SC_R14_OFF (LINUX_SC_R0_OFF + 14*8)
+#define LINUX_SC_R15_OFF (LINUX_SC_R0_OFF + 15*8)
+#define LINUX_SC_R16_OFF (LINUX_SC_R0_OFF + 16*8)
+#define LINUX_SC_R17_OFF (LINUX_SC_R0_OFF + 17*8)
+#define LINUX_SC_R18_OFF (LINUX_SC_R0_OFF + 18*8)
+#define LINUX_SC_R19_OFF (LINUX_SC_R0_OFF + 19*8)
+#define LINUX_SC_R20_OFF (LINUX_SC_R0_OFF + 20*8)
+#define LINUX_SC_R21_OFF (LINUX_SC_R0_OFF + 21*8)
+#define LINUX_SC_R22_OFF (LINUX_SC_R0_OFF + 22*8)
+#define LINUX_SC_R23_OFF (LINUX_SC_R0_OFF + 23*8)
+#define LINUX_SC_R24_OFF (LINUX_SC_R0_OFF + 24*8)
+#define LINUX_SC_R25_OFF (LINUX_SC_R0_OFF + 25*8)
+#define LINUX_SC_R26_OFF (LINUX_SC_R0_OFF + 26*8)
+#define LINUX_SC_R27_OFF (LINUX_SC_R0_OFF + 27*8)
+#define LINUX_SC_R28_OFF (LINUX_SC_R0_OFF + 28*8)
+#define LINUX_SC_R29_OFF (LINUX_SC_R0_OFF + 29*8)
+#define LINUX_SC_R30_OFF (LINUX_SC_R0_OFF + 30*8)
+#define LINUX_SC_R31_OFF (LINUX_SC_R0_OFF + 31*8)
+
+#define LINUX_SC_SP_OFF LINUX_SC_R29_OFF
+#define LINUX_SC_PC_OFF (LINUX_UC_MCONTEXT_PC - LINUX_UC_MCONTEXT_OFF)
diff --git a/src/pal/src/libunwind/src/mips/regname.c b/src/pal/src/libunwind/src/mips/regname.c
new file mode 100644
index 0000000000..b137b972b6
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/regname.c
@@ -0,0 +1,48 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ /* 0. */
+ "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7",
+ /* 8. */
+ "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",
+ /* 16. */
+ "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",
+ /* 24. */
+ "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31",
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else if (reg == UNW_MIPS_PC)
+ return "pc";
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/mips/siglongjmp.S b/src/pal/src/libunwind/src/mips/siglongjmp.S
new file mode 100644
index 0000000000..9cbcf3dc01
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/siglongjmp.S
@@ -0,0 +1,8 @@
+ /* Dummy implementation for now. */
+
+ .globl _UI_siglongjmp_cont
+ .globl _UI_longjmp_cont
+
+_UI_siglongjmp_cont:
+_UI_longjmp_cont:
+ j $31
diff --git a/src/pal/src/libunwind/src/mips/unwind_i.h b/src/pal/src/libunwind/src/mips/unwind_i.h
new file mode 100644
index 0000000000..3382dcfe58
--- /dev/null
+++ b/src/pal/src/libunwind/src/mips/unwind_i.h
@@ -0,0 +1,43 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <stdint.h>
+
+#include <libunwind-mips.h>
+
+#include "libunwind_i.h"
+
+#define mips_lock UNW_OBJ(lock)
+#define mips_local_resume UNW_OBJ(local_resume)
+#define mips_local_addr_space_init UNW_OBJ(local_addr_space_init)
+
+extern int mips_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+
+extern void mips_local_addr_space_init (void);
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/os-freebsd.c b/src/pal/src/libunwind/src/os-freebsd.c
new file mode 100644
index 0000000000..753e819dfe
--- /dev/null
+++ b/src/pal/src/libunwind/src/os-freebsd.c
@@ -0,0 +1,166 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include "libunwind_i.h"
+
+static void *
+get_mem(size_t sz)
+{
+ void *res;
+
+ res = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
+ if (res == MAP_FAILED)
+ return (NULL);
+ return (res);
+}
+
+static void
+free_mem(void *ptr, size_t sz)
+{
+ munmap(ptr, sz);
+}
+
+static int
+get_pid_by_tid(int tid)
+{
+ int mib[3], error;
+ size_t len, len1;
+ char *buf;
+ struct kinfo_proc *kv;
+ unsigned i, pid;
+
+ len = 0;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_ALL;
+
+ error = sysctl(mib, 3, NULL, &len, NULL, 0);
+ if (error == -1)
+ return (-1);
+ len1 = len * 4 / 3;
+ buf = get_mem(len1);
+ if (buf == NULL)
+ return (-1);
+ len = len1;
+ error = sysctl(mib, 3, buf, &len, NULL, 0);
+ if (error == -1) {
+ free_mem(buf, len1);
+ return (-1);
+ }
+ pid = -1;
+ for (i = 0, kv = (struct kinfo_proc *)buf; i < len / sizeof(*kv);
+ i++, kv++) {
+ if (kv->ki_tid == tid) {
+ pid = kv->ki_pid;
+ break;
+ }
+ }
+ free_mem(buf, len1);
+ return (pid);
+}
+
+int
+tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen)
+{
+ int mib[4], error, ret;
+ size_t len, len1;
+ char *buf, *bp, *eb;
+ struct kinfo_vmentry *kv;
+
+ len = 0;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_VMMAP;
+ mib[3] = pid;
+
+ error = sysctl(mib, 4, NULL, &len, NULL, 0);
+ if (error == -1) {
+ if (errno == ESRCH) {
+ mib[3] = get_pid_by_tid(pid);
+ if (mib[3] != -1)
+ error = sysctl(mib, 4, NULL, &len, NULL, 0);
+ if (error == -1)
+ return (-UNW_EUNSPEC);
+ } else
+ return (-UNW_EUNSPEC);
+ }
+ len1 = len * 4 / 3;
+ buf = get_mem(len1);
+ if (buf == NULL)
+ return (-UNW_EUNSPEC);
+ len = len1;
+ error = sysctl(mib, 4, buf, &len, NULL, 0);
+ if (error == -1) {
+ free_mem(buf, len1);
+ return (-UNW_EUNSPEC);
+ }
+ ret = -UNW_EUNSPEC;
+ for (bp = buf, eb = buf + len; bp < eb; bp += kv->kve_structsize) {
+ kv = (struct kinfo_vmentry *)(uintptr_t)bp;
+ if (ip < kv->kve_start || ip >= kv->kve_end)
+ continue;
+ if (kv->kve_type != KVME_TYPE_VNODE)
+ continue;
+ *segbase = kv->kve_start;
+ *mapoff = kv->kve_offset;
+ if (path)
+ {
+ strncpy(path, kv->kve_path, pathlen);
+ }
+ ret = elf_map_image (ei, kv->kve_path);
+ break;
+ }
+ free_mem(buf, len1);
+ return (ret);
+}
+
+#ifndef UNW_REMOTE_ONLY
+
+void
+tdep_get_exe_image_path (char *path)
+{
+ int mib[4], error;
+ size_t len;
+
+ len = 0;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PATHNAME;
+ mib[3] = getpid();
+
+ error = sysctl(mib, 4, path, &len, NULL, 0);
+ if (error == -1)
+ path[0] = 0;
+}
+
+#endif
diff --git a/src/pal/src/libunwind/src/os-hpux.c b/src/pal/src/libunwind/src/os-hpux.c
new file mode 100644
index 0000000000..48bfb05cf5
--- /dev/null
+++ b/src/pal/src/libunwind/src/os-hpux.c
@@ -0,0 +1,78 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <dlfcn.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "libunwind_i.h"
+
+#include "elf64.h"
+
+HIDDEN int
+tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen)
+{
+ struct load_module_desc lmd;
+ const char *path2;
+
+ if (pid != getpid ())
+ {
+ printf ("%s: remote case not implemented yet\n", __FUNCTION__);
+ return -UNW_ENOINFO;
+ }
+
+ if (!dlmodinfo (ip, &lmd, sizeof (lmd), NULL, 0, 0))
+ return -UNW_ENOINFO;
+
+ *segbase = lmd.text_base;
+ *mapoff = 0; /* XXX fix me? */
+
+ path2 = dlgetname (&lmd, sizeof (lmd), NULL, 0, 0);
+ if (!path2)
+ return -UNW_ENOINFO;
+ if (path)
+ {
+ strncpy(path, path2, pathlen);
+ path[pathlen - 1] = '\0';
+ if (strcmp(path, path2) != 0)
+ Debug(1, "buffer size (%d) not big enough to hold path\n", pathlen);
+ }
+ Debug(1, "segbase=%lx, mapoff=%lx, path=%s\n", *segbase, *mapoff, path);
+
+ return elf_map_image (ei, path);
+}
+
+#ifndef UNW_REMOTE_ONLY
+
+void
+tdep_get_exe_image_path (char *path)
+{
+ path[0] = 0; /* XXX */
+}
+
+#endif
+
diff --git a/src/pal/src/libunwind/src/os-linux.c b/src/pal/src/libunwind/src/os-linux.c
new file mode 100644
index 0000000000..8a00669fb3
--- /dev/null
+++ b/src/pal/src/libunwind/src/os-linux.c
@@ -0,0 +1,73 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <limits.h>
+#include <stdio.h>
+
+#include "libunwind_i.h"
+#include "os-linux.h"
+
+int
+tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen)
+{
+ struct map_iterator mi;
+ int found = 0, rc;
+ unsigned long hi;
+
+ if (maps_init (&mi, pid) < 0)
+ return -1;
+
+ while (maps_next (&mi, segbase, &hi, mapoff))
+ if (ip >= *segbase && ip < hi)
+ {
+ found = 1;
+ break;
+ }
+
+ if (!found)
+ {
+ maps_close (&mi);
+ return -1;
+ }
+ if (path)
+ {
+ strncpy(path, mi.path, pathlen);
+ }
+ rc = elf_map_image (ei, mi.path);
+ maps_close (&mi);
+ return rc;
+}
+
+#ifndef UNW_REMOTE_ONLY
+
+void
+tdep_get_exe_image_path (char *path)
+{
+ strcpy(path, "/proc/self/exe");
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/os-linux.h b/src/pal/src/libunwind/src/os-linux.h
new file mode 100644
index 0000000000..3976b38cc2
--- /dev/null
+++ b/src/pal/src/libunwind/src/os-linux.h
@@ -0,0 +1,297 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef os_linux_h
+#define os_linux_h
+
+struct map_iterator
+ {
+ off_t offset;
+ int fd;
+ size_t buf_size;
+ char *buf;
+ char *buf_end;
+ char *path;
+ };
+
+static inline char *
+ltoa (char *buf, long val)
+{
+ char *cp = buf, tmp;
+ ssize_t i, len;
+
+ do
+ {
+ *cp++ = '0' + (val % 10);
+ val /= 10;
+ }
+ while (val);
+
+ /* reverse the order of the digits: */
+ len = cp - buf;
+ --cp;
+ for (i = 0; i < len / 2; ++i)
+ {
+ tmp = buf[i];
+ buf[i] = cp[-i];
+ cp[-i] = tmp;
+ }
+ return buf + len;
+}
+
+static inline int
+maps_init (struct map_iterator *mi, pid_t pid)
+{
+ char path[sizeof ("/proc/0123456789/maps")], *cp;
+
+ memcpy (path, "/proc/", 6);
+ cp = ltoa (path + 6, pid);
+ assert (cp + 6 < path + sizeof (path));
+ memcpy (cp, "/maps", 6);
+
+ mi->fd = open (path, O_RDONLY);
+ if (mi->fd >= 0)
+ {
+ /* Try to allocate a page-sized buffer. */
+ mi->buf_size = getpagesize ();
+ cp = mmap (NULL, mi->buf_size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (cp == MAP_FAILED)
+ {
+ close(mi->fd);
+ mi->fd = -1;
+ return -1;
+ }
+ else
+ {
+ mi->offset = 0;
+ mi->buf = mi->buf_end = cp + mi->buf_size;
+ return 0;
+ }
+ }
+ return -1;
+}
+
+static inline char *
+skip_whitespace (char *cp)
+{
+ if (!cp)
+ return NULL;
+
+ while (*cp == ' ' || *cp == '\t')
+ ++cp;
+ return cp;
+}
+
+static inline char *
+scan_hex (char *cp, unsigned long *valp)
+{
+ unsigned long num_digits = 0, digit, val = 0;
+
+ cp = skip_whitespace (cp);
+ if (!cp)
+ return NULL;
+
+ while (1)
+ {
+ digit = *cp;
+ if ((digit - '0') <= 9)
+ digit -= '0';
+ else if ((digit - 'a') < 6)
+ digit -= 'a' - 10;
+ else if ((digit - 'A') < 6)
+ digit -= 'A' - 10;
+ else
+ break;
+ val = (val << 4) | digit;
+ ++num_digits;
+ ++cp;
+ }
+ if (!num_digits)
+ return NULL;
+ *valp = val;
+ return cp;
+}
+
+static inline char *
+scan_dec (char *cp, unsigned long *valp)
+{
+ unsigned long num_digits = 0, digit, val = 0;
+
+ if (!(cp = skip_whitespace (cp)))
+ return NULL;
+
+ while (1)
+ {
+ digit = *cp;
+ if ((digit - '0') <= 9)
+ {
+ digit -= '0';
+ ++cp;
+ }
+ else
+ break;
+ val = (10 * val) + digit;
+ ++num_digits;
+ }
+ if (!num_digits)
+ return NULL;
+ *valp = val;
+ return cp;
+}
+
+static inline char *
+scan_char (char *cp, char *valp)
+{
+ if (!cp)
+ return NULL;
+
+ *valp = *cp;
+
+ /* don't step over NUL terminator */
+ if (*cp)
+ ++cp;
+ return cp;
+}
+
+/* Scan a string delimited by white-space. Fails on empty string or
+ if string is doesn't fit in the specified buffer. */
+static inline char *
+scan_string (char *cp, char *valp, size_t buf_size)
+{
+ size_t i = 0;
+
+ if (!(cp = skip_whitespace (cp)))
+ return NULL;
+
+ while (*cp != ' ' && *cp != '\t' && *cp != '\0')
+ {
+ if ((valp != NULL) && (i < buf_size - 1))
+ valp[i++] = *cp;
+ ++cp;
+ }
+ if (i == 0 || i >= buf_size)
+ return NULL;
+ valp[i] = '\0';
+ return cp;
+}
+
+static inline int
+maps_next (struct map_iterator *mi,
+ unsigned long *low, unsigned long *high, unsigned long *offset)
+{
+ char perm[16], dash = 0, colon = 0, *cp;
+ unsigned long major, minor, inum;
+ ssize_t i, nread;
+
+ if (mi->fd < 0)
+ return 0;
+
+ while (1)
+ {
+ ssize_t bytes_left = mi->buf_end - mi->buf;
+ char *eol = NULL;
+
+ for (i = 0; i < bytes_left; ++i)
+ {
+ if (mi->buf[i] == '\n')
+ {
+ eol = mi->buf + i;
+ break;
+ }
+ else if (mi->buf[i] == '\0')
+ break;
+ }
+ if (!eol)
+ {
+ /* copy down the remaining bytes, if any */
+ if (bytes_left > 0)
+ memmove (mi->buf_end - mi->buf_size, mi->buf, bytes_left);
+
+ mi->buf = mi->buf_end - mi->buf_size;
+ nread = read (mi->fd, mi->buf + bytes_left,
+ mi->buf_size - bytes_left);
+ if (nread <= 0)
+ return 0;
+ else if ((size_t) (nread + bytes_left) < mi->buf_size)
+ {
+ /* Move contents to the end of the buffer so we
+ maintain the invariant that all bytes between
+ mi->buf and mi->buf_end are valid. */
+ memmove (mi->buf_end - nread - bytes_left, mi->buf,
+ nread + bytes_left);
+ mi->buf = mi->buf_end - nread - bytes_left;
+ }
+
+ eol = mi->buf + bytes_left + nread - 1;
+
+ for (i = bytes_left; i < bytes_left + nread; ++i)
+ if (mi->buf[i] == '\n')
+ {
+ eol = mi->buf + i;
+ break;
+ }
+ }
+ cp = mi->buf;
+ mi->buf = eol + 1;
+ *eol = '\0';
+
+ /* scan: "LOW-HIGH PERM OFFSET MAJOR:MINOR INUM PATH" */
+ cp = scan_hex (cp, low);
+ cp = scan_char (cp, &dash);
+ cp = scan_hex (cp, high);
+ cp = scan_string (cp, perm, sizeof (perm));
+ cp = scan_hex (cp, offset);
+ cp = scan_hex (cp, &major);
+ cp = scan_char (cp, &colon);
+ cp = scan_hex (cp, &minor);
+ cp = scan_dec (cp, &inum);
+ cp = mi->path = skip_whitespace (cp);
+ if (!cp)
+ continue;
+ cp = scan_string (cp, NULL, 0);
+ if (dash != '-' || colon != ':')
+ continue; /* skip line with unknown or bad format */
+ return 1;
+ }
+ return 0;
+}
+
+static inline void
+maps_close (struct map_iterator *mi)
+{
+ if (mi->fd < 0)
+ return;
+ close (mi->fd);
+ mi->fd = -1;
+ if (mi->buf)
+ {
+ munmap (mi->buf_end - mi->buf_size, mi->buf_size);
+ mi->buf = mi->buf_end = NULL;
+ }
+}
+
+#endif /* os_linux_h */
diff --git a/src/pal/src/libunwind/src/os-qnx.c b/src/pal/src/libunwind/src/os-qnx.c
new file mode 100644
index 0000000000..4a76c7cda4
--- /dev/null
+++ b/src/pal/src/libunwind/src/os-qnx.c
@@ -0,0 +1,117 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2013 Garmin International
+ Contributed by Matt Fischer <matt.fischer@garmin.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <string.h>
+
+#include "libunwind_i.h"
+
+struct cb_info
+{
+ unw_word_t ip;
+ unsigned long segbase;
+ unsigned long offset;
+ const char *path;
+};
+
+static int callback(const struct dl_phdr_info *info, size_t size, void *data)
+{
+ int i;
+ struct cb_info *cbi = (struct cb_info*)data;
+ for(i=0; i<info->dlpi_phnum; i++) {
+ int segbase = info->dlpi_addr + info->dlpi_phdr[i].p_vaddr;
+ if(cbi->ip >= segbase && cbi->ip < segbase + info->dlpi_phdr[i].p_memsz)
+ {
+ cbi->path = info->dlpi_name;
+ cbi->offset = info->dlpi_phdr[i].p_offset;
+ cbi->segbase = segbase;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int
+tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
+ unsigned long *segbase, unsigned long *mapoff,
+ char *path, size_t pathlen)
+{
+ struct cb_info cbi;
+ int ret = -1;
+ cbi.ip = ip;
+ cbi.segbase = 0;
+ cbi.offset = 0;
+ cbi.path = NULL;
+
+ /* QNX's support for accessing symbol maps is severely broken. There is
+ a devctl() call that can be made on a proc node (DCMD_PROC_MAPDEBUG)
+ which returns information similar to Linux's /proc/<pid>/maps
+ node, however the filename that is returned by this call is not an
+ absolute path, and there is no foolproof way to map the filename
+ back to the file that it came from.
+
+ Therefore, the normal approach for implementing this function,
+ which works equally well for both local and remote unwinding,
+ will not work here. The only type of image lookup which works
+ reliably is locally, using dl_iterate_phdr(). However, the only
+ time that this function is required to look up a remote image is for
+ ptrace support, which doesn't work on QNX anyway. Local unwinding,
+ which is the main case that makes use of this function, will work
+ fine with dl_iterate_phdr(). Therefore, in lieu of any better
+ platform support for remote image lookup, this function has just
+ been implemented in terms of dl_iterate_phdr().
+ */
+
+ if (pid != getpid())
+ {
+ /* Return an error if an attempt is made to perform remote image lookup */
+ return -1;
+ }
+
+ if (dl_iterate_phdr (callback, &cbi) != 0)
+ {
+ if (path)
+ {
+ strncpy (path, cbi.path, pathlen);
+ }
+
+ *mapoff = cbi.offset;
+ *segbase = cbi.segbase;
+
+ ret = elf_map_image (ei, cbi.path);
+ }
+
+ return ret;
+}
+
+#ifndef UNW_REMOTE_ONLY
+
+void
+tdep_get_exe_image_path (char *path)
+{
+ path[0] = 0; /* XXX */
+}
+
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/Gapply_reg_state.c b/src/pal/src/libunwind/src/ppc/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/ppc/Gget_proc_info.c b/src/pal/src/libunwind/src/ppc/Gget_proc_info.c
new file mode 100644
index 0000000000..7dfb6d4e42
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Gget_proc_info.c
@@ -0,0 +1,41 @@
+/* libunwind - a platform-independent unwind library
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <libunwind_i.h>
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ ret = dwarf_make_proc_info (&c->dwarf);
+ if (ret < 0)
+ return ret;
+
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ppc/Gget_save_loc.c b/src/pal/src/libunwind/src/ppc/Gget_save_loc.c
new file mode 100644
index 0000000000..5343fa4c7f
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Gget_save_loc.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <libunwind_i.h>
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ppc/Ginit_local.c b/src/pal/src/libunwind/src/ppc/Ginit_local.c
new file mode 100644
index 0000000000..366cf5bdaf
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Ginit_local.c
@@ -0,0 +1,88 @@
+/* libunwind - a platform-independent unwind library
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <libunwind_i.h>
+
+#ifdef UNW_TARGET_PPC64
+#include "../ppc64/init.h"
+#else
+#include "../ppc32/init.h"
+#endif
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ /* XXX: empty stub. */
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = uc;
+ #ifdef UNW_TARGET_PPC64
+ return common_init_ppc64 (c, use_prev_instr);
+ #else
+ return common_init_ppc32 (c, use_prev_instr);
+ #endif
+}
+
+int
+unw_init_local(unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/ppc/Ginit_remote.c b/src/pal/src/libunwind/src/ppc/Ginit_remote.c
new file mode 100644
index 0000000000..ed85be8971
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Ginit_remote.c
@@ -0,0 +1,60 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <libunwind_i.h>
+
+#ifdef UNW_TARGET_PPC64
+#include "../ppc64/init.h"
+#else
+#include "../ppc32/init.h"
+#endif
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+
+ #ifdef UNW_TARGET_PPC64
+ return common_init_ppc64 (c, 0);
+ #elif UNW_TARGET_PPC32
+ return common_init_ppc32 (c, 0);
+ #else
+ #error init_remote :: NO VALID PPC ARCH!
+ #endif
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/ppc/Gis_signal_frame.c b/src/pal/src/libunwind/src/ppc/Gis_signal_frame.c
new file mode 100644
index 0000000000..6184dd5d41
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Gis_signal_frame.c
@@ -0,0 +1,78 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <libunwind_i.h>
+
+int
+unw_is_signal_frame (unw_cursor_t * cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, w1, i0, i1, i2, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ as->validate = 1; /* Don't trust the ip */
+ arg = c->dwarf.as_arg;
+
+ /* Check if return address points at sigreturn sequence.
+ on ppc64 Linux that is (see libc.so):
+ 0x38210080 addi r1, r1, 128 // pop the stack
+ 0x380000ac li r0, 172 // invoke system service 172
+ 0x44000002 sc
+ */
+
+ ip = c->dwarf.ip;
+ if (ip == 0)
+ return 0;
+
+ /* Read up two 8-byte words at the IP. We are only looking at 3
+ consecutive 32-bit words, so the second 8-byte word needs to be
+ shifted right by 32 bits (think big-endian) */
+
+ a = unw_get_accessors_int (as);
+ if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0
+ || (ret = (*a->access_mem) (as, ip + 8, &w1, 0, arg)) < 0)
+ return 0;
+
+ if (tdep_big_endian (as))
+ {
+ i0 = w0 >> 32;
+ i1 = w0 & 0xffffffffUL;
+ i2 = w1 >> 32;
+ }
+ else
+ {
+ i0 = w0 & 0xffffffffUL;
+ i1 = w0 >> 32;
+ i2 = w1 & 0xffffffffUL;
+ }
+
+ return (i0 == 0x38210080 && i1 == 0x380000ac && i2 == 0x44000002);
+}
diff --git a/src/pal/src/libunwind/src/ppc/Greg_states_iterate.c b/src/pal/src/libunwind/src/ppc/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/ppc/Lapply_reg_state.c b/src/pal/src/libunwind/src/ppc/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/Lget_proc_info.c b/src/pal/src/libunwind/src/ppc/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/Lget_save_loc.c b/src/pal/src/libunwind/src/ppc/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/Linit_local.c b/src/pal/src/libunwind/src/ppc/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/Linit_remote.c b/src/pal/src/libunwind/src/ppc/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/Lis_signal_frame.c b/src/pal/src/libunwind/src/ppc/Lis_signal_frame.c
new file mode 100644
index 0000000000..b9a7c4f51a
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/Lreg_states_iterate.c b/src/pal/src/libunwind/src/ppc/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/longjmp.S b/src/pal/src/libunwind/src/ppc/longjmp.S
new file mode 100644
index 0000000000..d363aef222
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/longjmp.S
@@ -0,0 +1,36 @@
+/* libunwind - a platform-independent unwind library
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .globl _UI_longjmp_cont
+
+ .type _UI_longjmp_cont, @function
+_UI_longjmp_cont:
+ .size _UI_longjmp_cont, .-_UI_longjmp_cont
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ppc/siglongjmp.S b/src/pal/src/libunwind/src/ppc/siglongjmp.S
new file mode 100644
index 0000000000..64be36ce17
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc/siglongjmp.S
@@ -0,0 +1,31 @@
+/* libunwind - a platform-independent unwind library
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .globl _UI_siglongjmp_cont
+
+ _UI_siglongjmp_cont:
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Gapply_reg_state.c b/src/pal/src/libunwind/src/ppc32/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/ppc32/Gcreate_addr_space.c b/src/pal/src/libunwind/src/ppc32/Gcreate_addr_space.c
new file mode 100644
index 0000000000..aaa68bb354
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Gcreate_addr_space.c
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include <libunwind_i.h>
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * We support only big-endian on Linux ppc32.
+ */
+ if (byte_order != 0 && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/ppc32/Gglobal.c b/src/pal/src/libunwind/src/ppc32/Gglobal.c
new file mode 100644
index 0000000000..a0f80beec6
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Gglobal.c
@@ -0,0 +1,135 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (ppc32_lock);
+HIDDEN int tdep_init_done;
+
+/* The API register numbers are exactly the same as the .eh_frame
+ registers, for now at least. */
+HIDDEN const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] =
+ {
+ [UNW_PPC32_R0]=UNW_PPC32_R0,
+ [UNW_PPC32_R1]=UNW_PPC32_R1,
+ [UNW_PPC32_R2]=UNW_PPC32_R2,
+ [UNW_PPC32_R3]=UNW_PPC32_R3,
+ [UNW_PPC32_R4]=UNW_PPC32_R4,
+ [UNW_PPC32_R5]=UNW_PPC32_R5,
+ [UNW_PPC32_R6]=UNW_PPC32_R6,
+ [UNW_PPC32_R7]=UNW_PPC32_R7,
+ [UNW_PPC32_R8]=UNW_PPC32_R8,
+ [UNW_PPC32_R9]=UNW_PPC32_R9,
+ [UNW_PPC32_R10]=UNW_PPC32_R10,
+ [UNW_PPC32_R11]=UNW_PPC32_R11,
+ [UNW_PPC32_R12]=UNW_PPC32_R12,
+ [UNW_PPC32_R13]=UNW_PPC32_R13,
+ [UNW_PPC32_R14]=UNW_PPC32_R14,
+ [UNW_PPC32_R15]=UNW_PPC32_R15,
+ [UNW_PPC32_R16]=UNW_PPC32_R16,
+ [UNW_PPC32_R17]=UNW_PPC32_R17,
+ [UNW_PPC32_R18]=UNW_PPC32_R18,
+ [UNW_PPC32_R19]=UNW_PPC32_R19,
+ [UNW_PPC32_R20]=UNW_PPC32_R20,
+ [UNW_PPC32_R21]=UNW_PPC32_R21,
+ [UNW_PPC32_R22]=UNW_PPC32_R22,
+ [UNW_PPC32_R23]=UNW_PPC32_R23,
+ [UNW_PPC32_R24]=UNW_PPC32_R24,
+ [UNW_PPC32_R25]=UNW_PPC32_R25,
+ [UNW_PPC32_R26]=UNW_PPC32_R26,
+ [UNW_PPC32_R27]=UNW_PPC32_R27,
+ [UNW_PPC32_R28]=UNW_PPC32_R28,
+ [UNW_PPC32_R29]=UNW_PPC32_R29,
+ [UNW_PPC32_R30]=UNW_PPC32_R30,
+ [UNW_PPC32_R31]=UNW_PPC32_R31,
+
+ [UNW_PPC32_CTR]=UNW_PPC32_CTR,
+ [UNW_PPC32_XER]=UNW_PPC32_XER,
+ [UNW_PPC32_CCR]=UNW_PPC32_CCR,
+ [UNW_PPC32_LR]=UNW_PPC32_LR,
+ [UNW_PPC32_FPSCR]=UNW_PPC32_FPSCR,
+
+ [UNW_PPC32_F0]=UNW_PPC32_F0,
+ [UNW_PPC32_F1]=UNW_PPC32_F1,
+ [UNW_PPC32_F2]=UNW_PPC32_F2,
+ [UNW_PPC32_F3]=UNW_PPC32_F3,
+ [UNW_PPC32_F4]=UNW_PPC32_F4,
+ [UNW_PPC32_F5]=UNW_PPC32_F5,
+ [UNW_PPC32_F6]=UNW_PPC32_F6,
+ [UNW_PPC32_F7]=UNW_PPC32_F7,
+ [UNW_PPC32_F8]=UNW_PPC32_F8,
+ [UNW_PPC32_F9]=UNW_PPC32_F9,
+ [UNW_PPC32_F10]=UNW_PPC32_F10,
+ [UNW_PPC32_F11]=UNW_PPC32_F11,
+ [UNW_PPC32_F12]=UNW_PPC32_F12,
+ [UNW_PPC32_F13]=UNW_PPC32_F13,
+ [UNW_PPC32_F14]=UNW_PPC32_F14,
+ [UNW_PPC32_F15]=UNW_PPC32_F15,
+ [UNW_PPC32_F16]=UNW_PPC32_F16,
+ [UNW_PPC32_F17]=UNW_PPC32_F17,
+ [UNW_PPC32_F18]=UNW_PPC32_F18,
+ [UNW_PPC32_F19]=UNW_PPC32_F19,
+ [UNW_PPC32_F20]=UNW_PPC32_F20,
+ [UNW_PPC32_F21]=UNW_PPC32_F21,
+ [UNW_PPC32_F22]=UNW_PPC32_F22,
+ [UNW_PPC32_F23]=UNW_PPC32_F23,
+ [UNW_PPC32_F24]=UNW_PPC32_F24,
+ [UNW_PPC32_F25]=UNW_PPC32_F25,
+ [UNW_PPC32_F26]=UNW_PPC32_F26,
+ [UNW_PPC32_F27]=UNW_PPC32_F27,
+ [UNW_PPC32_F28]=UNW_PPC32_F28,
+ [UNW_PPC32_F29]=UNW_PPC32_F29,
+ [UNW_PPC32_F30]=UNW_PPC32_F30,
+ [UNW_PPC32_F31]=UNW_PPC32_F31,
+};
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&ppc32_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ ppc32_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&ppc32_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/ppc32/Ginit.c b/src/pal/src/libunwind/src/ppc32/Ginit.c
new file mode 100644
index 0000000000..ba302448a3
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Ginit.c
@@ -0,0 +1,216 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "ucontext_i.h"
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+static void *
+uc_addr (ucontext_t *uc, int reg)
+{
+ void *addr;
+
+ if ((unsigned) (reg - UNW_PPC32_R0) < 32)
+ addr = &uc->uc_mcontext.uc_regs->gregs[reg - UNW_PPC32_R0];
+
+ else
+ if ( ((unsigned) (reg - UNW_PPC32_F0) < 32) &&
+ ((unsigned) (reg - UNW_PPC32_F0) >= 0) )
+ addr = &uc->uc_mcontext.uc_regs->fpregs.fpregs[reg - UNW_PPC32_F0];
+
+ else
+ {
+ unsigned gregs_idx;
+
+ switch (reg)
+ {
+ case UNW_PPC32_CTR:
+ gregs_idx = CTR_IDX;
+ break;
+ case UNW_PPC32_LR:
+ gregs_idx = LINK_IDX;
+ break;
+ case UNW_PPC32_XER:
+ gregs_idx = XER_IDX;
+ break;
+ case UNW_PPC32_CCR:
+ gregs_idx = CCR_IDX;
+ break;
+ default:
+ return NULL;
+ }
+ addr = &uc->uc_mcontext.uc_regs->gregs[gregs_idx];
+ }
+ return addr;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg)
+{
+ return uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (12, "mem[%lx] <- %lx\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "mem[%lx] -> %lx\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
+ int write, void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = arg;
+
+ if ( ((unsigned int) (reg - UNW_PPC32_F0) < 32) &&
+ ((unsigned int) (reg - UNW_PPC32_F0) >= 0))
+ goto badreg;
+
+ addr = uc_addr (uc, reg);
+ if (!addr)
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) addr = *val;
+ Debug (12, "%s <- %lx\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %lx\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = arg;
+ unw_fpreg_t *addr;
+
+ if ((unsigned) (reg - UNW_PPC32_F0) < 0)
+ goto badreg;
+
+ addr = uc_addr (uc, reg);
+ if (!addr)
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %016Lf\n", unw_regname (reg), *val);
+ *(unw_fpreg_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %016Lf\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+ppc32_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = ppc32_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/ppc32/Greg_states_iterate.c b/src/pal/src/libunwind/src/ppc32/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/ppc32/Gregs.c b/src/pal/src/libunwind/src/ppc32/Gregs.c
new file mode 100644
index 0000000000..9344455e6c
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Gregs.c
@@ -0,0 +1,90 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ struct dwarf_loc loc;
+
+ switch (reg)
+ {
+ case UNW_TDEP_IP:
+ if (write)
+ {
+ c->dwarf.ip = *valp; /* update the IP cache */
+ if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip
+ || *valp >= c->dwarf.pi.end_ip))
+ c->dwarf.pi_valid = 0; /* new IP outside of current proc */
+ }
+ else
+ *valp = c->dwarf.ip;
+ return 0;
+
+ case UNW_TDEP_SP:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+
+ default:
+ break;
+ }
+
+ /* make sure it's not an FP or VR register */
+ if ((((unsigned) (reg - UNW_PPC32_F0)) <= 31))
+ return -UNW_EBADREG;
+
+ loc = c->dwarf.loc[reg];
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ struct dwarf_loc loc;
+
+ if ((unsigned) (reg - UNW_PPC32_F0) < 32)
+ {
+ loc = c->dwarf.loc[reg];
+ if (write)
+ return dwarf_putfp (&c->dwarf, loc, *valp);
+ else
+ return dwarf_getfp (&c->dwarf, loc, valp);
+ }
+
+ return -UNW_EBADREG;
+}
+
diff --git a/src/pal/src/libunwind/src/ppc32/Gresume.c b/src/pal/src/libunwind/src/ppc32/Gresume.c
new file mode 100644
index 0000000000..c0f95837b3
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Gresume.c
@@ -0,0 +1,77 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford cjashfor@us.ibm.com
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+#include <sys/syscall.h>
+
+/* sigreturn() is a no-op on x86_64 glibc. */
+
+static NORETURN inline long
+my_rt_sigreturn (void *new_sp)
+{
+ /* XXX: empty stub. */
+ abort ();
+}
+
+HIDDEN inline int
+ppc32_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ /* XXX: empty stub. */
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+/* This routine is responsible for copying the register values in
+ cursor C and establishing them as the current machine state. */
+
+static inline int
+establish_machine_state (struct cursor *c)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if ((ret = establish_machine_state (c)) < 0)
+ return ret;
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/ppc32/Gstep.c b/src/pal/src/libunwind/src/ppc32/Gstep.c
new file mode 100644
index 0000000000..478d3a6c1b
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Gstep.c
@@ -0,0 +1,309 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "ucontext_i.h"
+#include <signal.h>
+
+/* This definition originates in /usr/include/asm-ppc64/ptrace.h, but is
+ defined there only when __KERNEL__ is defined. We reproduce it here for
+ our use at the user level in order to locate the ucontext record, which
+ appears to be at this offset relative to the stack pointer when in the
+ context of the signal handler return trampoline code -
+ __kernel_sigtramp_rt64. */
+#define __SIGNAL_FRAMESIZE 128
+
+/* This definition comes from the document "64-bit PowerPC ELF Application
+ Binary Interface Supplement 1.9", section 3.2.2.
+ http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK */
+
+typedef struct
+{
+ long unsigned back_chain;
+ long unsigned lr_save;
+ /* many more fields here, but they are unused by this code */
+} stack_frame_t;
+
+
+int
+unw_step (unw_cursor_t * cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ stack_frame_t dummy;
+ unw_word_t back_chain_offset, lr_save_offset;
+ struct dwarf_loc back_chain_loc, lr_save_loc, sp_loc, ip_loc;
+ int ret;
+
+ Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->dwarf.ip);
+
+ if (c->dwarf.ip == 0)
+ {
+ /* Unless the cursor or stack is corrupt or uninitialized,
+ we've most likely hit the top of the stack */
+ return 0;
+ }
+
+ /* Try DWARF-based unwinding... */
+
+ ret = dwarf_step (&c->dwarf);
+
+ if (ret < 0 && ret != -UNW_ENOINFO)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ if (unlikely (ret < 0))
+ {
+ if (likely (unw_is_signal_frame (cursor) <= 0))
+ {
+ /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode
+ produces the mandatory level of traceback record in the code, but
+ I get the impression that this is transitory, that eventually gcc
+ will not produce any traceback records at all. So, for now, we
+ won't bother to try to find and use these records.
+
+ We can, however, attempt to unwind the frame by using the callback
+ chain. This is very crude, however, and won't be able to unwind
+ any registers besides the IP, SP, and LR . */
+
+ back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy);
+ lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy);
+
+ back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0);
+
+ if ((ret =
+ dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0)
+ {
+ Debug (2,
+ "Unable to retrieve CFA from back chain in stack frame - %d\n",
+ ret);
+ return ret;
+ }
+ if (c->dwarf.cfa == 0)
+ /* Unless the cursor or stack is corrupt or uninitialized we've most
+ likely hit the top of the stack */
+ return 0;
+
+ lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0);
+
+ if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0)
+ {
+ Debug (2,
+ "Unable to retrieve IP from lr save in stack frame - %d\n",
+ ret);
+ return ret;
+ }
+ ret = 1;
+ }
+ else
+ {
+ /* Find the sigcontext record by taking the CFA and adjusting by
+ the dummy signal frame size.
+
+ Note that there isn't any way to determined if SA_SIGINFO was
+ set in the sa_flags parameter to sigaction when the signal
+ handler was established. If it was not set, the ucontext
+ record is not required to be on the stack, in which case the
+ following code will likely cause a seg fault or other crash
+ condition. */
+
+ unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE;
+
+ Debug (1, "signal frame, skip over trampoline\n");
+
+ c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME;
+ c->sigcontext_addr = ucontext;
+
+ sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
+ ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0);
+
+ ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ /* Instead of just restoring the non-volatile registers, do all
+ of the registers for now. This will incur a performance hit,
+ but it's rare enough not to cause too much of a problem, and
+ might be useful in some cases. */
+ c->dwarf.loc[UNW_PPC32_R0] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0);
+ c->dwarf.loc[UNW_PPC32_R1] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
+ c->dwarf.loc[UNW_PPC32_R2] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0);
+ c->dwarf.loc[UNW_PPC32_R3] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0);
+ c->dwarf.loc[UNW_PPC32_R4] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0);
+ c->dwarf.loc[UNW_PPC32_R5] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0);
+ c->dwarf.loc[UNW_PPC32_R6] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0);
+ c->dwarf.loc[UNW_PPC32_R7] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0);
+ c->dwarf.loc[UNW_PPC32_R8] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0);
+ c->dwarf.loc[UNW_PPC32_R9] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0);
+ c->dwarf.loc[UNW_PPC32_R10] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0);
+ c->dwarf.loc[UNW_PPC32_R11] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0);
+ c->dwarf.loc[UNW_PPC32_R12] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0);
+ c->dwarf.loc[UNW_PPC32_R13] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0);
+ c->dwarf.loc[UNW_PPC32_R14] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0);
+ c->dwarf.loc[UNW_PPC32_R15] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0);
+ c->dwarf.loc[UNW_PPC32_R16] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0);
+ c->dwarf.loc[UNW_PPC32_R17] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0);
+ c->dwarf.loc[UNW_PPC32_R18] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0);
+ c->dwarf.loc[UNW_PPC32_R19] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0);
+ c->dwarf.loc[UNW_PPC32_R20] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0);
+ c->dwarf.loc[UNW_PPC32_R21] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0);
+ c->dwarf.loc[UNW_PPC32_R22] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0);
+ c->dwarf.loc[UNW_PPC32_R23] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0);
+ c->dwarf.loc[UNW_PPC32_R24] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0);
+ c->dwarf.loc[UNW_PPC32_R25] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0);
+ c->dwarf.loc[UNW_PPC32_R26] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0);
+ c->dwarf.loc[UNW_PPC32_R27] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0);
+ c->dwarf.loc[UNW_PPC32_R28] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0);
+ c->dwarf.loc[UNW_PPC32_R29] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0);
+ c->dwarf.loc[UNW_PPC32_R30] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0);
+ c->dwarf.loc[UNW_PPC32_R31] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0);
+
+ c->dwarf.loc[UNW_PPC32_LR] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0);
+ c->dwarf.loc[UNW_PPC32_CTR] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0);
+
+ /* This CR0 assignment is probably wrong. There are 8 dwarf columns
+ assigned to the CR registers, but only one CR register in the
+ mcontext structure */
+ c->dwarf.loc[UNW_PPC32_CCR] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0);
+ c->dwarf.loc[UNW_PPC32_XER] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0);
+
+ c->dwarf.loc[UNW_PPC32_F0] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0);
+ c->dwarf.loc[UNW_PPC32_F1] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0);
+ c->dwarf.loc[UNW_PPC32_F2] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0);
+ c->dwarf.loc[UNW_PPC32_F3] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0);
+ c->dwarf.loc[UNW_PPC32_F4] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0);
+ c->dwarf.loc[UNW_PPC32_F5] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0);
+ c->dwarf.loc[UNW_PPC32_F6] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0);
+ c->dwarf.loc[UNW_PPC32_F7] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0);
+ c->dwarf.loc[UNW_PPC32_F8] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0);
+ c->dwarf.loc[UNW_PPC32_F9] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0);
+ c->dwarf.loc[UNW_PPC32_F10] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0);
+ c->dwarf.loc[UNW_PPC32_F11] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0);
+ c->dwarf.loc[UNW_PPC32_F12] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0);
+ c->dwarf.loc[UNW_PPC32_F13] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0);
+ c->dwarf.loc[UNW_PPC32_F14] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0);
+ c->dwarf.loc[UNW_PPC32_F15] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0);
+ c->dwarf.loc[UNW_PPC32_F16] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0);
+ c->dwarf.loc[UNW_PPC32_F17] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0);
+ c->dwarf.loc[UNW_PPC32_F18] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0);
+ c->dwarf.loc[UNW_PPC32_F19] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0);
+ c->dwarf.loc[UNW_PPC32_F20] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0);
+ c->dwarf.loc[UNW_PPC32_F21] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0);
+ c->dwarf.loc[UNW_PPC32_F22] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0);
+ c->dwarf.loc[UNW_PPC32_F23] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0);
+ c->dwarf.loc[UNW_PPC32_F24] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0);
+ c->dwarf.loc[UNW_PPC32_F25] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0);
+ c->dwarf.loc[UNW_PPC32_F26] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0);
+ c->dwarf.loc[UNW_PPC32_F27] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0);
+ c->dwarf.loc[UNW_PPC32_F28] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0);
+ c->dwarf.loc[UNW_PPC32_F29] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0);
+ c->dwarf.loc[UNW_PPC32_F30] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0);
+ c->dwarf.loc[UNW_PPC32_F31] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0);
+
+ ret = 1;
+ }
+ }
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/ppc32/Lapply_reg_state.c b/src/pal/src/libunwind/src/ppc32/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Lcreate_addr_space.c b/src/pal/src/libunwind/src/ppc32/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Lglobal.c b/src/pal/src/libunwind/src/ppc32/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Linit.c b/src/pal/src/libunwind/src/ppc32/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Lreg_states_iterate.c b/src/pal/src/libunwind/src/ppc32/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Lregs.c b/src/pal/src/libunwind/src/ppc32/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Lresume.c b/src/pal/src/libunwind/src/ppc32/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Lstep.c b/src/pal/src/libunwind/src/ppc32/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/Make-arch.in b/src/pal/src/libunwind/src/ppc32/Make-arch.in
new file mode 100644
index 0000000000..947dd5fa03
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/Make-arch.in
@@ -0,0 +1,11 @@
+# Word size.
+ELFW = 64
+# Does use dwarf2 unwind info.
+dwarf_target = true
+
+libunwind_setjmp_OBJS += \
+ $(arch)/longjmp.o \
+ $(arch)/siglongjmp.o
+
+libunwind_OBJS_common += \
+ $(arch)/is_fpreg.o
diff --git a/src/pal/src/libunwind/src/ppc32/get_func_addr.c b/src/pal/src/libunwind/src/ppc32/get_func_addr.c
new file mode 100644
index 0000000000..66ff795fe7
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/get_func_addr.c
@@ -0,0 +1,36 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+tdep_get_func_addr (unw_addr_space_t as, unw_word_t symbol_val_addr,
+ unw_word_t *real_func_addr)
+{
+ *real_func_addr = symbol_val_addr;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ppc32/init.h b/src/pal/src/libunwind/src/ppc32/init.h
new file mode 100644
index 0000000000..87a69b1450
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/init.h
@@ -0,0 +1,72 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+/* Here is the "common" init, for remote and local debuging" */
+
+static inline int
+common_init_ppc32 (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret;
+ int i;
+
+ for (i = UNW_PPC32_R0; i <= UNW_PPC32_R31; i++) {
+ c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i);
+ }
+ for (i = UNW_PPC32_F0; i <= UNW_PPC32_F31; i++) {
+ c->dwarf.loc[i] = DWARF_FPREG_LOC (&c->dwarf, i);
+ }
+
+ c->dwarf.loc[UNW_PPC32_CTR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_CTR);
+ c->dwarf.loc[UNW_PPC32_XER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_XER);
+ c->dwarf.loc[UNW_PPC32_CCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_CCR);
+ c->dwarf.loc[UNW_PPC32_LR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_LR);
+ c->dwarf.loc[UNW_PPC32_FPSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_FPSCR);
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_PPC32_LR], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_PPC32_R1),
+ &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = PPC_SCF_NONE;
+ c->sigcontext_addr = 0;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ppc32/is_fpreg.c b/src/pal/src/libunwind/src/ppc32/is_fpreg.c
new file mode 100644
index 0000000000..646ff2379c
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/is_fpreg.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_is_fpreg (int regnum)
+{
+ return (regnum >= UNW_PPC32_F0 && regnum <= UNW_PPC32_F31);
+}
diff --git a/src/pal/src/libunwind/src/ppc32/regname.c b/src/pal/src/libunwind/src/ppc32/regname.c
new file mode 100644
index 0000000000..459b83a4e5
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/regname.c
@@ -0,0 +1,112 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ [UNW_PPC32_R0]="GPR0",
+ [UNW_PPC32_R1]="GPR1",
+ [UNW_PPC32_R2]="GPR2",
+ [UNW_PPC32_R3]="GPR3",
+ [UNW_PPC32_R4]="GPR4",
+ [UNW_PPC32_R5]="GPR5",
+ [UNW_PPC32_R6]="GPR6",
+ [UNW_PPC32_R7]="GPR7",
+ [UNW_PPC32_R8]="GPR8",
+ [UNW_PPC32_R9]="GPR9",
+ [UNW_PPC32_R10]="GPR10",
+ [UNW_PPC32_R11]="GPR11",
+ [UNW_PPC32_R12]="GPR12",
+ [UNW_PPC32_R13]="GPR13",
+ [UNW_PPC32_R14]="GPR14",
+ [UNW_PPC32_R15]="GPR15",
+ [UNW_PPC32_R16]="GPR16",
+ [UNW_PPC32_R17]="GPR17",
+ [UNW_PPC32_R18]="GPR18",
+ [UNW_PPC32_R19]="GPR19",
+ [UNW_PPC32_R20]="GPR20",
+ [UNW_PPC32_R21]="GPR21",
+ [UNW_PPC32_R22]="GPR22",
+ [UNW_PPC32_R23]="GPR23",
+ [UNW_PPC32_R24]="GPR24",
+ [UNW_PPC32_R25]="GPR25",
+ [UNW_PPC32_R26]="GPR26",
+ [UNW_PPC32_R27]="GPR27",
+ [UNW_PPC32_R28]="GPR28",
+ [UNW_PPC32_R29]="GPR29",
+ [UNW_PPC32_R30]="GPR30",
+ [UNW_PPC32_R31]="GPR31",
+
+ [UNW_PPC32_CTR]="CTR",
+ [UNW_PPC32_XER]="XER",
+ [UNW_PPC32_CCR]="CCR",
+ [UNW_PPC32_LR]="LR",
+ [UNW_PPC32_FPSCR]="FPSCR",
+
+ [UNW_PPC32_F0]="FPR0",
+ [UNW_PPC32_F1]="FPR1",
+ [UNW_PPC32_F2]="FPR2",
+ [UNW_PPC32_F3]="FPR3",
+ [UNW_PPC32_F4]="FPR4",
+ [UNW_PPC32_F5]="FPR5",
+ [UNW_PPC32_F6]="FPR6",
+ [UNW_PPC32_F7]="FPR7",
+ [UNW_PPC32_F8]="FPR8",
+ [UNW_PPC32_F9]="FPR9",
+ [UNW_PPC32_F10]="FPR10",
+ [UNW_PPC32_F11]="FPR11",
+ [UNW_PPC32_F12]="FPR12",
+ [UNW_PPC32_F13]="FPR13",
+ [UNW_PPC32_F14]="FPR14",
+ [UNW_PPC32_F15]="FPR15",
+ [UNW_PPC32_F16]="FPR16",
+ [UNW_PPC32_F17]="FPR17",
+ [UNW_PPC32_F18]="FPR18",
+ [UNW_PPC32_F19]="FPR19",
+ [UNW_PPC32_F20]="FPR20",
+ [UNW_PPC32_F21]="FPR21",
+ [UNW_PPC32_F22]="FPR22",
+ [UNW_PPC32_F23]="FPR23",
+ [UNW_PPC32_F24]="FPR24",
+ [UNW_PPC32_F25]="FPR25",
+ [UNW_PPC32_F26]="FPR26",
+ [UNW_PPC32_F27]="FPR27",
+ [UNW_PPC32_F28]="FPR28",
+ [UNW_PPC32_F29]="FPR29",
+ [UNW_PPC32_F30]="FPR30",
+ [UNW_PPC32_F31]="FPR31"
+};
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/ppc32/setcontext.S b/src/pal/src/libunwind/src/ppc32/setcontext.S
new file mode 100644
index 0000000000..b54378a9dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/setcontext.S
@@ -0,0 +1,9 @@
+ .global _UI_setcontext
+
+_UI_setcontext:
+ retq
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/ucontext_i.h b/src/pal/src/libunwind/src/ppc32/ucontext_i.h
new file mode 100644
index 0000000000..c6ba806a00
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/ucontext_i.h
@@ -0,0 +1,128 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef ucontext_i_h
+#define ucontext_i_h
+
+#include "compiler.h"
+#include <ucontext.h>
+
+/* These values were derived by reading
+ /usr/src/linux-2.6.18-1.8/arch/um/include/sysdep-ppc/ptrace.h and
+ /usr/src/linux-2.6.18-1.8/arch/powerpc/kernel/ppc32.h
+*/
+
+//#define NIP_IDX 32
+#define CTR_IDX 32
+#define XER_IDX 33
+#define CCR_IDX 34
+#define MSR_IDX 35
+//#define MQ_IDX 36
+#define LINK_IDX 36
+
+/* These are dummy structures used only for obtaining the offsets of the
+ various structure members. */
+static ucontext_t dmy_ctxt UNUSED;
+
+#define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[0] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[1] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[2] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[3] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[4] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[5] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[6] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[7] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[8] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[9] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[10] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[11] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[12] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[13] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[14] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[15] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[16] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[17] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[18] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[19] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[20] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[21] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[22] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[23] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[24] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[25] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[26] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[27] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[28] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[29] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[30] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[31] - (void *)&dmy_ctxt)
+
+#define UC_MCONTEXT_GREGS_MSR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[MSR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_ORIG_GPR3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[ORIG_GPR3_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_CTR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[CTR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_LINK ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[LINK_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_XER ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[XER_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_CCR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[CCR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_SOFTE ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[SOFTE_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_TRAP ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[TRAP_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_DAR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[DAR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_DSISR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[DSISR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_RESULT ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[RESULT_IDX] - (void *)&dmy_ctxt)
+
+#define UC_MCONTEXT_FREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[0] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[1] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[2] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[3] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[4] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[5] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[6] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[7] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[8] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[9] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[10] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[11] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[12] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[13] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[14] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[15] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[16] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[17] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[18] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[19] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[20] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[21] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[22] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[23] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[24] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[25] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[26] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[27] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[28] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[29] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[30] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[31] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_FPSCR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[32] - (void *)&dmy_ctxt)
+
+#endif
diff --git a/src/pal/src/libunwind/src/ppc32/unwind_i.h b/src/pal/src/libunwind/src/ppc32/unwind_i.h
new file mode 100644
index 0000000000..ad32d05654
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc32/unwind_i.h
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <stdint.h>
+
+#include <libunwind-ppc32.h>
+
+#include <libunwind_i.h>
+#include <sys/ucontext.h>
+
+#define ppc32_lock UNW_OBJ(lock)
+#define ppc32_local_resume UNW_OBJ(local_resume)
+#define ppc32_local_addr_space_init UNW_OBJ(local_addr_space_init)
+
+extern void ppc32_local_addr_space_init (void);
+extern int ppc32_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/ppc64/Gapply_reg_state.c b/src/pal/src/libunwind/src/ppc64/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/ppc64/Gcreate_addr_space.c b/src/pal/src/libunwind/src/ppc64/Gcreate_addr_space.c
new file mode 100644
index 0000000000..bd48555d4e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Gcreate_addr_space.c
@@ -0,0 +1,71 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include <libunwind_i.h>
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * We support both big- and little-endian on Linux ppc64.
+ */
+ if (byte_order != 0
+ && byte_order != __LITTLE_ENDIAN
+ && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ if (byte_order == 0)
+ /* use host default: */
+ as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ else
+ as->big_endian = (byte_order == __BIG_ENDIAN);
+
+ /* FIXME! There is no way to specify the ABI.
+ Default to ELFv1 on big-endian and ELFv2 on little-endian. */
+ if (as->big_endian)
+ as->abi = UNW_PPC64_ABI_ELFv1;
+ else
+ as->abi = UNW_PPC64_ABI_ELFv2;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/ppc64/Gglobal.c b/src/pal/src/libunwind/src/ppc64/Gglobal.c
new file mode 100644
index 0000000000..9d0b0f55a6
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Gglobal.c
@@ -0,0 +1,182 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (ppc64_lock);
+HIDDEN int tdep_init_done;
+
+/* The API register numbers are exactly the same as the .eh_frame
+ registers, for now at least. */
+HIDDEN const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] =
+ {
+ [UNW_PPC64_R0]=UNW_PPC64_R0,
+ [UNW_PPC64_R1]=UNW_PPC64_R1,
+ [UNW_PPC64_R2]=UNW_PPC64_R2,
+ [UNW_PPC64_R3]=UNW_PPC64_R3,
+ [UNW_PPC64_R4]=UNW_PPC64_R4,
+ [UNW_PPC64_R5]=UNW_PPC64_R5,
+ [UNW_PPC64_R6]=UNW_PPC64_R6,
+ [UNW_PPC64_R7]=UNW_PPC64_R7,
+ [UNW_PPC64_R8]=UNW_PPC64_R8,
+ [UNW_PPC64_R9]=UNW_PPC64_R9,
+ [UNW_PPC64_R10]=UNW_PPC64_R10,
+ [UNW_PPC64_R11]=UNW_PPC64_R11,
+ [UNW_PPC64_R12]=UNW_PPC64_R12,
+ [UNW_PPC64_R13]=UNW_PPC64_R13,
+ [UNW_PPC64_R14]=UNW_PPC64_R14,
+ [UNW_PPC64_R15]=UNW_PPC64_R15,
+ [UNW_PPC64_R16]=UNW_PPC64_R16,
+ [UNW_PPC64_R17]=UNW_PPC64_R17,
+ [UNW_PPC64_R18]=UNW_PPC64_R18,
+ [UNW_PPC64_R19]=UNW_PPC64_R19,
+ [UNW_PPC64_R20]=UNW_PPC64_R20,
+ [UNW_PPC64_R21]=UNW_PPC64_R21,
+ [UNW_PPC64_R22]=UNW_PPC64_R22,
+ [UNW_PPC64_R23]=UNW_PPC64_R23,
+ [UNW_PPC64_R24]=UNW_PPC64_R24,
+ [UNW_PPC64_R25]=UNW_PPC64_R25,
+ [UNW_PPC64_R26]=UNW_PPC64_R26,
+ [UNW_PPC64_R27]=UNW_PPC64_R27,
+ [UNW_PPC64_R28]=UNW_PPC64_R28,
+ [UNW_PPC64_R29]=UNW_PPC64_R29,
+ [UNW_PPC64_R30]=UNW_PPC64_R30,
+ [UNW_PPC64_R31]=UNW_PPC64_R31,
+
+ [UNW_PPC64_F0]=UNW_PPC64_F0,
+ [UNW_PPC64_F1]=UNW_PPC64_F1,
+ [UNW_PPC64_F2]=UNW_PPC64_F2,
+ [UNW_PPC64_F3]=UNW_PPC64_F3,
+ [UNW_PPC64_F4]=UNW_PPC64_F4,
+ [UNW_PPC64_F5]=UNW_PPC64_F5,
+ [UNW_PPC64_F6]=UNW_PPC64_F6,
+ [UNW_PPC64_F7]=UNW_PPC64_F7,
+ [UNW_PPC64_F8]=UNW_PPC64_F8,
+ [UNW_PPC64_F9]=UNW_PPC64_F9,
+ [UNW_PPC64_F10]=UNW_PPC64_F10,
+ [UNW_PPC64_F11]=UNW_PPC64_F11,
+ [UNW_PPC64_F12]=UNW_PPC64_F12,
+ [UNW_PPC64_F13]=UNW_PPC64_F13,
+ [UNW_PPC64_F14]=UNW_PPC64_F14,
+ [UNW_PPC64_F15]=UNW_PPC64_F15,
+ [UNW_PPC64_F16]=UNW_PPC64_F16,
+ [UNW_PPC64_F17]=UNW_PPC64_F17,
+ [UNW_PPC64_F18]=UNW_PPC64_F18,
+ [UNW_PPC64_F19]=UNW_PPC64_F19,
+ [UNW_PPC64_F20]=UNW_PPC64_F20,
+ [UNW_PPC64_F21]=UNW_PPC64_F21,
+ [UNW_PPC64_F22]=UNW_PPC64_F22,
+ [UNW_PPC64_F23]=UNW_PPC64_F23,
+ [UNW_PPC64_F24]=UNW_PPC64_F24,
+ [UNW_PPC64_F25]=UNW_PPC64_F25,
+ [UNW_PPC64_F26]=UNW_PPC64_F26,
+ [UNW_PPC64_F27]=UNW_PPC64_F27,
+ [UNW_PPC64_F28]=UNW_PPC64_F28,
+ [UNW_PPC64_F29]=UNW_PPC64_F29,
+ [UNW_PPC64_F30]=UNW_PPC64_F30,
+ [UNW_PPC64_F31]=UNW_PPC64_F31,
+
+ [UNW_PPC64_LR]=UNW_PPC64_LR,
+ [UNW_PPC64_CTR]=UNW_PPC64_CTR,
+ [UNW_PPC64_ARG_POINTER]=UNW_PPC64_ARG_POINTER,
+
+ [UNW_PPC64_CR0]=UNW_PPC64_CR0,
+ [UNW_PPC64_CR1]=UNW_PPC64_CR1,
+ [UNW_PPC64_CR2]=UNW_PPC64_CR2,
+ [UNW_PPC64_CR3]=UNW_PPC64_CR3,
+ [UNW_PPC64_CR4]=UNW_PPC64_CR4,
+ [UNW_PPC64_CR5]=UNW_PPC64_CR5,
+ [UNW_PPC64_CR6]=UNW_PPC64_CR6,
+ [UNW_PPC64_CR7]=UNW_PPC64_CR7,
+
+ [UNW_PPC64_XER]=UNW_PPC64_XER,
+
+ [UNW_PPC64_V0]=UNW_PPC64_V0,
+ [UNW_PPC64_V1]=UNW_PPC64_V1,
+ [UNW_PPC64_V2]=UNW_PPC64_V2,
+ [UNW_PPC64_V3]=UNW_PPC64_V3,
+ [UNW_PPC64_V4]=UNW_PPC64_V4,
+ [UNW_PPC64_V5]=UNW_PPC64_V5,
+ [UNW_PPC64_V6]=UNW_PPC64_V6,
+ [UNW_PPC64_V7]=UNW_PPC64_V7,
+ [UNW_PPC64_V8]=UNW_PPC64_V8,
+ [UNW_PPC64_V9]=UNW_PPC64_V9,
+ [UNW_PPC64_V10]=UNW_PPC64_V10,
+ [UNW_PPC64_V11]=UNW_PPC64_V11,
+ [UNW_PPC64_V12]=UNW_PPC64_V12,
+ [UNW_PPC64_V13]=UNW_PPC64_V13,
+ [UNW_PPC64_V14]=UNW_PPC64_V14,
+ [UNW_PPC64_V15]=UNW_PPC64_V15,
+ [UNW_PPC64_V16]=UNW_PPC64_V16,
+ [UNW_PPC64_V17]=UNW_PPC64_V17,
+ [UNW_PPC64_V18]=UNW_PPC64_V18,
+ [UNW_PPC64_V19]=UNW_PPC64_V19,
+ [UNW_PPC64_V20]=UNW_PPC64_V20,
+ [UNW_PPC64_V21]=UNW_PPC64_V21,
+ [UNW_PPC64_V22]=UNW_PPC64_V22,
+ [UNW_PPC64_V23]=UNW_PPC64_V23,
+ [UNW_PPC64_V24]=UNW_PPC64_V24,
+ [UNW_PPC64_V25]=UNW_PPC64_V25,
+ [UNW_PPC64_V26]=UNW_PPC64_V26,
+ [UNW_PPC64_V27]=UNW_PPC64_V27,
+ [UNW_PPC64_V28]=UNW_PPC64_V28,
+ [UNW_PPC64_V29]=UNW_PPC64_V29,
+ [UNW_PPC64_V30]=UNW_PPC64_V30,
+ [UNW_PPC64_V31]=UNW_PPC64_V31,
+
+ [UNW_PPC64_VRSAVE]=UNW_PPC64_VRSAVE,
+ [UNW_PPC64_VSCR]=UNW_PPC64_VSCR,
+ [UNW_PPC64_SPE_ACC]=UNW_PPC64_SPE_ACC,
+ [UNW_PPC64_SPEFSCR]=UNW_PPC64_SPEFSCR,
+ };
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&ppc64_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ ppc64_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&ppc64_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/ppc64/Ginit.c b/src/pal/src/libunwind/src/ppc64/Ginit.c
new file mode 100644
index 0000000000..4c88cd6e77
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Ginit.c
@@ -0,0 +1,229 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "ucontext_i.h"
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+static void *
+uc_addr (ucontext_t *uc, int reg)
+{
+ void *addr;
+
+ if ((unsigned) (reg - UNW_PPC64_R0) < 32)
+ addr = &uc->uc_mcontext.gp_regs[reg - UNW_PPC64_R0];
+
+ else if ((unsigned) (reg - UNW_PPC64_F0) < 32)
+ addr = &uc->uc_mcontext.fp_regs[reg - UNW_PPC64_F0];
+
+ else if ((unsigned) (reg - UNW_PPC64_V0) < 32)
+ addr = (uc->uc_mcontext.v_regs == 0) ? NULL : &uc->uc_mcontext.v_regs->vrregs[reg - UNW_PPC64_V0][0];
+
+ else
+ {
+ unsigned gregs_idx;
+
+ switch (reg)
+ {
+ case UNW_PPC64_NIP:
+ gregs_idx = NIP_IDX;
+ break;
+ case UNW_PPC64_CTR:
+ gregs_idx = CTR_IDX;
+ break;
+ case UNW_PPC64_LR:
+ gregs_idx = LINK_IDX;
+ break;
+ case UNW_PPC64_XER:
+ gregs_idx = XER_IDX;
+ break;
+ case UNW_PPC64_CR0:
+ gregs_idx = CCR_IDX;
+ break;
+ default:
+ return NULL;
+ }
+ addr = &uc->uc_mcontext.gp_regs[gregs_idx];
+ }
+ return addr;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg)
+{
+ return uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (12, "mem[%lx] <- %lx\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "mem[%lx] -> %lx\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
+ int write, void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = arg;
+
+ if (UNW_PPC64_F0 <= reg && reg <= UNW_PPC64_F31)
+ goto badreg;
+ if (UNW_PPC64_V0 <= reg && reg <= UNW_PPC64_V31)
+ goto badreg;
+
+ addr = uc_addr (uc, reg);
+ if (!addr)
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) addr = *val;
+ Debug (12, "%s <- %lx\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %lx\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = arg;
+ unw_fpreg_t *addr;
+
+ /* Allow only 32 fregs and 32 vregs */
+ if (!(((unsigned) (reg - UNW_PPC64_F0) < 32)
+ ||((unsigned) (reg - UNW_PPC64_V0) < 32)))
+ goto badreg;
+
+ addr = uc_addr (uc, reg);
+ if (!addr)
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %016Lf\n", unw_regname (reg), *val);
+ *(unw_fpreg_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %016Lf\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+ppc64_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+#if _CALL_ELF == 2
+ local_addr_space.abi = UNW_PPC64_ABI_ELFv2;
+#else
+ local_addr_space.abi = UNW_PPC64_ABI_ELFv1;
+#endif
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = ppc64_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/ppc64/Greg_states_iterate.c b/src/pal/src/libunwind/src/ppc64/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/ppc64/Gregs.c b/src/pal/src/libunwind/src/ppc64/Gregs.c
new file mode 100644
index 0000000000..1cb5d9dc65
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Gregs.c
@@ -0,0 +1,141 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ struct dwarf_loc loc;
+
+ switch (reg)
+ {
+ case UNW_PPC64_R0:
+ case UNW_PPC64_R2:
+ case UNW_PPC64_R3:
+ case UNW_PPC64_R4:
+ case UNW_PPC64_R5:
+ case UNW_PPC64_R6:
+ case UNW_PPC64_R7:
+ case UNW_PPC64_R8:
+ case UNW_PPC64_R9:
+ case UNW_PPC64_R10:
+ case UNW_PPC64_R11:
+ case UNW_PPC64_R12:
+ case UNW_PPC64_R13:
+ case UNW_PPC64_R14:
+ case UNW_PPC64_R15:
+ case UNW_PPC64_R16:
+ case UNW_PPC64_R17:
+ case UNW_PPC64_R18:
+ case UNW_PPC64_R19:
+ case UNW_PPC64_R20:
+ case UNW_PPC64_R21:
+ case UNW_PPC64_R22:
+ case UNW_PPC64_R23:
+ case UNW_PPC64_R24:
+ case UNW_PPC64_R25:
+ case UNW_PPC64_R26:
+ case UNW_PPC64_R27:
+ case UNW_PPC64_R28:
+ case UNW_PPC64_R29:
+ case UNW_PPC64_R30:
+ case UNW_PPC64_R31:
+ case UNW_PPC64_LR:
+ case UNW_PPC64_CTR:
+ case UNW_PPC64_CR0:
+ case UNW_PPC64_CR1:
+ case UNW_PPC64_CR2:
+ case UNW_PPC64_CR3:
+ case UNW_PPC64_CR4:
+ case UNW_PPC64_CR5:
+ case UNW_PPC64_CR6:
+ case UNW_PPC64_CR7:
+ case UNW_PPC64_VRSAVE:
+ case UNW_PPC64_VSCR:
+ case UNW_PPC64_SPE_ACC:
+ case UNW_PPC64_SPEFSCR:
+ loc = c->dwarf.loc[reg];
+ break;
+
+ case UNW_TDEP_IP:
+ if (write)
+ {
+ c->dwarf.ip = *valp; /* update the IP cache */
+ if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip
+ || *valp >= c->dwarf.pi.end_ip))
+ c->dwarf.pi_valid = 0; /* new IP outside of current proc */
+ }
+ else
+ *valp = c->dwarf.ip;
+ return 0;
+
+ case UNW_TDEP_SP:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+ default:
+ return -UNW_EBADREG;
+ break;
+ }
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ struct dwarf_loc loc;
+
+ if ((unsigned) (reg - UNW_PPC64_F0) < 32)
+ {
+ loc = c->dwarf.loc[reg];
+ if (write)
+ return dwarf_putfp (&c->dwarf, loc, *valp);
+ else
+ return dwarf_getfp (&c->dwarf, loc, valp);
+ }
+ else
+ if ((unsigned) (reg - UNW_PPC64_V0) < 32)
+ {
+ loc = c->dwarf.loc[reg];
+ if (write)
+ return dwarf_putvr (&c->dwarf, loc, *valp);
+ else
+ return dwarf_getvr (&c->dwarf, loc, valp);
+ }
+
+ return -UNW_EBADREG;
+}
+
diff --git a/src/pal/src/libunwind/src/ppc64/Gresume.c b/src/pal/src/libunwind/src/ppc64/Gresume.c
new file mode 100644
index 0000000000..0d832d0d97
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Gresume.c
@@ -0,0 +1,111 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford cjashfor@us.ibm.com
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+#include <sys/syscall.h>
+
+/* sigreturn() is a no-op on x86_64 glibc. */
+
+static NORETURN inline long
+my_rt_sigreturn (void *new_sp)
+{
+ /* XXX: empty stub. */
+ abort ();
+}
+
+HIDDEN inline int
+ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = (ucontext_t *)c->dwarf.as_arg;
+
+ if (unlikely (c->sigcontext_format != PPC_SCF_NONE))
+ {
+ my_rt_sigreturn(cursor);
+ abort();
+ }
+ else
+ {
+ Debug (8, "resuming at ip=%llx via setcontext()\n",
+ (unsigned long long) c->dwarf.ip);
+ setcontext (uc);
+ }
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+/* This routine is responsible for copying the register values in
+ cursor C and establishing them as the current machine state. */
+
+static inline int
+establish_machine_state (struct cursor *c)
+{
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ as->acc.access_fpreg (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ as->acc.access_reg (as, reg, &val, 1, arg);
+ }
+ }
+ return 0;
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if ((ret = establish_machine_state (c)) < 0)
+ return ret;
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/ppc64/Gstep.c b/src/pal/src/libunwind/src/ppc64/Gstep.c
new file mode 100644
index 0000000000..f44e959105
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Gstep.c
@@ -0,0 +1,466 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "ucontext_i.h"
+#include "remote.h"
+#include <signal.h>
+
+/* This definition originates in /usr/include/asm-ppc64/ptrace.h, but is
+ defined there only when __KERNEL__ is defined. We reproduce it here for
+ our use at the user level in order to locate the ucontext record, which
+ appears to be at this offset relative to the stack pointer when in the
+ context of the signal handler return trampoline code -
+ __kernel_sigtramp_rt64. */
+#define __SIGNAL_FRAMESIZE 128
+
+/* This definition comes from the document "64-bit PowerPC ELF Application
+ Binary Interface Supplement 1.9", section 3.2.2.
+ http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK */
+
+typedef struct
+{
+ long unsigned back_chain;
+ long unsigned cr_save;
+ long unsigned lr_save;
+ /* many more fields here, but they are unused by this code */
+} stack_frame_t;
+
+
+int
+unw_step (unw_cursor_t * cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ stack_frame_t dummy;
+ unw_word_t back_chain_offset, lr_save_offset, v_regs_ptr;
+ struct dwarf_loc back_chain_loc, lr_save_loc, sp_loc, ip_loc, v_regs_loc;
+ int ret, i;
+
+ Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->dwarf.ip);
+
+ /* Try DWARF-based unwinding... */
+
+ ret = dwarf_step (&c->dwarf);
+
+ if (ret < 0 && ret != -UNW_ENOINFO)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ if (unlikely (ret < 0))
+ {
+ if (likely (unw_is_signal_frame (cursor) <= 0))
+ {
+ /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode
+ produces the mandatory level of traceback record in the code, but
+ I get the impression that this is transitory, that eventually gcc
+ will not produce any traceback records at all. So, for now, we
+ won't bother to try to find and use these records.
+
+ We can, however, attempt to unwind the frame by using the callback
+ chain. This is very crude, however, and won't be able to unwind
+ any registers besides the IP, SP, and LR . */
+
+ back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy);
+ lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy);
+
+ back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0);
+
+ if ((ret =
+ dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0)
+ {
+ Debug (2,
+ "Unable to retrieve CFA from back chain in stack frame - %d\n",
+ ret);
+ return ret;
+ }
+ if (c->dwarf.cfa == 0)
+ /* Unless the cursor or stack is corrupt or uninitialized we've most
+ likely hit the top of the stack */
+ return 0;
+
+ lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0);
+
+ if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0)
+ {
+ Debug (2,
+ "Unable to retrieve IP from lr save in stack frame - %d\n",
+ ret);
+ return ret;
+ }
+
+ /* Mark all registers unsaved */
+ for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ ret = 1;
+ }
+ else
+ {
+ /* Find the sigcontext record by taking the CFA and adjusting by
+ the dummy signal frame size.
+
+ Note that there isn't any way to determined if SA_SIGINFO was
+ set in the sa_flags parameter to sigaction when the signal
+ handler was established. If it was not set, the ucontext
+ record is not required to be on the stack, in which case the
+ following code will likely cause a seg fault or other crash
+ condition. */
+
+ unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE;
+
+ Debug (1, "signal frame, skip over trampoline\n");
+
+ c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME;
+ c->sigcontext_addr = ucontext;
+
+ sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
+ ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
+
+ ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ /* Instead of just restoring the non-volatile registers, do all
+ of the registers for now. This will incur a performance hit,
+ but it's rare enough not to cause too much of a problem, and
+ might be useful in some cases. */
+ c->dwarf.loc[UNW_PPC64_R0] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0);
+ c->dwarf.loc[UNW_PPC64_R1] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
+ c->dwarf.loc[UNW_PPC64_R2] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0);
+ c->dwarf.loc[UNW_PPC64_R3] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0);
+ c->dwarf.loc[UNW_PPC64_R4] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0);
+ c->dwarf.loc[UNW_PPC64_R5] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0);
+ c->dwarf.loc[UNW_PPC64_R6] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0);
+ c->dwarf.loc[UNW_PPC64_R7] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0);
+ c->dwarf.loc[UNW_PPC64_R8] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0);
+ c->dwarf.loc[UNW_PPC64_R9] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0);
+ c->dwarf.loc[UNW_PPC64_R10] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0);
+ c->dwarf.loc[UNW_PPC64_R11] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0);
+ c->dwarf.loc[UNW_PPC64_R12] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0);
+ c->dwarf.loc[UNW_PPC64_R13] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0);
+ c->dwarf.loc[UNW_PPC64_R14] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0);
+ c->dwarf.loc[UNW_PPC64_R15] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0);
+ c->dwarf.loc[UNW_PPC64_R16] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0);
+ c->dwarf.loc[UNW_PPC64_R17] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0);
+ c->dwarf.loc[UNW_PPC64_R18] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0);
+ c->dwarf.loc[UNW_PPC64_R19] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0);
+ c->dwarf.loc[UNW_PPC64_R20] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0);
+ c->dwarf.loc[UNW_PPC64_R21] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0);
+ c->dwarf.loc[UNW_PPC64_R22] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0);
+ c->dwarf.loc[UNW_PPC64_R23] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0);
+ c->dwarf.loc[UNW_PPC64_R24] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0);
+ c->dwarf.loc[UNW_PPC64_R25] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0);
+ c->dwarf.loc[UNW_PPC64_R26] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0);
+ c->dwarf.loc[UNW_PPC64_R27] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0);
+ c->dwarf.loc[UNW_PPC64_R28] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0);
+ c->dwarf.loc[UNW_PPC64_R29] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0);
+ c->dwarf.loc[UNW_PPC64_R30] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0);
+ c->dwarf.loc[UNW_PPC64_R31] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0);
+
+ c->dwarf.loc[UNW_PPC64_LR] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0);
+ c->dwarf.loc[UNW_PPC64_CTR] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0);
+ /* This CR0 assignment is probably wrong. There are 8 dwarf columns
+ assigned to the CR registers, but only one CR register in the
+ mcontext structure */
+ c->dwarf.loc[UNW_PPC64_CR0] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0);
+ c->dwarf.loc[UNW_PPC64_XER] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0);
+ c->dwarf.loc[UNW_PPC64_NIP] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
+
+ /* TODO: Is there a way of obtaining the value of the
+ pseudo frame pointer (which is sp + some fixed offset, I
+ assume), based on the contents of the ucontext record
+ structure? For now, set this loc to null. */
+ c->dwarf.loc[UNW_PPC64_FRAME_POINTER] = DWARF_NULL_LOC;
+
+ c->dwarf.loc[UNW_PPC64_F0] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0);
+ c->dwarf.loc[UNW_PPC64_F1] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0);
+ c->dwarf.loc[UNW_PPC64_F2] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0);
+ c->dwarf.loc[UNW_PPC64_F3] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0);
+ c->dwarf.loc[UNW_PPC64_F4] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0);
+ c->dwarf.loc[UNW_PPC64_F5] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0);
+ c->dwarf.loc[UNW_PPC64_F6] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0);
+ c->dwarf.loc[UNW_PPC64_F7] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0);
+ c->dwarf.loc[UNW_PPC64_F8] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0);
+ c->dwarf.loc[UNW_PPC64_F9] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0);
+ c->dwarf.loc[UNW_PPC64_F10] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0);
+ c->dwarf.loc[UNW_PPC64_F11] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0);
+ c->dwarf.loc[UNW_PPC64_F12] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0);
+ c->dwarf.loc[UNW_PPC64_F13] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0);
+ c->dwarf.loc[UNW_PPC64_F14] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0);
+ c->dwarf.loc[UNW_PPC64_F15] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0);
+ c->dwarf.loc[UNW_PPC64_F16] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0);
+ c->dwarf.loc[UNW_PPC64_F17] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0);
+ c->dwarf.loc[UNW_PPC64_F18] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0);
+ c->dwarf.loc[UNW_PPC64_F19] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0);
+ c->dwarf.loc[UNW_PPC64_F20] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0);
+ c->dwarf.loc[UNW_PPC64_F21] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0);
+ c->dwarf.loc[UNW_PPC64_F22] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0);
+ c->dwarf.loc[UNW_PPC64_F23] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0);
+ c->dwarf.loc[UNW_PPC64_F24] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0);
+ c->dwarf.loc[UNW_PPC64_F25] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0);
+ c->dwarf.loc[UNW_PPC64_F26] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0);
+ c->dwarf.loc[UNW_PPC64_F27] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0);
+ c->dwarf.loc[UNW_PPC64_F28] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0);
+ c->dwarf.loc[UNW_PPC64_F29] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0);
+ c->dwarf.loc[UNW_PPC64_F30] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0);
+ c->dwarf.loc[UNW_PPC64_F31] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0);
+ /* Note that there is no .eh_section register column for the
+ FPSCR register. I don't know why this is. */
+
+ v_regs_loc = DWARF_LOC (ucontext + UC_MCONTEXT_V_REGS, 0);
+ ret = dwarf_get (&c->dwarf, v_regs_loc, &v_regs_ptr);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ if (v_regs_ptr != 0)
+ {
+ /* The v_regs_ptr is not null. Set all of the AltiVec locs */
+
+ c->dwarf.loc[UNW_PPC64_V0] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R0, 0);
+ c->dwarf.loc[UNW_PPC64_V1] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R1, 0);
+ c->dwarf.loc[UNW_PPC64_V2] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R2, 0);
+ c->dwarf.loc[UNW_PPC64_V3] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R3, 0);
+ c->dwarf.loc[UNW_PPC64_V4] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R4, 0);
+ c->dwarf.loc[UNW_PPC64_V5] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R5, 0);
+ c->dwarf.loc[UNW_PPC64_V6] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R6, 0);
+ c->dwarf.loc[UNW_PPC64_V7] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R7, 0);
+ c->dwarf.loc[UNW_PPC64_V8] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R8, 0);
+ c->dwarf.loc[UNW_PPC64_V9] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R9, 0);
+ c->dwarf.loc[UNW_PPC64_V10] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R10, 0);
+ c->dwarf.loc[UNW_PPC64_V11] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R11, 0);
+ c->dwarf.loc[UNW_PPC64_V12] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R12, 0);
+ c->dwarf.loc[UNW_PPC64_V13] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R13, 0);
+ c->dwarf.loc[UNW_PPC64_V14] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R14, 0);
+ c->dwarf.loc[UNW_PPC64_V15] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R15, 0);
+ c->dwarf.loc[UNW_PPC64_V16] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R16, 0);
+ c->dwarf.loc[UNW_PPC64_V17] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R17, 0);
+ c->dwarf.loc[UNW_PPC64_V18] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R18, 0);
+ c->dwarf.loc[UNW_PPC64_V19] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R19, 0);
+ c->dwarf.loc[UNW_PPC64_V20] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R20, 0);
+ c->dwarf.loc[UNW_PPC64_V21] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R21, 0);
+ c->dwarf.loc[UNW_PPC64_V22] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R22, 0);
+ c->dwarf.loc[UNW_PPC64_V23] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R23, 0);
+ c->dwarf.loc[UNW_PPC64_V24] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R24, 0);
+ c->dwarf.loc[UNW_PPC64_V25] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R25, 0);
+ c->dwarf.loc[UNW_PPC64_V26] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R26, 0);
+ c->dwarf.loc[UNW_PPC64_V27] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R27, 0);
+ c->dwarf.loc[UNW_PPC64_V28] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R28, 0);
+ c->dwarf.loc[UNW_PPC64_V29] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R29, 0);
+ c->dwarf.loc[UNW_PPC64_V30] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R30, 0);
+ c->dwarf.loc[UNW_PPC64_V31] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R31, 0);
+ c->dwarf.loc[UNW_PPC64_VRSAVE] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VRSAVE, 0);
+ c->dwarf.loc[UNW_PPC64_VSCR] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VSCR, 0);
+ }
+ else
+ {
+ c->dwarf.loc[UNW_PPC64_V0] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V1] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V2] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V3] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V4] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V5] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V6] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V7] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V8] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V9] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V10] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V11] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V12] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V13] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V14] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V15] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V16] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V17] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V18] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V19] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V20] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V21] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V22] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V23] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V24] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V25] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V26] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V27] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V28] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V29] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V30] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V31] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_NULL_LOC;
+ }
+ ret = 1;
+ }
+ }
+
+ if (c->dwarf.ip == 0)
+ {
+ /* Unless the cursor or stack is corrupt or uninitialized,
+ we've most likely hit the top of the stack */
+ Debug (2, "returning 0\n");
+ return 0;
+ }
+
+ // on ppc64, R2 register is used as pointer to TOC
+ // section which is used for symbol lookup in PIC code
+ // ppc64 linker generates "ld r2, 40(r1)" (ELFv1) or
+ // "ld r2, 24(r1)" (ELFv2) instruction after each
+ // @plt call. We need restore R2, but only for @plt calls
+ {
+ unw_word_t ip = c->dwarf.ip;
+ unw_addr_space_t as = c->dwarf.as;
+ unw_accessors_t *a = unw_get_accessors_int (as);
+ void *arg = c->dwarf.as_arg;
+ uint32_t toc_save = (as->abi == UNW_PPC64_ABI_ELFv2)? 24 : 40;
+ int32_t inst;
+
+ if (fetch32 (as, a, &ip, &inst, arg) >= 0
+ && (uint32_t)inst == (0xE8410000U + toc_save))
+ {
+ // @plt call, restoring R2 from CFA+toc_save
+ c->dwarf.loc[UNW_PPC64_R2] = DWARF_LOC(c->dwarf.cfa + toc_save, 0);
+ }
+ }
+
+ Debug (2, "returning %d with last return statement\n", ret);
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/ppc64/Lapply_reg_state.c b/src/pal/src/libunwind/src/ppc64/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/Lcreate_addr_space.c b/src/pal/src/libunwind/src/ppc64/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/Lglobal.c b/src/pal/src/libunwind/src/ppc64/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/Linit.c b/src/pal/src/libunwind/src/ppc64/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/Lreg_states_iterate.c b/src/pal/src/libunwind/src/ppc64/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/Lregs.c b/src/pal/src/libunwind/src/ppc64/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/Lresume.c b/src/pal/src/libunwind/src/ppc64/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/Lstep.c b/src/pal/src/libunwind/src/ppc64/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/get_func_addr.c b/src/pal/src/libunwind/src/ppc64/get_func_addr.c
new file mode 100644
index 0000000000..80a58fa1f8
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/get_func_addr.c
@@ -0,0 +1,51 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr,
+ unw_word_t *entry_point)
+{
+ if (as->abi == UNW_PPC64_ABI_ELFv1)
+ {
+ unw_accessors_t *a;
+ int ret;
+
+ a = unw_get_accessors_int (as);
+ /* Entry-point is stored in the 1st word of the function descriptor.
+ In case that changes in the future, we'd have to update the line
+ below and read the word at addr + offset: */
+ ret = (*a->access_mem) (as, addr, entry_point, 0, NULL);
+ if (ret < 0)
+ return ret;
+ }
+ else
+ *entry_point = addr;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ppc64/init.h b/src/pal/src/libunwind/src/ppc64/init.h
new file mode 100644
index 0000000000..9b8139343d
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/init.h
@@ -0,0 +1,82 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init_ppc64 (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret;
+ int i;
+
+ for (i = UNW_PPC64_R0; i <= UNW_PPC64_R31; i++) {
+ c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i);
+ }
+ for (i = UNW_PPC64_F0; i <= UNW_PPC64_F31; i++) {
+ c->dwarf.loc[i] = DWARF_FPREG_LOC (&c->dwarf, i);
+ }
+ for (i = UNW_PPC64_V0; i <= UNW_PPC64_V31; i++) {
+ c->dwarf.loc[i] = DWARF_VREG_LOC (&c->dwarf, i);
+ }
+
+ for (i = UNW_PPC64_CR0; i <= UNW_PPC64_CR7; i++) {
+ c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i);
+ }
+ c->dwarf.loc[UNW_PPC64_ARG_POINTER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_ARG_POINTER);
+ c->dwarf.loc[UNW_PPC64_CTR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_CTR);
+ c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VSCR);
+
+ c->dwarf.loc[UNW_PPC64_XER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_XER);
+ c->dwarf.loc[UNW_PPC64_LR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_LR);
+ c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VRSAVE);
+ c->dwarf.loc[UNW_PPC64_SPEFSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SPEFSCR);
+ c->dwarf.loc[UNW_PPC64_SPE_ACC] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SPE_ACC);
+
+ c->dwarf.loc[UNW_PPC64_NIP] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_NIP);
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_PPC64_NIP], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R1),
+ &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = PPC_SCF_NONE;
+ c->sigcontext_addr = 0;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/ppc64/is_fpreg.c b/src/pal/src/libunwind/src/ppc64/is_fpreg.c
new file mode 100644
index 0000000000..653964a7da
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/is_fpreg.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_is_fpreg (int regnum)
+{
+ return (regnum >= UNW_PPC64_F0 && regnum <= UNW_PPC64_F31);
+}
diff --git a/src/pal/src/libunwind/src/ppc64/regname.c b/src/pal/src/libunwind/src/ppc64/regname.c
new file mode 100644
index 0000000000..58c6fa6d87
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/regname.c
@@ -0,0 +1,164 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ [UNW_PPC64_R0]="GPR0",
+ [UNW_PPC64_R1]="GPR1",
+ [UNW_PPC64_R2]="GPR2",
+ [UNW_PPC64_R3]="GPR3",
+ [UNW_PPC64_R4]="GPR4",
+ [UNW_PPC64_R5]="GPR5",
+ [UNW_PPC64_R6]="GPR6",
+ [UNW_PPC64_R7]="GPR7",
+ [UNW_PPC64_R8]="GPR8",
+ [UNW_PPC64_R9]="GPR9",
+ [UNW_PPC64_R10]="GPR10",
+ [UNW_PPC64_R11]="GPR11",
+ [UNW_PPC64_R12]="GPR12",
+ [UNW_PPC64_R13]="GPR13",
+ [UNW_PPC64_R14]="GPR14",
+ [UNW_PPC64_R15]="GPR15",
+ [UNW_PPC64_R16]="GPR16",
+ [UNW_PPC64_R17]="GPR17",
+ [UNW_PPC64_R18]="GPR18",
+ [UNW_PPC64_R19]="GPR19",
+ [UNW_PPC64_R20]="GPR20",
+ [UNW_PPC64_R21]="GPR21",
+ [UNW_PPC64_R22]="GPR22",
+ [UNW_PPC64_R23]="GPR23",
+ [UNW_PPC64_R24]="GPR24",
+ [UNW_PPC64_R25]="GPR25",
+ [UNW_PPC64_R26]="GPR26",
+ [UNW_PPC64_R27]="GPR27",
+ [UNW_PPC64_R28]="GPR28",
+ [UNW_PPC64_R29]="GPR29",
+ [UNW_PPC64_R30]="GPR30",
+ [UNW_PPC64_R31]="GPR31",
+
+ [UNW_PPC64_F0]="FPR0",
+ [UNW_PPC64_F1]="FPR1",
+ [UNW_PPC64_F2]="FPR2",
+ [UNW_PPC64_F3]="FPR3",
+ [UNW_PPC64_F4]="FPR4",
+ [UNW_PPC64_F5]="FPR5",
+ [UNW_PPC64_F6]="FPR6",
+ [UNW_PPC64_F7]="FPR7",
+ [UNW_PPC64_F8]="FPR8",
+ [UNW_PPC64_F9]="FPR9",
+ [UNW_PPC64_F10]="FPR10",
+ [UNW_PPC64_F11]="FPR11",
+ [UNW_PPC64_F12]="FPR12",
+ [UNW_PPC64_F13]="FPR13",
+ [UNW_PPC64_F14]="FPR14",
+ [UNW_PPC64_F15]="FPR15",
+ [UNW_PPC64_F16]="FPR16",
+ [UNW_PPC64_F17]="FPR17",
+ [UNW_PPC64_F18]="FPR18",
+ [UNW_PPC64_F19]="FPR19",
+ [UNW_PPC64_F20]="FPR20",
+ [UNW_PPC64_F21]="FPR21",
+ [UNW_PPC64_F22]="FPR22",
+ [UNW_PPC64_F23]="FPR23",
+ [UNW_PPC64_F24]="FPR24",
+ [UNW_PPC64_F25]="FPR25",
+ [UNW_PPC64_F26]="FPR26",
+ [UNW_PPC64_F27]="FPR27",
+ [UNW_PPC64_F28]="FPR28",
+ [UNW_PPC64_F29]="FPR29",
+ [UNW_PPC64_F30]="FPR30",
+ [UNW_PPC64_F31]="FPR31",
+
+ [UNW_PPC64_LR]="LR",
+ [UNW_PPC64_CTR]="CTR",
+ [UNW_PPC64_ARG_POINTER]="ARG_POINTER",
+
+ [UNW_PPC64_CR0]="CR0",
+ [UNW_PPC64_CR1]="CR1",
+ [UNW_PPC64_CR2]="CR2",
+ [UNW_PPC64_CR3]="CR3",
+ [UNW_PPC64_CR4]="CR4",
+ [UNW_PPC64_CR5]="CR5",
+ [UNW_PPC64_CR6]="CR6",
+ [UNW_PPC64_CR7]="CR7",
+
+ [UNW_PPC64_XER]="XER",
+
+ [UNW_PPC64_V0]="VR0",
+ [UNW_PPC64_V1]="VR1",
+ [UNW_PPC64_V2]="VR2",
+ [UNW_PPC64_V3]="VR3",
+ [UNW_PPC64_V4]="VR4",
+ [UNW_PPC64_V5]="VR5",
+ [UNW_PPC64_V6]="VR6",
+ [UNW_PPC64_V7]="VR7",
+ [UNW_PPC64_V8]="VR8",
+ [UNW_PPC64_V9]="VR9",
+ [UNW_PPC64_V10]="VR10",
+ [UNW_PPC64_V11]="VR11",
+ [UNW_PPC64_V12]="VR12",
+ [UNW_PPC64_V13]="VR13",
+ [UNW_PPC64_V14]="VR14",
+ [UNW_PPC64_V15]="VR15",
+ [UNW_PPC64_V16]="VR16",
+ [UNW_PPC64_V17]="VR17",
+ [UNW_PPC64_V18]="VR18",
+ [UNW_PPC64_V19]="VR19",
+ [UNW_PPC64_V20]="VR20",
+ [UNW_PPC64_V21]="VR21",
+ [UNW_PPC64_V22]="VR22",
+ [UNW_PPC64_V23]="VR23",
+ [UNW_PPC64_V24]="VR24",
+ [UNW_PPC64_V25]="VR25",
+ [UNW_PPC64_V26]="VR26",
+ [UNW_PPC64_V27]="VR27",
+ [UNW_PPC64_V28]="VR28",
+ [UNW_PPC64_V29]="VR29",
+ [UNW_PPC64_V30]="VR30",
+ [UNW_PPC64_V31]="VR31",
+
+ [UNW_PPC64_VSCR]="VSCR",
+
+ [UNW_PPC64_VRSAVE]="VRSAVE",
+ [UNW_PPC64_SPE_ACC]="SPE_ACC",
+ [UNW_PPC64_SPEFSCR]="SPEFSCR",
+
+ [UNW_PPC64_FRAME_POINTER]="FRAME_POINTER",
+ [UNW_PPC64_NIP]="NIP",
+
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/ppc64/setcontext.S b/src/pal/src/libunwind/src/ppc64/setcontext.S
new file mode 100644
index 0000000000..ffc2500a51
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/setcontext.S
@@ -0,0 +1,9 @@
+ .global _UI_setcontext
+
+_UI_setcontext:
+ blr
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/ucontext_i.h b/src/pal/src/libunwind/src/ppc64/ucontext_i.h
new file mode 100644
index 0000000000..2ddfdb865a
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/ucontext_i.h
@@ -0,0 +1,173 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef ucontext_i_h
+#define ucontext_i_h
+
+#include <ucontext.h>
+
+/* These values were derived by reading
+ /usr/src/linux-2.6.18-1.8/arch/um/include/sysdep-ppc/ptrace.h and
+ /usr/src/linux-2.6.18-1.8/arch/powerpc/kernel/ppc32.h
+*/
+
+#define NIP_IDX 32
+#define MSR_IDX 33
+#define ORIG_GPR3_IDX 34
+#define CTR_IDX 35
+#define LINK_IDX 36
+#define XER_IDX 37
+#define CCR_IDX 38
+#define SOFTE_IDX 39
+#define TRAP_IDX 40
+#define DAR_IDX 41
+#define DSISR_IDX 42
+#define RESULT_IDX 43
+
+#define VSCR_IDX 32
+#define VRSAVE_IDX 33
+
+/* These are dummy structures used only for obtaining the offsets of the
+ various structure members. */
+static ucontext_t dmy_ctxt;
+static vrregset_t dmy_vrregset;
+
+#define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[0] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[1] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[2] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[3] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[4] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[5] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[6] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[7] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[8] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[9] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[10] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[11] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[12] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[13] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[14] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[15] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[16] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[17] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[18] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[19] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[20] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[21] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[22] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[23] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[24] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[25] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[26] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[27] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[28] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[29] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[30] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[31] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_NIP ((void *)&dmy_ctxt.uc_mcontext.gp_regs[NIP_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_MSR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[MSR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_ORIG_GPR3 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[ORIG_GPR3_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_CTR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[CTR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_LINK ((void *)&dmy_ctxt.uc_mcontext.gp_regs[LINK_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_XER ((void *)&dmy_ctxt.uc_mcontext.gp_regs[XER_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_CCR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[CCR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_SOFTE ((void *)&dmy_ctxt.uc_mcontext.gp_regs[SOFTE_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_TRAP ((void *)&dmy_ctxt.uc_mcontext.gp_regs[TRAP_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_DAR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[DAR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_DSISR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[DSISR_IDX] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_GREGS_RESULT ((void *)&dmy_ctxt.uc_mcontext.gp_regs[RESULT_IDX] - (void *)&dmy_ctxt)
+
+#define UC_MCONTEXT_FREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[0] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[1] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[2] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[3] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[4] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[5] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[6] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[7] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[8] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[9] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[10] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[11] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[12] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[13] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[14] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[15] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[16] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[17] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[18] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[19] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[20] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[21] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[22] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[23] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[24] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[25] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[26] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[27] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[28] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[29] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[30] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[31] - (void *)&dmy_ctxt)
+#define UC_MCONTEXT_FREGS_FPSCR ((void *)&dmy_ctxt.uc_mcontext.fp_regs[32] - (void *)&dmy_ctxt)
+
+#define UC_MCONTEXT_V_REGS ((void *)&dmy_ctxt.uc_mcontext.v_regs - (void *)&dmy_ctxt)
+
+#define UC_MCONTEXT_VREGS_R0 ((void *)&dmy_vrregset.vrregs[0] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R1 ((void *)&dmy_vrregset.vrregs[1] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R2 ((void *)&dmy_vrregset.vrregs[2] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R3 ((void *)&dmy_vrregset.vrregs[3] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R4 ((void *)&dmy_vrregset.vrregs[4] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R5 ((void *)&dmy_vrregset.vrregs[5] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R6 ((void *)&dmy_vrregset.vrregs[6] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R7 ((void *)&dmy_vrregset.vrregs[7] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R8 ((void *)&dmy_vrregset.vrregs[8] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R9 ((void *)&dmy_vrregset.vrregs[9] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R10 ((void *)&dmy_vrregset.vrregs[10] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R11 ((void *)&dmy_vrregset.vrregs[11] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R12 ((void *)&dmy_vrregset.vrregs[12] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R13 ((void *)&dmy_vrregset.vrregs[13] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R14 ((void *)&dmy_vrregset.vrregs[14] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R15 ((void *)&dmy_vrregset.vrregs[15] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R16 ((void *)&dmy_vrregset.vrregs[16] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R17 ((void *)&dmy_vrregset.vrregs[17] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R18 ((void *)&dmy_vrregset.vrregs[18] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R19 ((void *)&dmy_vrregset.vrregs[19] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R20 ((void *)&dmy_vrregset.vrregs[20] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R21 ((void *)&dmy_vrregset.vrregs[21] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R22 ((void *)&dmy_vrregset.vrregs[22] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R23 ((void *)&dmy_vrregset.vrregs[23] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R24 ((void *)&dmy_vrregset.vrregs[24] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R25 ((void *)&dmy_vrregset.vrregs[25] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R26 ((void *)&dmy_vrregset.vrregs[26] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R27 ((void *)&dmy_vrregset.vrregs[27] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R28 ((void *)&dmy_vrregset.vrregs[28] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R29 ((void *)&dmy_vrregset.vrregs[29] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R30 ((void *)&dmy_vrregset.vrregs[30] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_R31 ((void *)&dmy_vrregset.vrregs[31] - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_VSCR ((void *)&dmy_vrregset.vscr - (void *)&dmy_vrregset)
+#define UC_MCONTEXT_VREGS_VRSAVE ((void *)&dmy_vrregset.vrsave - (void *)&dmy_vrregset)
+
+#endif
diff --git a/src/pal/src/libunwind/src/ppc64/unwind_i.h b/src/pal/src/libunwind/src/ppc64/unwind_i.h
new file mode 100644
index 0000000000..26bbc2df83
--- /dev/null
+++ b/src/pal/src/libunwind/src/ppc64/unwind_i.h
@@ -0,0 +1,52 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2006-2007 IBM
+ Contributed by
+ Corey Ashford <cjashfor@us.ibm.com>
+ Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <stdint.h>
+
+#include <libunwind-ppc64.h>
+
+#include <libunwind_i.h>
+#include <sys/ucontext.h>
+
+#define ppc64_lock UNW_OBJ(lock)
+#define ppc64_local_resume UNW_OBJ(local_resume)
+#define ppc64_local_addr_space_init UNW_OBJ(local_addr_space_init)
+#if 0
+#define ppc64_scratch_loc UNW_OBJ(scratch_loc)
+#endif
+
+extern void ppc64_local_addr_space_init (void);
+extern int ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+#if 0
+extern dwarf_loc_t ppc64_scratch_loc (struct cursor *c, unw_regnum_t reg);
+#endif
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_access_fpreg.c b/src/pal/src/libunwind/src/ptrace/_UPT_access_fpreg.c
new file mode 100644
index 0000000000..2b92462fa9
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_access_fpreg.c
@@ -0,0 +1,121 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+#if HAVE_DECL_PTRACE_POKEUSER || HAVE_TTRACE
+int
+_UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ unw_word_t *wp = (unw_word_t *) val;
+ struct UPT_info *ui = arg;
+ pid_t pid = ui->pid;
+ int i;
+
+ if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset))
+ return -UNW_EBADREG;
+
+ errno = 0;
+ if (write)
+ for (i = 0; i < (int) (sizeof (*val) / sizeof (wp[i])); ++i)
+ {
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg] + i * sizeof(wp[i]),
+ wp[i]);
+#endif
+ if (errno)
+ return -UNW_EBADREG;
+ }
+ else
+ for (i = 0; i < (int) (sizeof (*val) / sizeof (wp[i])); ++i)
+ {
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ wp[i] = ptrace (PTRACE_PEEKUSER, pid,
+ _UPT_reg_offset[reg] + i * sizeof(wp[i]), 0);
+#endif
+ if (errno)
+ return -UNW_EBADREG;
+ }
+ return 0;
+}
+#elif HAVE_DECL_PT_GETFPREGS
+int
+_UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ struct UPT_info *ui = arg;
+ pid_t pid = ui->pid;
+ fpregset_t fpreg;
+
+#if defined(__amd64__)
+ if (1) /* XXXKIB */
+ return -UNW_EBADREG;
+#elif defined(__i386__)
+ if ((unsigned) reg < UNW_X86_ST0 || (unsigned) reg > UNW_X86_ST7)
+ return -UNW_EBADREG;
+#elif defined(__arm__)
+ if ((unsigned) reg < UNW_ARM_F0 || (unsigned) reg > UNW_ARM_F7)
+ return -UNW_EBADREG;
+#else
+#error Fix me
+#endif
+ if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset))
+ return -UNW_EBADREG;
+
+ if (ptrace(PT_GETFPREGS, pid, (caddr_t)&fpreg, 0) == -1)
+ return -UNW_EBADREG;
+ if (write) {
+#if defined(__amd64__)
+ memcpy(&fpreg.fpr_xacc[reg], val, sizeof(unw_fpreg_t));
+#elif defined(__i386__)
+ memcpy(&fpreg.fpr_acc[reg], val, sizeof(unw_fpreg_t));
+#elif defined(__arm__)
+ memcpy(&fpreg.fpr[reg], val, sizeof(unw_fpreg_t));
+#else
+#error Fix me
+#endif
+ if (ptrace(PT_SETFPREGS, pid, (caddr_t)&fpreg, 0) == -1)
+ return -UNW_EBADREG;
+ } else
+#if defined(__amd64__)
+ memcpy(val, &fpreg.fpr_xacc[reg], sizeof(unw_fpreg_t));
+#elif defined(__i386__)
+ memcpy(val, &fpreg.fpr_acc[reg], sizeof(unw_fpreg_t));
+#elif defined(__arm__)
+ memcpy(val, &fpreg.fpr[reg], sizeof(unw_fpreg_t));
+#else
+#error Fix me
+#endif
+ return 0;
+}
+#else
+#error Fix me
+#endif
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_access_mem.c b/src/pal/src/libunwind/src/ptrace/_UPT_access_mem.c
new file mode 100644
index 0000000000..79bde25dff
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_access_mem.c
@@ -0,0 +1,123 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+#if HAVE_DECL_PTRACE_POKEDATA || HAVE_TTRACE
+int
+_UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val,
+ int write, void *arg)
+{
+ struct UPT_info *ui = arg;
+ int i, end;
+ unw_word_t tmp_val;
+
+ if (!ui)
+ return -UNW_EINVAL;
+
+ pid_t pid = ui->pid;
+
+ // Some 32-bit archs have to define a 64-bit unw_word_t.
+ // Callers of this function therefore expect a 64-bit
+ // return value, but ptrace only returns a 32-bit value
+ // in such cases.
+ if (sizeof(long) == 4 && sizeof(unw_word_t) == 8)
+ end = 2;
+ else
+ end = 1;
+
+ for (i = 0; i < end; i++)
+ {
+ unw_word_t tmp_addr = i == 0 ? addr : addr + 4;
+
+ errno = 0;
+ if (write)
+ {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ tmp_val = i == 0 ? *val : *val >> 32;
+#else
+ tmp_val = i == 0 && end == 2 ? *val >> 32 : *val;
+#endif
+
+ Debug (16, "mem[%lx] <- %lx\n", (long) tmp_addr, (long) tmp_val);
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ ptrace (PTRACE_POKEDATA, pid, tmp_addr, tmp_val);
+ if (errno)
+ return -UNW_EINVAL;
+#endif
+ }
+ else
+ {
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ tmp_val = (unsigned long) ptrace (PTRACE_PEEKDATA, pid, tmp_addr, 0);
+
+ if (i == 0)
+ *val = 0;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ *val |= tmp_val << (i * 32);
+#else
+ *val |= i == 0 && end == 2 ? tmp_val << 32 : tmp_val;
+#endif
+
+ if (errno)
+ return -UNW_EINVAL;
+#endif
+ Debug (16, "mem[%lx] -> %lx\n", (long) tmp_addr, (long) tmp_val);
+ }
+ }
+ return 0;
+}
+#elif HAVE_DECL_PT_IO
+int
+_UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val,
+ int write, void *arg)
+{
+ struct UPT_info *ui = arg;
+ if (!ui)
+ return -UNW_EINVAL;
+ pid_t pid = ui->pid;
+ struct ptrace_io_desc iod;
+
+ iod.piod_offs = (void *)addr;
+ iod.piod_addr = val;
+ iod.piod_len = sizeof(*val);
+ iod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D;
+ if (write)
+ Debug (16, "mem[%lx] <- %lx\n", (long) addr, (long) *val);
+ if (ptrace(PT_IO, pid, (caddr_t)&iod, 0) == -1)
+ return -UNW_EINVAL;
+ if (!write)
+ Debug (16, "mem[%lx] -> %lx\n", (long) addr, (long) *val);
+ return 0;
+}
+#else
+#error Fix me
+#endif
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_access_reg.c b/src/pal/src/libunwind/src/ptrace/_UPT_access_reg.c
new file mode 100644
index 0000000000..ce25c783b0
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_access_reg.c
@@ -0,0 +1,352 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+#if UNW_TARGET_IA64
+# include <elf.h>
+# ifdef HAVE_ASM_PTRACE_OFFSETS_H
+# include <asm/ptrace_offsets.h>
+# endif
+# include "tdep-ia64/rse.h"
+#endif
+
+#if HAVE_DECL_PTRACE_SETREGSET
+#include <sys/uio.h>
+int
+_UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
+ int write, void *arg)
+{
+ struct UPT_info *ui = arg;
+ pid_t pid = ui->pid;
+ gregset_t regs;
+ char *r;
+ struct iovec loc;
+
+#if UNW_DEBUG
+ Debug(16, "using getregset: reg: %s [%u], val: %lx, write: %u\n",
+ unw_regname(reg), (unsigned) reg, (long) val, write);
+
+ if (write)
+ Debug (16, "%s [%u] <- %lx\n", unw_regname (reg), (unsigned) reg, (long) *val);
+#endif
+ if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset))
+ {
+ errno = EINVAL;
+ goto badreg;
+ }
+
+ loc.iov_base = &regs;
+ loc.iov_len = sizeof(regs);
+
+ r = (char *)&regs + _UPT_reg_offset[reg];
+ if (ptrace (PTRACE_GETREGSET, pid, NT_PRSTATUS, &loc) == -1)
+ goto badreg;
+ if (write) {
+ memcpy(r, val, sizeof(unw_word_t));
+ if (ptrace(PTRACE_SETREGSET, pid, NT_PRSTATUS, &loc) == -1)
+ goto badreg;
+ } else
+ memcpy(val, r, sizeof(unw_word_t));
+ return 0;
+
+badreg:
+ Debug (1, "bad register %s [%u] (error: %s)\n", unw_regname(reg), reg, strerror (errno));
+ return -UNW_EBADREG;
+}
+#elif HAVE_DECL_PTRACE_POKEUSER || HAVE_TTRACE
+int
+_UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
+ int write, void *arg)
+{
+ struct UPT_info *ui = arg;
+ pid_t pid = ui->pid;
+
+#if UNW_DEBUG
+ Debug(16, "using pokeuser: reg: %s [%u], val: %lx, write: %d\n", unw_regname(reg), (unsigned) reg, (long) val, write);
+
+ if (write)
+ Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val);
+#endif
+
+#if UNW_TARGET_IA64
+ if ((unsigned) reg - UNW_IA64_NAT < 32)
+ {
+ unsigned long nat_bits, mask;
+
+ /* The Linux ptrace represents the statc NaT bits as a single word. */
+ mask = ((unw_word_t) 1) << (reg - UNW_IA64_NAT);
+ errno = 0;
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ nat_bits = ptrace (PTRACE_PEEKUSER, pid, PT_NAT_BITS, 0);
+ if (errno)
+ goto badreg;
+#endif
+
+ if (write)
+ {
+ if (*val)
+ nat_bits |= mask;
+ else
+ nat_bits &= ~mask;
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ ptrace (PTRACE_POKEUSER, pid, PT_NAT_BITS, nat_bits);
+ if (errno)
+ goto badreg;
+#endif
+ }
+ goto out;
+ }
+ else
+ switch (reg)
+ {
+ case UNW_IA64_GR + 0:
+ if (write)
+ goto badreg;
+ *val = 0;
+ return 0;
+
+ case UNW_REG_IP:
+ {
+ unsigned long ip, psr;
+
+ /* distribute bundle-addr. & slot-number across PT_IIP & PT_IPSR. */
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ psr = ptrace (PTRACE_PEEKUSER, pid, PT_CR_IPSR, 0);
+ if (errno)
+ goto badreg;
+#endif
+ if (write)
+ {
+ ip = *val & ~0xfUL;
+ psr = (psr & ~0x3UL << 41) | (*val & 0x3);
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ ptrace (PTRACE_POKEUSER, pid, PT_CR_IIP, ip);
+ ptrace (PTRACE_POKEUSER, pid, PT_CR_IPSR, psr);
+ if (errno)
+ goto badreg;
+#endif
+ }
+ else
+ {
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ ip = ptrace (PTRACE_PEEKUSER, pid, PT_CR_IIP, 0);
+ if (errno)
+ goto badreg;
+#endif
+ *val = ip + ((psr >> 41) & 0x3);
+ }
+ goto out;
+ }
+
+ case UNW_IA64_AR_BSPSTORE:
+ reg = UNW_IA64_AR_BSP;
+ break;
+
+ case UNW_IA64_AR_BSP:
+ case UNW_IA64_BSP:
+ {
+ unsigned long sof, cfm, bsp;
+
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ /* Account for the fact that ptrace() expects bsp to point
+ _after_ the current register frame. */
+ errno = 0;
+ cfm = ptrace (PTRACE_PEEKUSER, pid, PT_CFM, 0);
+ if (errno)
+ goto badreg;
+#endif
+ sof = (cfm & 0x7f);
+
+ if (write)
+ {
+ bsp = rse_skip_regs (*val, sof);
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ ptrace (PTRACE_POKEUSER, pid, PT_AR_BSP, bsp);
+ if (errno)
+ goto badreg;
+#endif
+ }
+ else
+ {
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ bsp = ptrace (PTRACE_PEEKUSER, pid, PT_AR_BSP, 0);
+ if (errno)
+ goto badreg;
+#endif
+ *val = rse_skip_regs (bsp, -sof);
+ }
+ goto out;
+ }
+
+ case UNW_IA64_CFM:
+ /* If we change CFM, we need to adjust ptrace's notion of bsp
+ accordingly, so that the real bsp remains unchanged. */
+ if (write)
+ {
+ unsigned long new_sof, old_sof, cfm, bsp;
+
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ bsp = ptrace (PTRACE_PEEKUSER, pid, PT_AR_BSP, 0);
+ cfm = ptrace (PTRACE_PEEKUSER, pid, PT_CFM, 0);
+#endif
+ if (errno)
+ goto badreg;
+ old_sof = (cfm & 0x7f);
+ new_sof = (*val & 0x7f);
+ if (old_sof != new_sof)
+ {
+ bsp = rse_skip_regs (bsp, -old_sof + new_sof);
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ ptrace (PTRACE_POKEUSER, pid, PT_AR_BSP, 0);
+ if (errno)
+ goto badreg;
+#endif
+ }
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ ptrace (PTRACE_POKEUSER, pid, PT_CFM, *val);
+ if (errno)
+ goto badreg;
+#endif
+ goto out;
+ }
+ break;
+ }
+#endif /* End of IA64 */
+
+ if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset))
+ {
+#if UNW_DEBUG
+ Debug(2, "register out of range: >= %zu / %zu\n", sizeof(_UPT_reg_offset), sizeof(_UPT_reg_offset[0]));
+#endif
+ errno = EINVAL;
+ goto badreg;
+ }
+
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#else
+ errno = 0;
+ if (write)
+ ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg], *val);
+ else {
+#if UNW_DEBUG
+ Debug(16, "ptrace PEEKUSER pid: %lu , reg: %lu , offs: %lu\n", (unsigned long)pid, (unsigned long)reg,
+ (unsigned long)_UPT_reg_offset[reg]);
+#endif
+ *val = ptrace (PTRACE_PEEKUSER, pid, _UPT_reg_offset[reg], 0);
+ }
+ if (errno) {
+#if UNW_DEBUG
+ Debug(2, "ptrace failure\n");
+#endif
+ goto badreg;
+ }
+#endif
+
+#ifdef UNW_TARGET_IA64
+ out:
+#endif
+#if UNW_DEBUG
+ if (!write)
+ Debug (16, "%s[%u] -> %lx\n", unw_regname (reg), (unsigned) reg, (long) *val);
+#endif
+ return 0;
+
+ badreg:
+ Debug (1, "bad register %s [%u] (error: %s)\n", unw_regname(reg), reg, strerror (errno));
+ return -UNW_EBADREG;
+}
+#elif HAVE_DECL_PT_GETREGS
+int
+_UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
+ int write, void *arg)
+{
+ struct UPT_info *ui = arg;
+ pid_t pid = ui->pid;
+ gregset_t regs;
+ char *r;
+
+#if UNW_DEBUG
+ Debug(16, "using getregs: reg: %s [%u], val: %lx, write: %u\n", unw_regname(reg), (unsigned) reg, (long) val, write);
+
+ if (write)
+ Debug (16, "%s [%u] <- %lx\n", unw_regname (reg), (unsigned) reg, (long) *val);
+#endif
+ if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset))
+ {
+ errno = EINVAL;
+ goto badreg;
+ }
+ r = (char *)&regs + _UPT_reg_offset[reg];
+ if (ptrace(PT_GETREGS, pid, (caddr_t)&regs, 0) == -1)
+ goto badreg;
+ if (write) {
+ memcpy(r, val, sizeof(unw_word_t));
+ if (ptrace(PT_SETREGS, pid, (caddr_t)&regs, 0) == -1)
+ goto badreg;
+ } else
+ memcpy(val, r, sizeof(unw_word_t));
+ return 0;
+
+ badreg:
+ Debug (1, "bad register %s [%u] (error: %s)\n", unw_regname(reg), reg, strerror (errno));
+ return -UNW_EBADREG;
+}
+#else
+#error Port me
+#endif
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_accessors.c b/src/pal/src/libunwind/src/ptrace/_UPT_accessors.c
new file mode 100644
index 0000000000..4724360bb9
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_accessors.c
@@ -0,0 +1,38 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+unw_accessors_t _UPT_accessors =
+ {
+ .find_proc_info = _UPT_find_proc_info,
+ .put_unwind_info = _UPT_put_unwind_info,
+ .get_dyn_info_list_addr = _UPT_get_dyn_info_list_addr,
+ .access_mem = _UPT_access_mem,
+ .access_reg = _UPT_access_reg,
+ .access_fpreg = _UPT_access_fpreg,
+ .resume = _UPT_resume,
+ .get_proc_name = _UPT_get_proc_name
+ };
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_create.c b/src/pal/src/libunwind/src/ptrace/_UPT_create.c
new file mode 100644
index 0000000000..dd59e974a7
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_create.c
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <string.h>
+
+#include "_UPT_internal.h"
+
+void *
+_UPT_create (pid_t pid)
+{
+ struct UPT_info *ui = malloc (sizeof (struct UPT_info));
+
+ if (!ui)
+ return NULL;
+
+ memset (ui, 0, sizeof (*ui));
+ ui->pid = pid;
+ ui->edi.di_cache.format = -1;
+ ui->edi.di_debug.format = -1;
+#if UNW_TARGET_IA64
+ ui->edi.ktab.format = -1;
+#endif
+ return ui;
+}
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_destroy.c b/src/pal/src/libunwind/src/ptrace/_UPT_destroy.c
new file mode 100644
index 0000000000..edb664ce12
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_destroy.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+void
+_UPT_destroy (void *ptr)
+{
+ struct UPT_info *ui = (struct UPT_info *) ptr;
+ invalidate_edi (&ui->edi);
+ free (ptr);
+}
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_elf.c b/src/pal/src/libunwind/src/ptrace/_UPT_elf.c
new file mode 100644
index 0000000000..efc43b578b
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_elf.c
@@ -0,0 +1,5 @@
+/* We need to get a separate copy of the ELF-code into
+ libunwind-ptrace since it cannot (and must not) have any ELF
+ dependencies on libunwind. */
+#include "libunwind_i.h" /* get ELFCLASS defined */
+#include "../elfxx.c"
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_find_proc_info.c b/src/pal/src/libunwind/src/ptrace/_UPT_find_proc_info.c
new file mode 100644
index 0000000000..b3209f451e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_find_proc_info.c
@@ -0,0 +1,145 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <elf.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+
+#include "_UPT_internal.h"
+
+static int
+get_unwind_info (struct elf_dyn_info *edi, pid_t pid, unw_addr_space_t as, unw_word_t ip)
+{
+ unsigned long segbase, mapoff;
+ char path[PATH_MAX];
+
+#if UNW_TARGET_IA64 && defined(__linux)
+ if (!edi->ktab.start_ip && _Uia64_get_kernel_table (&edi->ktab) < 0)
+ return -UNW_ENOINFO;
+
+ if (edi->ktab.format != -1 && ip >= edi->ktab.start_ip && ip < edi->ktab.end_ip)
+ return 0;
+#endif
+
+ if ((edi->di_cache.format != -1
+ && ip >= edi->di_cache.start_ip && ip < edi->di_cache.end_ip)
+#if UNW_TARGET_ARM
+ || (edi->di_debug.format != -1
+ && ip >= edi->di_arm.start_ip && ip < edi->di_arm.end_ip)
+#endif
+ || (edi->di_debug.format != -1
+ && ip >= edi->di_debug.start_ip && ip < edi->di_debug.end_ip))
+ return 0;
+
+ invalidate_edi(edi);
+
+ if (tdep_get_elf_image (&edi->ei, pid, ip, &segbase, &mapoff, path,
+ sizeof(path)) < 0)
+ return -UNW_ENOINFO;
+
+ /* Here, SEGBASE is the starting-address of the (mmap'ped) segment
+ which covers the IP we're looking for. */
+ if (tdep_find_unwind_table (edi, as, path, segbase, mapoff, ip) < 0)
+ return -UNW_ENOINFO;
+
+ /* This can happen in corner cases where dynamically generated
+ code falls into the same page that contains the data-segment
+ and the page-offset of the code is within the first page of
+ the executable. */
+ if (edi->di_cache.format != -1
+ && (ip < edi->di_cache.start_ip || ip >= edi->di_cache.end_ip))
+ edi->di_cache.format = -1;
+
+ if (edi->di_debug.format != -1
+ && (ip < edi->di_debug.start_ip || ip >= edi->di_debug.end_ip))
+ edi->di_debug.format = -1;
+
+ if (edi->di_cache.format == -1
+#if UNW_TARGET_ARM
+ && edi->di_arm.format == -1
+#endif
+ && edi->di_debug.format == -1)
+ return -UNW_ENOINFO;
+
+ return 0;
+}
+
+int
+_UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
+ int need_unwind_info, void *arg)
+{
+ struct UPT_info *ui = arg;
+ int ret = -UNW_ENOINFO;
+
+ if (get_unwind_info (&ui->edi, ui->pid, as, ip) < 0)
+ return -UNW_ENOINFO;
+
+#if UNW_TARGET_IA64
+ if (ui->edi.ktab.format != -1)
+ {
+ /* The kernel unwind table resides in local memory, so we have
+ to use the local address space to search it. Since
+ _UPT_put_unwind_info() has no easy way of detecting this
+ case, we simply make a copy of the unwind-info, so
+ _UPT_put_unwind_info() can always free() the unwind-info
+ without ill effects. */
+ ret = tdep_search_unwind_table (unw_local_addr_space, ip, &ui->edi.ktab, pi,
+ need_unwind_info, arg);
+ if (ret >= 0)
+ {
+ if (!need_unwind_info)
+ pi->unwind_info = NULL;
+ else
+ {
+ void *mem = malloc (pi->unwind_info_size);
+
+ if (!mem)
+ return -UNW_ENOMEM;
+ memcpy (mem, pi->unwind_info, pi->unwind_info_size);
+ pi->unwind_info = mem;
+ }
+ }
+ }
+#endif
+
+ if (ret == -UNW_ENOINFO && ui->edi.di_cache.format != -1)
+ ret = tdep_search_unwind_table (as, ip, &ui->edi.di_cache,
+ pi, need_unwind_info, arg);
+
+ if (ret == -UNW_ENOINFO && ui->edi.di_debug.format != -1)
+ ret = tdep_search_unwind_table (as, ip, &ui->edi.di_debug, pi,
+ need_unwind_info, arg);
+
+#if UNW_TARGET_ARM
+ if (ret == -UNW_ENOINFO && ui->edi.di_arm.format != -1)
+ ret = tdep_search_unwind_table (as, ip, &ui->edi.di_arm, pi,
+ need_unwind_info, arg);
+#endif
+
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c
new file mode 100644
index 0000000000..cc5ed04418
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c
@@ -0,0 +1,105 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+#if UNW_TARGET_IA64 && defined(__linux)
+# include "elf64.h"
+# include "os-linux.h"
+
+static inline int
+get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
+ int *countp)
+{
+ unsigned long lo, hi, off;
+ struct UPT_info *ui = arg;
+ struct map_iterator mi;
+ char path[PATH_MAX];
+ unw_word_t res;
+ int count = 0;
+
+ maps_init (&mi, ui->pid);
+ while (maps_next (&mi, &lo, &hi, &off))
+ {
+ if (off)
+ continue;
+
+ invalidate_edi(&ui->edi);
+
+ if (elf_map_image (&ui->edi.ei, path) < 0)
+ /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */
+ continue;
+
+ Debug (16, "checking object %s\n", path);
+
+ if (tdep_find_unwind_table (&ui->edi, as, path, lo, off, 0) > 0)
+ {
+ res = _Uia64_find_dyn_list (as, &ui->edi.di_cache, arg);
+ if (res && count++ == 0)
+ {
+ Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res);
+ *dil_addr = res;
+ }
+ }
+ }
+ maps_close (&mi);
+ *countp = count;
+ return 0;
+}
+
+#else
+
+static inline int
+get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
+ int *countp)
+{
+# warning Implement get_list_addr(), please.
+ *countp = 0;
+ return 0;
+}
+
+#endif
+
+int
+_UPT_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr,
+ void *arg)
+{
+ int count, ret;
+
+ Debug (12, "looking for dyn_info list\n");
+
+ if ((ret = get_list_addr (as, dil_addr, arg, &count)) < 0)
+ return ret;
+
+ /* If multiple dynamic-info list addresses are found, we would have
+ to determine which was is the one actually in use (since the
+ dynamic name resolution algorithm will pick one "winner").
+ Perhaps we'd have to track them all until we find one that's
+ non-empty. Hopefully, this case simply will never arise, since
+ only libunwind defines the dynamic info list head. */
+ assert (count <= 1);
+
+ return (count > 0) ? 0 : -UNW_ENOINFO;
+}
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_get_proc_name.c b/src/pal/src/libunwind/src/ptrace/_UPT_get_proc_name.c
new file mode 100644
index 0000000000..79c1f38e25
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_get_proc_name.c
@@ -0,0 +1,42 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+int
+_UPT_get_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp, void *arg)
+{
+ struct UPT_info *ui = arg;
+
+#if ELF_CLASS == ELFCLASS64
+ return _Uelf64_get_proc_name (as, ui->pid, ip, buf, buf_len, offp);
+#elif ELF_CLASS == ELFCLASS32
+ return _Uelf32_get_proc_name (as, ui->pid, ip, buf, buf_len, offp);
+#else
+ return -UNW_ENOINFO;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_internal.h b/src/pal/src/libunwind/src/ptrace/_UPT_internal.h
new file mode 100644
index 0000000000..5cef2573ee
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_internal.h
@@ -0,0 +1,59 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef _UPT_internal_h
+#define _UPT_internal_h
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_PTRACE_H
+#include <sys/ptrace.h>
+#endif
+#ifdef HAVE_SYS_PROCFS_H
+#include <sys/procfs.h>
+#endif
+
+#include <errno.h>
+#include <libunwind-ptrace.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "libunwind_i.h"
+
+struct UPT_info
+ {
+ pid_t pid; /* the process-id of the child we're unwinding */
+ struct elf_dyn_info edi;
+ };
+
+extern const int _UPT_reg_offset[UNW_REG_LAST + 1];
+
+#endif /* _UPT_internal_h */
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_put_unwind_info.c b/src/pal/src/libunwind/src/ptrace/_UPT_put_unwind_info.c
new file mode 100644
index 0000000000..d4b8463147
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_put_unwind_info.c
@@ -0,0 +1,35 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+void
+_UPT_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg)
+{
+ if (!pi->unwind_info)
+ return;
+ free (pi->unwind_info);
+ pi->unwind_info = NULL;
+}
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_reg_offset.c b/src/pal/src/libunwind/src/ptrace/_UPT_reg_offset.c
new file mode 100644
index 0000000000..c82d1c9887
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_reg_offset.c
@@ -0,0 +1,638 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2013 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+#include <stddef.h>
+
+#ifdef HAVE_ASM_PTRACE_OFFSETS_H
+# include <asm/ptrace_offsets.h>
+#endif
+
+const int _UPT_reg_offset[UNW_REG_LAST + 1] =
+ {
+#ifdef HAVE_ASM_PTRACE_OFFSETS_H
+# ifndef PT_AR_CSD
+# define PT_AR_CSD -1 /* this was introduced with rev 2.1 of ia64 */
+# endif
+
+ [UNW_IA64_GR + 0] = -1, [UNW_IA64_GR + 1] = PT_R1,
+ [UNW_IA64_GR + 2] = PT_R2, [UNW_IA64_GR + 3] = PT_R3,
+ [UNW_IA64_GR + 4] = PT_R4, [UNW_IA64_GR + 5] = PT_R5,
+ [UNW_IA64_GR + 6] = PT_R6, [UNW_IA64_GR + 7] = PT_R7,
+ [UNW_IA64_GR + 8] = PT_R8, [UNW_IA64_GR + 9] = PT_R9,
+ [UNW_IA64_GR + 10] = PT_R10, [UNW_IA64_GR + 11] = PT_R11,
+ [UNW_IA64_GR + 12] = PT_R12, [UNW_IA64_GR + 13] = PT_R13,
+ [UNW_IA64_GR + 14] = PT_R14, [UNW_IA64_GR + 15] = PT_R15,
+ [UNW_IA64_GR + 16] = PT_R16, [UNW_IA64_GR + 17] = PT_R17,
+ [UNW_IA64_GR + 18] = PT_R18, [UNW_IA64_GR + 19] = PT_R19,
+ [UNW_IA64_GR + 20] = PT_R20, [UNW_IA64_GR + 21] = PT_R21,
+ [UNW_IA64_GR + 22] = PT_R22, [UNW_IA64_GR + 23] = PT_R23,
+ [UNW_IA64_GR + 24] = PT_R24, [UNW_IA64_GR + 25] = PT_R25,
+ [UNW_IA64_GR + 26] = PT_R26, [UNW_IA64_GR + 27] = PT_R27,
+ [UNW_IA64_GR + 28] = PT_R28, [UNW_IA64_GR + 29] = PT_R29,
+ [UNW_IA64_GR + 30] = PT_R30, [UNW_IA64_GR + 31] = PT_R31,
+
+ [UNW_IA64_NAT+ 0] = -1, [UNW_IA64_NAT+ 1] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 2] = PT_NAT_BITS, [UNW_IA64_NAT+ 3] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 4] = PT_NAT_BITS, [UNW_IA64_NAT+ 5] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 6] = PT_NAT_BITS, [UNW_IA64_NAT+ 7] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 8] = PT_NAT_BITS, [UNW_IA64_NAT+ 9] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 10] = PT_NAT_BITS, [UNW_IA64_NAT+ 11] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 12] = PT_NAT_BITS, [UNW_IA64_NAT+ 13] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 14] = PT_NAT_BITS, [UNW_IA64_NAT+ 15] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 16] = PT_NAT_BITS, [UNW_IA64_NAT+ 17] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 18] = PT_NAT_BITS, [UNW_IA64_NAT+ 19] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 20] = PT_NAT_BITS, [UNW_IA64_NAT+ 21] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 22] = PT_NAT_BITS, [UNW_IA64_NAT+ 23] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 24] = PT_NAT_BITS, [UNW_IA64_NAT+ 25] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 26] = PT_NAT_BITS, [UNW_IA64_NAT+ 27] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 28] = PT_NAT_BITS, [UNW_IA64_NAT+ 29] = PT_NAT_BITS,
+ [UNW_IA64_NAT+ 30] = PT_NAT_BITS, [UNW_IA64_NAT+ 31] = PT_NAT_BITS,
+
+ [UNW_IA64_FR + 0] = -1, [UNW_IA64_FR + 1] = -1,
+ [UNW_IA64_FR + 2] = PT_F2, [UNW_IA64_FR + 3] = PT_F3,
+ [UNW_IA64_FR + 4] = PT_F4, [UNW_IA64_FR + 5] = PT_F5,
+ [UNW_IA64_FR + 6] = PT_F6, [UNW_IA64_FR + 7] = PT_F7,
+ [UNW_IA64_FR + 8] = PT_F8, [UNW_IA64_FR + 9] = PT_F9,
+ [UNW_IA64_FR + 10] = PT_F10, [UNW_IA64_FR + 11] = PT_F11,
+ [UNW_IA64_FR + 12] = PT_F12, [UNW_IA64_FR + 13] = PT_F13,
+ [UNW_IA64_FR + 14] = PT_F14, [UNW_IA64_FR + 15] = PT_F15,
+ [UNW_IA64_FR + 16] = PT_F16, [UNW_IA64_FR + 17] = PT_F17,
+ [UNW_IA64_FR + 18] = PT_F18, [UNW_IA64_FR + 19] = PT_F19,
+ [UNW_IA64_FR + 20] = PT_F20, [UNW_IA64_FR + 21] = PT_F21,
+ [UNW_IA64_FR + 22] = PT_F22, [UNW_IA64_FR + 23] = PT_F23,
+ [UNW_IA64_FR + 24] = PT_F24, [UNW_IA64_FR + 25] = PT_F25,
+ [UNW_IA64_FR + 26] = PT_F26, [UNW_IA64_FR + 27] = PT_F27,
+ [UNW_IA64_FR + 28] = PT_F28, [UNW_IA64_FR + 29] = PT_F29,
+ [UNW_IA64_FR + 30] = PT_F30, [UNW_IA64_FR + 31] = PT_F31,
+ [UNW_IA64_FR + 32] = PT_F32, [UNW_IA64_FR + 33] = PT_F33,
+ [UNW_IA64_FR + 34] = PT_F34, [UNW_IA64_FR + 35] = PT_F35,
+ [UNW_IA64_FR + 36] = PT_F36, [UNW_IA64_FR + 37] = PT_F37,
+ [UNW_IA64_FR + 38] = PT_F38, [UNW_IA64_FR + 39] = PT_F39,
+ [UNW_IA64_FR + 40] = PT_F40, [UNW_IA64_FR + 41] = PT_F41,
+ [UNW_IA64_FR + 42] = PT_F42, [UNW_IA64_FR + 43] = PT_F43,
+ [UNW_IA64_FR + 44] = PT_F44, [UNW_IA64_FR + 45] = PT_F45,
+ [UNW_IA64_FR + 46] = PT_F46, [UNW_IA64_FR + 47] = PT_F47,
+ [UNW_IA64_FR + 48] = PT_F48, [UNW_IA64_FR + 49] = PT_F49,
+ [UNW_IA64_FR + 50] = PT_F50, [UNW_IA64_FR + 51] = PT_F51,
+ [UNW_IA64_FR + 52] = PT_F52, [UNW_IA64_FR + 53] = PT_F53,
+ [UNW_IA64_FR + 54] = PT_F54, [UNW_IA64_FR + 55] = PT_F55,
+ [UNW_IA64_FR + 56] = PT_F56, [UNW_IA64_FR + 57] = PT_F57,
+ [UNW_IA64_FR + 58] = PT_F58, [UNW_IA64_FR + 59] = PT_F59,
+ [UNW_IA64_FR + 60] = PT_F60, [UNW_IA64_FR + 61] = PT_F61,
+ [UNW_IA64_FR + 62] = PT_F62, [UNW_IA64_FR + 63] = PT_F63,
+ [UNW_IA64_FR + 64] = PT_F64, [UNW_IA64_FR + 65] = PT_F65,
+ [UNW_IA64_FR + 66] = PT_F66, [UNW_IA64_FR + 67] = PT_F67,
+ [UNW_IA64_FR + 68] = PT_F68, [UNW_IA64_FR + 69] = PT_F69,
+ [UNW_IA64_FR + 70] = PT_F70, [UNW_IA64_FR + 71] = PT_F71,
+ [UNW_IA64_FR + 72] = PT_F72, [UNW_IA64_FR + 73] = PT_F73,
+ [UNW_IA64_FR + 74] = PT_F74, [UNW_IA64_FR + 75] = PT_F75,
+ [UNW_IA64_FR + 76] = PT_F76, [UNW_IA64_FR + 77] = PT_F77,
+ [UNW_IA64_FR + 78] = PT_F78, [UNW_IA64_FR + 79] = PT_F79,
+ [UNW_IA64_FR + 80] = PT_F80, [UNW_IA64_FR + 81] = PT_F81,
+ [UNW_IA64_FR + 82] = PT_F82, [UNW_IA64_FR + 83] = PT_F83,
+ [UNW_IA64_FR + 84] = PT_F84, [UNW_IA64_FR + 85] = PT_F85,
+ [UNW_IA64_FR + 86] = PT_F86, [UNW_IA64_FR + 87] = PT_F87,
+ [UNW_IA64_FR + 88] = PT_F88, [UNW_IA64_FR + 89] = PT_F89,
+ [UNW_IA64_FR + 90] = PT_F90, [UNW_IA64_FR + 91] = PT_F91,
+ [UNW_IA64_FR + 92] = PT_F92, [UNW_IA64_FR + 93] = PT_F93,
+ [UNW_IA64_FR + 94] = PT_F94, [UNW_IA64_FR + 95] = PT_F95,
+ [UNW_IA64_FR + 96] = PT_F96, [UNW_IA64_FR + 97] = PT_F97,
+ [UNW_IA64_FR + 98] = PT_F98, [UNW_IA64_FR + 99] = PT_F99,
+ [UNW_IA64_FR +100] = PT_F100, [UNW_IA64_FR +101] = PT_F101,
+ [UNW_IA64_FR +102] = PT_F102, [UNW_IA64_FR +103] = PT_F103,
+ [UNW_IA64_FR +104] = PT_F104, [UNW_IA64_FR +105] = PT_F105,
+ [UNW_IA64_FR +106] = PT_F106, [UNW_IA64_FR +107] = PT_F107,
+ [UNW_IA64_FR +108] = PT_F108, [UNW_IA64_FR +109] = PT_F109,
+ [UNW_IA64_FR +110] = PT_F110, [UNW_IA64_FR +111] = PT_F111,
+ [UNW_IA64_FR +112] = PT_F112, [UNW_IA64_FR +113] = PT_F113,
+ [UNW_IA64_FR +114] = PT_F114, [UNW_IA64_FR +115] = PT_F115,
+ [UNW_IA64_FR +116] = PT_F116, [UNW_IA64_FR +117] = PT_F117,
+ [UNW_IA64_FR +118] = PT_F118, [UNW_IA64_FR +119] = PT_F119,
+ [UNW_IA64_FR +120] = PT_F120, [UNW_IA64_FR +121] = PT_F121,
+ [UNW_IA64_FR +122] = PT_F122, [UNW_IA64_FR +123] = PT_F123,
+ [UNW_IA64_FR +124] = PT_F124, [UNW_IA64_FR +125] = PT_F125,
+ [UNW_IA64_FR +126] = PT_F126, [UNW_IA64_FR +127] = PT_F127,
+
+ [UNW_IA64_AR + 0] = -1, [UNW_IA64_AR + 1] = -1,
+ [UNW_IA64_AR + 2] = -1, [UNW_IA64_AR + 3] = -1,
+ [UNW_IA64_AR + 4] = -1, [UNW_IA64_AR + 5] = -1,
+ [UNW_IA64_AR + 6] = -1, [UNW_IA64_AR + 7] = -1,
+ [UNW_IA64_AR + 8] = -1, [UNW_IA64_AR + 9] = -1,
+ [UNW_IA64_AR + 10] = -1, [UNW_IA64_AR + 11] = -1,
+ [UNW_IA64_AR + 12] = -1, [UNW_IA64_AR + 13] = -1,
+ [UNW_IA64_AR + 14] = -1, [UNW_IA64_AR + 15] = -1,
+ [UNW_IA64_AR + 16] = PT_AR_RSC, [UNW_IA64_AR + 17] = PT_AR_BSP,
+ [UNW_IA64_AR + 18] = PT_AR_BSPSTORE,[UNW_IA64_AR + 19] = PT_AR_RNAT,
+ [UNW_IA64_AR + 20] = -1, [UNW_IA64_AR + 21] = -1,
+ [UNW_IA64_AR + 22] = -1, [UNW_IA64_AR + 23] = -1,
+ [UNW_IA64_AR + 24] = -1, [UNW_IA64_AR + 25] = PT_AR_CSD,
+ [UNW_IA64_AR + 26] = -1, [UNW_IA64_AR + 27] = -1,
+ [UNW_IA64_AR + 28] = -1, [UNW_IA64_AR + 29] = -1,
+ [UNW_IA64_AR + 30] = -1, [UNW_IA64_AR + 31] = -1,
+ [UNW_IA64_AR + 32] = PT_AR_CCV, [UNW_IA64_AR + 33] = -1,
+ [UNW_IA64_AR + 34] = -1, [UNW_IA64_AR + 35] = -1,
+ [UNW_IA64_AR + 36] = PT_AR_UNAT, [UNW_IA64_AR + 37] = -1,
+ [UNW_IA64_AR + 38] = -1, [UNW_IA64_AR + 39] = -1,
+ [UNW_IA64_AR + 40] = PT_AR_FPSR, [UNW_IA64_AR + 41] = -1,
+ [UNW_IA64_AR + 42] = -1, [UNW_IA64_AR + 43] = -1,
+ [UNW_IA64_AR + 44] = -1, [UNW_IA64_AR + 45] = -1,
+ [UNW_IA64_AR + 46] = -1, [UNW_IA64_AR + 47] = -1,
+ [UNW_IA64_AR + 48] = -1, [UNW_IA64_AR + 49] = -1,
+ [UNW_IA64_AR + 50] = -1, [UNW_IA64_AR + 51] = -1,
+ [UNW_IA64_AR + 52] = -1, [UNW_IA64_AR + 53] = -1,
+ [UNW_IA64_AR + 54] = -1, [UNW_IA64_AR + 55] = -1,
+ [UNW_IA64_AR + 56] = -1, [UNW_IA64_AR + 57] = -1,
+ [UNW_IA64_AR + 58] = -1, [UNW_IA64_AR + 59] = -1,
+ [UNW_IA64_AR + 60] = -1, [UNW_IA64_AR + 61] = -1,
+ [UNW_IA64_AR + 62] = -1, [UNW_IA64_AR + 63] = -1,
+ [UNW_IA64_AR + 64] = PT_AR_PFS, [UNW_IA64_AR + 65] = PT_AR_LC,
+ [UNW_IA64_AR + 66] = PT_AR_EC, [UNW_IA64_AR + 67] = -1,
+ [UNW_IA64_AR + 68] = -1, [UNW_IA64_AR + 69] = -1,
+ [UNW_IA64_AR + 70] = -1, [UNW_IA64_AR + 71] = -1,
+ [UNW_IA64_AR + 72] = -1, [UNW_IA64_AR + 73] = -1,
+ [UNW_IA64_AR + 74] = -1, [UNW_IA64_AR + 75] = -1,
+ [UNW_IA64_AR + 76] = -1, [UNW_IA64_AR + 77] = -1,
+ [UNW_IA64_AR + 78] = -1, [UNW_IA64_AR + 79] = -1,
+ [UNW_IA64_AR + 80] = -1, [UNW_IA64_AR + 81] = -1,
+ [UNW_IA64_AR + 82] = -1, [UNW_IA64_AR + 83] = -1,
+ [UNW_IA64_AR + 84] = -1, [UNW_IA64_AR + 85] = -1,
+ [UNW_IA64_AR + 86] = -1, [UNW_IA64_AR + 87] = -1,
+ [UNW_IA64_AR + 88] = -1, [UNW_IA64_AR + 89] = -1,
+ [UNW_IA64_AR + 90] = -1, [UNW_IA64_AR + 91] = -1,
+ [UNW_IA64_AR + 92] = -1, [UNW_IA64_AR + 93] = -1,
+ [UNW_IA64_AR + 94] = -1, [UNW_IA64_AR + 95] = -1,
+ [UNW_IA64_AR + 96] = -1, [UNW_IA64_AR + 97] = -1,
+ [UNW_IA64_AR + 98] = -1, [UNW_IA64_AR + 99] = -1,
+ [UNW_IA64_AR +100] = -1, [UNW_IA64_AR +101] = -1,
+ [UNW_IA64_AR +102] = -1, [UNW_IA64_AR +103] = -1,
+ [UNW_IA64_AR +104] = -1, [UNW_IA64_AR +105] = -1,
+ [UNW_IA64_AR +106] = -1, [UNW_IA64_AR +107] = -1,
+ [UNW_IA64_AR +108] = -1, [UNW_IA64_AR +109] = -1,
+ [UNW_IA64_AR +110] = -1, [UNW_IA64_AR +111] = -1,
+ [UNW_IA64_AR +112] = -1, [UNW_IA64_AR +113] = -1,
+ [UNW_IA64_AR +114] = -1, [UNW_IA64_AR +115] = -1,
+ [UNW_IA64_AR +116] = -1, [UNW_IA64_AR +117] = -1,
+ [UNW_IA64_AR +118] = -1, [UNW_IA64_AR +119] = -1,
+ [UNW_IA64_AR +120] = -1, [UNW_IA64_AR +121] = -1,
+ [UNW_IA64_AR +122] = -1, [UNW_IA64_AR +123] = -1,
+ [UNW_IA64_AR +124] = -1, [UNW_IA64_AR +125] = -1,
+ [UNW_IA64_AR +126] = -1, [UNW_IA64_AR +127] = -1,
+
+ [UNW_IA64_BR + 0] = PT_B0, [UNW_IA64_BR + 1] = PT_B1,
+ [UNW_IA64_BR + 2] = PT_B2, [UNW_IA64_BR + 3] = PT_B3,
+ [UNW_IA64_BR + 4] = PT_B4, [UNW_IA64_BR + 5] = PT_B5,
+ [UNW_IA64_BR + 6] = PT_B6, [UNW_IA64_BR + 7] = PT_B7,
+
+ [UNW_IA64_PR] = PT_PR,
+ [UNW_IA64_CFM] = PT_CFM,
+ [UNW_IA64_IP] = PT_CR_IIP
+#elif defined(HAVE_TTRACE)
+# warning No support for ttrace() yet.
+#elif defined(UNW_TARGET_HPPA)
+ [UNW_HPPA_GR + 0] = 0x000, [UNW_HPPA_GR + 1] = 0x004,
+ [UNW_HPPA_GR + 2] = 0x008, [UNW_HPPA_GR + 3] = 0x00c,
+ [UNW_HPPA_GR + 4] = 0x010, [UNW_HPPA_GR + 5] = 0x014,
+ [UNW_HPPA_GR + 6] = 0x018, [UNW_HPPA_GR + 7] = 0x01c,
+ [UNW_HPPA_GR + 8] = 0x020, [UNW_HPPA_GR + 9] = 0x024,
+ [UNW_HPPA_GR + 10] = 0x028, [UNW_HPPA_GR + 11] = 0x02c,
+ [UNW_HPPA_GR + 12] = 0x030, [UNW_HPPA_GR + 13] = 0x034,
+ [UNW_HPPA_GR + 14] = 0x038, [UNW_HPPA_GR + 15] = 0x03c,
+ [UNW_HPPA_GR + 16] = 0x040, [UNW_HPPA_GR + 17] = 0x044,
+ [UNW_HPPA_GR + 18] = 0x048, [UNW_HPPA_GR + 19] = 0x04c,
+ [UNW_HPPA_GR + 20] = 0x050, [UNW_HPPA_GR + 21] = 0x054,
+ [UNW_HPPA_GR + 22] = 0x058, [UNW_HPPA_GR + 23] = 0x05c,
+ [UNW_HPPA_GR + 24] = 0x060, [UNW_HPPA_GR + 25] = 0x064,
+ [UNW_HPPA_GR + 26] = 0x068, [UNW_HPPA_GR + 27] = 0x06c,
+ [UNW_HPPA_GR + 28] = 0x070, [UNW_HPPA_GR + 29] = 0x074,
+ [UNW_HPPA_GR + 30] = 0x078, [UNW_HPPA_GR + 31] = 0x07c,
+
+ [UNW_HPPA_FR + 0] = 0x080, [UNW_HPPA_FR + 1] = 0x088,
+ [UNW_HPPA_FR + 2] = 0x090, [UNW_HPPA_FR + 3] = 0x098,
+ [UNW_HPPA_FR + 4] = 0x0a0, [UNW_HPPA_FR + 5] = 0x0a8,
+ [UNW_HPPA_FR + 6] = 0x0b0, [UNW_HPPA_FR + 7] = 0x0b8,
+ [UNW_HPPA_FR + 8] = 0x0c0, [UNW_HPPA_FR + 9] = 0x0c8,
+ [UNW_HPPA_FR + 10] = 0x0d0, [UNW_HPPA_FR + 11] = 0x0d8,
+ [UNW_HPPA_FR + 12] = 0x0e0, [UNW_HPPA_FR + 13] = 0x0e8,
+ [UNW_HPPA_FR + 14] = 0x0f0, [UNW_HPPA_FR + 15] = 0x0f8,
+ [UNW_HPPA_FR + 16] = 0x100, [UNW_HPPA_FR + 17] = 0x108,
+ [UNW_HPPA_FR + 18] = 0x110, [UNW_HPPA_FR + 19] = 0x118,
+ [UNW_HPPA_FR + 20] = 0x120, [UNW_HPPA_FR + 21] = 0x128,
+ [UNW_HPPA_FR + 22] = 0x130, [UNW_HPPA_FR + 23] = 0x138,
+ [UNW_HPPA_FR + 24] = 0x140, [UNW_HPPA_FR + 25] = 0x148,
+ [UNW_HPPA_FR + 26] = 0x150, [UNW_HPPA_FR + 27] = 0x158,
+ [UNW_HPPA_FR + 28] = 0x160, [UNW_HPPA_FR + 29] = 0x168,
+ [UNW_HPPA_FR + 30] = 0x170, [UNW_HPPA_FR + 31] = 0x178,
+
+ [UNW_HPPA_IP] = 0x1a8 /* IAOQ[0] */
+#elif defined(UNW_TARGET_X86)
+#if defined __FreeBSD__
+#define UNW_R_OFF(R, r) \
+ [UNW_X86_##R] = offsetof(gregset_t, r_##r),
+ UNW_R_OFF(EAX, eax)
+ UNW_R_OFF(EDX, edx)
+ UNW_R_OFF(ECX, ecx)
+ UNW_R_OFF(EBX, ebx)
+ UNW_R_OFF(ESI, esi)
+ UNW_R_OFF(EDI, edi)
+ UNW_R_OFF(EBP, ebp)
+ UNW_R_OFF(ESP, esp)
+ UNW_R_OFF(EIP, eip)
+// UNW_R_OFF(CS, cs)
+// UNW_R_OFF(EFLAGS, eflags)
+// UNW_R_OFF(SS, ss)
+#elif defined __linux__
+ [UNW_X86_EAX] = 0x18,
+ [UNW_X86_EBX] = 0x00,
+ [UNW_X86_ECX] = 0x04,
+ [UNW_X86_EDX] = 0x08,
+ [UNW_X86_ESI] = 0x0c,
+ [UNW_X86_EDI] = 0x10,
+ [UNW_X86_EBP] = 0x14,
+ [UNW_X86_EIP] = 0x30,
+ [UNW_X86_ESP] = 0x3c
+/* CS = 0x34, */
+/* DS = 0x1c, */
+/* ES = 0x20, */
+/* FS = 0x24, */
+/* GS = 0x28, */
+/* ORIG_EAX = 0x2c, */
+/* EFLAGS = 0x38, */
+/* SS = 0x40 */
+#else
+#error Port me
+#endif
+#elif defined(UNW_TARGET_X86_64)
+#if defined __FreeBSD__
+#define UNW_R_OFF(R, r) \
+ [UNW_X86_64_##R] = offsetof(gregset_t, r_##r),
+ UNW_R_OFF(RAX, rax)
+ UNW_R_OFF(RDX, rdx)
+ UNW_R_OFF(RCX, rcx)
+ UNW_R_OFF(RBX, rbx)
+ UNW_R_OFF(RSI, rsi)
+ UNW_R_OFF(RDI, rdi)
+ UNW_R_OFF(RBP, rbp)
+ UNW_R_OFF(RSP, rsp)
+ UNW_R_OFF(R8, r8)
+ UNW_R_OFF(R9, r9)
+ UNW_R_OFF(R10, r10)
+ UNW_R_OFF(R11, r11)
+ UNW_R_OFF(R12, r12)
+ UNW_R_OFF(R13, r13)
+ UNW_R_OFF(R14, r14)
+ UNW_R_OFF(R15, r15)
+ UNW_R_OFF(RIP, rip)
+// UNW_R_OFF(CS, cs)
+// UNW_R_OFF(EFLAGS, rflags)
+// UNW_R_OFF(SS, ss)
+#undef UNW_R_OFF
+#elif defined __linux__
+ [UNW_X86_64_RAX] = 0x50,
+ [UNW_X86_64_RDX] = 0x60,
+ [UNW_X86_64_RCX] = 0x58,
+ [UNW_X86_64_RBX] = 0x28,
+ [UNW_X86_64_RSI] = 0x68,
+ [UNW_X86_64_RDI] = 0x70,
+ [UNW_X86_64_RBP] = 0x20,
+ [UNW_X86_64_RSP] = 0x98,
+ [UNW_X86_64_R8] = 0x48,
+ [UNW_X86_64_R9] = 0x40,
+ [UNW_X86_64_R10] = 0x38,
+ [UNW_X86_64_R11] = 0x30,
+ [UNW_X86_64_R12] = 0x18,
+ [UNW_X86_64_R13] = 0x10,
+ [UNW_X86_64_R14] = 0x08,
+ [UNW_X86_64_R15] = 0x00,
+ [UNW_X86_64_RIP] = 0x80
+// [UNW_X86_64_CS] = 0x88,
+// [UNW_X86_64_EFLAGS] = 0x90,
+// [UNW_X86_64_RSP] = 0x98,
+// [UNW_X86_64_SS] = 0xa0
+#else
+#error Port me
+#endif
+#elif defined(UNW_TARGET_PPC32) || defined(UNW_TARGET_PPC64)
+
+#define UNW_REG_SLOT_SIZE sizeof(unsigned long)
+#define UNW_PPC_R(v) ((v) * UNW_REG_SLOT_SIZE)
+#define UNW_PPC_PT(p) UNW_PPC_R(PT_##p)
+
+#define UNW_FP_OFF(b, i) \
+ [UNW_PPC##b##_F##i] = UNW_PPC_R(PT_FPR0 + i * 8/UNW_REG_SLOT_SIZE)
+
+#define UNW_R_OFF(b, i) \
+ [UNW_PPC##b##_R##i] = UNW_PPC_R(PT_R##i)
+
+#define UNW_PPC_REGS(b) \
+ UNW_R_OFF(b, 0), \
+ UNW_R_OFF(b, 1), \
+ UNW_R_OFF(b, 2), \
+ UNW_R_OFF(b, 3), \
+ UNW_R_OFF(b, 4), \
+ UNW_R_OFF(b, 5), \
+ UNW_R_OFF(b, 6), \
+ UNW_R_OFF(b, 7), \
+ UNW_R_OFF(b, 8), \
+ UNW_R_OFF(b, 9), \
+ UNW_R_OFF(b, 10), \
+ UNW_R_OFF(b, 11), \
+ UNW_R_OFF(b, 12), \
+ UNW_R_OFF(b, 13), \
+ UNW_R_OFF(b, 14), \
+ UNW_R_OFF(b, 15), \
+ UNW_R_OFF(b, 16), \
+ UNW_R_OFF(b, 17), \
+ UNW_R_OFF(b, 18), \
+ UNW_R_OFF(b, 19), \
+ UNW_R_OFF(b, 20), \
+ UNW_R_OFF(b, 21), \
+ UNW_R_OFF(b, 22), \
+ UNW_R_OFF(b, 23), \
+ UNW_R_OFF(b, 24), \
+ UNW_R_OFF(b, 25), \
+ UNW_R_OFF(b, 26), \
+ UNW_R_OFF(b, 27), \
+ UNW_R_OFF(b, 28), \
+ UNW_R_OFF(b, 29), \
+ UNW_R_OFF(b, 30), \
+ UNW_R_OFF(b, 31), \
+ \
+ [UNW_PPC##b##_CTR] = UNW_PPC_PT(CTR), \
+ [UNW_PPC##b##_XER] = UNW_PPC_PT(XER), \
+ [UNW_PPC##b##_LR] = UNW_PPC_PT(LNK), \
+ \
+ UNW_FP_OFF(b, 0), \
+ UNW_FP_OFF(b, 1), \
+ UNW_FP_OFF(b, 2), \
+ UNW_FP_OFF(b, 3), \
+ UNW_FP_OFF(b, 4), \
+ UNW_FP_OFF(b, 5), \
+ UNW_FP_OFF(b, 6), \
+ UNW_FP_OFF(b, 7), \
+ UNW_FP_OFF(b, 8), \
+ UNW_FP_OFF(b, 9), \
+ UNW_FP_OFF(b, 10), \
+ UNW_FP_OFF(b, 11), \
+ UNW_FP_OFF(b, 12), \
+ UNW_FP_OFF(b, 13), \
+ UNW_FP_OFF(b, 14), \
+ UNW_FP_OFF(b, 15), \
+ UNW_FP_OFF(b, 16), \
+ UNW_FP_OFF(b, 17), \
+ UNW_FP_OFF(b, 18), \
+ UNW_FP_OFF(b, 19), \
+ UNW_FP_OFF(b, 20), \
+ UNW_FP_OFF(b, 21), \
+ UNW_FP_OFF(b, 22), \
+ UNW_FP_OFF(b, 23), \
+ UNW_FP_OFF(b, 24), \
+ UNW_FP_OFF(b, 25), \
+ UNW_FP_OFF(b, 26), \
+ UNW_FP_OFF(b, 27), \
+ UNW_FP_OFF(b, 28), \
+ UNW_FP_OFF(b, 29), \
+ UNW_FP_OFF(b, 30), \
+ UNW_FP_OFF(b, 31)
+
+#define UNW_PPC32_REGS \
+ [UNW_PPC32_FPSCR] = UNW_PPC_PT(FPSCR), \
+ [UNW_PPC32_CCR] = UNW_PPC_PT(CCR)
+
+#define UNW_VR_OFF(i) \
+ [UNW_PPC64_V##i] = UNW_PPC_R(PT_VR0 + i * 2)
+
+#define UNW_PPC64_REGS \
+ [UNW_PPC64_NIP] = UNW_PPC_PT(NIP), \
+ [UNW_PPC64_FRAME_POINTER] = -1, \
+ [UNW_PPC64_ARG_POINTER] = -1, \
+ [UNW_PPC64_CR0] = -1, \
+ [UNW_PPC64_CR1] = -1, \
+ [UNW_PPC64_CR2] = -1, \
+ [UNW_PPC64_CR3] = -1, \
+ [UNW_PPC64_CR4] = -1, \
+ [UNW_PPC64_CR5] = -1, \
+ [UNW_PPC64_CR6] = -1, \
+ [UNW_PPC64_CR7] = -1, \
+ [UNW_PPC64_VRSAVE] = UNW_PPC_PT(VRSAVE), \
+ [UNW_PPC64_VSCR] = UNW_PPC_PT(VSCR), \
+ [UNW_PPC64_SPE_ACC] = -1, \
+ [UNW_PPC64_SPEFSCR] = -1, \
+ UNW_VR_OFF(0), \
+ UNW_VR_OFF(1), \
+ UNW_VR_OFF(2), \
+ UNW_VR_OFF(3), \
+ UNW_VR_OFF(4), \
+ UNW_VR_OFF(5), \
+ UNW_VR_OFF(6), \
+ UNW_VR_OFF(7), \
+ UNW_VR_OFF(8), \
+ UNW_VR_OFF(9), \
+ UNW_VR_OFF(10), \
+ UNW_VR_OFF(11), \
+ UNW_VR_OFF(12), \
+ UNW_VR_OFF(13), \
+ UNW_VR_OFF(14), \
+ UNW_VR_OFF(15), \
+ UNW_VR_OFF(16), \
+ UNW_VR_OFF(17), \
+ UNW_VR_OFF(18), \
+ UNW_VR_OFF(19), \
+ UNW_VR_OFF(20), \
+ UNW_VR_OFF(21), \
+ UNW_VR_OFF(22), \
+ UNW_VR_OFF(23), \
+ UNW_VR_OFF(24), \
+ UNW_VR_OFF(25), \
+ UNW_VR_OFF(26), \
+ UNW_VR_OFF(27), \
+ UNW_VR_OFF(28), \
+ UNW_VR_OFF(29), \
+ UNW_VR_OFF(30), \
+ UNW_VR_OFF(31)
+
+#if defined(UNW_TARGET_PPC32)
+ UNW_PPC_REGS(32),
+ UNW_PPC32_REGS,
+#else
+ UNW_PPC_REGS(64),
+ UNW_PPC64_REGS,
+#endif
+
+#elif defined(UNW_TARGET_ARM)
+#if defined(__linux__) || defined(__FreeBSD__)
+ [UNW_ARM_R0] = 0x00,
+ [UNW_ARM_R1] = 0x04,
+ [UNW_ARM_R2] = 0x08,
+ [UNW_ARM_R3] = 0x0c,
+ [UNW_ARM_R4] = 0x10,
+ [UNW_ARM_R5] = 0x14,
+ [UNW_ARM_R6] = 0x18,
+ [UNW_ARM_R7] = 0x1c,
+ [UNW_ARM_R8] = 0x20,
+ [UNW_ARM_R9] = 0x24,
+ [UNW_ARM_R10] = 0x28,
+ [UNW_ARM_R11] = 0x2c,
+ [UNW_ARM_R12] = 0x30,
+ [UNW_ARM_R13] = 0x34,
+ [UNW_ARM_R14] = 0x38,
+ [UNW_ARM_R15] = 0x3c,
+#else
+#error Fix me
+#endif
+#elif defined(UNW_TARGET_MIPS)
+ [UNW_MIPS_R0] = 0,
+ [UNW_MIPS_R1] = 1,
+ [UNW_MIPS_R2] = 2,
+ [UNW_MIPS_R3] = 3,
+ [UNW_MIPS_R4] = 4,
+ [UNW_MIPS_R5] = 5,
+ [UNW_MIPS_R6] = 6,
+ [UNW_MIPS_R7] = 7,
+ [UNW_MIPS_R8] = 8,
+ [UNW_MIPS_R9] = 9,
+ [UNW_MIPS_R10] = 10,
+ [UNW_MIPS_R11] = 11,
+ [UNW_MIPS_R12] = 12,
+ [UNW_MIPS_R13] = 13,
+ [UNW_MIPS_R14] = 14,
+ [UNW_MIPS_R15] = 15,
+ [UNW_MIPS_R16] = 16,
+ [UNW_MIPS_R17] = 17,
+ [UNW_MIPS_R18] = 18,
+ [UNW_MIPS_R19] = 19,
+ [UNW_MIPS_R20] = 20,
+ [UNW_MIPS_R21] = 21,
+ [UNW_MIPS_R22] = 22,
+ [UNW_MIPS_R23] = 23,
+ [UNW_MIPS_R24] = 24,
+ [UNW_MIPS_R25] = 25,
+ [UNW_MIPS_R26] = 26,
+ [UNW_MIPS_R27] = 27,
+ [UNW_MIPS_R28] = 28,
+ [UNW_MIPS_R29] = 29,
+ [UNW_MIPS_R30] = 30,
+ [UNW_MIPS_R31] = 31,
+ [UNW_MIPS_PC] = 64,
+#elif defined(UNW_TARGET_SH)
+#elif defined(UNW_TARGET_AARCH64)
+ [UNW_AARCH64_X0] = 0x00,
+ [UNW_AARCH64_X1] = 0x08,
+ [UNW_AARCH64_X2] = 0x10,
+ [UNW_AARCH64_X3] = 0x18,
+ [UNW_AARCH64_X4] = 0x20,
+ [UNW_AARCH64_X5] = 0x28,
+ [UNW_AARCH64_X6] = 0x30,
+ [UNW_AARCH64_X7] = 0x38,
+ [UNW_AARCH64_X8] = 0x40,
+ [UNW_AARCH64_X9] = 0x48,
+ [UNW_AARCH64_X10] = 0x50,
+ [UNW_AARCH64_X11] = 0x58,
+ [UNW_AARCH64_X12] = 0x60,
+ [UNW_AARCH64_X13] = 0x68,
+ [UNW_AARCH64_X14] = 0x70,
+ [UNW_AARCH64_X15] = 0x78,
+ [UNW_AARCH64_X16] = 0x80,
+ [UNW_AARCH64_X17] = 0x88,
+ [UNW_AARCH64_X18] = 0x90,
+ [UNW_AARCH64_X19] = 0x98,
+ [UNW_AARCH64_X20] = 0xa0,
+ [UNW_AARCH64_X21] = 0xa8,
+ [UNW_AARCH64_X22] = 0xb0,
+ [UNW_AARCH64_X23] = 0xb8,
+ [UNW_AARCH64_X24] = 0xc0,
+ [UNW_AARCH64_X25] = 0xc8,
+ [UNW_AARCH64_X26] = 0xd0,
+ [UNW_AARCH64_X27] = 0xd8,
+ [UNW_AARCH64_X28] = 0xe0,
+ [UNW_AARCH64_X29] = 0xe8,
+ [UNW_AARCH64_X30] = 0xf0,
+ [UNW_AARCH64_SP] = 0xf8,
+ [UNW_AARCH64_PC] = 0x100,
+ [UNW_AARCH64_PSTATE] = 0x108
+#elif defined(UNW_TARGET_TILEGX)
+ [UNW_TILEGX_R0] = 0x00,
+ [UNW_TILEGX_R1] = 0x08,
+ [UNW_TILEGX_R2] = 0x10,
+ [UNW_TILEGX_R3] = 0x08,
+ [UNW_TILEGX_R4] = 0x20,
+ [UNW_TILEGX_R5] = 0x28,
+ [UNW_TILEGX_R6] = 0x30,
+ [UNW_TILEGX_R7] = 0x38,
+ [UNW_TILEGX_R8] = 0x40,
+ [UNW_TILEGX_R9] = 0x48,
+ [UNW_TILEGX_R10] = 0x50,
+ [UNW_TILEGX_R11] = 0x58,
+ [UNW_TILEGX_R12] = 0x60,
+ [UNW_TILEGX_R13] = 0x68,
+ [UNW_TILEGX_R14] = 0x70,
+ [UNW_TILEGX_R15] = 0x78,
+ [UNW_TILEGX_R16] = 0x80,
+ [UNW_TILEGX_R17] = 0x88,
+ [UNW_TILEGX_R18] = 0x90,
+ [UNW_TILEGX_R19] = 0x98,
+ [UNW_TILEGX_R20] = 0xa0,
+ [UNW_TILEGX_R21] = 0xa8,
+ [UNW_TILEGX_R22] = 0xb0,
+ [UNW_TILEGX_R23] = 0xb8,
+ [UNW_TILEGX_R24] = 0xc0,
+ [UNW_TILEGX_R25] = 0xc8,
+ [UNW_TILEGX_R26] = 0xd0,
+ [UNW_TILEGX_R27] = 0xd8,
+ [UNW_TILEGX_R28] = 0xe0,
+ [UNW_TILEGX_R29] = 0xe8,
+ [UNW_TILEGX_R30] = 0xf0,
+ [UNW_TILEGX_R31] = 0xf8,
+ [UNW_TILEGX_R32] = 0x100,
+ [UNW_TILEGX_R33] = 0x108,
+ [UNW_TILEGX_R34] = 0x110,
+ [UNW_TILEGX_R35] = 0x118,
+ [UNW_TILEGX_R36] = 0x120,
+ [UNW_TILEGX_R37] = 0x128,
+ [UNW_TILEGX_R38] = 0x130,
+ [UNW_TILEGX_R39] = 0x138,
+ [UNW_TILEGX_R40] = 0x140,
+ [UNW_TILEGX_R41] = 0x148,
+ [UNW_TILEGX_R42] = 0x150,
+ [UNW_TILEGX_R43] = 0x158,
+ [UNW_TILEGX_R44] = 0x160,
+ [UNW_TILEGX_R45] = 0x168,
+ [UNW_TILEGX_R46] = 0x170,
+ [UNW_TILEGX_R47] = 0x178,
+ [UNW_TILEGX_R48] = 0x180,
+ [UNW_TILEGX_R49] = 0x188,
+ [UNW_TILEGX_R50] = 0x190,
+ [UNW_TILEGX_R51] = 0x198,
+ [UNW_TILEGX_R52] = 0x1a0,
+ [UNW_TILEGX_R53] = 0x1a8,
+ [UNW_TILEGX_R54] = 0x1b0,
+ [UNW_TILEGX_R55] = 0x1b8,
+ [UNW_TILEGX_PC] = 0x1a0
+#else
+# error Fix me.
+#endif
+ };
diff --git a/src/pal/src/libunwind/src/ptrace/_UPT_resume.c b/src/pal/src/libunwind/src/ptrace/_UPT_resume.c
new file mode 100644
index 0000000000..d70a0d4821
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/_UPT_resume.c
@@ -0,0 +1,40 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "_UPT_internal.h"
+
+int
+_UPT_resume (unw_addr_space_t as, unw_cursor_t *c, void *arg)
+{
+ struct UPT_info *ui = arg;
+
+#ifdef HAVE_TTRACE
+# warning No support for ttrace() yet.
+#elif HAVE_DECL_PTRACE_CONT
+ return ptrace (PTRACE_CONT, ui->pid, 0, 0);
+#elif HAVE_DECL_PT_CONTINUE
+ return ptrace(PT_CONTINUE, ui->pid, (caddr_t)1, 0);
+#endif
+}
diff --git a/src/pal/src/libunwind/src/ptrace/libunwind-ptrace.pc.in b/src/pal/src/libunwind/src/ptrace/libunwind-ptrace.pc.in
new file mode 100644
index 0000000000..673004b69e
--- /dev/null
+++ b/src/pal/src/libunwind/src/ptrace/libunwind-ptrace.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libunwind-ptrace
+Description: libunwind ptrace library
+Version: @VERSION@
+Requires: libunwind-generic libunwind
+Libs: -L${libdir} -lunwind-ptrace
+Cflags: -I${includedir}
diff --git a/src/pal/src/libunwind/src/setjmp/libunwind-setjmp.pc.in b/src/pal/src/libunwind/src/setjmp/libunwind-setjmp.pc.in
new file mode 100644
index 0000000000..7b71126535
--- /dev/null
+++ b/src/pal/src/libunwind/src/setjmp/libunwind-setjmp.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libunwind-setjmp
+Description: libunwind setjmp library
+Version: @VERSION@
+Requires: libunwind
+Libs: -L${libdir} -lunwind-setjmp
+Cflags: -I${includedir}
diff --git a/src/pal/src/libunwind/src/setjmp/longjmp.c b/src/pal/src/libunwind/src/setjmp/longjmp.c
new file mode 100644
index 0000000000..8295a9b8ed
--- /dev/null
+++ b/src/pal/src/libunwind/src/setjmp/longjmp.c
@@ -0,0 +1,115 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UNW_LOCAL_ONLY
+
+#undef _FORTIFY_SOURCE
+#include <assert.h>
+#include <libunwind.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdlib.h>
+
+#include "jmpbuf.h"
+#include "setjmp_i.h"
+
+#if defined(__GLIBC__)
+#if __GLIBC_PREREQ(2, 4)
+
+/* Starting with glibc-2.4, {sig,}setjmp in GLIBC obfuscates the
+ register values in jmp_buf by XORing them with a "random"
+ canary value.
+
+ This makes it impossible to implement longjmp, as we
+ can never match wp[JB_SP], unless we decode the canary first.
+
+ Doing so is possible, but doesn't appear to be worth the trouble,
+ so we simply defer to glibc longjmp here. */
+#define _longjmp __nonworking__longjmp
+#define longjmp __nonworking_longjmp
+static void _longjmp (jmp_buf env, int val);
+static void longjmp (jmp_buf env, int val);
+#endif
+#endif /* __GLIBC__ */
+
+void
+_longjmp (jmp_buf env, int val)
+{
+ extern int _UI_longjmp_cont;
+ unw_context_t uc;
+ unw_cursor_t c;
+ unw_word_t sp;
+ unw_word_t *wp = (unw_word_t *) env;
+
+ if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0)
+ abort ();
+
+ do
+ {
+ if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0)
+ abort ();
+#ifdef __FreeBSD__
+ if (sp != wp[JB_SP] + sizeof(unw_word_t))
+#else
+ if (sp != wp[JB_SP])
+#endif
+ continue;
+
+ if (!bsp_match (&c, wp))
+ continue;
+
+ /* found the right frame: */
+
+ assert (UNW_NUM_EH_REGS >= 2);
+
+ if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0
+ || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0
+ || unw_set_reg (&c, UNW_REG_IP,
+ (unw_word_t) (uintptr_t) &_UI_longjmp_cont))
+ abort ();
+
+ unw_resume (&c);
+
+ abort ();
+ }
+ while (unw_step (&c) > 0);
+
+ abort ();
+}
+
+#ifdef __GNUC__
+#define STRINGIFY1(x) #x
+#define STRINGIFY(x) STRINGIFY1(x)
+void longjmp (jmp_buf env, int val)
+ __attribute__ ((alias (STRINGIFY(_longjmp))));
+#else
+
+void
+longjmp (jmp_buf env, int val)
+{
+ _longjmp (env, val);
+}
+
+#endif /* __GNUC__ */
diff --git a/src/pal/src/libunwind/src/setjmp/setjmp.c b/src/pal/src/libunwind/src/setjmp/setjmp.c
new file mode 100644
index 0000000000..bec9fc7d5b
--- /dev/null
+++ b/src/pal/src/libunwind/src/setjmp/setjmp.c
@@ -0,0 +1,49 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <libunwind.h>
+#include <setjmp.h>
+
+#include "jmpbuf.h"
+
+/* Why use K&R syntax here? setjmp() is often a macro and that
+ expands into a call to, say, __setjmp() and we need to define the
+ libunwind-version of setjmp() with the name of the actual function.
+ Using K&R syntax lets us keep the setjmp() macro while keeping the
+ syntax valid... This trick works provided setjmp() doesn't do
+ anything other than a function call. */
+
+int
+setjmp (env)
+ jmp_buf env;
+{
+ void **wp = (void **) env;
+
+ /* this should work on most platforms, but may not be
+ performance-optimal; check the code! */
+ wp[JB_SP] = __builtin_frame_address (0);
+ wp[JB_RP] = (void *) __builtin_return_address (0);
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/setjmp/setjmp_i.h b/src/pal/src/libunwind/src/setjmp/setjmp_i.h
new file mode 100644
index 0000000000..4d9139693e
--- /dev/null
+++ b/src/pal/src/libunwind/src/setjmp/setjmp_i.h
@@ -0,0 +1,118 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#if UNW_TARGET_IA64
+
+#include "libunwind_i.h"
+#include "tdep-ia64/rse.h"
+
+static inline int
+bsp_match (unw_cursor_t *c, unw_word_t *wp)
+{
+ unw_word_t bsp, pfs, sol;
+
+ if (unw_get_reg (c, UNW_IA64_BSP, &bsp) < 0
+ || unw_get_reg (c, UNW_IA64_AR_PFS, &pfs) < 0)
+ abort ();
+
+ /* simulate the effect of "br.call sigsetjmp" on ar.bsp: */
+ sol = (pfs >> 7) & 0x7f;
+ bsp = rse_skip_regs (bsp, sol);
+
+ if (bsp != wp[JB_BSP])
+ return 0;
+
+ if (unlikely (sol == 0))
+ {
+ unw_word_t sp, prev_sp;
+ unw_cursor_t tmp = *c;
+
+ /* The caller of {sig,}setjmp() cannot have a NULL-frame. If we
+ see a NULL-frame, we haven't reached the right target yet.
+ To have a NULL-frame, the number of locals must be zero and
+ the stack-frame must also be empty. */
+
+ if (unw_step (&tmp) < 0)
+ abort ();
+
+ if (unw_get_reg (&tmp, UNW_REG_SP, &sp) < 0
+ || unw_get_reg (&tmp, UNW_REG_SP, &prev_sp) < 0)
+ abort ();
+
+ if (sp == prev_sp)
+ /* got a NULL-frame; keep looking... */
+ return 0;
+ }
+ return 1;
+}
+
+/* On ia64 we cannot always call sigprocmask() at
+ _UI_siglongjmp_cont() because the signal may have switched stacks
+ and the old stack's register-backing store may have overflown,
+ leaving us no space to allocate the stacked registers needed to
+ call sigprocmask(). Fortunately, we can just let unw_resume() (via
+ sigreturn) take care of restoring the signal-mask. That's faster
+ anyhow. */
+static inline int
+resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
+{
+ unw_word_t sc_addr = ((struct cursor *) c)->sigcontext_addr;
+ struct sigcontext *sc = (struct sigcontext *) sc_addr;
+ sigset_t current_mask;
+ void *mp;
+
+ if (!sc_addr)
+ return 0;
+
+ /* let unw_resume() install the desired signal mask */
+
+ if (wp[JB_MASK_SAVED])
+ mp = &wp[JB_MASK];
+ else
+ {
+ if (sigprocmask (SIG_BLOCK, NULL, &current_mask) < 0)
+ abort ();
+ mp = &current_mask;
+ }
+ memcpy (&sc->sc_mask, mp, sizeof (sc->sc_mask));
+ return 1;
+}
+
+#else /* !UNW_TARGET_IA64 */
+
+static inline int
+bsp_match (unw_cursor_t *c, unw_word_t *wp)
+{
+ return 1;
+}
+
+static inline int
+resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
+{
+ /* We may want to do this analogously as for ia64... */
+ return 0;
+}
+
+#endif /* !UNW_TARGET_IA64 */
diff --git a/src/pal/src/libunwind/src/setjmp/siglongjmp.c b/src/pal/src/libunwind/src/setjmp/siglongjmp.c
new file mode 100644
index 0000000000..0e286f6f08
--- /dev/null
+++ b/src/pal/src/libunwind/src/setjmp/siglongjmp.c
@@ -0,0 +1,127 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UNW_LOCAL_ONLY
+
+#include <setjmp.h>
+
+#include "libunwind_i.h"
+#include "jmpbuf.h"
+#include "setjmp_i.h"
+
+#if !defined(_NSIG) && defined(_SIG_MAXSIG)
+# define _NSIG (_SIG_MAXSIG - 1)
+#endif
+
+#if defined(__GLIBC__)
+#if __GLIBC_PREREQ(2, 4)
+
+/* Starting with glibc-2.4, {sig,}setjmp in GLIBC obfuscates the
+ register values in jmp_buf by XORing them with a "random"
+ canary value.
+
+ This makes it impossible to implement longjmp, as we
+ can never match wp[JB_SP], unless we decode the canary first.
+
+ Doing so is possible, but doesn't appear to be worth the trouble,
+ so we simply defer to glibc siglongjmp here. */
+
+#define siglongjmp __nonworking_siglongjmp
+static void siglongjmp (sigjmp_buf env, int val) UNUSED;
+#endif
+#endif /* __GLIBC_PREREQ */
+
+void
+siglongjmp (sigjmp_buf env, int val)
+{
+ unw_word_t *wp = (unw_word_t *) env;
+ extern int _UI_siglongjmp_cont;
+ extern int _UI_longjmp_cont;
+ unw_context_t uc;
+ unw_cursor_t c;
+ unw_word_t sp;
+ int *cont;
+
+ if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0)
+ abort ();
+
+ do
+ {
+ if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0)
+ abort ();
+#ifdef __FreeBSD__
+ if (sp != wp[JB_SP] + sizeof(unw_word_t))
+#else
+ if (sp != wp[JB_SP])
+#endif
+ continue;
+
+ if (!bsp_match (&c, wp))
+ continue;
+
+ /* found the right frame: */
+
+ /* default to resuming without restoring signal-mask */
+ cont = &_UI_longjmp_cont;
+
+ /* Order of evaluation is important here: if unw_resume()
+ restores signal mask, we must set it up appropriately, even
+ if wp[JB_MASK_SAVED] is FALSE. */
+ if (!resume_restores_sigmask (&c, wp) && wp[JB_MASK_SAVED])
+ {
+ /* sigmask was saved */
+#if defined(__linux__)
+ if (UNW_NUM_EH_REGS < 4 || _NSIG > 16 * sizeof (unw_word_t))
+ /* signal mask doesn't fit into EH arguments and we can't
+ put it on the stack without overwriting something
+ else... */
+ abort ();
+ else
+ if (unw_set_reg (&c, UNW_REG_EH + 2, wp[JB_MASK]) < 0
+ || (_NSIG > 8 * sizeof (unw_word_t)
+ && unw_set_reg (&c, UNW_REG_EH + 3, wp[JB_MASK + 1]) < 0))
+ abort ();
+#elif defined(__FreeBSD__)
+ if (unw_set_reg (&c, UNW_REG_EH + 2, &wp[JB_MASK]) < 0)
+ abort();
+#else
+#error Port me
+#endif
+ cont = &_UI_siglongjmp_cont;
+ }
+
+ if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0
+ || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0
+ || unw_set_reg (&c, UNW_REG_IP, (unw_word_t) (uintptr_t) cont))
+ abort ();
+
+ unw_resume (&c);
+
+ abort ();
+ }
+ while (unw_step (&c) > 0);
+
+ abort ();
+}
diff --git a/src/pal/src/libunwind/src/setjmp/sigsetjmp.c b/src/pal/src/libunwind/src/setjmp/sigsetjmp.c
new file mode 100644
index 0000000000..f84935d638
--- /dev/null
+++ b/src/pal/src/libunwind/src/setjmp/sigsetjmp.c
@@ -0,0 +1,50 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <libunwind.h>
+#include <setjmp.h>
+#include <stdlib.h>
+
+#include "jmpbuf.h"
+
+int
+sigsetjmp (sigjmp_buf env, int savemask)
+{
+ unw_word_t *wp = (unw_word_t *) env;
+
+ /* This should work on most platforms, but may not be
+ performance-optimal; check the code! */
+
+ wp[JB_SP] = (unw_word_t) __builtin_frame_address (0);
+ wp[JB_RP] = (unw_word_t) __builtin_return_address (0);
+ wp[JB_MASK_SAVED] = savemask;
+
+ /* Note: we assume here that "wp" has same or better alignment as
+ sigset_t. */
+ if (savemask
+ && sigprocmask (SIG_BLOCK, NULL, (sigset_t *) (wp + JB_MASK)) < 0)
+ abort ();
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/sh/Gapply_reg_state.c b/src/pal/src/libunwind/src/sh/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/sh/Gcreate_addr_space.c b/src/pal/src/libunwind/src/sh/Gcreate_addr_space.c
new file mode 100644
index 0000000000..6ca3a384da
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gcreate_addr_space.c
@@ -0,0 +1,59 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /* SH supports little-endian and big-endian. */
+ if (byte_order != 0 && byte_order != __LITTLE_ENDIAN
+ && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ /* Default to little-endian for SH. */
+ if (byte_order == 0 || byte_order == __LITTLE_ENDIAN)
+ as->big_endian = 0;
+ else
+ as->big_endian = 1;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/sh/Gget_proc_info.c b/src/pal/src/libunwind/src/sh/Gget_proc_info.c
new file mode 100644
index 0000000000..c363d2405d
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gget_proc_info.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ ret = dwarf_make_proc_info (&c->dwarf);
+ if (ret < 0)
+ return ret;
+
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/sh/Gget_save_loc.c b/src/pal/src/libunwind/src/sh/Gget_save_loc.c
new file mode 100644
index 0000000000..24d9f63bc3
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gget_save_loc.c
@@ -0,0 +1,83 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ dwarf_loc_t loc;
+
+ switch (reg)
+ {
+ case UNW_SH_R0:
+ case UNW_SH_R1:
+ case UNW_SH_R2:
+ case UNW_SH_R3:
+ case UNW_SH_R4:
+ case UNW_SH_R5:
+ case UNW_SH_R6:
+ case UNW_SH_R7:
+ case UNW_SH_R8:
+ case UNW_SH_R9:
+ case UNW_SH_R10:
+ case UNW_SH_R11:
+ case UNW_SH_R12:
+ case UNW_SH_R13:
+ case UNW_SH_R14:
+ case UNW_SH_R15:
+ case UNW_SH_PC:
+ case UNW_SH_PR:
+ loc = c->dwarf.loc[reg];
+ break;
+
+ default:
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+ break;
+ }
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/sh/Gglobal.c b/src/pal/src/libunwind/src/sh/Gglobal.c
new file mode 100644
index 0000000000..ed27333976
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gglobal.c
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (sh_lock);
+HIDDEN int tdep_init_done;
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&sh_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ sh_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&sh_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/sh/Ginit.c b/src/pal/src/libunwind/src/sh/Ginit.c
new file mode 100644
index 0000000000..52988a721e
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Ginit.c
@@ -0,0 +1,186 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+static inline void *
+uc_addr (ucontext_t *uc, int reg)
+{
+ if (reg >= UNW_SH_R0 && reg <= UNW_SH_PR)
+ return &uc->uc_mcontext.gregs[reg];
+ else
+ return NULL;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg)
+{
+ return uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (16, "mem[%x] <- %x\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (16, "mem[%x] -> %x\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = arg;
+
+ if (unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) addr = *val;
+ Debug (12, "%s <- %x\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %x\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = arg;
+ unw_fpreg_t *addr;
+
+ if (!unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ *(unw_fpreg_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+sh_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = sh_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/sh/Ginit_local.c b/src/pal/src/libunwind/src/sh/Ginit_local.c
new file mode 100644
index 0000000000..99ddb36fb3
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Ginit_local.c
@@ -0,0 +1,78 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = uc;
+
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/sh/Ginit_remote.c b/src/pal/src/libunwind/src/sh/Ginit_remote.c
new file mode 100644
index 0000000000..9b8ba5b89d
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Ginit_remote.c
@@ -0,0 +1,45 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/sh/Gis_signal_frame.c b/src/pal/src/libunwind/src/sh/Gis_signal_frame.c
new file mode 100644
index 0000000000..4481fe1a49
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gis_signal_frame.c
@@ -0,0 +1,119 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+/* Disassembly of the Linux VDSO sigreturn functions:
+
+00000000 <__kernel_sigreturn>:
+ 0: 05 93 mov.w e <__kernel_sigreturn+0xe>,r3 ! 77
+ 2: 10 c3 trapa #16
+ 4: 0b 20 or r0,r0
+ 6: 0b 20 or r0,r0
+ 8: 0b 20 or r0,r0
+ a: 0b 20 or r0,r0
+ c: 0b 20 or r0,r0
+ e: 77 00 .word 0x0077
+ 10: 09 00 nop
+ 12: 09 00 nop
+ 14: 09 00 nop
+ 16: 09 00 nop
+ 18: 09 00 nop
+ 1a: 09 00 nop
+ 1c: 09 00 nop
+ 1e: 09 00 nop
+
+00000020 <__kernel_rt_sigreturn>:
+ 20: 05 93 mov.w 2e <__kernel_rt_sigreturn+0xe>,r3 ! ad
+ 22: 10 c3 trapa #16
+ 24: 0b 20 or r0,r0
+ 26: 0b 20 or r0,r0
+ 28: 0b 20 or r0,r0
+ 2a: 0b 20 or r0,r0
+ 2c: 0b 20 or r0,r0
+ 2e: ad 00 mov.w @(r0,r10),r0
+ 30: 09 00 nop
+ 32: 09 00 nop
+ 34: 09 00 nop
+ 36: 09 00 nop
+ 38: 09 00 nop
+ 3a: 09 00 nop
+ 3c: 09 00 nop
+ 3e: 09 00 nop
+*/
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+#ifdef __linux__
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ ip = c->dwarf.ip;
+
+ ret = (*a->access_mem) (as, ip, &w0, 0, arg);
+ if (ret < 0)
+ return ret;
+
+ if (w0 != 0xc3109305)
+ return 0;
+
+ ret = (*a->access_mem) (as, ip+4, &w0, 0, arg);
+ if (ret < 0)
+ return ret;
+
+ if (w0 != 0x200b200b)
+ return 0;
+
+ ret = (*a->access_mem) (as, ip+8, &w0, 0, arg);
+ if (ret < 0)
+ return ret;
+
+ if (w0 != 0x200b200b)
+ return 0;
+
+ ret = (*a->access_mem) (as, ip+12, &w0, 0, arg);
+ if (ret < 0)
+ return ret;
+
+ if (w0 == 0x0077200b)
+ return 1; /* non-RT */
+ else if (w0 == 0x00ad200b)
+ return 2; /* RT */
+
+ /* does not look like a signal frame */
+ return 0;
+
+#else
+ return -UNW_ENOINFO;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/sh/Greg_states_iterate.c b/src/pal/src/libunwind/src/sh/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/sh/Gregs.c b/src/pal/src/libunwind/src/sh/Gregs.c
new file mode 100644
index 0000000000..7d8e8e93da
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gregs.c
@@ -0,0 +1,81 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ dwarf_loc_t loc = DWARF_NULL_LOC;
+
+ switch (reg)
+ {
+ case UNW_SH_PC:
+ if (write)
+ c->dwarf.ip = *valp; /* update the IP cache */
+ case UNW_SH_R0:
+ case UNW_SH_R1:
+ case UNW_SH_R2:
+ case UNW_SH_R3:
+ case UNW_SH_R4:
+ case UNW_SH_R5:
+ case UNW_SH_R6:
+ case UNW_SH_R7:
+ case UNW_SH_R8:
+ case UNW_SH_R9:
+ case UNW_SH_R10:
+ case UNW_SH_R11:
+ case UNW_SH_R12:
+ case UNW_SH_R13:
+ case UNW_SH_R14:
+ case UNW_SH_PR:
+ loc = c->dwarf.loc[reg];
+ break;
+
+ case UNW_SH_R15:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+ default:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
diff --git a/src/pal/src/libunwind/src/sh/Gresume.c b/src/pal/src/libunwind/src/sh/Gresume.c
new file mode 100644
index 0000000000..a263c92718
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gresume.c
@@ -0,0 +1,165 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+HIDDEN inline int
+sh_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+#ifdef __linux__
+ struct cursor *c = (struct cursor *) cursor;
+ unw_tdep_context_t *uc = c->dwarf.as_arg;
+
+ if (c->sigcontext_format == SH_SCF_NONE)
+ {
+ /* Since there are no signals involved here we restore the non scratch
+ registers only. */
+ unsigned long regs[8];
+ regs[0] = uc->uc_mcontext.gregs[8];
+ regs[1] = uc->uc_mcontext.gregs[9];
+ regs[2] = uc->uc_mcontext.gregs[10];
+ regs[3] = uc->uc_mcontext.gregs[11];
+ regs[4] = uc->uc_mcontext.gregs[12];
+ regs[5] = uc->uc_mcontext.gregs[13];
+ regs[6] = uc->uc_mcontext.gregs[14];
+ regs[7] = uc->uc_mcontext.gregs[15];
+ unsigned long pc = uc->uc_mcontext.pr;
+
+ struct regs_overlay {
+ char x[sizeof(regs)];
+ };
+
+ asm volatile (
+ "mov.l @%0+, r8\n"
+ "mov.l @%0+, r9\n"
+ "mov.l @%0+, r10\n"
+ "mov.l @%0+, r11\n"
+ "mov.l @%0+, r12\n"
+ "mov.l @%0+, r13\n"
+ "mov.l @%0+, r14\n"
+ "mov.l @%0, r15\n"
+ "lds %1, pr\n"
+ "rts\n"
+ "nop\n"
+ :
+ : "r" (regs),
+ "r" (pc),
+ "m" (*(struct regs_overlay *)regs)
+ );
+ }
+ else
+ {
+ /* In case a signal frame is involved, we're using its trampoline which
+ calls sigreturn. */
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+ sc->sc_regs[0] = uc->uc_mcontext.gregs[0];
+ sc->sc_regs[1] = uc->uc_mcontext.gregs[1];
+ sc->sc_regs[2] = uc->uc_mcontext.gregs[2];
+ sc->sc_regs[3] = uc->uc_mcontext.gregs[3];
+ sc->sc_regs[4] = uc->uc_mcontext.gregs[4];
+ sc->sc_regs[5] = uc->uc_mcontext.gregs[5];
+ sc->sc_regs[6] = uc->uc_mcontext.gregs[6];
+ sc->sc_regs[7] = uc->uc_mcontext.gregs[7];
+ sc->sc_regs[8] = uc->uc_mcontext.gregs[8];
+ sc->sc_regs[9] = uc->uc_mcontext.gregs[9];
+ sc->sc_regs[10] = uc->uc_mcontext.gregs[10];
+ sc->sc_regs[11] = uc->uc_mcontext.gregs[11];
+ sc->sc_regs[12] = uc->uc_mcontext.gregs[12];
+ sc->sc_regs[13] = uc->uc_mcontext.gregs[13];
+ sc->sc_regs[14] = uc->uc_mcontext.gregs[14];
+ sc->sc_regs[15] = uc->uc_mcontext.gregs[15];
+ sc->sc_pc = uc->uc_mcontext.pc;
+ sc->sc_pr = uc->uc_mcontext.pr;
+
+ /* Set the SP and the PC in order to continue execution at the modified
+ trampoline which restores the signal mask and the registers. */
+ asm __volatile__ (
+ "mov %0, r15\n"
+ "lds %1, pr\n"
+ "rts\n"
+ "nop\n"
+ :
+ : "r" (c->sigcontext_sp),
+ "r" (c->sigcontext_pc)
+ );
+ }
+ unreachable();
+#endif
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+static inline void
+establish_machine_state (struct cursor *c)
+{
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ as->acc.access_fpreg (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ as->acc.access_reg (as, reg, &val, 1, arg);
+ }
+ }
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if (!c->dwarf.ip)
+ {
+ /* This can happen easily when the frame-chain gets truncated
+ due to bad or missing unwind-info. */
+ Debug (1, "refusing to resume execution at address 0\n");
+ return -UNW_EINVAL;
+ }
+
+ establish_machine_state (c);
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/sh/Gstep.c b/src/pal/src/libunwind/src/sh/Gstep.c
new file mode 100644
index 0000000000..60d7ec2ba9
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Gstep.c
@@ -0,0 +1,117 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright 2011 Linaro Limited
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+static int
+sh_handle_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+ unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa;
+ struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0);
+
+ if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0)
+ return -UNW_EUNSPEC;
+
+ ret = unw_is_signal_frame (cursor);
+ Debug(1, "unw_is_signal_frame()=%d\n", ret);
+
+ /* Save the SP and PC to be able to return execution at this point
+ later in time (unw_resume). */
+ c->sigcontext_sp = c->dwarf.cfa;
+ c->sigcontext_pc = c->dwarf.ip;
+
+ if (ret == 1)
+ {
+ /* Handle non-RT signal frame. */
+ c->sigcontext_format = SH_SCF_LINUX_SIGFRAME;
+ sc_addr = sp_addr;
+ }
+ else if (ret == 2)
+ {
+ /* Handle RT signal frame. */
+ c->sigcontext_format = SH_SCF_LINUX_RT_SIGFRAME;
+ sc_addr = sp_addr + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF;
+ }
+ else
+ return -UNW_EUNSPEC;
+
+ c->sigcontext_addr = sc_addr;
+
+ /* Update the dwarf cursor.
+ Set the location of the registers to the corresponding addresses of the
+ uc_mcontext / sigcontext structure contents. */
+ c->dwarf.loc[UNW_SH_R0] = DWARF_LOC (sc_addr + LINUX_SC_R0_OFF, 0);
+ c->dwarf.loc[UNW_SH_R1] = DWARF_LOC (sc_addr + LINUX_SC_R1_OFF, 0);
+ c->dwarf.loc[UNW_SH_R2] = DWARF_LOC (sc_addr + LINUX_SC_R2_OFF, 0);
+ c->dwarf.loc[UNW_SH_R3] = DWARF_LOC (sc_addr + LINUX_SC_R3_OFF, 0);
+ c->dwarf.loc[UNW_SH_R4] = DWARF_LOC (sc_addr + LINUX_SC_R4_OFF, 0);
+ c->dwarf.loc[UNW_SH_R5] = DWARF_LOC (sc_addr + LINUX_SC_R5_OFF, 0);
+ c->dwarf.loc[UNW_SH_R6] = DWARF_LOC (sc_addr + LINUX_SC_R6_OFF, 0);
+ c->dwarf.loc[UNW_SH_R7] = DWARF_LOC (sc_addr + LINUX_SC_R7_OFF, 0);
+ c->dwarf.loc[UNW_SH_R8] = DWARF_LOC (sc_addr + LINUX_SC_R8_OFF, 0);
+ c->dwarf.loc[UNW_SH_R9] = DWARF_LOC (sc_addr + LINUX_SC_R9_OFF, 0);
+ c->dwarf.loc[UNW_SH_R10] = DWARF_LOC (sc_addr + LINUX_SC_R10_OFF, 0);
+ c->dwarf.loc[UNW_SH_R11] = DWARF_LOC (sc_addr + LINUX_SC_R11_OFF, 0);
+ c->dwarf.loc[UNW_SH_R12] = DWARF_LOC (sc_addr + LINUX_SC_R12_OFF, 0);
+ c->dwarf.loc[UNW_SH_R13] = DWARF_LOC (sc_addr + LINUX_SC_R13_OFF, 0);
+ c->dwarf.loc[UNW_SH_R14] = DWARF_LOC (sc_addr + LINUX_SC_R14_OFF, 0);
+ c->dwarf.loc[UNW_SH_R15] = DWARF_LOC (sc_addr + LINUX_SC_R15_OFF, 0);
+ c->dwarf.loc[UNW_SH_PR] = DWARF_LOC (sc_addr + LINUX_SC_PR_OFF, 0);
+ c->dwarf.loc[UNW_SH_PC] = DWARF_LOC (sc_addr + LINUX_SC_PC_OFF, 0);
+
+ /* Set SP/CFA and PC/IP. */
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_SH_R15], &c->dwarf.cfa);
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_SH_PC], &c->dwarf.ip);
+
+ c->dwarf.pi_valid = 0;
+
+ return 1;
+}
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if (unw_is_signal_frame (cursor) > 0)
+ return sh_handle_signal_frame (cursor);
+
+ ret = dwarf_step (&c->dwarf);
+
+ if (unlikely (ret == -UNW_ESTOPUNWIND))
+ return ret;
+
+ if (unlikely (ret < 0))
+ return 0;
+
+ return (c->dwarf.ip == 0) ? 0 : 1;
+}
diff --git a/src/pal/src/libunwind/src/sh/Lapply_reg_state.c b/src/pal/src/libunwind/src/sh/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lcreate_addr_space.c b/src/pal/src/libunwind/src/sh/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lget_proc_info.c b/src/pal/src/libunwind/src/sh/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lget_save_loc.c b/src/pal/src/libunwind/src/sh/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lglobal.c b/src/pal/src/libunwind/src/sh/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Linit.c b/src/pal/src/libunwind/src/sh/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Linit_local.c b/src/pal/src/libunwind/src/sh/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Linit_remote.c b/src/pal/src/libunwind/src/sh/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lis_signal_frame.c b/src/pal/src/libunwind/src/sh/Lis_signal_frame.c
new file mode 100644
index 0000000000..b9a7c4f51a
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lreg_states_iterate.c b/src/pal/src/libunwind/src/sh/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lregs.c b/src/pal/src/libunwind/src/sh/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lresume.c b/src/pal/src/libunwind/src/sh/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/Lstep.c b/src/pal/src/libunwind/src/sh/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/sh/gen-offsets.c b/src/pal/src/libunwind/src/sh/gen-offsets.c
new file mode 100644
index 0000000000..16695a6489
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/gen-offsets.c
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <stddef.h>
+#include <ucontext.h>
+#include <asm/sigcontext.h>
+
+#define UC(N,X) \
+ printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))
+
+#define SC(N,X) \
+ printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))
+
+int
+main (void)
+{
+ printf (
+"/* Linux-specific definitions: */\n\n"
+
+"/* Define various structure offsets to simplify cross-compilation. */\n\n"
+
+"/* Offsets for SH Linux \"ucontext_t\": */\n\n");
+
+ UC ("FLAGS", uc_flags);
+ UC ("LINK", uc_link);
+ UC ("STACK", uc_stack);
+ UC ("MCONTEXT", uc_mcontext);
+ UC ("SIGMASK", uc_sigmask);
+
+ printf ("\n/* Offsets for SH Linux \"struct sigcontext\": */\n\n");
+
+ SC ("R0", sc_regs[0]);
+ SC ("R1", sc_regs[1]);
+ SC ("R2", sc_regs[2]);
+ SC ("R3", sc_regs[3]);
+ SC ("R4", sc_regs[4]);
+ SC ("R5", sc_regs[5]);
+ SC ("R6", sc_regs[6]);
+ SC ("R7", sc_regs[7]);
+ SC ("R8", sc_regs[8]);
+ SC ("R9", sc_regs[9]);
+ SC ("R10", sc_regs[10]);
+ SC ("R11", sc_regs[11]);
+ SC ("R12", sc_regs[12]);
+ SC ("R13", sc_regs[13]);
+ SC ("R14", sc_regs[14]);
+ SC ("R15", sc_regs[15]);
+
+ SC ("PC", sc_pc);
+ SC ("PR", sc_pr);
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/sh/init.h b/src/pal/src/libunwind/src/sh/init.h
new file mode 100644
index 0000000000..36713fe89b
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/init.h
@@ -0,0 +1,73 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret;
+
+ c->dwarf.loc[UNW_SH_R0] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R0);
+ c->dwarf.loc[UNW_SH_R1] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R1);
+ c->dwarf.loc[UNW_SH_R2] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R2);
+ c->dwarf.loc[UNW_SH_R3] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R3);
+ c->dwarf.loc[UNW_SH_R4] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R4);
+ c->dwarf.loc[UNW_SH_R5] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R5);
+ c->dwarf.loc[UNW_SH_R6] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R6);
+ c->dwarf.loc[UNW_SH_R7] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R7);
+ c->dwarf.loc[UNW_SH_R8] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R8);
+ c->dwarf.loc[UNW_SH_R9] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R9);
+ c->dwarf.loc[UNW_SH_R10] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R10);
+ c->dwarf.loc[UNW_SH_R11] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R11);
+ c->dwarf.loc[UNW_SH_R12] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R12);
+ c->dwarf.loc[UNW_SH_R13] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R13);
+ c->dwarf.loc[UNW_SH_R14] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R14);
+ c->dwarf.loc[UNW_SH_R15] = DWARF_REG_LOC (&c->dwarf, UNW_SH_R15);
+ c->dwarf.loc[UNW_SH_PC] = DWARF_REG_LOC (&c->dwarf, UNW_SH_PC);
+ c->dwarf.loc[UNW_SH_PR] = DWARF_REG_LOC (&c->dwarf, UNW_SH_PR);
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_SH_PC], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_TDEP_SP], &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = SH_SCF_NONE;
+ c->sigcontext_addr = 0;
+ c->sigcontext_sp = 0;
+ c->sigcontext_pc = 0;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/sh/is_fpreg.c b/src/pal/src/libunwind/src/sh/is_fpreg.c
new file mode 100644
index 0000000000..de09340194
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/is_fpreg.c
@@ -0,0 +1,32 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_is_fpreg (int regnum)
+{
+ /* FIXME: Support FP. */
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/sh/offsets.h b/src/pal/src/libunwind/src/sh/offsets.h
new file mode 100644
index 0000000000..b02d8aee1e
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/offsets.h
@@ -0,0 +1,32 @@
+/* Linux-specific definitions: */
+
+/* Define various structure offsets to simplify cross-compilation. */
+
+/* Offsets for SH Linux "ucontext_t": */
+
+#define LINUX_UC_FLAGS_OFF 0x0
+#define LINUX_UC_LINK_OFF 0x4
+#define LINUX_UC_STACK_OFF 0x8
+#define LINUX_UC_MCONTEXT_OFF 0x14
+#define LINUX_UC_SIGMASK_OFF 0xFC
+
+/* Offsets for SH Linux "struct sigcontext": */
+
+#define LINUX_SC_R0_OFF 0x4
+#define LINUX_SC_R1_OFF 0x8
+#define LINUX_SC_R2_OFF 0xC
+#define LINUX_SC_R3_OFF 0x10
+#define LINUX_SC_R4_OFF 0x14
+#define LINUX_SC_R5_OFF 0x18
+#define LINUX_SC_R6_OFF 0x1C
+#define LINUX_SC_R7_OFF 0x20
+#define LINUX_SC_R8_OFF 0x24
+#define LINUX_SC_R9_OFF 0x28
+#define LINUX_SC_R10_OFF 0x2C
+#define LINUX_SC_R11_OFF 0x30
+#define LINUX_SC_R12_OFF 0x34
+#define LINUX_SC_R13_OFF 0x38
+#define LINUX_SC_R14_OFF 0x3C
+#define LINUX_SC_R15_OFF 0x40
+#define LINUX_SC_PC_OFF 0x44
+#define LINUX_SC_PR_OFF 0x48
diff --git a/src/pal/src/libunwind/src/sh/regname.c b/src/pal/src/libunwind/src/sh/regname.c
new file mode 100644
index 0000000000..b52925b4da
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/regname.c
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *const regname[] =
+ {
+ [UNW_SH_R0] = "r0",
+ [UNW_SH_R1] = "r1",
+ [UNW_SH_R2] = "r2",
+ [UNW_SH_R3] = "r3",
+ [UNW_SH_R4] = "r4",
+ [UNW_SH_R5] = "r5",
+ [UNW_SH_R6] = "r6",
+ [UNW_SH_R7] = "r7",
+ [UNW_SH_R8] = "r8",
+ [UNW_SH_R9] = "r9",
+ [UNW_SH_R10] = "r10",
+ [UNW_SH_R11] = "r11",
+ [UNW_SH_R12] = "r12",
+ [UNW_SH_R13] = "r13",
+ [UNW_SH_R14] = "r14",
+ [UNW_SH_R15] = "r15",
+ [UNW_SH_PC] = "pc",
+ [UNW_SH_PR] = "pr",
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname) && regname[reg] != NULL)
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/sh/siglongjmp.S b/src/pal/src/libunwind/src/sh/siglongjmp.S
new file mode 100644
index 0000000000..9ca53d124b
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/siglongjmp.S
@@ -0,0 +1,8 @@
+ /* Dummy implementation for now. */
+
+ .globl _UI_siglongjmp_cont
+ .globl _UI_longjmp_cont
+
+_UI_siglongjmp_cont:
+_UI_longjmp_cont:
+ rts
diff --git a/src/pal/src/libunwind/src/sh/unwind_i.h b/src/pal/src/libunwind/src/sh/unwind_i.h
new file mode 100644
index 0000000000..3066d84631
--- /dev/null
+++ b/src/pal/src/libunwind/src/sh/unwind_i.h
@@ -0,0 +1,40 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <libunwind-sh.h>
+
+#include "libunwind_i.h"
+
+#define sh_lock UNW_OBJ(lock)
+#define sh_local_resume UNW_OBJ(local_resume)
+#define sh_local_addr_space_init UNW_OBJ(local_addr_space_init)
+
+extern void sh_local_addr_space_init (void);
+extern int sh_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/tilegx/Gapply_reg_state.c b/src/pal/src/libunwind/src/tilegx/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Gcreate_addr_space.c b/src/pal/src/libunwind/src/tilegx/Gcreate_addr_space.c
new file mode 100644
index 0000000000..39acdc2c3d
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gcreate_addr_space.c
@@ -0,0 +1,65 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as = malloc (sizeof (*as));
+
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ /*
+ * Tilegx supports only big or little-endian, not weird stuff like
+ * PDP_ENDIAN.
+ */
+ if (byte_order != 0
+ && byte_order != __LITTLE_ENDIAN
+ && byte_order != __BIG_ENDIAN)
+ return NULL;
+
+ if (byte_order == 0)
+ /* use host default: */
+ as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+ else
+ as->big_endian = (byte_order == __BIG_ENDIAN);
+
+ as->abi = UNW_TILEGX_ABI_N64;
+ as->addr_size = 8;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Gget_proc_info.c b/src/pal/src/libunwind/src/tilegx/Gget_proc_info.c
new file mode 100644
index 0000000000..3a158da2df
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gget_proc_info.c
@@ -0,0 +1,48 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ ret = dwarf_make_proc_info (&c->dwarf);
+
+ if (ret < 0)
+ {
+ /* On Tilegx, some routines i.e. _start() etc has no dwarf info.
+ Just simply mark the end of the frames. */
+ memset (pi, 0, sizeof (*pi));
+ pi->start_ip = c->dwarf.ip;
+ pi->end_ip = c->dwarf.ip + 1;
+ return 0;
+ }
+
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Gget_save_loc.c b/src/pal/src/libunwind/src/tilegx/Gget_save_loc.c
new file mode 100644
index 0000000000..fcf0697892
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gget_save_loc.c
@@ -0,0 +1,62 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ dwarf_loc_t loc;
+
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+
+ if (reg <= UNW_TILEGX_R55)
+ loc = c->dwarf.loc[reg - UNW_TILEGX_R0];
+ else
+ printf("\nInvalid register!");
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Gglobal.c b/src/pal/src/libunwind/src/tilegx/Gglobal.c
new file mode 100644
index 0000000000..e18f50a50f
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gglobal.c
@@ -0,0 +1,64 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+__attribute__((weak))
+pthread_mutex_t tilegx_lock = PTHREAD_MUTEX_INITIALIZER;
+HIDDEN int tdep_init_done;
+
+HIDDEN const uint8_t dwarf_to_unw_regnum_map[] =
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55
+ };
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&tilegx_lock, saved_mask);
+
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ tilegx_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+
+ out:
+ lock_release (&tilegx_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Ginit.c b/src/pal/src/libunwind/src/tilegx/Ginit.c
new file mode 100644
index 0000000000..7564a558be
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Ginit.c
@@ -0,0 +1,167 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+/* Return the address of the 64-bit slot in UC for REG (even for o32,
+ where registers are 32-bit, the slots are still 64-bit). */
+
+static inline void *
+uc_addr (ucontext_t *uc, int reg)
+{
+ if (reg >= UNW_TILEGX_R0 && reg < UNW_TILEGX_R0 + 56)
+ return &uc->uc_mcontext.gregs[reg - UNW_TILEGX_R0];
+ else if (reg == UNW_TILEGX_PC)
+ return &uc->uc_mcontext.pc;
+ else
+ return NULL;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg)
+{
+ char *addr = uc_addr (uc, reg);
+ return addr;
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if ((long long)addr & (sizeof(unw_word_t) - 1))
+ return 0;
+
+ if (write)
+ {
+ Debug (16, "mem[%llx] <- %llx\n", (long long) addr, (long long) *val);
+ *(unw_word_t *) (intptr_t) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_word_t *) (intptr_t) addr;
+ Debug (16, "mem[%llx] -> %llx\n", (long long) addr, (long long) *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = arg;
+
+ if (unw_is_fpreg (reg))
+ goto badreg;
+
+ Debug (16, "reg = %s\n", unw_regname (reg));
+ if (!(addr = uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) (intptr_t) addr = (tilegx_reg_t) *val;
+ Debug (12, "%s <- %llx\n", unw_regname (reg), (long long) *val);
+ }
+ else
+ {
+ *val = (tilegx_reg_t) *(unw_word_t *) (intptr_t) addr;
+ Debug (12, "%s -> %llx\n", unw_regname (reg), (long long) *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return elf_w (get_proc_name) (as, getpid (), ip, buf, buf_len, offp);
+}
+
+__attribute__((weak)) void
+tilegx_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
+
+ local_addr_space.abi = UNW_TILEGX_ABI_N64;
+ local_addr_space.addr_size = sizeof (void *);
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = NULL;
+ local_addr_space.acc.resume = tilegx_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/tilegx/Ginit_local.c b/src/pal/src/libunwind/src/tilegx/Ginit_local.c
new file mode 100644
index 0000000000..31a716df34
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Ginit_local.c
@@ -0,0 +1,80 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ memset(c, 0, sizeof(unw_cursor_t));
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+
+ c->dwarf.as_arg = uc;
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/tilegx/Ginit_remote.c b/src/pal/src/libunwind/src/tilegx/Ginit_remote.c
new file mode 100644
index 0000000000..2a31b18aae
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Ginit_remote.c
@@ -0,0 +1,47 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Gis_signal_frame.c b/src/pal/src/libunwind/src/tilegx/Gis_signal_frame.c
new file mode 100644
index 0000000000..5452c2cb2a
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gis_signal_frame.c
@@ -0,0 +1,115 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include <stdio.h>
+#include "offsets.h"
+
+#ifdef __linux__
+#include <sys/syscall.h>
+#include <arch/abi.h>
+#else
+# error "Only support Linux!"
+#endif
+
+#define MOVELI_R10_RT_SIGRETURN \
+ ( 0x000007e051483000ULL | \
+ ((unsigned long)__NR_rt_sigreturn << 43) | \
+ ((unsigned long)TREG_SYSCALL_NR << 31) )
+#define SWINT1 0x286b180051485000ULL
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor*) cursor;
+ unw_word_t w0, w1, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ ip = c->dwarf.ip;
+
+ if (!ip || !a->access_mem || (ip & (sizeof(unw_word_t) - 1)))
+ return 0;
+
+ if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0)
+ return ret;
+
+ if ((ret = (*a->access_mem) (as, ip + 8, &w1, 0, arg)) < 0)
+ return ret;
+
+ /* Return 1 if the IP points to a RT sigreturn sequence. */
+ if (w0 == MOVELI_R10_RT_SIGRETURN &&
+ w1 == SWINT1)
+ {
+ return 1;
+ }
+ return 0;
+}
+
+
+HIDDEN int
+tilegx_handle_signal_frame (unw_cursor_t *cursor)
+{
+ int i;
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa;
+ struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0);
+ int ret;
+
+ if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0)
+ return -UNW_EUNSPEC;
+
+ /* Save the SP and PC to be able to return execution at this point
+ later in time (unw_resume). */
+ c->sigcontext_sp = c->dwarf.cfa;
+ c->sigcontext_pc = c->dwarf.ip;
+
+ c->sigcontext_addr = sp_addr + sizeof (siginfo_t) +
+ C_ABI_SAVE_AREA_SIZE;
+ sc_addr = c->sigcontext_addr + LINUX_UC_MCONTEXT_OFF;
+
+ /* Update the dwarf cursor.
+ Set the location of the registers to the corresponding addresses of the
+ uc_mcontext / sigcontext structure contents. */
+
+#define SC_REG_OFFSET(X) (8 * X)
+
+ for (i = UNW_TILEGX_R0; i <= UNW_TILEGX_R55; i++)
+ {
+ c->dwarf.loc[i] = DWARF_LOC (sc_addr + SC_REG_OFFSET(i), 0);
+ }
+
+ /* Set SP/CFA and PC/IP. */
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_TILEGX_R54], &c->dwarf.cfa);
+ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_TILEGX_R55], &c->dwarf.ip);
+
+ return 1;
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Greg_states_iterate.c b/src/pal/src/libunwind/src/tilegx/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Gregs.c b/src/pal/src/libunwind/src/tilegx/Gregs.c
new file mode 100644
index 0000000000..565c6f4432
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gregs.c
@@ -0,0 +1,76 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ dwarf_loc_t loc = DWARF_NULL_LOC;
+
+ if (reg == UNW_TILEGX_R54 && !write)
+ {
+ reg = UNW_TILEGX_CFA;
+ }
+
+ if (reg <= UNW_TILEGX_R55)
+ loc = c->dwarf.loc[reg - UNW_TILEGX_R0];
+ else if (reg == UNW_TILEGX_CFA)
+ {
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+ }
+ else
+ {
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ {
+ if (ci->dwarf.use_prev_instr == 0) {
+ if (reg == UNW_TILEGX_PC)
+ c->dwarf.ip = *valp; /* update the IP cache */
+ }
+ else {
+ if (reg == UNW_TILEGX_R55)
+ c->dwarf.ip = *valp; /* update the IP cache */
+ }
+ return dwarf_put (&c->dwarf, loc, *valp);
+ }
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Gresume.c b/src/pal/src/libunwind/src/tilegx/Gresume.c
new file mode 100644
index 0000000000..ece443a5b5
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gresume.c
@@ -0,0 +1,94 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+
+#include "unwind_i.h"
+#include "offsets.h"
+#include <ucontext.h>
+
+#ifndef UNW_REMOTE_ONLY
+
+HIDDEN inline int
+tilegx_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ int i;
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = c->dwarf.as_arg;
+
+ Debug (1, "(cursor=%p\n", c);
+
+ return setcontext(uc);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+static inline void
+establish_machine_state (struct cursor *c)
+{
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+
+ if (unw_is_fpreg (reg))
+ {
+ Debug (1, "no fp!");
+ abort ();
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ as->acc.access_reg (as, reg, &val, 1, arg);
+ }
+ }
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ Debug (1, "(cursor=%p) ip=0x%lx\n", c, c->dwarf.ip);
+
+ if (!c->dwarf.ip)
+ {
+ /* This can happen easily when the frame-chain gets truncated
+ due to bad or missing unwind-info. */
+ Debug (1, "refusing to resume execution at address 0\n");
+ return -UNW_EINVAL;
+ }
+
+ establish_machine_state (c);
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Gstep.c b/src/pal/src/libunwind/src/tilegx/Gstep.c
new file mode 100644
index 0000000000..c748dbc588
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Gstep.c
@@ -0,0 +1,53 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p, ip=0x%016lx, sp=0x%016lx)\n",
+ c, c->dwarf.ip, c->dwarf.cfa);
+
+ /* Special handling the singal frame. */
+ if (unw_is_signal_frame (cursor) > 0)
+ return tilegx_handle_signal_frame (cursor);
+
+ /* Try DWARF-based unwinding... */
+ ret = dwarf_step (&c->dwarf);
+
+ if (unlikely (ret == -UNW_ESTOPUNWIND))
+ return ret;
+
+ /* Dwarf unwinding didn't work, stop. */
+ if (unlikely (ret < 0))
+ return 0;
+
+ return (c->dwarf.ip == 0) ? 0 : 1;
+}
diff --git a/src/pal/src/libunwind/src/tilegx/Lapply_reg_state.c b/src/pal/src/libunwind/src/tilegx/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lcreate_addr_space.c b/src/pal/src/libunwind/src/tilegx/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lget_proc_info.c b/src/pal/src/libunwind/src/tilegx/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lget_save_loc.c b/src/pal/src/libunwind/src/tilegx/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lglobal.c b/src/pal/src/libunwind/src/tilegx/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Linit.c b/src/pal/src/libunwind/src/tilegx/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Linit_local.c b/src/pal/src/libunwind/src/tilegx/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Linit_remote.c b/src/pal/src/libunwind/src/tilegx/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lis_signal_frame.c b/src/pal/src/libunwind/src/tilegx/Lis_signal_frame.c
new file mode 100644
index 0000000000..b9a7c4f51a
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lis_signal_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gis_signal_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lreg_states_iterate.c b/src/pal/src/libunwind/src/tilegx/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lregs.c b/src/pal/src/libunwind/src/tilegx/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lresume.c b/src/pal/src/libunwind/src/tilegx/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/Lstep.c b/src/pal/src/libunwind/src/tilegx/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/tilegx/elfxx.c b/src/pal/src/libunwind/src/tilegx/elfxx.c
new file mode 100644
index 0000000000..07d3d12b94
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/elfxx.c
@@ -0,0 +1,27 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+#include "../src/elfxx.c"
diff --git a/src/pal/src/libunwind/src/tilegx/gen-offsets.c b/src/pal/src/libunwind/src/tilegx/gen-offsets.c
new file mode 100644
index 0000000000..8704bb215e
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/gen-offsets.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stddef.h>
+#include <ucontext.h>
+
+#define UC(N,X) \
+ printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))
+
+#define SC(N,X) \
+ printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))
+
+int
+main (void)
+{
+ printf (
+"/* Linux-specific definitions: */\n\n"
+
+"/* Define various structure offsets to simplify cross-compilation. */\n\n"
+
+"/* Offsets for TILEGX Linux \"ucontext_t\": */\n\n");
+
+ UC ("FLAGS", uc_flags);
+ UC ("LINK", uc_link);
+ UC ("STACK", uc_stack);
+ UC ("MCONTEXT", uc_mcontext);
+ UC ("SIGMASK", uc_sigmask);
+
+ UC ("MCONTEXT_GREGS", uc_mcontext.gregs);
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/tilegx/getcontext.S b/src/pal/src/libunwind/src/tilegx/getcontext.S
new file mode 100644
index 0000000000..fbc8654bc7
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/getcontext.S
@@ -0,0 +1,36 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+#include <endian.h>
+
+ .text
+ # define REG(X) LINUX_UC_MCONTEXT_GREGS + 8 * (X)
+ .global _Utilegx_getcontext
+ .type _Utilegx_getcontext, %function
+ # This is a stub version of getcontext() for TILEGX.
+_Utilegx_getcontext:
+
+
diff --git a/src/pal/src/libunwind/src/tilegx/init.h b/src/pal/src/libunwind/src/tilegx/init.h
new file mode 100644
index 0000000000..0e0f7fd1da
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/init.h
@@ -0,0 +1,63 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret, i;
+
+ for (i = 0; i < 56; i++)
+ c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, UNW_TILEGX_R0 + i);
+ for (i = 56; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ if (use_prev_instr == 0)
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_TILEGX_PC),
+ &c->dwarf.ip);
+ else
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_TILEGX_R55),
+ &c->dwarf.ip);
+
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_TILEGX_R54),
+ &c->dwarf.cfa);
+
+ if (ret < 0)
+ return ret;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/tilegx/is_fpreg.c b/src/pal/src/libunwind/src/tilegx/is_fpreg.c
new file mode 100644
index 0000000000..d6d5896901
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/is_fpreg.c
@@ -0,0 +1,33 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+/* TILEGX has no FP. */
+
+int
+unw_is_fpreg (int regnum)
+{
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/tilegx/offsets.h b/src/pal/src/libunwind/src/tilegx/offsets.h
new file mode 100644
index 0000000000..6d30f1edcf
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/offsets.h
@@ -0,0 +1,12 @@
+/* Linux-specific definitions: */
+
+/* Define various structure offsets to simplify cross-compilation. */
+
+/* Offsets for TILEGX Linux "ucontext_t": */
+
+#define LINUX_UC_FLAGS_OFF 0x0
+#define LINUX_UC_LINK_OFF 0x8
+#define LINUX_UC_STACK_OFF 0x10
+#define LINUX_UC_MCONTEXT_OFF 0x28
+#define LINUX_UC_SIGMASK_OFF 0x228
+#define LINUX_UC_MCONTEXT_GREGS 0x28
diff --git a/src/pal/src/libunwind/src/tilegx/regname.c b/src/pal/src/libunwind/src/tilegx/regname.c
new file mode 100644
index 0000000000..0ce47b9d66
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/regname.c
@@ -0,0 +1,55 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+ Copyright (C) 2014 Tilera Corp.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ /* 0. */
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ /* 8. */
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ /* 16. */
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ /* 24. */
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ /* 32. */
+ "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39",
+ /* 40. */
+ "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47",
+ /* 48. */
+ "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55",
+ /* pc, cfa */
+ "pc", "cfa"
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/tilegx/siglongjmp.S b/src/pal/src/libunwind/src/tilegx/siglongjmp.S
new file mode 100644
index 0000000000..bccb1c7785
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/siglongjmp.S
@@ -0,0 +1,7 @@
+ /* Dummy implementation for now. */
+ .globl _UI_siglongjmp_cont
+ .globl _UI_longjmp_cont
+
+_UI_siglongjmp_cont:
+_UI_longjmp_cont:
+ jrp lr
diff --git a/src/pal/src/libunwind/src/tilegx/unwind_i.h b/src/pal/src/libunwind/src/tilegx/unwind_i.h
new file mode 100644
index 0000000000..9d41c90b4d
--- /dev/null
+++ b/src/pal/src/libunwind/src/tilegx/unwind_i.h
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 CodeSourcery
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <memory.h>
+#include <stdint.h>
+
+#include <libunwind-tilegx.h>
+
+#include "libunwind_i.h"
+
+#define tilegx_local_resume UNW_OBJ(local_resume)
+#define tilegx_local_addr_space_init UNW_OBJ(local_addr_space_init)
+
+extern int tilegx_local_resume (unw_addr_space_t as,
+ unw_cursor_t *cursor,
+ void *arg);
+#define tilegx_handle_signal_frame UNW_OBJ(handle_signal_frame)
+extern int tilegx_handle_signal_frame(unw_cursor_t *cursor);
+
+extern void tilegx_local_addr_space_init (void);
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/unwind/Backtrace.c b/src/pal/src/libunwind/src/unwind/Backtrace.c
new file mode 100644
index 0000000000..0b14df4cb9
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/Backtrace.c
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+_Unwind_Reason_Code
+_Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_parameter)
+{
+ struct _Unwind_Context context;
+ unw_context_t uc;
+ int ret;
+
+ if (_Unwind_InitContext (&context, &uc) < 0)
+ return _URC_FATAL_PHASE1_ERROR;
+
+ /* Phase 1 (search phase) */
+
+ while (1)
+ {
+ if ((ret = unw_step (&context.cursor)) <= 0)
+ {
+ if (ret == 0)
+ return _URC_END_OF_STACK;
+ else
+ return _URC_FATAL_PHASE1_ERROR;
+ }
+
+ if ((*trace) (&context, trace_parameter) != _URC_NO_REASON)
+ return _URC_FATAL_PHASE1_ERROR;
+ }
+}
+
+_Unwind_Reason_Code __libunwind_Unwind_Backtrace (_Unwind_Trace_Fn, void *)
+ ALIAS (_Unwind_Backtrace);
diff --git a/src/pal/src/libunwind/src/unwind/DeleteException.c b/src/pal/src/libunwind/src/unwind/DeleteException.c
new file mode 100644
index 0000000000..ad38eaf651
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/DeleteException.c
@@ -0,0 +1,38 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+void
+_Unwind_DeleteException (struct _Unwind_Exception *exception_object)
+{
+ _Unwind_Exception_Cleanup_Fn cleanup = exception_object->exception_cleanup;
+
+ if (cleanup)
+ (*cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exception_object);
+}
+
+void __libunwind_Unwind_DeleteException (struct _Unwind_Exception *)
+ ALIAS (_Unwind_DeleteException);
diff --git a/src/pal/src/libunwind/src/unwind/FindEnclosingFunction.c b/src/pal/src/libunwind/src/unwind/FindEnclosingFunction.c
new file mode 100644
index 0000000000..4f10666172
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/FindEnclosingFunction.c
@@ -0,0 +1,42 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+void *
+_Unwind_FindEnclosingFunction (void *ip)
+{
+ unw_proc_info_t pi;
+
+ if (unw_get_proc_info_by_ip (unw_local_addr_space,
+ (unw_word_t) (uintptr_t) ip, &pi, 0)
+ < 0)
+ return NULL;
+
+ return (void *) (uintptr_t) pi.start_ip;
+}
+
+void *__libunwind_Unwind_FindEnclosingFunction (void *)
+ ALIAS (_Unwind_FindEnclosingFunction);
diff --git a/src/pal/src/libunwind/src/unwind/ForcedUnwind.c b/src/pal/src/libunwind/src/unwind/ForcedUnwind.c
new file mode 100644
index 0000000000..905b31cd87
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/ForcedUnwind.c
@@ -0,0 +1,52 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+_Unwind_Reason_Code
+_Unwind_ForcedUnwind (struct _Unwind_Exception *exception_object,
+ _Unwind_Stop_Fn stop, void *stop_parameter)
+{
+ struct _Unwind_Context context;
+ unw_context_t uc;
+
+ /* We check "stop" here to tell the compiler's inliner that
+ exception_object->private_1 isn't NULL when calling
+ _Unwind_Phase2(). */
+ if (!stop)
+ return _URC_FATAL_PHASE2_ERROR;
+
+ if (_Unwind_InitContext (&context, &uc) < 0)
+ return _URC_FATAL_PHASE2_ERROR;
+
+ exception_object->private_1 = (unsigned long) stop;
+ exception_object->private_2 = (unsigned long) stop_parameter;
+
+ return _Unwind_Phase2 (exception_object, &context);
+}
+
+_Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind (struct _Unwind_Exception*,
+ _Unwind_Stop_Fn, void *)
+ ALIAS (_Unwind_ForcedUnwind);
diff --git a/src/pal/src/libunwind/src/unwind/GetBSP.c b/src/pal/src/libunwind/src/unwind/GetBSP.c
new file mode 100644
index 0000000000..d1bc84e0d2
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetBSP.c
@@ -0,0 +1,42 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+unsigned long
+_Unwind_GetBSP (struct _Unwind_Context *context)
+{
+#ifdef UNW_TARGET_IA64
+ unw_word_t val;
+
+ unw_get_reg (&context->cursor, UNW_IA64_BSP, &val);
+ return val;
+#else
+ return 0;
+#endif
+}
+
+unsigned long __libunwind_Unwind_GetBSP (struct _Unwind_Context *)
+ ALIAS (_Unwind_GetBSP);
diff --git a/src/pal/src/libunwind/src/unwind/GetCFA.c b/src/pal/src/libunwind/src/unwind/GetCFA.c
new file mode 100644
index 0000000000..5ca63903dd
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetCFA.c
@@ -0,0 +1,38 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+unsigned long
+_Unwind_GetCFA (struct _Unwind_Context *context)
+{
+ unw_word_t val;
+
+ unw_get_reg (&context->cursor, UNW_REG_SP, &val);
+ return val;
+}
+
+unsigned long __libunwind_Unwind_GetCFA (struct _Unwind_Context *)
+ ALIAS (_Unwind_GetCFA);
diff --git a/src/pal/src/libunwind/src/unwind/GetDataRelBase.c b/src/pal/src/libunwind/src/unwind/GetDataRelBase.c
new file mode 100644
index 0000000000..8e6914f4f3
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetDataRelBase.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+unsigned long
+_Unwind_GetDataRelBase (struct _Unwind_Context *context)
+{
+ unw_proc_info_t pi;
+
+ pi.gp = 0;
+ unw_get_proc_info (&context->cursor, &pi);
+ return pi.gp;
+}
+
+unsigned long __libunwind_Unwind_GetDataRelBase (struct _Unwind_Context *)
+ ALIAS (_Unwind_GetDataRelBase);
diff --git a/src/pal/src/libunwind/src/unwind/GetGR.c b/src/pal/src/libunwind/src/unwind/GetGR.c
new file mode 100644
index 0000000000..fa70943435
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetGR.c
@@ -0,0 +1,43 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+unsigned long
+_Unwind_GetGR (struct _Unwind_Context *context, int index)
+{
+ unw_word_t val;
+
+ if (index == UNW_REG_SP && context->end_of_stack)
+ /* _Unwind_ForcedUnwind() requires us to return a NULL
+ stack-pointer after reaching the end of the stack. */
+ return 0;
+
+ unw_get_reg (&context->cursor, index, &val);
+ return val;
+}
+
+unsigned long __libunwind_Unwind_GetGR (struct _Unwind_Context *, int)
+ ALIAS (_Unwind_GetGR);
diff --git a/src/pal/src/libunwind/src/unwind/GetIP.c b/src/pal/src/libunwind/src/unwind/GetIP.c
new file mode 100644
index 0000000000..e9fc494402
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetIP.c
@@ -0,0 +1,38 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+unsigned long
+_Unwind_GetIP (struct _Unwind_Context *context)
+{
+ unw_word_t val;
+
+ unw_get_reg (&context->cursor, UNW_REG_IP, &val);
+ return val;
+}
+
+unsigned long __libunwind_Unwind_GetIP (struct _Unwind_Context *)
+ ALIAS (_Unwind_GetIP);
diff --git a/src/pal/src/libunwind/src/unwind/GetIPInfo.c b/src/pal/src/libunwind/src/unwind/GetIPInfo.c
new file mode 100644
index 0000000000..e8ee7fd7f1
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetIPInfo.c
@@ -0,0 +1,42 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2009 Red Hat
+ Contributed by Jan Kratochvil <jan.kratochvil@redhat.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+/* gcc/unwind-dw2.c: Retrieve the return address and flag whether that IP is
+ before or after first not yet fully executed instruction. */
+
+unsigned long
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
+{
+ unw_word_t val;
+
+ unw_get_reg (&context->cursor, UNW_REG_IP, &val);
+ *ip_before_insn = unw_is_signal_frame (&context->cursor);
+ return val;
+}
+
+unsigned long __libunwind_Unwind_GetIPInfo (struct _Unwind_Context *, int *)
+ ALIAS (_Unwind_GetIPInfo);
diff --git a/src/pal/src/libunwind/src/unwind/GetLanguageSpecificData.c b/src/pal/src/libunwind/src/unwind/GetLanguageSpecificData.c
new file mode 100644
index 0000000000..e7ca9b453c
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetLanguageSpecificData.c
@@ -0,0 +1,40 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+unsigned long
+_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
+{
+ unw_proc_info_t pi;
+
+ pi.lsda = 0;
+ unw_get_proc_info (&context->cursor, &pi);
+ return pi.lsda;
+}
+
+unsigned long
+__libunwind_Unwind_GetLanguageSpecificData (struct _Unwind_Context *)
+ ALIAS (_Unwind_GetLanguageSpecificData);
diff --git a/src/pal/src/libunwind/src/unwind/GetRegionStart.c b/src/pal/src/libunwind/src/unwind/GetRegionStart.c
new file mode 100644
index 0000000000..f4995813fa
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetRegionStart.c
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+unsigned long
+_Unwind_GetRegionStart (struct _Unwind_Context *context)
+{
+ unw_proc_info_t pi;
+
+ pi.start_ip = 0;
+ unw_get_proc_info (&context->cursor, &pi);
+ return pi.start_ip;
+}
+
+unsigned long __libunwind_Unwind_GetRegionStart (struct _Unwind_Context *)
+ ALIAS (_Unwind_GetRegionStart);
diff --git a/src/pal/src/libunwind/src/unwind/GetTextRelBase.c b/src/pal/src/libunwind/src/unwind/GetTextRelBase.c
new file mode 100644
index 0000000000..ce65ae93e7
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/GetTextRelBase.c
@@ -0,0 +1,35 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+unsigned long
+_Unwind_GetTextRelBase (struct _Unwind_Context *context)
+{
+ return 0;
+}
+
+unsigned long __libunwind_Unwind_GetTextRelBase (struct _Unwind_Context *)
+ ALIAS (_Unwind_GetTextRelBase);
diff --git a/src/pal/src/libunwind/src/unwind/RaiseException.c b/src/pal/src/libunwind/src/unwind/RaiseException.c
new file mode 100644
index 0000000000..3c3ca19e98
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/RaiseException.c
@@ -0,0 +1,103 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+_Unwind_Reason_Code
+_Unwind_RaiseException (struct _Unwind_Exception *exception_object)
+{
+ uint64_t exception_class = exception_object->exception_class;
+ _Unwind_Personality_Fn personality;
+ struct _Unwind_Context context;
+ _Unwind_Reason_Code reason;
+ unw_proc_info_t pi;
+ unw_context_t uc;
+ unw_word_t ip;
+ int ret;
+
+ Debug (1, "(exception_object=%p)\n", exception_object);
+
+ if (_Unwind_InitContext (&context, &uc) < 0)
+ return _URC_FATAL_PHASE1_ERROR;
+
+ /* Phase 1 (search phase) */
+
+ while (1)
+ {
+ if ((ret = unw_step (&context.cursor)) <= 0)
+ {
+ if (ret == 0)
+ {
+ Debug (1, "no handler found\n");
+ return _URC_END_OF_STACK;
+ }
+ else
+ return _URC_FATAL_PHASE1_ERROR;
+ }
+
+ if (unw_get_proc_info (&context.cursor, &pi) < 0)
+ return _URC_FATAL_PHASE1_ERROR;
+
+ personality = (_Unwind_Personality_Fn) (uintptr_t) pi.handler;
+ if (personality)
+ {
+ reason = (*personality) (_U_VERSION, _UA_SEARCH_PHASE,
+ exception_class, exception_object,
+ &context);
+ if (reason != _URC_CONTINUE_UNWIND)
+ {
+ if (reason == _URC_HANDLER_FOUND)
+ break;
+ else
+ {
+ Debug (1, "personality returned %d\n", reason);
+ return _URC_FATAL_PHASE1_ERROR;
+ }
+ }
+ }
+ }
+
+ /* Exceptions are associated with IP-ranges. If a given exception
+ is handled at a particular IP, it will _always_ be handled at
+ that IP. If this weren't true, we'd have to track the tuple
+ (IP,SP,BSP) to uniquely identify the stack frame that's handling
+ the exception. */
+ if (unw_get_reg (&context.cursor, UNW_REG_IP, &ip) < 0)
+ return _URC_FATAL_PHASE1_ERROR;
+ exception_object->private_1 = 0; /* clear "stop" pointer */
+ exception_object->private_2 = ip; /* save frame marker */
+
+ Debug (1, "found handler for IP=%lx; entering cleanup phase\n", (long) ip);
+
+ /* Reset the cursor to the first frame: */
+ if (unw_init_local (&context.cursor, &uc) < 0)
+ return _URC_FATAL_PHASE1_ERROR;
+
+ return _Unwind_Phase2 (exception_object, &context);
+}
+
+_Unwind_Reason_Code
+__libunwind_Unwind_RaiseException (struct _Unwind_Exception *)
+ ALIAS (_Unwind_RaiseException);
diff --git a/src/pal/src/libunwind/src/unwind/Resume.c b/src/pal/src/libunwind/src/unwind/Resume.c
new file mode 100644
index 0000000000..e23d6be27c
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/Resume.c
@@ -0,0 +1,42 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+void
+_Unwind_Resume (struct _Unwind_Exception *exception_object)
+{
+ struct _Unwind_Context context;
+ unw_context_t uc;
+
+ if (_Unwind_InitContext (&context, &uc) < 0)
+ abort ();
+
+ _Unwind_Phase2 (exception_object, &context);
+ abort ();
+}
+
+void __libunwind_Unwind_Resume (struct _Unwind_Exception *)
+ ALIAS (_Unwind_Resume);
diff --git a/src/pal/src/libunwind/src/unwind/Resume_or_Rethrow.c b/src/pal/src/libunwind/src/unwind/Resume_or_Rethrow.c
new file mode 100644
index 0000000000..9c76443b36
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/Resume_or_Rethrow.c
@@ -0,0 +1,47 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+_Unwind_Reason_Code
+_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exception_object)
+{
+ struct _Unwind_Context context;
+ unw_context_t uc;
+
+ if (exception_object->private_1)
+ {
+ if (_Unwind_InitContext (&context, &uc) < 0)
+ return _URC_FATAL_PHASE2_ERROR;
+
+ return _Unwind_Phase2 (exception_object, &context);
+ }
+ else
+ return _Unwind_RaiseException (exception_object);
+}
+
+_Unwind_Reason_Code
+__libunwind_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *)
+ ALIAS (_Unwind_Resume_or_Rethrow);
diff --git a/src/pal/src/libunwind/src/unwind/SetGR.c b/src/pal/src/libunwind/src/unwind/SetGR.c
new file mode 100644
index 0000000000..ae77a8e825
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/SetGR.c
@@ -0,0 +1,47 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+#ifdef UNW_TARGET_X86
+#include "dwarf_i.h"
+#endif
+
+void
+_Unwind_SetGR (struct _Unwind_Context *context, int index,
+ unsigned long new_value)
+{
+#ifdef UNW_TARGET_X86
+ index = dwarf_to_unw_regnum(index);
+#endif
+ unw_set_reg (&context->cursor, index, new_value);
+#ifdef UNW_TARGET_IA64
+ if (index >= UNW_IA64_GR && index <= UNW_IA64_GR + 127)
+ /* Clear the NaT bit. */
+ unw_set_reg (&context->cursor, UNW_IA64_NAT + (index - UNW_IA64_GR), 0);
+#endif
+}
+
+void __libunwind_Unwind_SetGR (struct _Unwind_Context *, int, unsigned long)
+ ALIAS (_Unwind_SetGR);
diff --git a/src/pal/src/libunwind/src/unwind/SetIP.c b/src/pal/src/libunwind/src/unwind/SetIP.c
new file mode 100644
index 0000000000..fccc2f0dd5
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/SetIP.c
@@ -0,0 +1,35 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind-internal.h"
+
+void
+_Unwind_SetIP (struct _Unwind_Context *context, unsigned long new_value)
+{
+ unw_set_reg (&context->cursor, UNW_REG_IP, new_value);
+}
+
+void __libunwind_Unwind_SetIP (struct _Unwind_Context *, unsigned long)
+ ALIAS (_Unwind_SetIP);
diff --git a/src/pal/src/libunwind/src/unwind/libunwind.pc.in b/src/pal/src/libunwind/src/unwind/libunwind.pc.in
new file mode 100644
index 0000000000..1505c5d6f6
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/libunwind.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libunwind
+Description: libunwind base library
+Version: @VERSION@
+Libs: -L${libdir} -lunwind
+Libs.private: @LIBLZMA@
+Cflags: -I${includedir}
diff --git a/src/pal/src/libunwind/src/unwind/unwind-internal.h b/src/pal/src/libunwind/src/unwind/unwind-internal.h
new file mode 100644
index 0000000000..c68fc3c5ed
--- /dev/null
+++ b/src/pal/src/libunwind/src/unwind/unwind-internal.h
@@ -0,0 +1,140 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_internal_h
+#define unwind_internal_h
+
+#define UNW_LOCAL_ONLY
+
+#include <unwind.h>
+#include <stdlib.h>
+#include <libunwind.h>
+
+#include "libunwind_i.h"
+
+/* The version of the _Unwind_*() interface implemented by this code. */
+#define _U_VERSION 1
+
+typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)
+ (int, _Unwind_Action, uint64_t, struct _Unwind_Exception *,
+ struct _Unwind_Context *);
+
+struct _Unwind_Context {
+ unw_cursor_t cursor;
+ int end_of_stack; /* set to 1 if the end of stack was reached */
+};
+
+/* This must be a macro because unw_getcontext() must be invoked from
+ the callee, even if optimization (and hence inlining) is turned
+ off. The macro arguments MUST NOT have any side-effects. */
+#define _Unwind_InitContext(context, uc) \
+ ((context)->end_of_stack = 0, \
+ ((unw_getcontext (uc) < 0 || unw_init_local (&(context)->cursor, uc) < 0) \
+ ? -1 : 0))
+
+static _Unwind_Reason_Code ALWAYS_INLINE
+_Unwind_Phase2 (struct _Unwind_Exception *exception_object,
+ struct _Unwind_Context *context)
+{
+ _Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) exception_object->private_1;
+ uint64_t exception_class = exception_object->exception_class;
+ void *stop_parameter = (void *) exception_object->private_2;
+ _Unwind_Personality_Fn personality;
+ _Unwind_Reason_Code reason;
+ _Unwind_Action actions;
+ unw_proc_info_t pi;
+ unw_word_t ip;
+ int ret;
+
+ actions = _UA_CLEANUP_PHASE;
+ if (stop)
+ actions |= _UA_FORCE_UNWIND;
+
+ while (1)
+ {
+ ret = unw_step (&context->cursor);
+ if (ret <= 0)
+ {
+ if (ret == 0)
+ {
+ actions |= _UA_END_OF_STACK;
+ context->end_of_stack = 1;
+ }
+ else
+ return _URC_FATAL_PHASE2_ERROR;
+ }
+
+ if (stop)
+ {
+ reason = (*stop) (_U_VERSION, actions, exception_class,
+ exception_object, context, stop_parameter);
+ if (reason != _URC_NO_REASON)
+ /* Stop function may return _URC_FATAL_PHASE2_ERROR if
+ it's unable to handle end-of-stack condition or
+ _URC_FATAL_PHASE2_ERROR if something is wrong. Not
+ that it matters: the resulting state is indeterminate
+ anyhow so we must return _URC_FATAL_PHASE2_ERROR... */
+ return _URC_FATAL_PHASE2_ERROR;
+ }
+
+ if (context->end_of_stack
+ || unw_get_proc_info (&context->cursor, &pi) < 0)
+ return _URC_FATAL_PHASE2_ERROR;
+
+ personality = (_Unwind_Personality_Fn) (uintptr_t) pi.handler;
+ if (personality)
+ {
+ if (!stop)
+ {
+ if (unw_get_reg (&context->cursor, UNW_REG_IP, &ip) < 0)
+ return _URC_FATAL_PHASE2_ERROR;
+
+ if ((unsigned long) stop_parameter == ip)
+ actions |= _UA_HANDLER_FRAME;
+ }
+
+ reason = (*personality) (_U_VERSION, actions, exception_class,
+ exception_object, context);
+ if (reason != _URC_CONTINUE_UNWIND)
+ {
+ if (reason == _URC_INSTALL_CONTEXT)
+ {
+ /* we may regain control via _Unwind_Resume() */
+ unw_resume (&context->cursor);
+ abort ();
+ }
+ else
+ return _URC_FATAL_PHASE2_ERROR;
+ }
+ if (actions & _UA_HANDLER_FRAME)
+ /* The personality routine for the handler-frame changed
+ it's mind; that's a no-no... */
+ abort ();
+ }
+ }
+ return _URC_FATAL_PHASE2_ERROR; /* shouldn't be reached */
+}
+
+#endif /* unwind_internal_h */
diff --git a/src/pal/src/libunwind/src/x86/Gapply_reg_state.c b/src/pal/src/libunwind/src/x86/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/x86/Gcreate_addr_space.c b/src/pal/src/libunwind/src/x86/Gcreate_addr_space.c
new file mode 100644
index 0000000000..a7e41a58f4
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gcreate_addr_space.c
@@ -0,0 +1,58 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+#if defined(_LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN)
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#endif
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * x86 supports only little-endian.
+ */
+ if (byte_order != 0 && byte_order != __LITTLE_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/x86/Gget_proc_info.c b/src/pal/src/libunwind/src/x86/Gget_proc_info.c
new file mode 100644
index 0000000000..4dc2cff366
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gget_proc_info.c
@@ -0,0 +1,45 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (dwarf_make_proc_info (&c->dwarf) < 0)
+ {
+ /* On x86, it's relatively common to be missing DWARF unwind
+ info. We don't want to fail in that case, because the
+ frame-chain still would let us do a backtrace at least. */
+ memset (pi, 0, sizeof (*pi));
+ pi->start_ip = c->dwarf.ip;
+ pi->end_ip = c->dwarf.ip + 1;
+ return 0;
+ }
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/x86/Gget_save_loc.c b/src/pal/src/libunwind/src/x86/Gget_save_loc.c
new file mode 100644
index 0000000000..e459382f6d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gget_save_loc.c
@@ -0,0 +1,133 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ dwarf_loc_t loc;
+
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+
+ switch (reg)
+ {
+ case UNW_X86_EIP: loc = c->dwarf.loc[EIP]; break;
+ case UNW_X86_CFA: break;
+ case UNW_X86_EAX: loc = c->dwarf.loc[EAX]; break;
+ case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break;
+ case UNW_X86_EDX: loc = c->dwarf.loc[EDX]; break;
+ case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break;
+ case UNW_X86_ESP: loc = c->dwarf.loc[ESP]; break;
+ case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break;
+ case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break;
+ case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break;
+ case UNW_X86_EFLAGS: loc = c->dwarf.loc[EFLAGS]; break;
+ case UNW_X86_TRAPNO: loc = c->dwarf.loc[TRAPNO]; break;
+ case UNW_X86_ST0: loc = c->dwarf.loc[ST0]; break;
+
+ case UNW_X86_FCW:
+ case UNW_X86_FSW:
+ case UNW_X86_FTW:
+ case UNW_X86_FOP:
+ case UNW_X86_FCS:
+ case UNW_X86_FIP:
+ case UNW_X86_FEA:
+ case UNW_X86_FDS:
+ case UNW_X86_MXCSR:
+ case UNW_X86_GS:
+ case UNW_X86_FS:
+ case UNW_X86_ES:
+ case UNW_X86_DS:
+ case UNW_X86_SS:
+ case UNW_X86_CS:
+ case UNW_X86_TSS:
+ case UNW_X86_LDT:
+ loc = x86_scratch_loc (c, reg);
+ break;
+
+ /* stacked fp registers */
+ case UNW_X86_ST1:
+ case UNW_X86_ST2:
+ case UNW_X86_ST3:
+ case UNW_X86_ST4:
+ case UNW_X86_ST5:
+ case UNW_X86_ST6:
+ case UNW_X86_ST7:
+ /* SSE fp registers */
+ case UNW_X86_XMM0_lo:
+ case UNW_X86_XMM0_hi:
+ case UNW_X86_XMM1_lo:
+ case UNW_X86_XMM1_hi:
+ case UNW_X86_XMM2_lo:
+ case UNW_X86_XMM2_hi:
+ case UNW_X86_XMM3_lo:
+ case UNW_X86_XMM3_hi:
+ case UNW_X86_XMM4_lo:
+ case UNW_X86_XMM4_hi:
+ case UNW_X86_XMM5_lo:
+ case UNW_X86_XMM5_hi:
+ case UNW_X86_XMM6_lo:
+ case UNW_X86_XMM6_hi:
+ case UNW_X86_XMM7_lo:
+ case UNW_X86_XMM7_hi:
+ case UNW_X86_XMM0:
+ case UNW_X86_XMM1:
+ case UNW_X86_XMM2:
+ case UNW_X86_XMM3:
+ case UNW_X86_XMM4:
+ case UNW_X86_XMM5:
+ case UNW_X86_XMM6:
+ case UNW_X86_XMM7:
+ loc = x86_scratch_loc (c, reg);
+ break;
+
+ default:
+ break;
+ }
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/x86/Gglobal.c b/src/pal/src/libunwind/src/x86/Gglobal.c
new file mode 100644
index 0000000000..132b824994
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gglobal.c
@@ -0,0 +1,67 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (x86_lock);
+HIDDEN int tdep_init_done;
+
+/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */
+
+HIDDEN const uint8_t dwarf_to_unw_regnum_map[19] =
+ {
+ UNW_X86_EAX, UNW_X86_ECX, UNW_X86_EDX, UNW_X86_EBX,
+ UNW_X86_ESP, UNW_X86_EBP, UNW_X86_ESI, UNW_X86_EDI,
+ UNW_X86_EIP, UNW_X86_EFLAGS, UNW_X86_TRAPNO,
+ UNW_X86_ST0, UNW_X86_ST1, UNW_X86_ST2, UNW_X86_ST3,
+ UNW_X86_ST4, UNW_X86_ST5, UNW_X86_ST6, UNW_X86_ST7
+ };
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&x86_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ x86_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&x86_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/x86/Ginit.c b/src/pal/src/libunwind/src/x86/Ginit.c
new file mode 100644
index 0000000000..f6b8dc27d4
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Ginit.c
@@ -0,0 +1,243 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg)
+{
+ return x86_r_uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+#define PAGE_SIZE 4096
+#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
+
+/* Cache of already validated addresses */
+#define NLGA 4
+static unw_word_t last_good_addr[NLGA];
+static int lga_victim;
+
+static int
+validate_mem (unw_word_t addr)
+{
+ int i, victim;
+#ifdef HAVE_MINCORE
+ unsigned char mvec[2]; /* Unaligned access may cross page boundary */
+#endif
+ size_t len;
+
+ if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
+ len = PAGE_SIZE;
+ else
+ len = PAGE_SIZE * 2;
+
+ addr = PAGE_START(addr);
+
+ if (addr == 0)
+ return -1;
+
+ for (i = 0; i < NLGA; i++)
+ {
+ if (last_good_addr[i] && (addr == last_good_addr[i]))
+ return 0;
+ }
+
+#ifdef HAVE_MINCORE
+ if (mincore ((void *) addr, len, mvec) == -1)
+#else
+ if (msync ((void *) addr, len, MS_ASYNC) == -1)
+#endif
+ return -1;
+
+ victim = lga_victim;
+ for (i = 0; i < NLGA; i++) {
+ if (!last_good_addr[victim]) {
+ last_good_addr[victim++] = addr;
+ return 0;
+ }
+ victim = (victim + 1) % NLGA;
+ }
+
+ /* All slots full. Evict the victim. */
+ last_good_addr[victim] = addr;
+ victim = (victim + 1) % NLGA;
+ lga_victim = victim;
+
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (write)
+ {
+ Debug (16, "mem[%x] <- %x\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ /* validate address */
+ const struct cursor *c = (const struct cursor *)arg;
+ if (c && c->validate && validate_mem(addr))
+ return -1;
+ *val = *(unw_word_t *) addr;
+ Debug (16, "mem[%x] -> %x\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = ((struct cursor *)arg)->uc;
+
+ if (unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = x86_r_uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) addr = *val;
+ Debug (12, "%s <- %x\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> %x\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = ((struct cursor *)arg)->uc;
+ unw_fpreg_t *addr;
+
+ if (!unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = x86_r_uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ *(unw_fpreg_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+x86_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = x86_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/x86/Ginit_local.c b/src/pal/src/libunwind/src/x86/Ginit_local.c
new file mode 100644
index 0000000000..bff068704d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Ginit_local.c
@@ -0,0 +1,79 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = c;
+ c->uc = uc;
+ c->validate = 0;
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/x86/Ginit_remote.c b/src/pal/src/libunwind/src/x86/Ginit_remote.c
new file mode 100644
index 0000000000..7c15096e4f
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Ginit_remote.c
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+ if (as == unw_local_addr_space)
+ {
+ c->dwarf.as_arg = c;
+ c->uc = as_arg;
+ }
+ else
+ {
+ c->dwarf.as_arg = as_arg;
+ c->uc = 0;
+ }
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/x86/Gos-freebsd.c b/src/pal/src/libunwind/src/x86/Gos-freebsd.c
new file mode 100644
index 0000000000..7dd0140463
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gos-freebsd.c
@@ -0,0 +1,374 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/types.h>
+#include <signal.h>
+#include <stddef.h>
+#include <ucontext.h>
+#include <machine/sigframe.h>
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, w1, w2, w3, w4, w5, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ /* Check if EIP points at sigreturn() sequence. It can be:
+sigcode+4: from amd64 freebsd32 environment
+8d 44 24 20 lea 0x20(%esp),%eax
+50 push %eax
+b8 a1 01 00 00 mov $0x1a1,%eax
+50 push %eax
+cd 80 int $0x80
+
+sigcode+4: from real i386
+8d 44 24 20 lea 0x20(%esp),%eax
+50 push %eax
+f7 40 54 00 02 00 testl $0x20000,0x54(%eax)
+75 03 jne sigcode+21
+8e 68 14 mov 0x14(%eax),%gs
+b8 a1 01 00 00 mov $0x1a1,%eax
+50 push %eax
+cd 80 int $0x80
+
+freebsd4_sigcode+4:
+XXX
+osigcode:
+XXX
+ */
+ ip = c->dwarf.ip;
+ ret = X86_SCF_NONE;
+ c->sigcontext_format = ret;
+ if ((*a->access_mem) (as, ip, &w0, 0, arg) < 0 ||
+ (*a->access_mem) (as, ip + 4, &w1, 0, arg) < 0 ||
+ (*a->access_mem) (as, ip + 8, &w2, 0, arg) < 0 ||
+ (*a->access_mem) (as, ip + 12, &w3, 0, arg) < 0)
+ return ret;
+ if (w0 == 0x2024448d && w1 == 0x01a1b850 && w2 == 0xcd500000 &&
+ (w3 & 0xff) == 0x80)
+ ret = X86_SCF_FREEBSD_SIGFRAME;
+ else {
+ if ((*a->access_mem) (as, ip + 16, &w4, 0, arg) < 0 ||
+ (*a->access_mem) (as, ip + 20, &w5, 0, arg) < 0)
+ return ret;
+ if (w0 == 0x2024448d && w1 == 0x5440f750 && w2 == 0x75000200 &&
+ w3 == 0x14688e03 && w4 == 0x0001a1b8 && w5 == 0x80cd5000)
+ ret = X86_SCF_FREEBSD_SIGFRAME;
+ }
+
+ /* Check for syscall */
+ if (ret == X86_SCF_NONE && (*a->access_mem) (as, ip - 2, &w0, 0, arg) >= 0 &&
+ (w0 & 0xffff) == 0x80cd)
+ ret = X86_SCF_FREEBSD_SYSCALL;
+ Debug (16, "returning %d\n", ret);
+ c->sigcontext_format = ret;
+ return (ret);
+}
+
+HIDDEN int
+x86_handle_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ if (c->sigcontext_format == X86_SCF_FREEBSD_SIGFRAME) {
+ struct sigframe *sf;
+ uintptr_t uc_addr;
+ struct dwarf_loc esp_loc;
+
+ sf = (struct sigframe *)c->dwarf.cfa;
+ uc_addr = (uintptr_t)&(sf->sf_uc);
+ c->sigcontext_addr = c->dwarf.cfa;
+
+ esp_loc = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ESP_OFF, 0);
+ ret = dwarf_get (&c->dwarf, esp_loc, &c->dwarf.cfa);
+ if (ret < 0)
+ {
+ Debug (2, "returning 0\n");
+ return 0;
+ }
+
+ c->dwarf.loc[EIP] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EIP_OFF, 0);
+ c->dwarf.loc[ESP] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ESP_OFF, 0);
+ c->dwarf.loc[EAX] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EAX_OFF, 0);
+ c->dwarf.loc[ECX] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ECX_OFF, 0);
+ c->dwarf.loc[EDX] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EDX_OFF, 0);
+ c->dwarf.loc[EBX] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EBX_OFF, 0);
+ c->dwarf.loc[EBP] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EBP_OFF, 0);
+ c->dwarf.loc[ESI] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ESI_OFF, 0);
+ c->dwarf.loc[EDI] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EDI_OFF, 0);
+ c->dwarf.loc[EFLAGS] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EFLAGS_OFF, 0);
+ c->dwarf.loc[TRAPNO] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_TRAPNO_OFF, 0);
+ c->dwarf.loc[ST0] = DWARF_NULL_LOC;
+ } else if (c->sigcontext_format == X86_SCF_FREEBSD_SYSCALL) {
+ c->dwarf.loc[EIP] = DWARF_LOC (c->dwarf.cfa, 0);
+ c->dwarf.loc[EAX] = DWARF_NULL_LOC;
+ c->dwarf.cfa += 4;
+ c->dwarf.use_prev_instr = 1;
+ } else {
+ Debug (8, "Gstep: not handling frame format %d\n", c->sigcontext_format);
+ abort();
+ }
+ return 0;
+}
+
+HIDDEN dwarf_loc_t
+x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg)
+{
+ unw_word_t addr = c->sigcontext_addr, off, xmm_off;
+ unw_word_t fpstate, fpformat;
+ int ret, is_fpstate = 0, is_xmmstate = 0;
+
+ switch (c->sigcontext_format)
+ {
+ case X86_SCF_NONE:
+ return DWARF_REG_LOC (&c->dwarf, reg);
+
+ case X86_SCF_FREEBSD_SIGFRAME:
+ addr += offsetof(struct sigframe, sf_uc) + FREEBSD_UC_MCONTEXT_OFF;
+ break;
+
+ case X86_SCF_FREEBSD_SIGFRAME4:
+ abort();
+ break;
+
+ case X86_SCF_FREEBSD_OSIGFRAME:
+ /* XXXKIB */
+ abort();
+ break;
+
+ case X86_SCF_FREEBSD_SYSCALL:
+ /* XXXKIB */
+ abort();
+ break;
+
+ default:
+ /* XXXKIB */
+ abort();
+ break;
+ }
+
+ off = 0; /* shut gcc warning */
+ switch (reg)
+ {
+ case UNW_X86_GS: off = FREEBSD_UC_MCONTEXT_GS_OFF; break;
+ case UNW_X86_FS: off = FREEBSD_UC_MCONTEXT_FS_OFF; break;
+ case UNW_X86_ES: off = FREEBSD_UC_MCONTEXT_ES_OFF; break;
+ case UNW_X86_DS: off = FREEBSD_UC_MCONTEXT_SS_OFF; break;
+ case UNW_X86_EDI: off = FREEBSD_UC_MCONTEXT_EDI_OFF; break;
+ case UNW_X86_ESI: off = FREEBSD_UC_MCONTEXT_ESI_OFF; break;
+ case UNW_X86_EBP: off = FREEBSD_UC_MCONTEXT_EBP_OFF; break;
+ case UNW_X86_ESP: off = FREEBSD_UC_MCONTEXT_ESP_OFF; break;
+ case UNW_X86_EBX: off = FREEBSD_UC_MCONTEXT_EBX_OFF; break;
+ case UNW_X86_EDX: off = FREEBSD_UC_MCONTEXT_EDX_OFF; break;
+ case UNW_X86_ECX: off = FREEBSD_UC_MCONTEXT_ECX_OFF; break;
+ case UNW_X86_EAX: off = FREEBSD_UC_MCONTEXT_EAX_OFF; break;
+ case UNW_X86_TRAPNO: off = FREEBSD_UC_MCONTEXT_TRAPNO_OFF; break;
+ case UNW_X86_EIP: off = FREEBSD_UC_MCONTEXT_EIP_OFF; break;
+ case UNW_X86_CS: off = FREEBSD_UC_MCONTEXT_CS_OFF; break;
+ case UNW_X86_EFLAGS: off = FREEBSD_UC_MCONTEXT_EFLAGS_OFF; break;
+ case UNW_X86_SS: off = FREEBSD_UC_MCONTEXT_SS_OFF; break;
+
+ case UNW_X86_FCW:
+ is_fpstate = 1;
+ off = FREEBSD_UC_MCONTEXT_CW_OFF;
+ xmm_off = FREEBSD_UC_MCONTEXT_CW_XMM_OFF;
+ break;
+ case UNW_X86_FSW:
+ is_fpstate = 1;
+ off = FREEBSD_UC_MCONTEXT_SW_OFF;
+ xmm_off = FREEBSD_UC_MCONTEXT_SW_XMM_OFF;
+ break;
+ case UNW_X86_FTW:
+ is_fpstate = 1;
+ xmm_off = FREEBSD_UC_MCONTEXT_TAG_XMM_OFF;
+ off = FREEBSD_UC_MCONTEXT_TAG_OFF;
+ break;
+ case UNW_X86_FCS:
+ is_fpstate = 1;
+ off = FREEBSD_UC_MCONTEXT_CSSEL_OFF;
+ xmm_off = FREEBSD_UC_MCONTEXT_CSSEL_XMM_OFF;
+ break;
+ case UNW_X86_FIP:
+ is_fpstate = 1;
+ off = FREEBSD_UC_MCONTEXT_IPOFF_OFF;
+ xmm_off = FREEBSD_UC_MCONTEXT_IPOFF_XMM_OFF;
+ break;
+ case UNW_X86_FEA:
+ is_fpstate = 1;
+ off = FREEBSD_UC_MCONTEXT_DATAOFF_OFF;
+ xmm_off = FREEBSD_UC_MCONTEXT_DATAOFF_XMM_OFF;
+ break;
+ case UNW_X86_FDS:
+ is_fpstate = 1;
+ off = FREEBSD_US_MCONTEXT_DATASEL_OFF;
+ xmm_off = FREEBSD_US_MCONTEXT_DATASEL_XMM_OFF;
+ break;
+ case UNW_X86_MXCSR:
+ is_fpstate = 1;
+ is_xmmstate = 1;
+ xmm_off = FREEBSD_UC_MCONTEXT_MXCSR_XMM_OFF;
+ break;
+
+ /* stacked fp registers */
+ case UNW_X86_ST0: case UNW_X86_ST1: case UNW_X86_ST2: case UNW_X86_ST3:
+ case UNW_X86_ST4: case UNW_X86_ST5: case UNW_X86_ST6: case UNW_X86_ST7:
+ is_fpstate = 1;
+ off = FREEBSD_UC_MCONTEXT_ST0_OFF + 10*(reg - UNW_X86_ST0);
+ xmm_off = FREEBSD_UC_MCONTEXT_ST0_XMM_OFF + 10*(reg - UNW_X86_ST0);
+ break;
+
+ /* SSE fp registers */
+ case UNW_X86_XMM0_lo: case UNW_X86_XMM0_hi:
+ case UNW_X86_XMM1_lo: case UNW_X86_XMM1_hi:
+ case UNW_X86_XMM2_lo: case UNW_X86_XMM2_hi:
+ case UNW_X86_XMM3_lo: case UNW_X86_XMM3_hi:
+ case UNW_X86_XMM4_lo: case UNW_X86_XMM4_hi:
+ case UNW_X86_XMM5_lo: case UNW_X86_XMM5_hi:
+ case UNW_X86_XMM6_lo: case UNW_X86_XMM6_hi:
+ case UNW_X86_XMM7_lo: case UNW_X86_XMM7_hi:
+ is_fpstate = 1;
+ is_xmmstate = 1;
+ xmm_off = FREEBSD_UC_MCONTEXT_XMM0_OFF + 8*(reg - UNW_X86_XMM0_lo);
+ break;
+ case UNW_X86_XMM0:
+ case UNW_X86_XMM1:
+ case UNW_X86_XMM2:
+ case UNW_X86_XMM3:
+ case UNW_X86_XMM4:
+ case UNW_X86_XMM5:
+ case UNW_X86_XMM6:
+ case UNW_X86_XMM7:
+ is_fpstate = 1;
+ is_xmmstate = 1;
+ xmm_off = FREEBSD_UC_MCONTEXT_XMM0_OFF + 16*(reg - UNW_X86_XMM0);
+ break;
+
+ case UNW_X86_FOP:
+ case UNW_X86_TSS:
+ case UNW_X86_LDT:
+ default:
+ return DWARF_REG_LOC (&c->dwarf, reg);
+ }
+
+ if (is_fpstate)
+ {
+ if ((ret = dwarf_get (&c->dwarf,
+ DWARF_MEM_LOC (&c->dwarf, addr + FREEBSD_UC_MCONTEXT_FPSTATE_OFF),
+ &fpstate)) < 0)
+ return DWARF_NULL_LOC;
+ if (fpstate == FREEBSD_UC_MCONTEXT_FPOWNED_NONE)
+ return DWARF_NULL_LOC;
+ if ((ret = dwarf_get (&c->dwarf,
+ DWARF_MEM_LOC (&c->dwarf, addr + FREEBSD_UC_MCONTEXT_FPFORMAT_OFF),
+ &fpformat)) < 0)
+ return DWARF_NULL_LOC;
+ if (fpformat == FREEBSD_UC_MCONTEXT_FPFMT_NODEV ||
+ (is_xmmstate && fpformat != FREEBSD_UC_MCONTEXT_FPFMT_XMM))
+ return DWARF_NULL_LOC;
+ if (is_xmmstate)
+ off = xmm_off;
+ }
+
+ return DWARF_MEM_LOC (c, addr + off);
+}
+
+#ifndef UNW_REMOTE_ONLY
+HIDDEN void *
+x86_r_uc_addr (ucontext_t *uc, int reg)
+{
+ void *addr;
+
+ switch (reg)
+ {
+ case UNW_X86_GS: addr = &uc->uc_mcontext.mc_gs; break;
+ case UNW_X86_FS: addr = &uc->uc_mcontext.mc_fs; break;
+ case UNW_X86_ES: addr = &uc->uc_mcontext.mc_es; break;
+ case UNW_X86_DS: addr = &uc->uc_mcontext.mc_ds; break;
+ case UNW_X86_EAX: addr = &uc->uc_mcontext.mc_eax; break;
+ case UNW_X86_EBX: addr = &uc->uc_mcontext.mc_ebx; break;
+ case UNW_X86_ECX: addr = &uc->uc_mcontext.mc_ecx; break;
+ case UNW_X86_EDX: addr = &uc->uc_mcontext.mc_edx; break;
+ case UNW_X86_ESI: addr = &uc->uc_mcontext.mc_esi; break;
+ case UNW_X86_EDI: addr = &uc->uc_mcontext.mc_edi; break;
+ case UNW_X86_EBP: addr = &uc->uc_mcontext.mc_ebp; break;
+ case UNW_X86_EIP: addr = &uc->uc_mcontext.mc_eip; break;
+ case UNW_X86_ESP: addr = &uc->uc_mcontext.mc_esp; break;
+ case UNW_X86_TRAPNO: addr = &uc->uc_mcontext.mc_trapno; break;
+ case UNW_X86_CS: addr = &uc->uc_mcontext.mc_cs; break;
+ case UNW_X86_EFLAGS: addr = &uc->uc_mcontext.mc_eflags; break;
+ case UNW_X86_SS: addr = &uc->uc_mcontext.mc_ss; break;
+
+ default:
+ addr = NULL;
+ }
+ return addr;
+}
+
+HIDDEN int
+x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = c->uc;
+
+ /* Ensure c->pi is up-to-date. On x86, it's relatively common to be
+ missing DWARF unwind info. We don't want to fail in that case,
+ because the frame-chain still would let us do a backtrace at
+ least. */
+ dwarf_make_proc_info (&c->dwarf);
+
+ if (c->sigcontext_format == X86_SCF_NONE) {
+ Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
+ setcontext (uc);
+ abort();
+ } else if (c->sigcontext_format == X86_SCF_FREEBSD_SIGFRAME) {
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+
+ Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
+ sigreturn((ucontext_t *)((const char *)sc + FREEBSD_SC_UCONTEXT_OFF));
+ abort();
+ } else {
+ Debug (8, "resuming at ip=%x for sigcontext format %d not implemented\n",
+ c->dwarf.ip, c->sigcontext_format);
+ abort();
+ }
+ return -UNW_EINVAL;
+}
+
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Gos-linux.c b/src/pal/src/libunwind/src/x86/Gos-linux.c
new file mode 100644
index 0000000000..fb9a5e3461
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gos-linux.c
@@ -0,0 +1,331 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+#include <sys/syscall.h>
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, w1, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ /* Check if EIP points at sigreturn() sequence. On Linux, this is:
+
+ __restore:
+ 0x58 pop %eax
+ 0xb8 0x77 0x00 0x00 0x00 movl 0x77,%eax
+ 0xcd 0x80 int 0x80
+
+ without SA_SIGINFO, and
+
+ __restore_rt:
+ 0xb8 0xad 0x00 0x00 0x00 movl 0xad,%eax
+ 0xcd 0x80 int 0x80
+ 0x00
+
+ if SA_SIGINFO is specified.
+ */
+ ip = c->dwarf.ip;
+ if ((*a->access_mem) (as, ip, &w0, 0, arg) < 0
+ || (*a->access_mem) (as, ip + 4, &w1, 0, arg) < 0)
+ ret = 0;
+ else
+ ret = ((w0 == 0x0077b858 && w1 == 0x80cd0000)
+ || (w0 == 0x0000adb8 && (w1 & 0xffffff) == 0x80cd00));
+ Debug (16, "returning %d\n", ret);
+ return ret;
+}
+
+HIDDEN int
+x86_handle_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ /* c->esp points at the arguments to the handler. Without
+ SA_SIGINFO, the arguments consist of a signal number
+ followed by a struct sigcontext. With SA_SIGINFO, the
+ arguments consist a signal number, a siginfo *, and a
+ ucontext *. */
+ unw_word_t sc_addr;
+ unw_word_t siginfo_ptr_addr = c->dwarf.cfa + 4;
+ unw_word_t sigcontext_ptr_addr = c->dwarf.cfa + 8;
+ unw_word_t siginfo_ptr, sigcontext_ptr;
+ struct dwarf_loc esp_loc, siginfo_ptr_loc, sigcontext_ptr_loc;
+
+ siginfo_ptr_loc = DWARF_LOC (siginfo_ptr_addr, 0);
+ sigcontext_ptr_loc = DWARF_LOC (sigcontext_ptr_addr, 0);
+ ret = (dwarf_get (&c->dwarf, siginfo_ptr_loc, &siginfo_ptr)
+ | dwarf_get (&c->dwarf, sigcontext_ptr_loc, &sigcontext_ptr));
+ if (ret < 0)
+ {
+ Debug (2, "returning 0\n");
+ return 0;
+ }
+ if (siginfo_ptr < c->dwarf.cfa
+ || siginfo_ptr > c->dwarf.cfa + 256
+ || sigcontext_ptr < c->dwarf.cfa
+ || sigcontext_ptr > c->dwarf.cfa + 256)
+ {
+ /* Not plausible for SA_SIGINFO signal */
+ c->sigcontext_format = X86_SCF_LINUX_SIGFRAME;
+ c->sigcontext_addr = sc_addr = c->dwarf.cfa + 4;
+ }
+ else
+ {
+ /* If SA_SIGINFO were not specified, we actually read
+ various segment pointers instead. We believe that at
+ least fs and _fsh are always zero for linux, so it is
+ not just unlikely, but impossible that we would end
+ up here. */
+ c->sigcontext_format = X86_SCF_LINUX_RT_SIGFRAME;
+ c->sigcontext_addr = sigcontext_ptr;
+ sc_addr = sigcontext_ptr + LINUX_UC_MCONTEXT_OFF;
+ }
+ esp_loc = DWARF_LOC (sc_addr + LINUX_SC_ESP_OFF, 0);
+ ret = dwarf_get (&c->dwarf, esp_loc, &c->dwarf.cfa);
+ if (ret < 0)
+ {
+ Debug (2, "returning 0\n");
+ return 0;
+ }
+
+ c->dwarf.loc[EAX] = DWARF_LOC (sc_addr + LINUX_SC_EAX_OFF, 0);
+ c->dwarf.loc[ECX] = DWARF_LOC (sc_addr + LINUX_SC_ECX_OFF, 0);
+ c->dwarf.loc[EDX] = DWARF_LOC (sc_addr + LINUX_SC_EDX_OFF, 0);
+ c->dwarf.loc[EBX] = DWARF_LOC (sc_addr + LINUX_SC_EBX_OFF, 0);
+ c->dwarf.loc[EBP] = DWARF_LOC (sc_addr + LINUX_SC_EBP_OFF, 0);
+ c->dwarf.loc[ESI] = DWARF_LOC (sc_addr + LINUX_SC_ESI_OFF, 0);
+ c->dwarf.loc[EDI] = DWARF_LOC (sc_addr + LINUX_SC_EDI_OFF, 0);
+ c->dwarf.loc[EFLAGS] = DWARF_NULL_LOC;
+ c->dwarf.loc[TRAPNO] = DWARF_NULL_LOC;
+ c->dwarf.loc[ST0] = DWARF_NULL_LOC;
+ c->dwarf.loc[EIP] = DWARF_LOC (sc_addr + LINUX_SC_EIP_OFF, 0);
+ c->dwarf.loc[ESP] = DWARF_LOC (sc_addr + LINUX_SC_ESP_OFF, 0);
+
+ return 0;
+}
+
+HIDDEN dwarf_loc_t
+x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg)
+{
+ unw_word_t addr = c->sigcontext_addr, fpstate_addr, off;
+ int ret, is_fpstate = 0;
+
+ switch (c->sigcontext_format)
+ {
+ case X86_SCF_NONE:
+ return DWARF_REG_LOC (&c->dwarf, reg);
+
+ case X86_SCF_LINUX_SIGFRAME:
+ break;
+
+ case X86_SCF_LINUX_RT_SIGFRAME:
+ addr += LINUX_UC_MCONTEXT_OFF;
+ break;
+
+ default:
+ return DWARF_NULL_LOC;
+ }
+
+ switch (reg)
+ {
+ case UNW_X86_GS: off = LINUX_SC_GS_OFF; break;
+ case UNW_X86_FS: off = LINUX_SC_FS_OFF; break;
+ case UNW_X86_ES: off = LINUX_SC_ES_OFF; break;
+ case UNW_X86_DS: off = LINUX_SC_DS_OFF; break;
+ case UNW_X86_EDI: off = LINUX_SC_EDI_OFF; break;
+ case UNW_X86_ESI: off = LINUX_SC_ESI_OFF; break;
+ case UNW_X86_EBP: off = LINUX_SC_EBP_OFF; break;
+ case UNW_X86_ESP: off = LINUX_SC_ESP_OFF; break;
+ case UNW_X86_EBX: off = LINUX_SC_EBX_OFF; break;
+ case UNW_X86_EDX: off = LINUX_SC_EDX_OFF; break;
+ case UNW_X86_ECX: off = LINUX_SC_ECX_OFF; break;
+ case UNW_X86_EAX: off = LINUX_SC_EAX_OFF; break;
+ case UNW_X86_TRAPNO: off = LINUX_SC_TRAPNO_OFF; break;
+ case UNW_X86_EIP: off = LINUX_SC_EIP_OFF; break;
+ case UNW_X86_CS: off = LINUX_SC_CS_OFF; break;
+ case UNW_X86_EFLAGS: off = LINUX_SC_EFLAGS_OFF; break;
+ case UNW_X86_SS: off = LINUX_SC_SS_OFF; break;
+
+ /* The following is probably not correct for all possible cases.
+ Somebody who understands this better should review this for
+ correctness. */
+
+ case UNW_X86_FCW: is_fpstate = 1; off = LINUX_FPSTATE_CW_OFF; break;
+ case UNW_X86_FSW: is_fpstate = 1; off = LINUX_FPSTATE_SW_OFF; break;
+ case UNW_X86_FTW: is_fpstate = 1; off = LINUX_FPSTATE_TAG_OFF; break;
+ case UNW_X86_FCS: is_fpstate = 1; off = LINUX_FPSTATE_CSSEL_OFF; break;
+ case UNW_X86_FIP: is_fpstate = 1; off = LINUX_FPSTATE_IPOFF_OFF; break;
+ case UNW_X86_FEA: is_fpstate = 1; off = LINUX_FPSTATE_DATAOFF_OFF; break;
+ case UNW_X86_FDS: is_fpstate = 1; off = LINUX_FPSTATE_DATASEL_OFF; break;
+ case UNW_X86_MXCSR: is_fpstate = 1; off = LINUX_FPSTATE_MXCSR_OFF; break;
+
+ /* stacked fp registers */
+ case UNW_X86_ST0: case UNW_X86_ST1: case UNW_X86_ST2: case UNW_X86_ST3:
+ case UNW_X86_ST4: case UNW_X86_ST5: case UNW_X86_ST6: case UNW_X86_ST7:
+ is_fpstate = 1;
+ off = LINUX_FPSTATE_ST0_OFF + 10*(reg - UNW_X86_ST0);
+ break;
+
+ /* SSE fp registers */
+ case UNW_X86_XMM0_lo: case UNW_X86_XMM0_hi:
+ case UNW_X86_XMM1_lo: case UNW_X86_XMM1_hi:
+ case UNW_X86_XMM2_lo: case UNW_X86_XMM2_hi:
+ case UNW_X86_XMM3_lo: case UNW_X86_XMM3_hi:
+ case UNW_X86_XMM4_lo: case UNW_X86_XMM4_hi:
+ case UNW_X86_XMM5_lo: case UNW_X86_XMM5_hi:
+ case UNW_X86_XMM6_lo: case UNW_X86_XMM6_hi:
+ case UNW_X86_XMM7_lo: case UNW_X86_XMM7_hi:
+ is_fpstate = 1;
+ off = LINUX_FPSTATE_XMM0_OFF + 8*(reg - UNW_X86_XMM0_lo);
+ break;
+ case UNW_X86_XMM0:
+ case UNW_X86_XMM1:
+ case UNW_X86_XMM2:
+ case UNW_X86_XMM3:
+ case UNW_X86_XMM4:
+ case UNW_X86_XMM5:
+ case UNW_X86_XMM6:
+ case UNW_X86_XMM7:
+ is_fpstate = 1;
+ off = LINUX_FPSTATE_XMM0_OFF + 16*(reg - UNW_X86_XMM0);
+ break;
+
+ case UNW_X86_FOP:
+ case UNW_X86_TSS:
+ case UNW_X86_LDT:
+ default:
+ return DWARF_REG_LOC (&c->dwarf, reg);
+ }
+
+ if (is_fpstate)
+ {
+ if ((ret = dwarf_get (&c->dwarf,
+ DWARF_MEM_LOC (&c->dwarf,
+ addr + LINUX_SC_FPSTATE_OFF),
+ &fpstate_addr)) < 0)
+ return DWARF_NULL_LOC;
+
+ if (!fpstate_addr)
+ return DWARF_NULL_LOC;
+
+ return DWARF_MEM_LOC (c, fpstate_addr + off);
+ }
+ else
+ return DWARF_MEM_LOC (c, addr + off);
+}
+
+#ifndef UNW_REMOTE_ONLY
+HIDDEN void *
+x86_r_uc_addr (ucontext_t *uc, int reg)
+{
+ void *addr;
+
+ switch (reg)
+ {
+ case UNW_X86_GS: addr = &uc->uc_mcontext.gregs[REG_GS]; break;
+ case UNW_X86_FS: addr = &uc->uc_mcontext.gregs[REG_FS]; break;
+ case UNW_X86_ES: addr = &uc->uc_mcontext.gregs[REG_ES]; break;
+ case UNW_X86_DS: addr = &uc->uc_mcontext.gregs[REG_DS]; break;
+ case UNW_X86_EAX: addr = &uc->uc_mcontext.gregs[REG_EAX]; break;
+ case UNW_X86_EBX: addr = &uc->uc_mcontext.gregs[REG_EBX]; break;
+ case UNW_X86_ECX: addr = &uc->uc_mcontext.gregs[REG_ECX]; break;
+ case UNW_X86_EDX: addr = &uc->uc_mcontext.gregs[REG_EDX]; break;
+ case UNW_X86_ESI: addr = &uc->uc_mcontext.gregs[REG_ESI]; break;
+ case UNW_X86_EDI: addr = &uc->uc_mcontext.gregs[REG_EDI]; break;
+ case UNW_X86_EBP: addr = &uc->uc_mcontext.gregs[REG_EBP]; break;
+ case UNW_X86_EIP: addr = &uc->uc_mcontext.gregs[REG_EIP]; break;
+ case UNW_X86_ESP: addr = &uc->uc_mcontext.gregs[REG_ESP]; break;
+ case UNW_X86_TRAPNO: addr = &uc->uc_mcontext.gregs[REG_TRAPNO]; break;
+ case UNW_X86_CS: addr = &uc->uc_mcontext.gregs[REG_CS]; break;
+ case UNW_X86_EFLAGS: addr = &uc->uc_mcontext.gregs[REG_EFL]; break;
+ case UNW_X86_SS: addr = &uc->uc_mcontext.gregs[REG_SS]; break;
+
+ default:
+ addr = NULL;
+ }
+ return addr;
+}
+
+HIDDEN int
+x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = c->uc;
+
+ /* Ensure c->pi is up-to-date. On x86, it's relatively common to be
+ missing DWARF unwind info. We don't want to fail in that case,
+ because the frame-chain still would let us do a backtrace at
+ least. */
+ dwarf_make_proc_info (&c->dwarf);
+
+ if (unlikely (c->sigcontext_format != X86_SCF_NONE))
+ {
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+
+ Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
+ x86_sigreturn (sc);
+ }
+ else
+ {
+ Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
+ setcontext (uc);
+ }
+ return -UNW_EINVAL;
+}
+
+/* sigreturn() is a no-op on x86 glibc. */
+HIDDEN void
+x86_sigreturn (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+ mcontext_t *sc_mcontext = &((ucontext_t*)sc)->uc_mcontext;
+ /* Copy in saved uc - all preserved regs are at the start of sigcontext */
+ memcpy(sc_mcontext, &c->uc->uc_mcontext,
+ DWARF_NUM_PRESERVED_REGS * sizeof(unw_word_t));
+
+ Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
+ (unsigned long long) c->dwarf.ip, sc);
+ __asm__ __volatile__ ("mov %0, %%esp;"
+ "mov %1, %%eax;"
+ "syscall"
+ :: "r"(sc), "i"(SYS_rt_sigreturn)
+ : "memory");
+ abort();
+}
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Greg_states_iterate.c b/src/pal/src/libunwind/src/x86/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/x86/Gregs.c b/src/pal/src/libunwind/src/x86/Gregs.c
new file mode 100644
index 0000000000..4a9592617d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gregs.c
@@ -0,0 +1,178 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+#include "unwind_i.h"
+
+HIDDEN dwarf_loc_t
+x86_scratch_loc (struct cursor *c, unw_regnum_t reg)
+{
+ if (c->sigcontext_addr)
+ return x86_get_scratch_loc (c, reg);
+ else
+ return DWARF_REG_LOC (&c->dwarf, reg);
+}
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ dwarf_loc_t loc = DWARF_NULL_LOC;
+ unsigned int mask;
+ int arg_num;
+
+ switch (reg)
+ {
+
+ case UNW_X86_EIP:
+ if (write)
+ c->dwarf.ip = *valp; /* also update the EIP cache */
+ loc = c->dwarf.loc[EIP];
+ break;
+
+ case UNW_X86_CFA:
+ case UNW_X86_ESP:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+ case UNW_X86_EAX:
+ case UNW_X86_EDX:
+ arg_num = reg - UNW_X86_EAX;
+ mask = (1 << arg_num);
+ if (write)
+ {
+ c->dwarf.eh_args[arg_num] = *valp;
+ c->dwarf.eh_valid_mask |= mask;
+ return 0;
+ }
+ else if ((c->dwarf.eh_valid_mask & mask) != 0)
+ {
+ *valp = c->dwarf.eh_args[arg_num];
+ return 0;
+ }
+ else
+ loc = c->dwarf.loc[(reg == UNW_X86_EAX) ? EAX : EDX];
+ break;
+
+ case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break;
+ case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break;
+
+ case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break;
+ case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break;
+ case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break;
+ case UNW_X86_EFLAGS: loc = c->dwarf.loc[EFLAGS]; break;
+ case UNW_X86_TRAPNO: loc = c->dwarf.loc[TRAPNO]; break;
+
+ case UNW_X86_FCW:
+ case UNW_X86_FSW:
+ case UNW_X86_FTW:
+ case UNW_X86_FOP:
+ case UNW_X86_FCS:
+ case UNW_X86_FIP:
+ case UNW_X86_FEA:
+ case UNW_X86_FDS:
+ case UNW_X86_MXCSR:
+ case UNW_X86_GS:
+ case UNW_X86_FS:
+ case UNW_X86_ES:
+ case UNW_X86_DS:
+ case UNW_X86_SS:
+ case UNW_X86_CS:
+ case UNW_X86_TSS:
+ case UNW_X86_LDT:
+ loc = x86_scratch_loc (c, reg);
+ break;
+
+ default:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ struct dwarf_loc loc = DWARF_NULL_LOC;
+
+ switch (reg)
+ {
+ case UNW_X86_ST0:
+ loc = c->dwarf.loc[ST0];
+ break;
+
+ /* stacked fp registers */
+ case UNW_X86_ST1:
+ case UNW_X86_ST2:
+ case UNW_X86_ST3:
+ case UNW_X86_ST4:
+ case UNW_X86_ST5:
+ case UNW_X86_ST6:
+ case UNW_X86_ST7:
+ /* SSE fp registers */
+ case UNW_X86_XMM0:
+ case UNW_X86_XMM1:
+ case UNW_X86_XMM2:
+ case UNW_X86_XMM3:
+ case UNW_X86_XMM4:
+ case UNW_X86_XMM5:
+ case UNW_X86_XMM6:
+ case UNW_X86_XMM7:
+ case UNW_X86_XMM0_lo:
+ case UNW_X86_XMM0_hi:
+ case UNW_X86_XMM1_lo:
+ case UNW_X86_XMM1_hi:
+ case UNW_X86_XMM2_lo:
+ case UNW_X86_XMM2_hi:
+ case UNW_X86_XMM3_lo:
+ case UNW_X86_XMM3_hi:
+ case UNW_X86_XMM4_lo:
+ case UNW_X86_XMM4_hi:
+ case UNW_X86_XMM5_lo:
+ case UNW_X86_XMM5_hi:
+ case UNW_X86_XMM6_lo:
+ case UNW_X86_XMM6_hi:
+ case UNW_X86_XMM7_lo:
+ case UNW_X86_XMM7_hi:
+ loc = x86_scratch_loc (c, reg);
+ break;
+
+ default:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return dwarf_putfp (&c->dwarf, loc, *valp);
+ else
+ return dwarf_getfp (&c->dwarf, loc, valp);
+}
diff --git a/src/pal/src/libunwind/src/x86/Gresume.c b/src/pal/src/libunwind/src/x86/Gresume.c
new file mode 100644
index 0000000000..5072c4ba08
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gresume.c
@@ -0,0 +1,91 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+/* This routine is responsible for copying the register values in
+ cursor C and establishing them as the current machine state. */
+
+static inline int
+establish_machine_state (struct cursor *c)
+{
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *,
+ int write, void *);
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *,
+ int write, void *);
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ access_reg = as->acc.access_reg;
+ access_fpreg = as->acc.access_fpreg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ (*access_fpreg) (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ (*access_reg) (as, reg, &val, 1, arg);
+ }
+ }
+
+ if (c->dwarf.args_size)
+ {
+ if (tdep_access_reg (c, UNW_X86_ESP, &val, 0) >= 0)
+ {
+ val += c->dwarf.args_size;
+ (*access_reg) (as, UNW_X86_ESP, &val, 1, arg);
+ }
+ }
+ return 0;
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if ((ret = establish_machine_state (c)) < 0)
+ return ret;
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/x86/Gstep.c b/src/pal/src/libunwind/src/x86/Gstep.c
new file mode 100644
index 0000000000..129b739a3e
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Gstep.c
@@ -0,0 +1,115 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "offsets.h"
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret, i;
+
+ Debug (1, "(cursor=%p, ip=0x%08x)\n", c, (unsigned) c->dwarf.ip);
+
+ /* Try DWARF-based unwinding... */
+ ret = dwarf_step (&c->dwarf);
+
+ if (ret < 0 && ret != -UNW_ENOINFO)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ if (unlikely (ret < 0))
+ {
+ /* DWARF failed, let's see if we can follow the frame-chain
+ or skip over the signal trampoline. */
+ struct dwarf_loc ebp_loc, eip_loc;
+
+ /* We could get here because of missing/bad unwind information.
+ Validate all addresses before dereferencing. */
+ c->validate = 1;
+
+ Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret);
+
+ if (unw_is_signal_frame (cursor) > 0)
+ {
+ ret = x86_handle_signal_frame(cursor);
+ if (ret < 0)
+ {
+ Debug (2, "returning 0\n");
+ return 0;
+ }
+ }
+ else
+ {
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[EBP], &c->dwarf.cfa);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ Debug (13, "[EBP=0x%x] = 0x%x\n", DWARF_GET_LOC (c->dwarf.loc[EBP]),
+ c->dwarf.cfa);
+
+ ebp_loc = DWARF_LOC (c->dwarf.cfa, 0);
+ eip_loc = DWARF_LOC (c->dwarf.cfa + 4, 0);
+ c->dwarf.cfa += 8;
+
+ /* Mark all registers unsaved, since we don't know where
+ they are saved (if at all), except for the EBP and
+ EIP. */
+ for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ c->dwarf.loc[EBP] = ebp_loc;
+ c->dwarf.loc[EIP] = eip_loc;
+ c->dwarf.use_prev_instr = 1;
+ }
+
+ if (!DWARF_IS_NULL_LOC (c->dwarf.loc[EBP]))
+ {
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[EIP], &c->dwarf.ip);
+ if (ret < 0)
+ {
+ Debug (13, "dwarf_get([EIP=0x%x]) failed\n", DWARF_GET_LOC (c->dwarf.loc[EIP]));
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ else
+ {
+ Debug (13, "[EIP=0x%x] = 0x%x\n", DWARF_GET_LOC (c->dwarf.loc[EIP]),
+ c->dwarf.ip);
+ }
+ }
+ else
+ c->dwarf.ip = 0;
+ }
+ ret = (c->dwarf.ip == 0) ? 0 : 1;
+ Debug (2, "returning %d\n", ret);
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/x86/Lapply_reg_state.c b/src/pal/src/libunwind/src/x86/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Lcreate_addr_space.c b/src/pal/src/libunwind/src/x86/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Lget_proc_info.c b/src/pal/src/libunwind/src/x86/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Lget_save_loc.c b/src/pal/src/libunwind/src/x86/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Lglobal.c b/src/pal/src/libunwind/src/x86/Lglobal.c
new file mode 100644
index 0000000000..6d7b489e14
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lglobal.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Linit.c b/src/pal/src/libunwind/src/x86/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Linit_local.c b/src/pal/src/libunwind/src/x86/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Linit_remote.c b/src/pal/src/libunwind/src/x86/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Los-freebsd.c b/src/pal/src/libunwind/src/x86/Los-freebsd.c
new file mode 100644
index 0000000000..a75a205df1
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Los-freebsd.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gos-freebsd.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Los-linux.c b/src/pal/src/libunwind/src/x86/Los-linux.c
new file mode 100644
index 0000000000..3cc18aabcc
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Los-linux.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gos-linux.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Lreg_states_iterate.c b/src/pal/src/libunwind/src/x86/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Lregs.c b/src/pal/src/libunwind/src/x86/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Lresume.c b/src/pal/src/libunwind/src/x86/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/Lstep.c b/src/pal/src/libunwind/src/x86/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86/getcontext-freebsd.S b/src/pal/src/libunwind/src/x86/getcontext-freebsd.S
new file mode 100644
index 0000000000..670eff1ae1
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/getcontext-freebsd.S
@@ -0,0 +1,112 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+
+ .global _Ux86_getcontext
+ .type _Ux86_getcontext, @function
+_Ux86_getcontext:
+ .cfi_startproc
+ pushl %eax
+ .cfi_adjust_cfa_offset 4
+ mov 8(%esp),%eax /* ucontext_t* */
+ popl FREEBSD_UC_MCONTEXT_EAX_OFF(%eax)
+ .cfi_adjust_cfa_offset 4
+ movl %ebx, FREEBSD_UC_MCONTEXT_EBX_OFF(%eax)
+ movl %ecx, FREEBSD_UC_MCONTEXT_ECX_OFF(%eax)
+ movl %edx, FREEBSD_UC_MCONTEXT_EDX_OFF(%eax)
+ movl %edi, FREEBSD_UC_MCONTEXT_EDI_OFF(%eax)
+ movl %esi, FREEBSD_UC_MCONTEXT_ESI_OFF(%eax)
+ movl %ebp, FREEBSD_UC_MCONTEXT_EBP_OFF(%eax)
+
+ movl (%esp), %ecx
+ movl %ecx, FREEBSD_UC_MCONTEXT_EIP_OFF(%eax)
+
+ leal 4(%esp), %ecx /* Exclude the return address. */
+ movl %ecx, FREEBSD_UC_MCONTEXT_ESP_OFF(%eax)
+
+ xorl %ecx, %ecx
+ movw %fs, %cx
+ movl %ecx, FREEBSD_UC_MCONTEXT_FS_OFF(%eax)
+ movw %gs, %cx
+ movl %ecx, FREEBSD_UC_MCONTEXT_GS_OFF(%eax)
+ movw %ds, %cx
+ movl %ecx, FREEBSD_UC_MCONTEXT_DS_OFF(%eax)
+ movw %es, %cx
+ movl %ecx, FREEBSD_UC_MCONTEXT_ES_OFF(%eax)
+ movw %ss, %cx
+ movl %ecx, FREEBSD_UC_MCONTEXT_SS_OFF(%eax)
+ movw %cs, %cx
+ movl %ecx, FREEBSD_UC_MCONTEXT_CS_OFF(%eax)
+
+ pushfl
+ .cfi_adjust_cfa_offset 4
+ popl FREEBSD_UC_MCONTEXT_EFLAGS_OFF(%eax)
+ .cfi_adjust_cfa_offset -4
+
+ movl $0, FREEBSD_UC_MCONTEXT_TRAPNO_OFF(%eax)
+
+ movl $FREEBSD_UC_MCONTEXT_FPOWNED_FPU,\
+ FREEBSD_UC_MCONTEXT_OWNEDFP_OFF(%eax)
+ movl $FREEBSD_UC_MCONTEXT_FPFMT_XMM,\
+ FREEBSD_UC_MCONTEXT_FPFORMAT_OFF(%eax)
+
+ /*
+ * Require CPU with fxsave implemented, and enabled by OS.
+ *
+ * If passed ucontext is not aligned to 16-byte boundary,
+ * save fpu context into temporary aligned location on stack
+ * and then copy.
+ */
+ leal FREEBSD_UC_MCONTEXT_FPSTATE_OFF(%eax), %edx
+ testl $0xf, %edx
+ jne 2f
+ fxsave (%edx) /* fast path, passed ucontext save area was aligned */
+1: movl $FREEBSD_UC_MCONTEXT_MC_LEN_VAL,\
+ FREEBSD_UC_MCONTEXT_MC_LEN_OFF(%eax)
+
+ xorl %eax, %eax
+ ret
+
+2: movl %edx, %edi /* not aligned, do the dance */
+ subl $512 + 16, %esp /* save area and 16 bytes for alignment */
+ .cfi_adjust_cfa_offset 512 + 16
+ movl %esp, %edx
+ orl $0xf, %edx /* align *%edx to 16-byte up */
+ incl %edx
+ fxsave (%edx)
+ movl %edx, %esi /* copy to the final destination */
+ movl $512/4,%ecx
+ rep; movsl
+ addl $512 + 16, %esp /* restore the stack */
+ .cfi_adjust_cfa_offset -512 - 16
+ movl FREEBSD_UC_MCONTEXT_ESI_OFF(%eax), %esi
+ movl FREEBSD_UC_MCONTEXT_EDI_OFF(%eax), %edi
+ jmp 1b
+
+ .cfi_endproc
+ .size _Ux86_getcontext, . - _Ux86_getcontext
+
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/x86/getcontext-linux.S b/src/pal/src/libunwind/src/x86/getcontext-linux.S
new file mode 100644
index 0000000000..c469dadbac
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/getcontext-linux.S
@@ -0,0 +1,74 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2009 Google, Inc
+ Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "offsets.h"
+
+/* int _Ux86_getcontext (ucontext_t *ucp)
+
+ Saves the machine context in UCP necessary for libunwind.
+ Unlike the libc implementation, we don't save the signal mask
+ and hence avoid the cost of a system call per unwind.
+
+*/
+
+ .global _Ux86_getcontext
+ .type _Ux86_getcontext, @function
+_Ux86_getcontext:
+ .cfi_startproc
+ mov 4(%esp),%eax /* ucontext_t* */
+
+ /* EAX is not preserved. */
+ movl $0, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EAX_OFF)(%eax)
+
+ movl %ebx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EBX_OFF)(%eax)
+ movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ECX_OFF)(%eax)
+ movl %edx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EDX_OFF)(%eax)
+ movl %edi, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EDI_OFF)(%eax)
+ movl %esi, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ESI_OFF)(%eax)
+ movl %ebp, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EBP_OFF)(%eax)
+
+ movl (%esp), %ecx
+ movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EIP_OFF)(%eax)
+
+ leal 4(%esp), %ecx /* Exclude the return address. */
+ movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ESP_OFF)(%eax)
+
+ /* glibc getcontext saves FS, but not GS */
+ xorl %ecx, %ecx
+ movw %fs, %cx
+ movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FS_OFF)(%eax)
+
+ leal LINUX_UC_FPREGS_MEM_OFF(%eax), %ecx
+ movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FPSTATE_OFF)(%eax)
+ fnstenv (%ecx)
+ fldenv (%ecx)
+
+ xor %eax, %eax
+ ret
+ .cfi_endproc
+ .size _Ux86_getcontext, . - _Ux86_getcontext
+
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/x86/init.h b/src/pal/src/libunwind/src/x86/init.h
new file mode 100644
index 0000000000..b0db8d337d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/init.h
@@ -0,0 +1,69 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret, i;
+
+ c->dwarf.loc[EAX] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EAX);
+ c->dwarf.loc[ECX] = DWARF_REG_LOC (&c->dwarf, UNW_X86_ECX);
+ c->dwarf.loc[EDX] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EDX);
+ c->dwarf.loc[EBX] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EBX);
+ c->dwarf.loc[ESP] = DWARF_REG_LOC (&c->dwarf, UNW_X86_ESP);
+ c->dwarf.loc[EBP] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EBP);
+ c->dwarf.loc[ESI] = DWARF_REG_LOC (&c->dwarf, UNW_X86_ESI);
+ c->dwarf.loc[EDI] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EDI);
+ c->dwarf.loc[EIP] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EIP);
+ c->dwarf.loc[EFLAGS] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EFLAGS);
+ c->dwarf.loc[TRAPNO] = DWARF_REG_LOC (&c->dwarf, UNW_X86_TRAPNO);
+ c->dwarf.loc[ST0] = DWARF_REG_LOC (&c->dwarf, UNW_X86_ST0);
+ for (i = ST0 + 1; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[EIP], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_X86_ESP),
+ &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = X86_SCF_NONE;
+ c->sigcontext_addr = 0;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/x86/is_fpreg.c b/src/pal/src/libunwind/src/x86/is_fpreg.c
new file mode 100644
index 0000000000..a3a98ac8d3
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/is_fpreg.c
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_is_fpreg (int regnum)
+{
+ return ((regnum >= UNW_X86_ST0 && regnum <= UNW_X86_ST7)
+ || (regnum >= UNW_X86_XMM0_lo && regnum <= UNW_X86_XMM7_hi)
+ || (regnum >= UNW_X86_XMM0 && regnum <= UNW_X86_XMM7));
+}
diff --git a/src/pal/src/libunwind/src/x86/longjmp.S b/src/pal/src/libunwind/src/x86/longjmp.S
new file mode 100644
index 0000000000..05173d0c10
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/longjmp.S
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .globl _UI_longjmp_cont
+
+ .type _UI_longjmp_cont, @function
+_UI_longjmp_cont:
+ .cfi_startproc
+ .cfi_register 8, 0 /* IP saved in EAX */
+ push %eax /* push target IP as return address */
+ .cfi_restore 8
+ mov %edx, %eax /* set up return-value */
+ ret
+ .cfi_endproc
+ .size _UI_siglongjmp_cont, .-_UI_longjmp_cont
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/x86/offsets.h b/src/pal/src/libunwind/src/x86/offsets.h
new file mode 100644
index 0000000000..e5aec7f588
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/offsets.h
@@ -0,0 +1,140 @@
+/* Linux-specific definitions: */
+
+/* Define various structure offsets to simplify cross-compilation. */
+
+/* Offsets for x86 Linux "ucontext_t": */
+
+#define LINUX_UC_FLAGS_OFF 0x00
+#define LINUX_UC_LINK_OFF 0x04
+#define LINUX_UC_STACK_OFF 0x08
+#define LINUX_UC_MCONTEXT_OFF 0x14
+#define LINUX_UC_SIGMASK_OFF 0x6c
+#define LINUX_UC_FPREGS_MEM_OFF 0xec
+
+/* The struct sigcontext is located at an offset of 4
+ from the stack pointer in the signal frame. */
+
+/* Offsets for x86 Linux "struct sigcontext": */
+
+#define LINUX_SC_GS_OFF 0x00
+#define LINUX_SC_GSH_OFF 0x02
+#define LINUX_SC_FS_OFF 0x04
+#define LINUX_SC_FSH_OFF 0x06
+#define LINUX_SC_ES_OFF 0x08
+#define LINUX_SC_ESH_OFF 0x0a
+#define LINUX_SC_DS_OFF 0x0c
+#define LINUX_SC_DSH_OFF 0x0e
+#define LINUX_SC_EDI_OFF 0x10
+#define LINUX_SC_ESI_OFF 0x14
+#define LINUX_SC_EBP_OFF 0x18
+#define LINUX_SC_ESP_OFF 0x1c
+#define LINUX_SC_EBX_OFF 0x20
+#define LINUX_SC_EDX_OFF 0x24
+#define LINUX_SC_ECX_OFF 0x28
+#define LINUX_SC_EAX_OFF 0x2c
+#define LINUX_SC_TRAPNO_OFF 0x30
+#define LINUX_SC_ERR_OFF 0x34
+#define LINUX_SC_EIP_OFF 0x38
+#define LINUX_SC_CS_OFF 0x3c
+#define LINUX_SC_CSH_OFF 0x3e
+#define LINUX_SC_EFLAGS_OFF 0x40
+#define LINUX_SC_ESP_AT_SIGNAL_OFF 0x44
+#define LINUX_SC_SS_OFF 0x48
+#define LINUX_SC_SSH_OFF 0x4a
+#define LINUX_SC_FPSTATE_OFF 0x4c
+#define LINUX_SC_OLDMASK_OFF 0x50
+#define LINUX_SC_CR2_OFF 0x54
+
+/* Offsets for x86 Linux "struct _fpstate": */
+
+#define LINUX_FPSTATE_CW_OFF 0x000
+#define LINUX_FPSTATE_SW_OFF 0x004
+#define LINUX_FPSTATE_TAG_OFF 0x008
+#define LINUX_FPSTATE_IPOFF_OFF 0x00c
+#define LINUX_FPSTATE_CSSEL_OFF 0x010
+#define LINUX_FPSTATE_DATAOFF_OFF 0x014
+#define LINUX_FPSTATE_DATASEL_OFF 0x018
+#define LINUX_FPSTATE_ST0_OFF 0x01c
+#define LINUX_FPSTATE_ST1_OFF 0x026
+#define LINUX_FPSTATE_ST2_OFF 0x030
+#define LINUX_FPSTATE_ST3_OFF 0x03a
+#define LINUX_FPSTATE_ST4_OFF 0x044
+#define LINUX_FPSTATE_ST5_OFF 0x04e
+#define LINUX_FPSTATE_ST6_OFF 0x058
+#define LINUX_FPSTATE_ST7_OFF 0x062
+#define LINUX_FPSTATE_STATUS_OFF 0x06c
+#define LINUX_FPSTATE_MAGIC_OFF 0x06e
+#define LINUX_FPSTATE_FXSR_ENV_OFF 0x070
+#define LINUX_FPSTATE_MXCSR_OFF 0x088
+#define LINUX_FPSTATE_FXSR_ST0_OFF 0x090
+#define LINUX_FPSTATE_FXSR_ST1_OFF 0x0a0
+#define LINUX_FPSTATE_FXSR_ST2_OFF 0x0b0
+#define LINUX_FPSTATE_FXSR_ST3_OFF 0x0c0
+#define LINUX_FPSTATE_FXSR_ST4_OFF 0x0d0
+#define LINUX_FPSTATE_FXSR_ST5_OFF 0x0e0
+#define LINUX_FPSTATE_FXSR_ST6_OFF 0x0f0
+#define LINUX_FPSTATE_FXSR_ST7_OFF 0x100
+#define LINUX_FPSTATE_XMM0_OFF 0x110
+#define LINUX_FPSTATE_XMM1_OFF 0x120
+#define LINUX_FPSTATE_XMM2_OFF 0x130
+#define LINUX_FPSTATE_XMM3_OFF 0x140
+#define LINUX_FPSTATE_XMM4_OFF 0x150
+#define LINUX_FPSTATE_XMM5_OFF 0x160
+#define LINUX_FPSTATE_XMM6_OFF 0x170
+#define LINUX_FPSTATE_XMM7_OFF 0x180
+
+/* FreeBSD-specific definitions: */
+
+#define FREEBSD_SC_UCONTEXT_OFF 0x20
+#define FREEBSD_UC_MCONTEXT_OFF 0x10
+
+#define FREEBSD_UC_MCONTEXT_GS_OFF 0x14
+#define FREEBSD_UC_MCONTEXT_FS_OFF 0x18
+#define FREEBSD_UC_MCONTEXT_ES_OFF 0x1c
+#define FREEBSD_UC_MCONTEXT_DS_OFF 0x20
+#define FREEBSD_UC_MCONTEXT_EDI_OFF 0x24
+#define FREEBSD_UC_MCONTEXT_ESI_OFF 0x28
+#define FREEBSD_UC_MCONTEXT_EBP_OFF 0x2c
+#define FREEBSD_UC_MCONTEXT_EBX_OFF 0x34
+#define FREEBSD_UC_MCONTEXT_EDX_OFF 0x38
+#define FREEBSD_UC_MCONTEXT_ECX_OFF 0x3c
+#define FREEBSD_UC_MCONTEXT_EAX_OFF 0x40
+#define FREEBSD_UC_MCONTEXT_TRAPNO_OFF 0x44
+#define FREEBSD_UC_MCONTEXT_EIP_OFF 0x4c
+#define FREEBSD_UC_MCONTEXT_ESP_OFF 0x58
+#define FREEBSD_UC_MCONTEXT_CS_OFF 0x50
+#define FREEBSD_UC_MCONTEXT_EFLAGS_OFF 0x54
+#define FREEBSD_UC_MCONTEXT_SS_OFF 0x5c
+#define FREEBSD_UC_MCONTEXT_MC_LEN_OFF 0x60
+#define FREEBSD_UC_MCONTEXT_FPFORMAT_OFF 0x64
+#define FREEBSD_UC_MCONTEXT_OWNEDFP_OFF 0x68
+#define FREEBSD_UC_MCONTEXT_FPSTATE_OFF 0x70
+
+#define FREEBSD_UC_MCONTEXT_CW_OFF 0x70
+#define FREEBSD_UC_MCONTEXT_SW_OFF 0x74
+#define FREEBSD_UC_MCONTEXT_TAG_OFF 0x78
+#define FREEBSD_UC_MCONTEXT_IPOFF_OFF 0x7c
+#define FREEBSD_UC_MCONTEXT_CSSEL_OFF 0x80
+#define FREEBSD_UC_MCONTEXT_DATAOFF_OFF 0x84
+#define FREEBSD_US_MCONTEXT_DATASEL_OFF 0x88
+#define FREEBSD_UC_MCONTEXT_ST0_OFF 0x8c
+
+#define FREEBSD_UC_MCONTEXT_CW_XMM_OFF 0x70
+#define FREEBSD_UC_MCONTEXT_SW_XMM_OFF 0x72
+#define FREEBSD_UC_MCONTEXT_TAG_XMM_OFF 0x74
+#define FREEBSD_UC_MCONTEXT_IPOFF_XMM_OFF 0x78
+#define FREEBSD_UC_MCONTEXT_CSSEL_XMM_OFF 0x7c
+#define FREEBSD_UC_MCONTEXT_DATAOFF_XMM_OFF 0x80
+#define FREEBSD_US_MCONTEXT_DATASEL_XMM_OFF 0x84
+#define FREEBSD_UC_MCONTEXT_MXCSR_XMM_OFF 0x88
+#define FREEBSD_UC_MCONTEXT_ST0_XMM_OFF 0x90
+#define FREEBSD_UC_MCONTEXT_XMM0_OFF 0x110
+
+#define FREEBSD_UC_MCONTEXT_MC_LEN_VAL 0x280
+#define FREEBSD_UC_MCONTEXT_FPFMT_NODEV 0x10000
+#define FREEBSD_UC_MCONTEXT_FPFMT_387 0x10001
+#define FREEBSD_UC_MCONTEXT_FPFMT_XMM 0x10002
+#define FREEBSD_UC_MCONTEXT_FPOWNED_NONE 0x20000
+#define FREEBSD_UC_MCONTEXT_FPOWNED_FPU 0x20001
+#define FREEBSD_UC_MCONTEXT_FPOWNED_PCB 0x20002
+
diff --git a/src/pal/src/libunwind/src/x86/regname.c b/src/pal/src/libunwind/src/x86/regname.c
new file mode 100644
index 0000000000..11f6228041
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/regname.c
@@ -0,0 +1,27 @@
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ "eax", "edx", "ecx", "ebx", "esi", "edi", "ebp", "esp", "eip",
+ "eflags", "trapno",
+ "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7",
+ "fcw", "fsw", "ftw", "fop", "fcs", "fip", "fea", "fds",
+ "xmm0_lo", "xmm0_hi", "xmm1_lo", "xmm1_hi",
+ "xmm2_lo", "xmm2_hi", "xmm3_lo", "xmm3_hi",
+ "xmm4_lo", "xmm4_hi", "xmm5_lo", "xmm5_hi",
+ "xmm6_lo", "xmm6_hi", "xmm7_lo", "xmm7_hi",
+ "mxcsr",
+ "gs", "fs", "es", "ds", "ss", "cs",
+ "tss", "ldt",
+ "cfi",
+ "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/x86/siglongjmp.S b/src/pal/src/libunwind/src/x86/siglongjmp.S
new file mode 100644
index 0000000000..32bba3b3b6
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/siglongjmp.S
@@ -0,0 +1,92 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2011 Konstantin Belousov <kib@FreeBSD.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .globl _UI_siglongjmp_cont
+
+#if defined(__linux__)
+#define SIG_SETMASK 2
+#elif defined(__FreeBSD__)
+#define SIG_SETMASK 3
+#endif
+
+ /* Stack layout at this point:
+
+ +------------+ <- original $esp (at time of setjmp() call)
+ | sigmask[1] |
+ +------------+
+ | sigmask[0] |
+ +------------+
+ */
+
+ .type _UI_siglongjmp_cont, @function
+_UI_siglongjmp_cont:
+ .cfi_startproc
+#ifdef __linux__
+ .cfi_register 8, 0 /* IP saved in EAX */
+ .cfi_def_cfa_offset 8
+ mov %esp, %ecx /* pass address of signal mask in 3rd sc arg */
+ push %eax /* save target IP */
+ .cfi_adjust_cfa_offset 4
+ .cfi_offset 8, -12
+ push %edx /* save return value */
+ .cfi_adjust_cfa_offset 4
+ push %ebx /* save %ebx (preserved) */
+ .cfi_adjust_cfa_offset 4
+ .cfi_offset 3, -20
+ mov $SIG_SETMASK, %ebx /* 1st syscall arg (how) */
+ xor %edx, %edx /* pass NULL as 3rd syscall arg (old maskp) */
+ int $0x80
+ pop %ebx /* restore %ebx */
+ .cfi_adjust_cfa_offset -4
+ .cfi_restore 3
+ pop %eax /* fetch return value */
+ .cfi_adjust_cfa_offset -4
+ pop %edx /* pop target IP */
+ .cfi_adjust_cfa_offset -4
+ .cfi_register 8, 2 /* saved IP is now n EDX */
+ lea 8(%esp), %esp /* pop sigmask */
+ .cfi_adjust_cfa_offset -4
+ jmp *%edx
+#elif defined(__FreeBSD__)
+ pushl %eax
+ pushl %edx
+ pushl $0
+ pushl %ecx
+ pushl $SIG_SETMASK
+ movl $340,%eax
+ pushl %eax
+ int $0x80
+ addl $16,%esp
+ popl %eax
+ popl %edx
+ jmp *%edx
+#else
+#error Port me
+#endif
+ .cfi_endproc
+ .size _UI_siglongjmp_cont, .-_UI_siglongjmp_cont
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/x86/unwind_i.h b/src/pal/src/libunwind/src/x86/unwind_i.h
new file mode 100644
index 0000000000..caa7e02dee
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86/unwind_i.h
@@ -0,0 +1,68 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <stdint.h>
+
+#include <libunwind-x86.h>
+
+#include "libunwind_i.h"
+
+/* DWARF column numbers: */
+#define EAX 0
+#define ECX 1
+#define EDX 2
+#define EBX 3
+#define ESP 4
+#define EBP 5
+#define ESI 6
+#define EDI 7
+#define EIP 8
+#define EFLAGS 9
+#define TRAPNO 10
+#define ST0 11
+
+#define x86_lock UNW_OBJ(lock)
+#define x86_local_resume UNW_OBJ(local_resume)
+#define x86_local_addr_space_init UNW_OBJ(local_addr_space_init)
+#define x86_scratch_loc UNW_OBJ(scratch_loc)
+#define x86_get_scratch_loc UNW_OBJ(get_scratch_loc)
+#define x86_r_uc_addr UNW_OBJ(r_uc_addr)
+#define x86_sigreturn UNW_OBJ(sigreturn)
+
+extern void x86_local_addr_space_init (void);
+extern int x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+extern dwarf_loc_t x86_scratch_loc (struct cursor *c, unw_regnum_t reg);
+extern dwarf_loc_t x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg);
+extern void *x86_r_uc_addr (ucontext_t *uc, int reg);
+
+extern void x86_sigreturn (unw_cursor_t *cursor);
+#define x86_handle_signal_frame UNW_OBJ(handle_signal_frame)
+extern int x86_handle_signal_frame(unw_cursor_t *cursor);
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/src/x86_64/Gapply_reg_state.c b/src/pal/src/libunwind/src/x86_64/Gapply_reg_state.c
new file mode 100644
index 0000000000..82f056da67
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gapply_reg_state.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_apply_reg_state (unw_cursor_t *cursor,
+ void *reg_states_data)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data);
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gcreate_addr_space.c b/src/pal/src/libunwind/src/x86_64/Gcreate_addr_space.c
new file mode 100644
index 0000000000..9b2db9810a
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gcreate_addr_space.c
@@ -0,0 +1,61 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "unwind_i.h"
+
+#if defined(_LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN)
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#endif
+
+unw_addr_space_t
+unw_create_addr_space (unw_accessors_t *a, int byte_order)
+{
+#ifdef UNW_LOCAL_ONLY
+ return NULL;
+#else
+ unw_addr_space_t as;
+
+ /*
+ * x86_64 supports only little-endian.
+ */
+ if (byte_order != 0 && byte_order != __LITTLE_ENDIAN)
+ return NULL;
+
+ as = malloc (sizeof (*as));
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ return as;
+#endif
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gget_proc_info.c b/src/pal/src/libunwind/src/x86_64/Gget_proc_info.c
new file mode 100644
index 0000000000..50de1e423c
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gget_proc_info.c
@@ -0,0 +1,48 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (dwarf_make_proc_info (&c->dwarf) < 0)
+ {
+ /* On x86-64, some key routines such as _start() and _dl_start()
+ are missing DWARF unwind info. We don't want to fail in that
+ case, because those frames are uninteresting and just mark
+ the end of the frame-chain anyhow. */
+ memset (pi, 0, sizeof (*pi));
+ pi->start_ip = c->dwarf.ip;
+ pi->end_ip = c->dwarf.ip + 1;
+ return 0;
+ }
+ *pi = c->dwarf.pi;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gget_save_loc.c b/src/pal/src/libunwind/src/x86_64/Gget_save_loc.c
new file mode 100644
index 0000000000..0057c62d64
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gget_save_loc.c
@@ -0,0 +1,73 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ dwarf_loc_t loc;
+
+ loc = DWARF_NULL_LOC; /* default to "not saved" */
+
+ switch (reg)
+ {
+ case UNW_X86_64_RBX: loc = c->dwarf.loc[RBX]; break;
+ case UNW_X86_64_RSP: loc = c->dwarf.loc[RSP]; break;
+ case UNW_X86_64_RBP: loc = c->dwarf.loc[RBP]; break;
+ case UNW_X86_64_R12: loc = c->dwarf.loc[R12]; break;
+ case UNW_X86_64_R13: loc = c->dwarf.loc[R13]; break;
+ case UNW_X86_64_R14: loc = c->dwarf.loc[R14]; break;
+ case UNW_X86_64_R15: loc = c->dwarf.loc[R15]; break;
+
+ default:
+ break;
+ }
+
+ memset (sloc, 0, sizeof (*sloc));
+
+ if (DWARF_IS_NULL_LOC (loc))
+ {
+ sloc->type = UNW_SLT_NONE;
+ return 0;
+ }
+
+#if !defined(UNW_LOCAL_ONLY)
+ if (DWARF_IS_REG_LOC (loc))
+ {
+ sloc->type = UNW_SLT_REG;
+ sloc->u.regnum = DWARF_GET_LOC (loc);
+ }
+ else
+#endif
+ {
+ sloc->type = UNW_SLT_MEMORY;
+ sloc->u.addr = DWARF_GET_LOC (loc);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gglobal.c b/src/pal/src/libunwind/src/x86_64/Gglobal.c
new file mode 100644
index 0000000000..8d1fbb4b0a
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gglobal.c
@@ -0,0 +1,102 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "config.h"
+#include "unwind_i.h"
+#include "dwarf_i.h"
+
+HIDDEN define_lock (x86_64_lock);
+HIDDEN int tdep_init_done;
+
+/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */
+
+HIDDEN const uint8_t dwarf_to_unw_regnum_map[DWARF_NUM_PRESERVED_REGS] =
+ {
+ UNW_X86_64_RAX,
+ UNW_X86_64_RDX,
+ UNW_X86_64_RCX,
+ UNW_X86_64_RBX,
+ UNW_X86_64_RSI,
+ UNW_X86_64_RDI,
+ UNW_X86_64_RBP,
+ UNW_X86_64_RSP,
+ UNW_X86_64_R8,
+ UNW_X86_64_R9,
+ UNW_X86_64_R10,
+ UNW_X86_64_R11,
+ UNW_X86_64_R12,
+ UNW_X86_64_R13,
+ UNW_X86_64_R14,
+ UNW_X86_64_R15,
+ UNW_X86_64_RIP,
+#ifdef CONFIG_MSABI_SUPPORT
+ UNW_X86_64_XMM0,
+ UNW_X86_64_XMM1,
+ UNW_X86_64_XMM2,
+ UNW_X86_64_XMM3,
+ UNW_X86_64_XMM4,
+ UNW_X86_64_XMM5,
+ UNW_X86_64_XMM6,
+ UNW_X86_64_XMM7,
+ UNW_X86_64_XMM8,
+ UNW_X86_64_XMM9,
+ UNW_X86_64_XMM10,
+ UNW_X86_64_XMM11,
+ UNW_X86_64_XMM12,
+ UNW_X86_64_XMM13,
+ UNW_X86_64_XMM14,
+ UNW_X86_64_XMM15
+#endif
+ };
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ lock_acquire (&x86_64_lock, saved_mask);
+ {
+ if (tdep_init_done)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+ tdep_init_mem_validate ();
+
+#ifndef UNW_REMOTE_ONLY
+ x86_64_local_addr_space_init ();
+#endif
+ tdep_init_done = 1; /* signal that we're initialized... */
+ }
+ out:
+ lock_release (&x86_64_lock, saved_mask);
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Ginit.c b/src/pal/src/libunwind/src/x86_64/Ginit.c
new file mode 100644
index 0000000000..2a84a1eec7
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Ginit.c
@@ -0,0 +1,342 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Copyright (C) 2007 David Mosberger-Tang
+ Contributed by David Mosberger-Tang <dmosberger@gmail.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/syscall.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+static void
+put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+{
+ /* it's a no-op */
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+#define PAGE_SIZE 4096
+#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
+
+static int mem_validate_pipe[2] = {-1, -1};
+
+static inline void
+open_pipe (void)
+{
+ /* ignore errors for closing invalid fd's */
+ close (mem_validate_pipe[0]);
+ close (mem_validate_pipe[1]);
+
+ pipe2 (mem_validate_pipe, O_CLOEXEC | O_NONBLOCK);
+}
+
+ALWAYS_INLINE
+static int
+write_validate (void *addr)
+{
+ int ret = -1;
+ ssize_t bytes = 0;
+
+ do
+ {
+ char buf;
+ bytes = read (mem_validate_pipe[0], &buf, 1);
+ }
+ while ( errno == EINTR );
+
+ int valid_read = (bytes > 0 || errno == EAGAIN || errno == EWOULDBLOCK);
+ if (!valid_read)
+ {
+ // re-open closed pipe
+ open_pipe ();
+ }
+
+ do
+ {
+ /* use syscall insteadof write() so that ASAN does not complain */
+ ret = syscall (SYS_write, mem_validate_pipe[1], addr, 1);
+ }
+ while ( errno == EINTR );
+
+ return ret;
+}
+
+static int (*mem_validate_func) (void *addr, size_t len);
+static int msync_validate (void *addr, size_t len)
+{
+ if (msync (addr, len, MS_ASYNC) != 0)
+ {
+ return -1;
+ }
+
+ return write_validate (addr);
+}
+
+#ifdef HAVE_MINCORE
+static int mincore_validate (void *addr, size_t len)
+{
+ unsigned char mvec[2]; /* Unaligned access may cross page boundary */
+ size_t i;
+
+ /* mincore could fail with EAGAIN but we conservatively return -1
+ instead of looping. */
+ if (mincore (addr, len, mvec) != 0)
+ {
+ return -1;
+ }
+
+ for (i = 0; i < (len + PAGE_SIZE - 1) / PAGE_SIZE; i++)
+ {
+ if (!(mvec[i] & 1)) return -1;
+ }
+
+ return write_validate (addr);
+}
+#endif
+
+/* Initialise memory validation method. On linux kernels <2.6.21,
+ mincore() returns incorrect value for MAP_PRIVATE mappings,
+ such as stacks. If mincore() was available at compile time,
+ check if we can actually use it. If not, use msync() instead. */
+HIDDEN void
+tdep_init_mem_validate (void)
+{
+ open_pipe ();
+
+#ifdef HAVE_MINCORE
+ unsigned char present = 1;
+ unw_word_t addr = PAGE_START((unw_word_t)&present);
+ unsigned char mvec[1];
+ int ret;
+ while ((ret = mincore ((void*)addr, PAGE_SIZE, mvec)) == -1 &&
+ errno == EAGAIN) {}
+ if (ret == 0 && (mvec[0] & 1))
+ {
+ Debug(1, "using mincore to validate memory\n");
+ mem_validate_func = mincore_validate;
+ }
+ else
+#endif
+ {
+ Debug(1, "using msync to validate memory\n");
+ mem_validate_func = msync_validate;
+ }
+}
+
+/* Cache of already validated addresses */
+#define NLGA 4
+static unw_word_t last_good_addr[NLGA];
+static int lga_victim;
+
+static int
+validate_mem (unw_word_t addr)
+{
+ int i, victim;
+ size_t len;
+
+ if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr))
+ len = PAGE_SIZE;
+ else
+ len = PAGE_SIZE * 2;
+
+ addr = PAGE_START(addr);
+
+ if (addr == 0)
+ return -1;
+
+ for (i = 0; i < NLGA; i++)
+ {
+ if (last_good_addr[i] && (addr == last_good_addr[i]))
+ return 0;
+ }
+
+ if (mem_validate_func ((void *) addr, len) == -1)
+ return -1;
+
+ victim = lga_victim;
+ for (i = 0; i < NLGA; i++) {
+ if (!last_good_addr[victim]) {
+ last_good_addr[victim++] = addr;
+ return 0;
+ }
+ victim = (victim + 1) % NLGA;
+ }
+
+ /* All slots full. Evict the victim. */
+ last_good_addr[victim] = addr;
+ victim = (victim + 1) % NLGA;
+ lga_victim = victim;
+
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ if (unlikely (write))
+ {
+ Debug (16, "mem[%016lx] <- %lx\n", addr, *val);
+ *(unw_word_t *) addr = *val;
+ }
+ else
+ {
+ /* validate address */
+ const struct cursor *c = (const struct cursor *)arg;
+ if (likely (c != NULL) && unlikely (c->validate)
+ && unlikely (validate_mem (addr))) {
+ Debug (16, "mem[%016lx] -> invalid\n", addr);
+ return -1;
+ }
+ *val = *(unw_word_t *) addr;
+ Debug (16, "mem[%016lx] -> %lx\n", addr, *val);
+ }
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ unw_word_t *addr;
+ ucontext_t *uc = ((struct cursor *)arg)->uc;
+
+ if (unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = x86_64_r_uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ *(unw_word_t *) addr = *val;
+ Debug (12, "%s <- 0x%016lx\n", unw_regname (reg), *val);
+ }
+ else
+ {
+ *val = *(unw_word_t *) addr;
+ Debug (12, "%s -> 0x%016lx\n", unw_regname (reg), *val);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ ucontext_t *uc = ((struct cursor *)arg)->uc;
+ unw_fpreg_t *addr;
+
+ if (!unw_is_fpreg (reg))
+ goto badreg;
+
+ if (!(addr = x86_64_r_uc_addr (uc, reg)))
+ goto badreg;
+
+ if (write)
+ {
+ Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ *(unw_fpreg_t *) addr = *val;
+ }
+ else
+ {
+ *val = *(unw_fpreg_t *) addr;
+ Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg),
+ ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]);
+ }
+ return 0;
+
+ badreg:
+ Debug (1, "bad register number %u\n", reg);
+ /* attempt to access a non-preserved register */
+ return -UNW_EBADREG;
+}
+
+static int
+get_static_proc_name (unw_addr_space_t as, unw_word_t ip,
+ char *buf, size_t buf_len, unw_word_t *offp,
+ void *arg)
+{
+ return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+x86_64_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY;
+ local_addr_space.acc.find_proc_info = dwarf_find_proc_info;
+ local_addr_space.acc.put_unwind_info = put_unwind_info;
+ local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ local_addr_space.acc.access_mem = access_mem;
+ local_addr_space.acc.access_reg = access_reg;
+ local_addr_space.acc.access_fpreg = access_fpreg;
+ local_addr_space.acc.resume = x86_64_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+
+ memset (last_good_addr, 0, sizeof (unw_word_t) * NLGA);
+ lga_victim = 0;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/x86_64/Ginit_local.c b/src/pal/src/libunwind/src/x86_64/Ginit_local.c
new file mode 100644
index 0000000000..5eaead0f84
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Ginit_local.c
@@ -0,0 +1,81 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "init.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static int
+unw_init_local_common (unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_instr)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (unlikely (!tdep_init_done))
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = c;
+ c->uc = uc;
+ c->validate = 0;
+ return common_init (c, use_prev_instr);
+}
+
+int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ return unw_init_local_common(cursor, uc, 1);
+}
+
+int
+unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag)
+{
+ if (!flag)
+ {
+ return unw_init_local_common(cursor, uc, 1);
+ }
+ else if (flag == UNW_INIT_SIGNAL_FRAME)
+ {
+ return unw_init_local_common(cursor, uc, 0);
+ }
+ else
+ {
+ return -UNW_EINVAL;
+ }
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff --git a/src/pal/src/libunwind/src/x86_64/Ginit_remote.c b/src/pal/src/libunwind/src/x86_64/Ginit_remote.c
new file mode 100644
index 0000000000..efd61d64d4
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Ginit_remote.c
@@ -0,0 +1,57 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "init.h"
+#include "unwind_i.h"
+
+int
+unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
+{
+#ifdef UNW_LOCAL_ONLY
+ return -UNW_EINVAL;
+#else /* !UNW_LOCAL_ONLY */
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (!tdep_init_done)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ if (as == unw_local_addr_space)
+ {
+ c->dwarf.as_arg = c;
+ c->uc = as_arg;
+ }
+ else
+ {
+ c->dwarf.as_arg = as_arg;
+ c->uc = NULL;
+ }
+ return common_init (c, 0);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gos-freebsd.c b/src/pal/src/libunwind/src/x86_64/Gos-freebsd.c
new file mode 100644
index 0000000000..883025c88d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gos-freebsd.c
@@ -0,0 +1,218 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/ucontext.h>
+#include <machine/sigframe.h>
+#include <signal.h>
+#include <stddef.h>
+#include "unwind_i.h"
+#include "ucontext_i.h"
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ /* XXXKIB */
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t w0, w1, w2, b0, ip;
+ unw_addr_space_t as;
+ unw_accessors_t *a;
+ void *arg;
+ int ret;
+
+ as = c->dwarf.as;
+ a = unw_get_accessors_int (as);
+ arg = c->dwarf.as_arg;
+
+ /* Check if RIP points at sigreturn sequence.
+48 8d 7c 24 10 lea SIGF_UC(%rsp),%rdi
+6a 00 pushq $0
+48 c7 c0 a1 01 00 00 movq $SYS_sigreturn,%rax
+0f 05 syscall
+f4 0: hlt
+eb fd jmp 0b
+ */
+
+ ip = c->dwarf.ip;
+ c->sigcontext_format = X86_64_SCF_NONE;
+ if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0
+ || (ret = (*a->access_mem) (as, ip + 8, &w1, 0, arg)) < 0
+ || (ret = (*a->access_mem) (as, ip + 16, &w2, 0, arg)) < 0)
+ return 0;
+ w2 &= 0xffffff;
+ if (w0 == 0x48006a10247c8d48 &&
+ w1 == 0x050f000001a1c0c7 &&
+ w2 == 0x0000000000fdebf4)
+ {
+ c->sigcontext_format = X86_64_SCF_FREEBSD_SIGFRAME;
+ return (c->sigcontext_format);
+ }
+ /* Check if RIP points at standard syscall sequence.
+49 89 ca mov %rcx,%r10
+0f 05 syscall
+ */
+ if ((ret = (*a->access_mem) (as, ip - 5, &b0, 0, arg)) < 0)
+ return (0);
+ Debug (12, "b0 0x%lx\n", b0);
+ if ((b0 & 0xffffffffffffff) == 0x050fca89490000 ||
+ (b0 & 0xffffffffff) == 0x050fca8949)
+ {
+ c->sigcontext_format = X86_64_SCF_FREEBSD_SYSCALL;
+ return (c->sigcontext_format);
+ }
+ return (X86_64_SCF_NONE);
+}
+
+HIDDEN int
+x86_64_handle_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ unw_word_t ucontext;
+ int ret;
+
+ if (c->sigcontext_format == X86_64_SCF_FREEBSD_SIGFRAME)
+ {
+ ucontext = c->dwarf.cfa + offsetof(struct sigframe, sf_uc);
+ c->sigcontext_addr = c->dwarf.cfa;
+ Debug(1, "signal frame, skip over trampoline\n");
+
+ struct dwarf_loc rsp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RSP, 0);
+ ret = dwarf_get (&c->dwarf, rsp_loc, &c->dwarf.cfa);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ c->dwarf.loc[RAX] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RAX, 0);
+ c->dwarf.loc[RDX] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RDX, 0);
+ c->dwarf.loc[RCX] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RCX, 0);
+ c->dwarf.loc[RBX] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RBX, 0);
+ c->dwarf.loc[RSI] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RSI, 0);
+ c->dwarf.loc[RDI] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RDI, 0);
+ c->dwarf.loc[RBP] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RBP, 0);
+ c->dwarf.loc[RSP] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RSP, 0);
+ c->dwarf.loc[ R8] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0);
+ c->dwarf.loc[ R9] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0);
+ c->dwarf.loc[R10] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0);
+ c->dwarf.loc[R11] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0);
+ c->dwarf.loc[R12] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0);
+ c->dwarf.loc[R13] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0);
+ c->dwarf.loc[R14] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0);
+ c->dwarf.loc[R15] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0);
+ c->dwarf.loc[RIP] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RIP, 0);
+
+ return 0;
+ }
+ else if (c->sigcontext_format == X86_64_SCF_FREEBSD_SYSCALL)
+ {
+ c->dwarf.loc[RCX] = c->dwarf.loc[R10];
+ /* rsp_loc = DWARF_LOC(c->dwarf.cfa - 8, 0); */
+ /* rbp_loc = c->dwarf.loc[RBP]; */
+ c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0);
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip);
+ Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n",
+ (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]),
+ (unsigned long long) c->dwarf.ip);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ c->dwarf.cfa += 8;
+ c->dwarf.use_prev_instr = 1;
+ return 1;
+ }
+ else
+ return -UNW_EBADFRAME;
+
+}
+
+#ifndef UNW_REMOTE_ONLY
+HIDDEN void *
+x86_64_r_uc_addr (ucontext_t *uc, int reg)
+{
+ /* NOTE: common_init() in init.h inlines these for fast path access. */
+ void *addr;
+
+ switch (reg)
+ {
+ case UNW_X86_64_R8: addr = &uc->uc_mcontext.mc_r8; break;
+ case UNW_X86_64_R9: addr = &uc->uc_mcontext.mc_r9; break;
+ case UNW_X86_64_R10: addr = &uc->uc_mcontext.mc_r10; break;
+ case UNW_X86_64_R11: addr = &uc->uc_mcontext.mc_r11; break;
+ case UNW_X86_64_R12: addr = &uc->uc_mcontext.mc_r12; break;
+ case UNW_X86_64_R13: addr = &uc->uc_mcontext.mc_r13; break;
+ case UNW_X86_64_R14: addr = &uc->uc_mcontext.mc_r14; break;
+ case UNW_X86_64_R15: addr = &uc->uc_mcontext.mc_r15; break;
+ case UNW_X86_64_RDI: addr = &uc->uc_mcontext.mc_rdi; break;
+ case UNW_X86_64_RSI: addr = &uc->uc_mcontext.mc_rsi; break;
+ case UNW_X86_64_RBP: addr = &uc->uc_mcontext.mc_rbp; break;
+ case UNW_X86_64_RBX: addr = &uc->uc_mcontext.mc_rbx; break;
+ case UNW_X86_64_RDX: addr = &uc->uc_mcontext.mc_rdx; break;
+ case UNW_X86_64_RAX: addr = &uc->uc_mcontext.mc_rax; break;
+ case UNW_X86_64_RCX: addr = &uc->uc_mcontext.mc_rcx; break;
+ case UNW_X86_64_RSP: addr = &uc->uc_mcontext.mc_rsp; break;
+ case UNW_X86_64_RIP: addr = &uc->uc_mcontext.mc_rip; break;
+
+ default:
+ addr = NULL;
+ }
+ return addr;
+}
+
+HIDDEN NORETURN void
+x86_64_sigreturn (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = (ucontext_t *)(c->sigcontext_addr +
+ offsetof(struct sigframe, sf_uc));
+
+ uc->uc_mcontext.mc_r8 = c->uc->uc_mcontext.mc_r8;
+ uc->uc_mcontext.mc_r9 = c->uc->uc_mcontext.mc_r9;
+ uc->uc_mcontext.mc_r10 = c->uc->uc_mcontext.mc_r10;
+ uc->uc_mcontext.mc_r11 = c->uc->uc_mcontext.mc_r11;
+ uc->uc_mcontext.mc_r12 = c->uc->uc_mcontext.mc_r12;
+ uc->uc_mcontext.mc_r13 = c->uc->uc_mcontext.mc_r13;
+ uc->uc_mcontext.mc_r14 = c->uc->uc_mcontext.mc_r14;
+ uc->uc_mcontext.mc_r15 = c->uc->uc_mcontext.mc_r15;
+ uc->uc_mcontext.mc_rdi = c->uc->uc_mcontext.mc_rdi;
+ uc->uc_mcontext.mc_rsi = c->uc->uc_mcontext.mc_rsi;
+ uc->uc_mcontext.mc_rbp = c->uc->uc_mcontext.mc_rbp;
+ uc->uc_mcontext.mc_rbx = c->uc->uc_mcontext.mc_rbx;
+ uc->uc_mcontext.mc_rdx = c->uc->uc_mcontext.mc_rdx;
+ uc->uc_mcontext.mc_rax = c->uc->uc_mcontext.mc_rax;
+ uc->uc_mcontext.mc_rcx = c->uc->uc_mcontext.mc_rcx;
+ uc->uc_mcontext.mc_rsp = c->uc->uc_mcontext.mc_rsp;
+ uc->uc_mcontext.mc_rip = c->uc->uc_mcontext.mc_rip;
+
+ Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
+ (unsigned long long) c->dwarf.ip, uc);
+ sigreturn(uc);
+ abort();
+}
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Gos-linux.c b/src/pal/src/libunwind/src/x86_64/Gos-linux.c
new file mode 100644
index 0000000000..bd142345ed
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gos-linux.c
@@ -0,0 +1,156 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "ucontext_i.h"
+
+#include <sys/syscall.h>
+
+HIDDEN void
+tdep_fetch_frame (struct dwarf_cursor *dw, unw_word_t ip, int need_unwind_info)
+{
+ struct cursor *c = (struct cursor *) dw;
+ assert(! need_unwind_info || dw->pi_valid);
+ assert(! need_unwind_info || dw->pi.unwind_info);
+ if (dw->pi_valid
+ && dw->pi.unwind_info
+ && ((struct dwarf_cie_info *) dw->pi.unwind_info)->signal_frame)
+ c->sigcontext_format = X86_64_SCF_LINUX_RT_SIGFRAME;
+ else
+ c->sigcontext_format = X86_64_SCF_NONE;
+
+ Debug(5, "fetch frame ip=0x%lx cfa=0x%lx format=%d\n",
+ dw->ip, dw->cfa, c->sigcontext_format);
+}
+
+HIDDEN int
+tdep_cache_frame (struct dwarf_cursor *dw)
+{
+ struct cursor *c = (struct cursor *) dw;
+
+ Debug(5, "cache frame ip=0x%lx cfa=0x%lx format=%d\n",
+ dw->ip, dw->cfa, c->sigcontext_format);
+ return c->sigcontext_format;
+}
+
+HIDDEN void
+tdep_reuse_frame (struct dwarf_cursor *dw, int frame)
+{
+ struct cursor *c = (struct cursor *) dw;
+ c->sigcontext_format = frame;
+ if (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME)
+ {
+ c->frame_info.frame_type = UNW_X86_64_FRAME_SIGRETURN;
+ /* Offset from cfa to ucontext_t in signal frame. */
+ c->frame_info.cfa_reg_offset = 0;
+ c->sigcontext_addr = dw->cfa;
+ }
+
+ Debug(5, "reuse frame ip=0x%lx cfa=0x%lx format=%d addr=0x%lx offset=%+d\n",
+ dw->ip, dw->cfa, c->sigcontext_format, c->sigcontext_addr,
+ (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME
+ ? c->frame_info.cfa_reg_offset : 0));
+}
+
+int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ return c->sigcontext_format != X86_64_SCF_NONE;
+}
+
+HIDDEN int
+x86_64_handle_signal_frame (unw_cursor_t *cursor)
+{
+#if UNW_DEBUG /* To silence compiler warnings */
+ /* Should not get here because we now use kernel-provided dwarf
+ information for the signal trampoline and dwarf_step() works.
+ Hence unw_step() should never call this function. Maybe
+ restore old non-dwarf signal handling here, but then the
+ gating on unw_is_signal_frame() needs to be removed. */
+ struct cursor *c = (struct cursor *) cursor;
+ Debug(1, "old format signal frame? format=%d addr=0x%lx cfa=0x%lx\n",
+ c->sigcontext_format, c->sigcontext_addr, c->dwarf.cfa);
+#endif
+ return -UNW_EBADFRAME;
+}
+
+#ifndef UNW_REMOTE_ONLY
+HIDDEN void *
+x86_64_r_uc_addr (ucontext_t *uc, int reg)
+{
+ /* NOTE: common_init() in init.h inlines these for fast path access. */
+ void *addr;
+
+ switch (reg)
+ {
+ case UNW_X86_64_R8: addr = &uc->uc_mcontext.gregs[REG_R8]; break;
+ case UNW_X86_64_R9: addr = &uc->uc_mcontext.gregs[REG_R9]; break;
+ case UNW_X86_64_R10: addr = &uc->uc_mcontext.gregs[REG_R10]; break;
+ case UNW_X86_64_R11: addr = &uc->uc_mcontext.gregs[REG_R11]; break;
+ case UNW_X86_64_R12: addr = &uc->uc_mcontext.gregs[REG_R12]; break;
+ case UNW_X86_64_R13: addr = &uc->uc_mcontext.gregs[REG_R13]; break;
+ case UNW_X86_64_R14: addr = &uc->uc_mcontext.gregs[REG_R14]; break;
+ case UNW_X86_64_R15: addr = &uc->uc_mcontext.gregs[REG_R15]; break;
+ case UNW_X86_64_RDI: addr = &uc->uc_mcontext.gregs[REG_RDI]; break;
+ case UNW_X86_64_RSI: addr = &uc->uc_mcontext.gregs[REG_RSI]; break;
+ case UNW_X86_64_RBP: addr = &uc->uc_mcontext.gregs[REG_RBP]; break;
+ case UNW_X86_64_RBX: addr = &uc->uc_mcontext.gregs[REG_RBX]; break;
+ case UNW_X86_64_RDX: addr = &uc->uc_mcontext.gregs[REG_RDX]; break;
+ case UNW_X86_64_RAX: addr = &uc->uc_mcontext.gregs[REG_RAX]; break;
+ case UNW_X86_64_RCX: addr = &uc->uc_mcontext.gregs[REG_RCX]; break;
+ case UNW_X86_64_RSP: addr = &uc->uc_mcontext.gregs[REG_RSP]; break;
+ case UNW_X86_64_RIP: addr = &uc->uc_mcontext.gregs[REG_RIP]; break;
+
+ default:
+ addr = NULL;
+ }
+ return addr;
+}
+
+/* sigreturn() is a no-op on x86_64 glibc. */
+HIDDEN NORETURN void
+x86_64_sigreturn (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
+ mcontext_t *sc_mcontext = &((ucontext_t*)sc)->uc_mcontext;
+ /* Copy in saved uc - all preserved regs are at the start of sigcontext */
+ memcpy(sc_mcontext, &c->uc->uc_mcontext,
+ DWARF_NUM_PRESERVED_REGS * sizeof(unw_word_t));
+
+ Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
+ (unsigned long long) c->dwarf.ip, sc);
+ __asm__ __volatile__ ("mov %0, %%rsp;"
+ "mov %1, %%rax;"
+ "syscall"
+ :: "r"(sc), "i"(SYS_rt_sigreturn)
+ : "memory");
+ abort();
+}
+
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Greg_states_iterate.c b/src/pal/src/libunwind/src/x86_64/Greg_states_iterate.c
new file mode 100644
index 0000000000..a17dc1b561
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Greg_states_iterate.c
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+int
+unw_reg_states_iterate (unw_cursor_t *cursor,
+ unw_reg_states_callback cb, void *token)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ return dwarf_reg_states_iterate (&c->dwarf, cb, token);
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gregs.c b/src/pal/src/libunwind/src/x86_64/Gregs.c
new file mode 100644
index 0000000000..baf8a24f0b
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gregs.c
@@ -0,0 +1,138 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+#if 0
+static inline dwarf_loc_t
+linux_scratch_loc (struct cursor *c, unw_regnum_t reg)
+{
+ unw_word_t addr = c->sigcontext_addr;
+
+ switch (c->sigcontext_format)
+ {
+ case X86_64_SCF_NONE:
+ return DWARF_REG_LOC (&c->dwarf, reg);
+
+ case X86_64_SCF_LINUX_RT_SIGFRAME:
+ addr += LINUX_UC_MCONTEXT_OFF;
+ break;
+
+ case X86_64_SCF_FREEBSD_SIGFRAME:
+ addr += FREEBSD_UC_MCONTEXT_OFF;
+ break;
+ }
+
+ return DWARF_REG_LOC (&c->dwarf, reg);
+
+}
+
+HIDDEN dwarf_loc_t
+x86_64_scratch_loc (struct cursor *c, unw_regnum_t reg)
+{
+ if (c->sigcontext_addr)
+ return linux_scratch_loc (c, reg);
+ else
+ return DWARF_REG_LOC (&c->dwarf, reg);
+}
+#endif
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ dwarf_loc_t loc = DWARF_NULL_LOC;
+ unsigned int mask;
+ int arg_num;
+
+ switch (reg)
+ {
+
+ case UNW_X86_64_RIP:
+ if (write)
+ c->dwarf.ip = *valp; /* also update the RIP cache */
+ loc = c->dwarf.loc[RIP];
+ break;
+
+ case UNW_X86_64_CFA:
+ case UNW_X86_64_RSP:
+ if (write)
+ return -UNW_EREADONLYREG;
+ *valp = c->dwarf.cfa;
+ return 0;
+
+ case UNW_X86_64_RAX:
+ case UNW_X86_64_RDX:
+ arg_num = reg - UNW_X86_64_RAX;
+ mask = (1 << arg_num);
+ if (write)
+ {
+ c->dwarf.eh_args[arg_num] = *valp;
+ c->dwarf.eh_valid_mask |= mask;
+ return 0;
+ }
+ else if ((c->dwarf.eh_valid_mask & mask) != 0)
+ {
+ *valp = c->dwarf.eh_args[arg_num];
+ return 0;
+ }
+ else
+ loc = c->dwarf.loc[(reg == UNW_X86_64_RAX) ? RAX : RDX];
+ break;
+
+ case UNW_X86_64_RCX: loc = c->dwarf.loc[RCX]; break;
+ case UNW_X86_64_RBX: loc = c->dwarf.loc[RBX]; break;
+
+ case UNW_X86_64_RBP: loc = c->dwarf.loc[RBP]; break;
+ case UNW_X86_64_RSI: loc = c->dwarf.loc[RSI]; break;
+ case UNW_X86_64_RDI: loc = c->dwarf.loc[RDI]; break;
+ case UNW_X86_64_R8: loc = c->dwarf.loc[R8]; break;
+ case UNW_X86_64_R9: loc = c->dwarf.loc[R9]; break;
+ case UNW_X86_64_R10: loc = c->dwarf.loc[R10]; break;
+ case UNW_X86_64_R11: loc = c->dwarf.loc[R11]; break;
+ case UNW_X86_64_R12: loc = c->dwarf.loc[R12]; break;
+ case UNW_X86_64_R13: loc = c->dwarf.loc[R13]; break;
+ case UNW_X86_64_R14: loc = c->dwarf.loc[R14]; break;
+ case UNW_X86_64_R15: loc = c->dwarf.loc[R15]; break;
+
+ default:
+ Debug (1, "bad register number %u\n", reg);
+ return -UNW_EBADREG;
+ }
+
+ if (write)
+ return dwarf_put (&c->dwarf, loc, *valp);
+ else
+ return dwarf_get (&c->dwarf, loc, valp);
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ return -UNW_EBADREG;
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gresume.c b/src/pal/src/libunwind/src/x86_64/Gresume.c
new file mode 100644
index 0000000000..944cdaae19
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gresume.c
@@ -0,0 +1,123 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdlib.h>
+
+#include "offsets.h"
+#include "unwind_i.h"
+
+#ifndef UNW_REMOTE_ONLY
+
+HIDDEN inline int
+x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = c->uc;
+
+ /* Ensure c->pi is up-to-date. On x86-64, it's relatively common to
+ be missing DWARF unwind info. We don't want to fail in that
+ case, because the frame-chain still would let us do a backtrace
+ at least. */
+ dwarf_make_proc_info (&c->dwarf);
+
+ if (unlikely (c->sigcontext_addr != X86_64_SCF_NONE))
+ {
+ x86_64_sigreturn(cursor);
+ abort();
+ }
+ else
+ {
+ Debug (8, "resuming at ip=%llx via setcontext()\n",
+ (unsigned long long) c->dwarf.ip);
+ setcontext (uc);
+ }
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+/* This routine is responsible for copying the register values in
+ cursor C and establishing them as the current machine state. */
+
+static inline int
+establish_machine_state (struct cursor *c)
+{
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *,
+ int write, void *);
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *,
+ int write, void *);
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ access_reg = as->acc.access_reg;
+ access_fpreg = as->acc.access_fpreg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ (*access_fpreg) (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ (*access_reg) (as, reg, &val, 1, arg);
+ }
+ }
+
+ if (c->dwarf.args_size)
+ {
+ if (tdep_access_reg (c, UNW_X86_64_RSP, &val, 0) >= 0)
+ {
+ val += c->dwarf.args_size;
+ (*access_reg) (as, UNW_X86_64_RSP, &val, 1, arg);
+ }
+ }
+ return 0;
+}
+
+int
+unw_resume (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret;
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ if ((ret = establish_machine_state (c)) < 0)
+ return ret;
+
+ return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c,
+ c->dwarf.as_arg);
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gstash_frame.c b/src/pal/src/libunwind/src/x86_64/Gstash_frame.c
new file mode 100644
index 0000000000..2c7bc312e2
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gstash_frame.c
@@ -0,0 +1,119 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "ucontext_i.h"
+
+HIDDEN void
+tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
+{
+ struct cursor *c = (struct cursor *) dwarf_to_cursor (d);
+ unw_tdep_frame_t *f = &c->frame_info;
+
+ Debug (4, "ip=0x%lx cfa=0x%lx type %d cfa [where=%d val=%ld] cfaoff=%ld"
+ " ra=0x%lx rbp [where=%d val=%ld @0x%lx] rsp [where=%d val=%ld @0x%lx]\n",
+ d->ip, d->cfa, f->frame_type,
+ rs->reg.where[DWARF_CFA_REG_COLUMN],
+ rs->reg.val[DWARF_CFA_REG_COLUMN],
+ rs->reg.val[DWARF_CFA_OFF_COLUMN],
+ DWARF_GET_LOC(d->loc[rs->ret_addr_column]),
+ rs->reg.where[RBP], rs->reg.val[RBP], DWARF_GET_LOC(d->loc[RBP]),
+ rs->reg.where[RSP], rs->reg.val[RSP], DWARF_GET_LOC(d->loc[RSP]));
+
+ if (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_EXPR &&
+ rs->reg.where[RBP] == DWARF_WHERE_EXPR) {
+ /* Check for GCC generated alignment frame for rsp. A simple
+ * def_cfa_expr that loads a constant offset from rbp, where the
+ * addres of the rip was pushed on the stack */
+ unw_word_t cfa_addr = rs->reg.val[DWARF_CFA_REG_COLUMN];
+ unw_word_t rbp_addr = rs->reg.val[RBP];
+ unw_word_t cfa_offset;
+
+ int ret = dwarf_stack_aligned(d, cfa_addr, rbp_addr, &cfa_offset);
+ if (ret) {
+ f->frame_type = UNW_X86_64_FRAME_ALIGNED;
+ f->cfa_reg_offset = cfa_offset;
+ f->cfa_reg_rsp = 0;
+ }
+ }
+
+ /* A standard frame is defined as:
+ - CFA is register-relative offset off RBP or RSP;
+ - Return address is saved at CFA-8;
+ - RBP is unsaved or saved at CFA+offset, offset != -1;
+ - RSP is unsaved or saved at CFA+offset, offset != -1. */
+ if (f->frame_type == UNW_X86_64_FRAME_OTHER
+ && (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
+ && (rs->reg.val[DWARF_CFA_REG_COLUMN] == RBP
+ || rs->reg.val[DWARF_CFA_REG_COLUMN] == RSP)
+ && labs((long) rs->reg.val[DWARF_CFA_OFF_COLUMN]) < (1 << 28)
+ && DWARF_GET_LOC(d->loc[rs->ret_addr_column]) == d->cfa-8
+ && (rs->reg.where[RBP] == DWARF_WHERE_UNDEF
+ || rs->reg.where[RBP] == DWARF_WHERE_SAME
+ || (rs->reg.where[RBP] == DWARF_WHERE_CFAREL
+ && labs((long) rs->reg.val[RBP]) < (1 << 14)
+ && rs->reg.val[RBP]+1 != 0))
+ && (rs->reg.where[RSP] == DWARF_WHERE_UNDEF
+ || rs->reg.where[RSP] == DWARF_WHERE_SAME
+ || (rs->reg.where[RSP] == DWARF_WHERE_CFAREL
+ && labs((long) rs->reg.val[RSP]) < (1 << 14)
+ && rs->reg.val[RSP]+1 != 0)))
+ {
+ /* Save information for a standard frame. */
+ f->frame_type = UNW_X86_64_FRAME_STANDARD;
+ f->cfa_reg_rsp = (rs->reg.val[DWARF_CFA_REG_COLUMN] == RSP);
+ f->cfa_reg_offset = rs->reg.val[DWARF_CFA_OFF_COLUMN];
+ if (rs->reg.where[RBP] == DWARF_WHERE_CFAREL)
+ f->rbp_cfa_offset = rs->reg.val[RBP];
+ if (rs->reg.where[RSP] == DWARF_WHERE_CFAREL)
+ f->rsp_cfa_offset = rs->reg.val[RSP];
+ Debug (4, " standard frame\n");
+ }
+
+ /* Signal frame was detected via augmentation in tdep_fetch_frame() */
+ else if (f->frame_type == UNW_X86_64_FRAME_SIGRETURN)
+ {
+ /* Later we are going to fish out {RBP,RSP,RIP} from sigcontext via
+ their ucontext_t offsets. Confirm DWARF info agrees with the
+ offsets we expect. */
+
+#ifndef NDEBUG
+ const unw_word_t uc = c->sigcontext_addr;
+
+ assert (DWARF_GET_LOC(d->loc[RIP]) - uc == UC_MCONTEXT_GREGS_RIP);
+ assert (DWARF_GET_LOC(d->loc[RBP]) - uc == UC_MCONTEXT_GREGS_RBP);
+ assert (DWARF_GET_LOC(d->loc[RSP]) - uc == UC_MCONTEXT_GREGS_RSP);
+#endif
+
+ Debug (4, " sigreturn frame\n");
+ }
+
+ else if (f->frame_type == UNW_X86_64_FRAME_ALIGNED) {
+ Debug (4, " aligned frame, offset %li\n", f->cfa_reg_offset);
+ }
+
+ /* PLT and guessed RBP-walked frames are handled in unw_step(). */
+ else
+ Debug (4, " unusual frame\n");
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gstep.c b/src/pal/src/libunwind/src/x86_64/Gstep.c
new file mode 100644
index 0000000000..10498170ac
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gstep.c
@@ -0,0 +1,227 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include <signal.h>
+
+/* Recognise PLT entries such as:
+ 3bdf0: ff 25 e2 49 13 00 jmpq *0x1349e2(%rip)
+ 3bdf6: 68 ae 03 00 00 pushq $0x3ae
+ 3bdfb: e9 00 c5 ff ff jmpq 38300 <_init+0x18> */
+static int
+is_plt_entry (struct dwarf_cursor *c)
+{
+ unw_word_t w0, w1;
+ unw_accessors_t *a;
+ int ret;
+
+ a = unw_get_accessors_int (c->as);
+ if ((ret = (*a->access_mem) (c->as, c->ip, &w0, 0, c->as_arg)) < 0
+ || (ret = (*a->access_mem) (c->as, c->ip + 8, &w1, 0, c->as_arg)) < 0)
+ return 0;
+
+ ret = (((w0 & 0xffff) == 0x25ff)
+ && (((w0 >> 48) & 0xff) == 0x68)
+ && (((w1 >> 24) & 0xff) == 0xe9));
+
+ Debug (14, "ip=0x%lx => 0x%016lx 0x%016lx, ret = %d\n", c->ip, w0, w1, ret);
+ return ret;
+}
+
+int
+unw_step (unw_cursor_t *cursor)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ int ret, i;
+
+#if CONSERVATIVE_CHECKS
+ int val = c->validate;
+ c->validate = 1;
+#endif
+
+ Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx)\n",
+ c, c->dwarf.ip, c->dwarf.cfa);
+
+ /* Try DWARF-based unwinding... */
+ c->sigcontext_format = X86_64_SCF_NONE;
+ ret = dwarf_step (&c->dwarf);
+
+#if CONSERVATIVE_CHECKS
+ c->validate = val;
+#endif
+
+ if (ret < 0 && ret != -UNW_ENOINFO)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ if (likely (ret >= 0))
+ {
+ /* x86_64 ABI specifies that end of call-chain is marked with a
+ NULL RBP or undefined return address */
+ if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP]))
+ {
+ c->dwarf.ip = 0;
+ ret = 0;
+ }
+ }
+ else
+ {
+ /* DWARF failed. There isn't much of a usable frame-chain on x86-64,
+ but we do need to handle two special-cases:
+
+ (i) signal trampoline: Old kernels and older libcs don't
+ export the vDSO needed to get proper unwind info for the
+ trampoline. Recognize that case by looking at the code
+ and filling in things by hand.
+
+ (ii) PLT (shared-library) call-stubs: PLT stubs are invoked
+ via CALLQ. Try this for all non-signal trampoline
+ code. */
+
+ unw_word_t prev_ip = c->dwarf.ip, prev_cfa = c->dwarf.cfa;
+ struct dwarf_loc rbp_loc, rsp_loc, rip_loc;
+
+ /* We could get here because of missing/bad unwind information.
+ Validate all addresses before dereferencing. */
+ c->validate = 1;
+
+ Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret);
+
+ if (unw_is_signal_frame (cursor) > 0)
+ {
+ ret = x86_64_handle_signal_frame(cursor);
+ if (ret < 0)
+ {
+ Debug (2, "returning 0\n");
+ return 0;
+ }
+ }
+ else if (is_plt_entry (&c->dwarf))
+ {
+ /* Like regular frame, CFA = RSP+8, RA = [CFA-8], no regs saved. */
+ Debug (2, "found plt entry\n");
+ c->frame_info.cfa_reg_offset = 8;
+ c->frame_info.cfa_reg_rsp = -1;
+ c->frame_info.frame_type = UNW_X86_64_FRAME_STANDARD;
+ c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0);
+ c->dwarf.cfa += 8;
+ }
+ else if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP]))
+ {
+ for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+ }
+ else
+ {
+ unw_word_t rbp;
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[RBP], &rbp);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d [RBP=0x%lx]\n", ret,
+ DWARF_GET_LOC (c->dwarf.loc[RBP]));
+ return ret;
+ }
+
+ if (!rbp)
+ {
+ /* Looks like we may have reached the end of the call-chain. */
+ rbp_loc = DWARF_NULL_LOC;
+ rsp_loc = DWARF_NULL_LOC;
+ rip_loc = DWARF_NULL_LOC;
+ }
+ else
+ {
+ unw_word_t rbp1 = 0;
+ rbp_loc = DWARF_LOC(rbp, 0);
+ rsp_loc = DWARF_NULL_LOC;
+ rip_loc = DWARF_LOC (rbp + 8, 0);
+ ret = dwarf_get (&c->dwarf, rbp_loc, &rbp1);
+ Debug (1, "[RBP=0x%lx] = 0x%lx (cfa = 0x%lx) -> 0x%lx\n",
+ (unsigned long) DWARF_GET_LOC (c->dwarf.loc[RBP]),
+ rbp, c->dwarf.cfa, rbp1);
+
+ /* Heuristic to determine incorrect guess. For RBP to be a
+ valid frame it needs to be above current CFA, but don't
+ let it go more than a little. Note that we can't deduce
+ anything about new RBP (rbp1) since it may not be a frame
+ pointer in the frame above. Just check we get the value. */
+ if (ret < 0
+ || rbp < c->dwarf.cfa
+ || (rbp - c->dwarf.cfa) > 0x4000)
+ {
+ rip_loc = DWARF_NULL_LOC;
+ rbp_loc = DWARF_NULL_LOC;
+ }
+
+ c->frame_info.frame_type = UNW_X86_64_FRAME_GUESSED;
+ c->frame_info.cfa_reg_rsp = 0;
+ c->frame_info.cfa_reg_offset = 16;
+ c->frame_info.rbp_cfa_offset = -16;
+ c->dwarf.cfa += 16;
+ }
+
+ /* Mark all registers unsaved */
+ for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i)
+ c->dwarf.loc[i] = DWARF_NULL_LOC;
+
+ c->dwarf.loc[RBP] = rbp_loc;
+ c->dwarf.loc[RSP] = rsp_loc;
+ c->dwarf.loc[RIP] = rip_loc;
+ c->dwarf.use_prev_instr = 1;
+ }
+
+ if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP]))
+ {
+ ret = 0;
+ Debug (2, "NULL %%rbp loc, returning %d\n", ret);
+ return ret;
+ }
+ if (!DWARF_IS_NULL_LOC (c->dwarf.loc[RIP]))
+ {
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip);
+ Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n",
+ (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]),
+ (unsigned long long) c->dwarf.ip);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ ret = 1;
+ }
+ else
+ c->dwarf.ip = 0;
+
+ if (c->dwarf.ip == prev_ip && c->dwarf.cfa == prev_cfa)
+ return -UNW_EBADFRAME;
+ }
+ Debug (2, "returning %d\n", ret);
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Gtrace.c b/src/pal/src/libunwind/src/x86_64/Gtrace.c
new file mode 100644
index 0000000000..741227105e
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Gtrace.c
@@ -0,0 +1,551 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+#include "ucontext_i.h"
+#include <signal.h>
+#include <limits.h>
+
+#pragma weak pthread_once
+#pragma weak pthread_key_create
+#pragma weak pthread_getspecific
+#pragma weak pthread_setspecific
+
+/* Initial hash table size. Table expands by 2 bits (times four). */
+#define HASH_MIN_BITS 14
+
+typedef struct
+{
+ unw_tdep_frame_t *frames;
+ size_t log_size;
+ size_t used;
+ size_t dtor_count; /* Counts how many times our destructor has already
+ been called. */
+} unw_trace_cache_t;
+
+static const unw_tdep_frame_t empty_frame = { 0, UNW_X86_64_FRAME_OTHER, -1, -1, 0, -1, -1 };
+static define_lock (trace_init_lock);
+static pthread_once_t trace_cache_once = PTHREAD_ONCE_INIT;
+static sig_atomic_t trace_cache_once_happen;
+static pthread_key_t trace_cache_key;
+static struct mempool trace_cache_pool;
+static __thread unw_trace_cache_t *tls_cache;
+static __thread int tls_cache_destroyed;
+
+/* Free memory for a thread's trace cache. */
+static void
+trace_cache_free (void *arg)
+{
+ unw_trace_cache_t *cache = arg;
+ if (++cache->dtor_count < PTHREAD_DESTRUCTOR_ITERATIONS)
+ {
+ /* Not yet our turn to get destroyed. Re-install ourselves into the key. */
+ pthread_setspecific(trace_cache_key, cache);
+ Debug(5, "delayed freeing cache %p (%zx to go)\n", cache,
+ PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count);
+ return;
+ }
+ tls_cache_destroyed = 1;
+ tls_cache = NULL;
+ munmap (cache->frames, (1u << cache->log_size) * sizeof(unw_tdep_frame_t));
+ mempool_free (&trace_cache_pool, cache);
+ Debug(5, "freed cache %p\n", cache);
+}
+
+/* Initialise frame tracing for threaded use. */
+static void
+trace_cache_init_once (void)
+{
+ pthread_key_create (&trace_cache_key, &trace_cache_free);
+ mempool_init (&trace_cache_pool, sizeof (unw_trace_cache_t), 0);
+ trace_cache_once_happen = 1;
+}
+
+static unw_tdep_frame_t *
+trace_cache_buckets (size_t n)
+{
+ unw_tdep_frame_t *frames;
+ size_t i;
+
+ GET_MEMORY(frames, n * sizeof (unw_tdep_frame_t));
+ if (likely(frames != NULL))
+ for (i = 0; i < n; ++i)
+ frames[i] = empty_frame;
+
+ return frames;
+}
+
+/* Allocate and initialise hash table for frame cache lookups.
+ Returns the cache initialised with (1u << HASH_LOW_BITS) hash
+ buckets, or NULL if there was a memory allocation problem. */
+static unw_trace_cache_t *
+trace_cache_create (void)
+{
+ unw_trace_cache_t *cache;
+
+ if (tls_cache_destroyed)
+ {
+ /* The current thread is in the process of exiting. Don't recreate
+ cache, as we wouldn't have another chance to free it. */
+ Debug(5, "refusing to reallocate cache: "
+ "thread-locals are being deallocated\n");
+ return NULL;
+ }
+
+ if (! (cache = mempool_alloc(&trace_cache_pool)))
+ {
+ Debug(5, "failed to allocate cache\n");
+ return NULL;
+ }
+
+ if (! (cache->frames = trace_cache_buckets(1u << HASH_MIN_BITS)))
+ {
+ Debug(5, "failed to allocate buckets\n");
+ mempool_free(&trace_cache_pool, cache);
+ return NULL;
+ }
+
+ cache->log_size = HASH_MIN_BITS;
+ cache->used = 0;
+ cache->dtor_count = 0;
+ tls_cache_destroyed = 0; /* Paranoia: should already be 0. */
+ Debug(5, "allocated cache %p\n", cache);
+ return cache;
+}
+
+/* Expand the hash table in the frame cache if possible. This always
+ quadruples the hash size, and clears all previous frame entries. */
+static int
+trace_cache_expand (unw_trace_cache_t *cache)
+{
+ size_t old_size = (1u << cache->log_size);
+ size_t new_log_size = cache->log_size + 2;
+ unw_tdep_frame_t *new_frames = trace_cache_buckets (1u << new_log_size);
+
+ if (unlikely(! new_frames))
+ {
+ Debug(5, "failed to expand cache to 2^%lu buckets\n", new_log_size);
+ return -UNW_ENOMEM;
+ }
+
+ Debug(5, "expanded cache from 2^%lu to 2^%lu buckets\n", cache->log_size, new_log_size);
+ munmap(cache->frames, old_size * sizeof(unw_tdep_frame_t));
+ cache->frames = new_frames;
+ cache->log_size = new_log_size;
+ cache->used = 0;
+ return 0;
+}
+
+static unw_trace_cache_t *
+trace_cache_get_unthreaded (void)
+{
+ unw_trace_cache_t *cache;
+ intrmask_t saved_mask;
+ static unw_trace_cache_t *global_cache = NULL;
+ lock_acquire (&trace_init_lock, saved_mask);
+ if (! global_cache)
+ {
+ mempool_init (&trace_cache_pool, sizeof (unw_trace_cache_t), 0);
+ global_cache = trace_cache_create ();
+ }
+ cache = global_cache;
+ lock_release (&trace_init_lock, saved_mask);
+ Debug(5, "using cache %p\n", cache);
+ return cache;
+}
+
+/* Get the frame cache for the current thread. Create it if there is none. */
+static unw_trace_cache_t *
+trace_cache_get (void)
+{
+ unw_trace_cache_t *cache;
+ if (likely (pthread_once != NULL))
+ {
+ pthread_once(&trace_cache_once, &trace_cache_init_once);
+ if (!trace_cache_once_happen)
+ {
+ return trace_cache_get_unthreaded();
+ }
+ if (! (cache = tls_cache))
+ {
+ cache = trace_cache_create();
+ pthread_setspecific(trace_cache_key, cache);
+ tls_cache = cache;
+ }
+ Debug(5, "using cache %p\n", cache);
+ return cache;
+ }
+ else
+ {
+ return trace_cache_get_unthreaded();
+ }
+}
+
+/* Initialise frame properties for address cache slot F at address
+ RIP using current CFA, RBP and RSP values. Modifies CURSOR to
+ that location, performs one unw_step(), and fills F with what
+ was discovered about the location. Returns F.
+
+ FIXME: This probably should tell DWARF handling to never evaluate
+ or use registers other than RBP, RSP and RIP in case there is
+ highly unusual unwind info which uses these creatively. */
+static unw_tdep_frame_t *
+trace_init_addr (unw_tdep_frame_t *f,
+ unw_cursor_t *cursor,
+ unw_word_t cfa,
+ unw_word_t rip,
+ unw_word_t rbp,
+ unw_word_t rsp)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct dwarf_cursor *d = &c->dwarf;
+ int ret = -UNW_EINVAL;
+
+ /* Initialise frame properties: unknown, not last. */
+ f->virtual_address = rip;
+ f->frame_type = UNW_X86_64_FRAME_OTHER;
+ f->last_frame = 0;
+ f->cfa_reg_rsp = -1;
+ f->cfa_reg_offset = 0;
+ f->rbp_cfa_offset = -1;
+ f->rsp_cfa_offset = -1;
+
+ /* Reinitialise cursor to this instruction - but undo next/prev RIP
+ adjustment because unw_step will redo it - and force RIP, RBP
+ RSP into register locations (=~ ucontext we keep), then set
+ their desired values. Then perform the step. */
+ d->ip = rip + d->use_prev_instr;
+ d->cfa = cfa;
+ d->loc[UNW_X86_64_RIP] = DWARF_REG_LOC (d, UNW_X86_64_RIP);
+ d->loc[UNW_X86_64_RBP] = DWARF_REG_LOC (d, UNW_X86_64_RBP);
+ d->loc[UNW_X86_64_RSP] = DWARF_REG_LOC (d, UNW_X86_64_RSP);
+ c->frame_info = *f;
+
+ if (likely(dwarf_put (d, d->loc[UNW_X86_64_RIP], rip) >= 0)
+ && likely(dwarf_put (d, d->loc[UNW_X86_64_RBP], rbp) >= 0)
+ && likely(dwarf_put (d, d->loc[UNW_X86_64_RSP], rsp) >= 0)
+ && likely((ret = unw_step (cursor)) >= 0))
+ *f = c->frame_info;
+
+ /* If unw_step() stopped voluntarily, remember that, even if it
+ otherwise could not determine anything useful. This avoids
+ failing trace if we hit frames without unwind info, which is
+ common for the outermost frame (CRT stuff) on many systems.
+ This avoids failing trace in very common circumstances; failing
+ to unw_step() loop wouldn't produce any better result. */
+ if (ret == 0)
+ f->last_frame = -1;
+
+ Debug (3, "frame va %lx type %d last %d cfa %s+%d rbp @ cfa%+d rsp @ cfa%+d\n",
+ f->virtual_address, f->frame_type, f->last_frame,
+ f->cfa_reg_rsp ? "rsp" : "rbp", f->cfa_reg_offset,
+ f->rbp_cfa_offset, f->rsp_cfa_offset);
+
+ return f;
+}
+
+/* Look up and if necessary fill in frame attributes for address RIP
+ in CACHE using current CFA, RBP and RSP values. Uses CURSOR to
+ perform any unwind steps necessary to fill the cache. Returns the
+ frame cache slot which describes RIP. */
+static unw_tdep_frame_t *
+trace_lookup (unw_cursor_t *cursor,
+ unw_trace_cache_t *cache,
+ unw_word_t cfa,
+ unw_word_t rip,
+ unw_word_t rbp,
+ unw_word_t rsp)
+{
+ /* First look up for previously cached information using cache as
+ linear probing hash table with probe step of 1. Majority of
+ lookups should be completed within few steps, but it is very
+ important the hash table does not fill up, or performance falls
+ off the cliff. */
+ uint64_t i, addr;
+ uint64_t cache_size = 1u << cache->log_size;
+ uint64_t slot = ((rip * 0x9e3779b97f4a7c16) >> 43) & (cache_size-1);
+ unw_tdep_frame_t *frame;
+
+ for (i = 0; i < 16; ++i)
+ {
+ frame = &cache->frames[slot];
+ addr = frame->virtual_address;
+
+ /* Return if we found the address. */
+ if (likely(addr == rip))
+ {
+ Debug (4, "found address after %ld steps\n", i);
+ return frame;
+ }
+
+ /* If slot is empty, reuse it. */
+ if (likely(! addr))
+ break;
+
+ /* Linear probe to next slot candidate, step = 1. */
+ if (++slot >= cache_size)
+ slot -= cache_size;
+ }
+
+ /* If we collided after 16 steps, or if the hash is more than half
+ full, force the hash to expand. Fill the selected slot, whether
+ it's free or collides. Note that hash expansion drops previous
+ contents; further lookups will refill the hash. */
+ Debug (4, "updating slot %lu after %ld steps, replacing 0x%lx\n", slot, i, addr);
+ if (unlikely(addr || cache->used >= cache_size / 2))
+ {
+ if (unlikely(trace_cache_expand (cache) < 0))
+ return NULL;
+
+ cache_size = 1u << cache->log_size;
+ slot = ((rip * 0x9e3779b97f4a7c16) >> 43) & (cache_size-1);
+ frame = &cache->frames[slot];
+ addr = frame->virtual_address;
+ }
+
+ if (! addr)
+ ++cache->used;
+
+ return trace_init_addr (frame, cursor, cfa, rip, rbp, rsp);
+}
+
+/* Fast stack backtrace for x86-64.
+
+ This is used by backtrace() implementation to accelerate frequent
+ queries for current stack, without any desire to unwind. It fills
+ BUFFER with the call tree from CURSOR upwards for at most SIZE
+ stack levels. The first frame, backtrace itself, is omitted. When
+ called, SIZE should give the maximum number of entries that can be
+ stored into BUFFER. Uses an internal thread-specific cache to
+ accelerate queries.
+
+ The caller should fall back to a unw_step() loop if this function
+ fails by returning -UNW_ESTOPUNWIND, meaning the routine hit a
+ stack frame that is too complex to be traced in the fast path.
+
+ This function is tuned for clients which only need to walk the
+ stack to get the call tree as fast as possible but without any
+ other details, for example profilers sampling the stack thousands
+ to millions of times per second. The routine handles the most
+ common x86-64 ABI stack layouts: CFA is RBP or RSP plus/minus
+ constant offset, return address is at CFA-8, and RBP and RSP are
+ either unchanged or saved on stack at constant offset from the CFA;
+ the signal return frame; and frames without unwind info provided
+ they are at the outermost (final) frame or can conservatively be
+ assumed to be frame-pointer based.
+
+ Any other stack layout will cause the routine to give up. There
+ are only a handful of relatively rarely used functions which do
+ not have a stack in the standard form: vfork, longjmp, setcontext
+ and _dl_runtime_profile on common linux systems for example.
+
+ On success BUFFER and *SIZE reflect the trace progress up to *SIZE
+ stack levels or the outermost frame, which ever is less. It may
+ stop short of outermost frame if unw_step() loop would also do so,
+ e.g. if there is no more unwind information; this is not reported
+ as an error.
+
+ The function returns a negative value for errors, -UNW_ESTOPUNWIND
+ if tracing stopped because of an unusual frame unwind info. The
+ BUFFER and *SIZE reflect tracing progress up to the error frame.
+
+ Callers of this function would normally look like this:
+
+ unw_cursor_t cur;
+ unw_context_t ctx;
+ void addrs[128];
+ int depth = 128;
+ int ret;
+
+ unw_getcontext(&ctx);
+ unw_init_local(&cur, &ctx);
+ if ((ret = unw_tdep_trace(&cur, addrs, &depth)) < 0)
+ {
+ depth = 0;
+ unw_getcontext(&ctx);
+ unw_init_local(&cur, &ctx);
+ while ((ret = unw_step(&cur)) > 0 && depth < 128)
+ {
+ unw_word_t ip;
+ unw_get_reg(&cur, UNW_REG_IP, &ip);
+ addresses[depth++] = (void *) ip;
+ }
+ }
+*/
+HIDDEN int
+tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
+{
+ struct cursor *c = (struct cursor *) cursor;
+ struct dwarf_cursor *d = &c->dwarf;
+ unw_trace_cache_t *cache;
+ unw_word_t rbp, rsp, rip, cfa;
+ int maxdepth = 0;
+ int depth = 0;
+ int ret;
+
+ /* Check input parametres. */
+ if (unlikely(! cursor || ! buffer || ! size || (maxdepth = *size) <= 0))
+ return -UNW_EINVAL;
+
+ Debug (1, "begin ip 0x%lx cfa 0x%lx\n", d->ip, d->cfa);
+
+ /* Tell core dwarf routines to call back to us. */
+ d->stash_frames = 1;
+
+ /* Determine initial register values. These are direct access safe
+ because we know they come from the initial machine context. */
+ rip = d->ip;
+ rsp = cfa = d->cfa;
+ ACCESS_MEM_FAST(ret, 0, d, DWARF_GET_LOC(d->loc[UNW_X86_64_RBP]), rbp);
+ assert(ret == 0);
+
+ /* Get frame cache. */
+ if (unlikely(! (cache = trace_cache_get())))
+ {
+ Debug (1, "returning %d, cannot get trace cache\n", -UNW_ENOMEM);
+ *size = 0;
+ d->stash_frames = 0;
+ return -UNW_ENOMEM;
+ }
+
+ /* Trace the stack upwards, starting from current RIP. Adjust
+ the RIP address for previous/next instruction as the main
+ unwinding logic would also do. We undo this before calling
+ back into unw_step(). */
+ while (depth < maxdepth)
+ {
+ rip -= d->use_prev_instr;
+ Debug (2, "depth %d cfa 0x%lx rip 0x%lx rsp 0x%lx rbp 0x%lx\n",
+ depth, cfa, rip, rsp, rbp);
+
+ /* See if we have this address cached. If not, evaluate enough of
+ the dwarf unwind information to fill the cache line data, or to
+ decide this frame cannot be handled in fast trace mode. We
+ cache negative results too to prevent unnecessary dwarf parsing
+ for common failures. */
+ unw_tdep_frame_t *f = trace_lookup (cursor, cache, cfa, rip, rbp, rsp);
+
+ /* If we don't have information for this frame, give up. */
+ if (unlikely(! f))
+ {
+ ret = -UNW_ENOINFO;
+ break;
+ }
+
+ Debug (3, "frame va %lx type %d last %d cfa %s+%d rbp @ cfa%+d rsp @ cfa%+d\n",
+ f->virtual_address, f->frame_type, f->last_frame,
+ f->cfa_reg_rsp ? "rsp" : "rbp", f->cfa_reg_offset,
+ f->rbp_cfa_offset, f->rsp_cfa_offset);
+
+ assert (f->virtual_address == rip);
+
+ /* Stop if this was the last frame. In particular don't evaluate
+ new register values as it may not be safe - we don't normally
+ run with full validation on, and do not want to - and there's
+ enough bad unwind info floating around that we need to trust
+ what unw_step() previously said, in potentially bogus frames. */
+ if (f->last_frame)
+ break;
+
+ /* Evaluate CFA and registers for the next frame. */
+ switch (f->frame_type)
+ {
+ case UNW_X86_64_FRAME_GUESSED:
+ /* Fall thru to standard processing after forcing validation. */
+ c->validate = 1;
+
+ case UNW_X86_64_FRAME_STANDARD:
+ /* Advance standard traceable frame. */
+ cfa = (f->cfa_reg_rsp ? rsp : rbp) + f->cfa_reg_offset;
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa - 8, rip);
+ if (likely(ret >= 0) && likely(f->rbp_cfa_offset != -1))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->rbp_cfa_offset, rbp);
+
+ /* Don't bother reading RSP from DWARF, CFA becomes new RSP. */
+ rsp = cfa;
+
+ /* Next frame needs to back up for unwind info lookup. */
+ d->use_prev_instr = 1;
+ break;
+
+ case UNW_X86_64_FRAME_SIGRETURN:
+ cfa = cfa + f->cfa_reg_offset; /* cfa now points to ucontext_t. */
+
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RIP, rip);
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RBP, rbp);
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RSP, rsp);
+
+ /* Resume stack at signal restoration point. The stack is not
+ necessarily continuous here, especially with sigaltstack(). */
+ cfa = rsp;
+
+ /* Next frame should not back up. */
+ d->use_prev_instr = 0;
+ break;
+
+ case UNW_X86_64_FRAME_ALIGNED:
+ /* Address of RIP was pushed on the stack via a simple
+ * def_cfa_expr - result stack offset stored in cfa_reg_offset */
+ cfa = (f->cfa_reg_rsp ? rsp : rbp) + f->cfa_reg_offset;
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa, cfa);
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, cfa - 8, rip);
+ if (likely(ret >= 0))
+ ACCESS_MEM_FAST(ret, c->validate, d, rbp, rbp);
+
+ /* Don't bother reading RSP from DWARF, CFA becomes new RSP. */
+ rsp = cfa;
+
+ /* Next frame needs to back up for unwind info lookup. */
+ d->use_prev_instr = 1;
+
+ break;
+
+ default:
+ /* We cannot trace through this frame, give up and tell the
+ caller we had to stop. Data collected so far may still be
+ useful to the caller, so let it know how far we got. */
+ ret = -UNW_ESTOPUNWIND;
+ break;
+ }
+
+ Debug (4, "new cfa 0x%lx rip 0x%lx rsp 0x%lx rbp 0x%lx\n",
+ cfa, rip, rsp, rbp);
+
+ /* If we failed or ended up somewhere bogus, stop. */
+ if (unlikely(ret < 0 || rip < 0x4000))
+ break;
+
+ /* Record this address in stack trace. We skipped the first address. */
+ buffer[depth++] = (void *) (rip - d->use_prev_instr);
+ }
+
+#if UNW_DEBUG
+ Debug (1, "returning %d, depth %d\n", ret, depth);
+#endif
+ *size = depth;
+ return ret;
+}
diff --git a/src/pal/src/libunwind/src/x86_64/Lapply_reg_state.c b/src/pal/src/libunwind/src/x86_64/Lapply_reg_state.c
new file mode 100644
index 0000000000..7ebada480e
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lapply_reg_state.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gapply_reg_state.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lcreate_addr_space.c b/src/pal/src/libunwind/src/x86_64/Lcreate_addr_space.c
new file mode 100644
index 0000000000..0f2dc6be90
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lcreate_addr_space.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gcreate_addr_space.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lget_proc_info.c b/src/pal/src/libunwind/src/x86_64/Lget_proc_info.c
new file mode 100644
index 0000000000..69028b019f
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lget_proc_info.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_proc_info.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lget_save_loc.c b/src/pal/src/libunwind/src/x86_64/Lget_save_loc.c
new file mode 100644
index 0000000000..9ea048a907
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lget_save_loc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gget_save_loc.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lglobal.c b/src/pal/src/libunwind/src/x86_64/Lglobal.c
new file mode 100644
index 0000000000..8c43a67c0f
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lglobal.c
@@ -0,0 +1,6 @@
+#define UNW_LOCAL_ONLY
+#include "config.h"
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gglobal.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Linit.c b/src/pal/src/libunwind/src/x86_64/Linit.c
new file mode 100644
index 0000000000..e9abfdd46a
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Linit.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Linit_local.c b/src/pal/src/libunwind/src/x86_64/Linit_local.c
new file mode 100644
index 0000000000..68a1687e85
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Linit_local.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_local.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Linit_remote.c b/src/pal/src/libunwind/src/x86_64/Linit_remote.c
new file mode 100644
index 0000000000..58cb04ab7c
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Linit_remote.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Ginit_remote.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Los-freebsd.c b/src/pal/src/libunwind/src/x86_64/Los-freebsd.c
new file mode 100644
index 0000000000..a75a205df1
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Los-freebsd.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gos-freebsd.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Los-linux.c b/src/pal/src/libunwind/src/x86_64/Los-linux.c
new file mode 100644
index 0000000000..3cc18aabcc
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Los-linux.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gos-linux.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lreg_states_iterate.c b/src/pal/src/libunwind/src/x86_64/Lreg_states_iterate.c
new file mode 100644
index 0000000000..f1eb1e79dc
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lreg_states_iterate.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Greg_states_iterate.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lregs.c b/src/pal/src/libunwind/src/x86_64/Lregs.c
new file mode 100644
index 0000000000..2c9c75cd7d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lregs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gregs.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lresume.c b/src/pal/src/libunwind/src/x86_64/Lresume.c
new file mode 100644
index 0000000000..41a8cf003d
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lresume.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gresume.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lstash_frame.c b/src/pal/src/libunwind/src/x86_64/Lstash_frame.c
new file mode 100644
index 0000000000..77587803d0
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lstash_frame.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstash_frame.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Lstep.c b/src/pal/src/libunwind/src/x86_64/Lstep.c
new file mode 100644
index 0000000000..c1ac3c7547
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Lstep.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gstep.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/Ltrace.c b/src/pal/src/libunwind/src/x86_64/Ltrace.c
new file mode 100644
index 0000000000..fcd3f239c9
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/Ltrace.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gtrace.c"
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/getcontext.S b/src/pal/src/libunwind/src/x86_64/getcontext.S
new file mode 100644
index 0000000000..7a8b5664bd
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/getcontext.S
@@ -0,0 +1,134 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2008 Google, Inc
+ Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "ucontext_i.h"
+
+/* int _Ux86_64_getcontext (ucontext_t *ucp)
+
+ Saves the machine context in UCP necessary for libunwind.
+ Unlike the libc implementation, we don't save the signal mask
+ and hence avoid the cost of a system call per unwind.
+
+*/
+
+ .global _Ux86_64_getcontext
+ .type _Ux86_64_getcontext, @function
+_Ux86_64_getcontext:
+ .cfi_startproc
+
+ /* Callee saved: RBX, RBP, R12-R15 */
+ movq %r12, UC_MCONTEXT_GREGS_R12(%rdi)
+ movq %r13, UC_MCONTEXT_GREGS_R13(%rdi)
+ movq %r14, UC_MCONTEXT_GREGS_R14(%rdi)
+ movq %r15, UC_MCONTEXT_GREGS_R15(%rdi)
+ movq %rbp, UC_MCONTEXT_GREGS_RBP(%rdi)
+ movq %rbx, UC_MCONTEXT_GREGS_RBX(%rdi)
+
+ /* Save argument registers (not strictly needed, but setcontext
+ restores them, so don't restore garbage). */
+ movq %r8, UC_MCONTEXT_GREGS_R8(%rdi)
+ movq %r9, UC_MCONTEXT_GREGS_R9(%rdi)
+ movq %rdi, UC_MCONTEXT_GREGS_RDI(%rdi)
+ movq %rsi, UC_MCONTEXT_GREGS_RSI(%rdi)
+ movq %rdx, UC_MCONTEXT_GREGS_RDX(%rdi)
+ movq %rax, UC_MCONTEXT_GREGS_RAX(%rdi)
+ movq %rcx, UC_MCONTEXT_GREGS_RCX(%rdi)
+
+#if defined __linux__
+ /* Save fp state (not needed, except for setcontext not
+ restoring garbage). */
+ leaq UC_MCONTEXT_FPREGS_MEM(%rdi),%r8
+ movq %r8, UC_MCONTEXT_FPREGS_PTR(%rdi)
+ fnstenv (%r8)
+ stmxcsr FPREGS_OFFSET_MXCSR(%r8)
+#elif defined __FreeBSD__
+ fxsave UC_MCONTEXT_FPSTATE(%rdi)
+ movq $UC_MCONTEXT_FPOWNED_FPU,UC_MCONTEXT_OWNEDFP(%rdi)
+ movq $UC_MCONTEXT_FPFMT_XMM,UC_MCONTEXT_FPFORMAT(%rdi)
+ /* Save rflags and segment registers, so that sigreturn(2)
+ does not complain. */
+ pushfq
+ .cfi_adjust_cfa_offset 8
+ popq UC_MCONTEXT_RFLAGS(%rdi)
+ .cfi_adjust_cfa_offset -8
+ movl $0, UC_MCONTEXT_FLAGS(%rdi)
+ movw %cs, UC_MCONTEXT_CS(%rdi)
+ movw %ss, UC_MCONTEXT_SS(%rdi)
+#if 0
+ /* Setting the flags to 0 above disables restore of segment
+ registers from the context */
+ movw %ds, UC_MCONTEXT_DS(%rdi)
+ movw %es, UC_MCONTEXT_ES(%rdi)
+ movw %fs, UC_MCONTEXT_FS(%rdi)
+ movw %gs, UC_MCONTEXT_GS(%rdi)
+#endif
+ movq $UC_MCONTEXT_MC_LEN_VAL, UC_MCONTEXT_MC_LEN(%rdi)
+#else
+#error Port me
+#endif
+
+ leaq 8(%rsp), %rax /* exclude this call. */
+ movq %rax, UC_MCONTEXT_GREGS_RSP(%rdi)
+
+ movq 0(%rsp), %rax
+ movq %rax, UC_MCONTEXT_GREGS_RIP(%rdi)
+
+ xorq %rax, %rax
+ retq
+ .cfi_endproc
+ .size _Ux86_64_getcontext, . - _Ux86_64_getcontext
+
+/* int _Ux86_64_getcontext_trace (ucontext_t *ucp)
+
+ Saves limited machine context in UCP necessary for libunwind.
+ Unlike _Ux86_64_getcontext, saves only the parts needed for
+ fast trace. If fast trace fails, caller will have to get the
+ full context.
+*/
+
+ .global _Ux86_64_getcontext_trace
+ .hidden _Ux86_64_getcontext_trace
+ .type _Ux86_64_getcontext_trace, @function
+_Ux86_64_getcontext_trace:
+ .cfi_startproc
+
+ /* Save only RBP, RBX, RSP, RIP - exclude this call. */
+ movq %rbp, UC_MCONTEXT_GREGS_RBP(%rdi)
+ movq %rbx, UC_MCONTEXT_GREGS_RBX(%rdi)
+
+ leaq 8(%rsp), %rax
+ movq %rax, UC_MCONTEXT_GREGS_RSP(%rdi)
+
+ movq 0(%rsp), %rax
+ movq %rax, UC_MCONTEXT_GREGS_RIP(%rdi)
+
+ xorq %rax, %rax
+ retq
+ .cfi_endproc
+ .size _Ux86_64_getcontext_trace, . - _Ux86_64_getcontext_trace
+
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/x86_64/init.h b/src/pal/src/libunwind/src/x86_64/init.h
new file mode 100644
index 0000000000..a7a996f127
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/init.h
@@ -0,0 +1,89 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+/* Avoid a trip to x86_64_r_uc_addr() for purely local initialisation. */
+#if defined UNW_LOCAL_ONLY && defined __linux
+# define REG_INIT_LOC(c, rlc, ruc) \
+ DWARF_LOC ((unw_word_t) &c->uc->uc_mcontext.gregs[REG_ ## ruc], 0)
+
+#elif defined UNW_LOCAL_ONLY && defined __FreeBSD__
+# define REG_INIT_LOC(c, rlc, ruc) \
+ DWARF_LOC ((unw_word_t) &c->uc->uc_mcontext.mc_ ## rlc, 0)
+
+#else
+# define REG_INIT_LOC(c, rlc, ruc) \
+ DWARF_REG_LOC (&c->dwarf, UNW_X86_64_ ## ruc)
+#endif
+
+static inline int
+common_init (struct cursor *c, unsigned use_prev_instr)
+{
+ int ret;
+
+ c->dwarf.loc[RAX] = REG_INIT_LOC(c, rax, RAX);
+ c->dwarf.loc[RDX] = REG_INIT_LOC(c, rdx, RDX);
+ c->dwarf.loc[RCX] = REG_INIT_LOC(c, rcx, RCX);
+ c->dwarf.loc[RBX] = REG_INIT_LOC(c, rbx, RBX);
+ c->dwarf.loc[RSI] = REG_INIT_LOC(c, rsi, RSI);
+ c->dwarf.loc[RDI] = REG_INIT_LOC(c, rdi, RDI);
+ c->dwarf.loc[RBP] = REG_INIT_LOC(c, rbp, RBP);
+ c->dwarf.loc[RSP] = REG_INIT_LOC(c, rsp, RSP);
+ c->dwarf.loc[R8] = REG_INIT_LOC(c, r8, R8);
+ c->dwarf.loc[R9] = REG_INIT_LOC(c, r9, R9);
+ c->dwarf.loc[R10] = REG_INIT_LOC(c, r10, R10);
+ c->dwarf.loc[R11] = REG_INIT_LOC(c, r11, R11);
+ c->dwarf.loc[R12] = REG_INIT_LOC(c, r12, R12);
+ c->dwarf.loc[R13] = REG_INIT_LOC(c, r13, R13);
+ c->dwarf.loc[R14] = REG_INIT_LOC(c, r14, R14);
+ c->dwarf.loc[R15] = REG_INIT_LOC(c, r15, R15);
+ c->dwarf.loc[RIP] = REG_INIT_LOC(c, rip, RIP);
+
+ ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip);
+ if (ret < 0)
+ return ret;
+
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_X86_64_RSP),
+ &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = X86_64_SCF_NONE;
+ c->sigcontext_addr = 0;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.stash_frames = 0;
+ c->dwarf.use_prev_instr = use_prev_instr;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+ c->dwarf.eh_valid_mask = 0;
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/x86_64/is_fpreg.c b/src/pal/src/libunwind/src/x86_64/is_fpreg.c
new file mode 100644
index 0000000000..5c036137b6
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/is_fpreg.c
@@ -0,0 +1,38 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "libunwind_i.h"
+
+int
+unw_is_fpreg (int regnum)
+{
+#if 0
+ return ((regnum >= UNW_X86_ST0 && regnum <= UNW_X86_ST7)
+ || (regnum >= UNW_X86_XMM0_lo && regnum <= UNW_X86_XMM7_hi));
+#endif
+ return 0;
+}
diff --git a/src/pal/src/libunwind/src/x86_64/longjmp.S b/src/pal/src/libunwind/src/x86_64/longjmp.S
new file mode 100644
index 0000000000..274778fd80
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/longjmp.S
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .globl _UI_longjmp_cont
+ .type _UI_longjmp_cont, @function
+_UI_longjmp_cont:
+ push %rax /* push target IP as return address */
+ mov %rdx, %rax /* set up return-value */
+ retq
+ .size _UI_longjmp_cont, .-_UI_longjmp_cont
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/x86_64/offsets.h b/src/pal/src/libunwind/src/x86_64/offsets.h
new file mode 100644
index 0000000000..0807960f30
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/offsets.h
@@ -0,0 +1,3 @@
+/* FreeBSD specific definitions */
+
+#define FREEBSD_UC_MCONTEXT_OFF 0x10
diff --git a/src/pal/src/libunwind/src/x86_64/regname.c b/src/pal/src/libunwind/src/x86_64/regname.c
new file mode 100644
index 0000000000..77660af4a2
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/regname.c
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+
+ Contributed by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "unwind_i.h"
+
+static const char *regname[] =
+ {
+ "RAX",
+ "RDX",
+ "RCX",
+ "RBX",
+ "RSI",
+ "RDI",
+ "RBP",
+ "RSP",
+ "R8",
+ "R9",
+ "R10",
+ "R11",
+ "R12",
+ "R13",
+ "R14",
+ "R15",
+ "RIP",
+ };
+
+const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff --git a/src/pal/src/libunwind/src/x86_64/setcontext.S b/src/pal/src/libunwind/src/x86_64/setcontext.S
new file mode 100644
index 0000000000..358217defb
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/setcontext.S
@@ -0,0 +1,83 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2007 Google, Inc
+ Contributed by Arun Sharma <arun.sharma@google.com>
+ Copyright (C) 2010 Konstantin Belousov <kib@freebsd.org>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "ucontext_i.h"
+
+/* int _Ux86_64_setcontext (const ucontext_t *ucp)
+
+ Restores the machine context provided.
+ Unlike the libc implementation, doesn't clobber %rax
+
+*/
+ .global _Ux86_64_setcontext
+ .type _Ux86_64_setcontext, @function
+
+_Ux86_64_setcontext:
+
+#if defined __linux__
+ /* restore fp state */
+ mov UC_MCONTEXT_FPREGS_PTR(%rdi),%r8
+ fldenv (%r8)
+ ldmxcsr FPREGS_OFFSET_MXCSR(%r8)
+#elif defined __FreeBSD__
+ /* restore fp state */
+ cmpq $UC_MCONTEXT_FPOWNED_FPU,UC_MCONTEXT_OWNEDFP(%rdi)
+ jne 1f
+ cmpq $UC_MCONTEXT_FPFMT_XMM,UC_MCONTEXT_FPFORMAT(%rdi)
+ jne 1f
+ fxrstor UC_MCONTEXT_FPSTATE(%rdi)
+1:
+#else
+#error Port me
+#endif
+
+ /* restore the rest of the state */
+ mov UC_MCONTEXT_GREGS_R8(%rdi),%r8
+ mov UC_MCONTEXT_GREGS_R9(%rdi),%r9
+ mov UC_MCONTEXT_GREGS_RBX(%rdi),%rbx
+ mov UC_MCONTEXT_GREGS_RBP(%rdi),%rbp
+ mov UC_MCONTEXT_GREGS_R12(%rdi),%r12
+ mov UC_MCONTEXT_GREGS_R13(%rdi),%r13
+ mov UC_MCONTEXT_GREGS_R14(%rdi),%r14
+ mov UC_MCONTEXT_GREGS_R15(%rdi),%r15
+ mov UC_MCONTEXT_GREGS_RSI(%rdi),%rsi
+ mov UC_MCONTEXT_GREGS_RDX(%rdi),%rdx
+ mov UC_MCONTEXT_GREGS_RAX(%rdi),%rax
+ mov UC_MCONTEXT_GREGS_RCX(%rdi),%rcx
+ mov UC_MCONTEXT_GREGS_RSP(%rdi),%rsp
+
+ /* push the return address on the stack */
+ mov UC_MCONTEXT_GREGS_RIP(%rdi),%rcx
+ push %rcx
+
+ mov UC_MCONTEXT_GREGS_RCX(%rdi),%rcx
+ mov UC_MCONTEXT_GREGS_RDI(%rdi),%rdi
+ retq
+
+ .size _Ux86_64_setcontext, . - _Ux86_64_setcontext
+
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/x86_64/siglongjmp.S b/src/pal/src/libunwind/src/x86_64/siglongjmp.S
new file mode 100644
index 0000000000..32489e53a9
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/siglongjmp.S
@@ -0,0 +1,32 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .globl _UI_siglongjmp_cont
+ .type _UI_siglongjmp_cont, @function
+_UI_siglongjmp_cont:
+ retq
+ .size _UI_siglongjmp_cont, . - _UI_siglongjmp_cont
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
diff --git a/src/pal/src/libunwind/src/x86_64/ucontext_i.h b/src/pal/src/libunwind/src/x86_64/ucontext_i.h
new file mode 100644
index 0000000000..aded941d05
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/ucontext_i.h
@@ -0,0 +1,82 @@
+/* Copyright (C) 2004 Hewlett-Packard Co.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#if defined __linux__
+#define UC_MCONTEXT_GREGS_R8 0x28
+#define UC_MCONTEXT_GREGS_R9 0x30
+#define UC_MCONTEXT_GREGS_R10 0x38
+#define UC_MCONTEXT_GREGS_R11 0x40
+#define UC_MCONTEXT_GREGS_R12 0x48
+#define UC_MCONTEXT_GREGS_R13 0x50
+#define UC_MCONTEXT_GREGS_R14 0x58
+#define UC_MCONTEXT_GREGS_R15 0x60
+#define UC_MCONTEXT_GREGS_RDI 0x68
+#define UC_MCONTEXT_GREGS_RSI 0x70
+#define UC_MCONTEXT_GREGS_RBP 0x78
+#define UC_MCONTEXT_GREGS_RBX 0x80
+#define UC_MCONTEXT_GREGS_RDX 0x88
+#define UC_MCONTEXT_GREGS_RAX 0x90
+#define UC_MCONTEXT_GREGS_RCX 0x98
+#define UC_MCONTEXT_GREGS_RSP 0xa0
+#define UC_MCONTEXT_GREGS_RIP 0xa8
+#define UC_MCONTEXT_FPREGS_PTR 0x1a8
+#define UC_MCONTEXT_FPREGS_MEM 0xe0
+#define UC_SIGMASK 0x128
+#define FPREGS_OFFSET_MXCSR 0x18
+#elif defined __FreeBSD__
+#define UC_SIGMASK 0x0
+#define UC_MCONTEXT_GREGS_RDI 0x18
+#define UC_MCONTEXT_GREGS_RSI 0x20
+#define UC_MCONTEXT_GREGS_RDX 0x28
+#define UC_MCONTEXT_GREGS_RCX 0x30
+#define UC_MCONTEXT_GREGS_R8 0x38
+#define UC_MCONTEXT_GREGS_R9 0x40
+#define UC_MCONTEXT_GREGS_RAX 0x48
+#define UC_MCONTEXT_GREGS_RBX 0x50
+#define UC_MCONTEXT_GREGS_RBP 0x58
+#define UC_MCONTEXT_GREGS_R10 0x60
+#define UC_MCONTEXT_GREGS_R11 0x68
+#define UC_MCONTEXT_GREGS_R12 0x70
+#define UC_MCONTEXT_GREGS_R13 0x78
+#define UC_MCONTEXT_GREGS_R14 0x80
+#define UC_MCONTEXT_GREGS_R15 0x88
+#define UC_MCONTEXT_FS 0x94
+#define UC_MCONTEXT_GS 0x96
+#define UC_MCONTEXT_FLAGS 0xa0
+#define UC_MCONTEXT_ES 0xa4
+#define UC_MCONTEXT_DS 0xa6
+#define UC_MCONTEXT_GREGS_RIP 0xb0
+#define UC_MCONTEXT_CS 0xb8
+#define UC_MCONTEXT_RFLAGS 0xc0
+#define UC_MCONTEXT_GREGS_RSP 0xc8
+#define UC_MCONTEXT_SS 0xd0
+#define UC_MCONTEXT_MC_LEN 0xd8
+#define UC_MCONTEXT_FPFORMAT 0xe0
+#define UC_MCONTEXT_OWNEDFP 0xe8
+#define UC_MCONTEXT_FPSTATE 0xf0
+#define UC_MCONTEXT_FPOWNED_FPU 0x20001
+#define UC_MCONTEXT_FPFMT_XMM 0x10002
+#define UC_MCONTEXT_MC_LEN_VAL 0x320
+
+#endif
diff --git a/src/pal/src/libunwind/src/x86_64/unwind_i.h b/src/pal/src/libunwind/src/x86_64/unwind_i.h
new file mode 100644
index 0000000000..e95a60ff37
--- /dev/null
+++ b/src/pal/src/libunwind/src/x86_64/unwind_i.h
@@ -0,0 +1,93 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef unwind_i_h
+#define unwind_i_h
+
+#include <stdint.h>
+
+#include <libunwind-x86_64.h>
+
+#include "libunwind_i.h"
+#include <sys/ucontext.h>
+
+/* DWARF column numbers for x86_64: */
+#define RAX 0
+#define RDX 1
+#define RCX 2
+#define RBX 3
+#define RSI 4
+#define RDI 5
+#define RBP 6
+#define RSP 7
+#define R8 8
+#define R9 9
+#define R10 10
+#define R11 11
+#define R12 12
+#define R13 13
+#define R14 14
+#define R15 15
+#define RIP 16
+
+#define x86_64_lock UNW_OBJ(lock)
+#define x86_64_local_resume UNW_OBJ(local_resume)
+#define x86_64_local_addr_space_init UNW_OBJ(local_addr_space_init)
+#define setcontext UNW_ARCH_OBJ (setcontext)
+#if 0
+#define x86_64_scratch_loc UNW_OBJ(scratch_loc)
+#endif
+#define x86_64_r_uc_addr UNW_OBJ(r_uc_addr)
+#define x86_64_sigreturn UNW_OBJ(sigreturn)
+
+/* By-pass calls to access_mem() when known to be safe. */
+#ifdef UNW_LOCAL_ONLY
+# undef ACCESS_MEM_FAST
+# define ACCESS_MEM_FAST(ret,validate,cur,addr,to) \
+ do { \
+ if (unlikely(validate)) \
+ (ret) = dwarf_get ((cur), DWARF_MEM_LOC ((cur), (addr)), &(to)); \
+ else \
+ (ret) = 0, (to) = *(unw_word_t *)(addr); \
+ } while (0)
+#endif
+
+extern void x86_64_local_addr_space_init (void);
+extern int x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+extern int setcontext (const ucontext_t *ucp);
+
+#if 0
+extern dwarf_loc_t x86_64_scratch_loc (struct cursor *c, unw_regnum_t reg);
+#endif
+
+extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg);
+extern NORETURN void x86_64_sigreturn (unw_cursor_t *cursor);
+#define x86_64_handle_signal_frame UNW_OBJ(handle_signal_frame)
+extern int x86_64_handle_signal_frame(unw_cursor_t *cursor);
+
+#endif /* unwind_i_h */
diff --git a/src/pal/src/libunwind/tests/Gia64-test-nat.c b/src/pal/src/libunwind/tests/Gia64-test-nat.c
new file mode 100644
index 0000000000..89df54e0b0
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gia64-test-nat.c
@@ -0,0 +1,626 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file tests corner-cases of NaT-bit handling. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libunwind.h>
+#include "compiler.h"
+
+#ifdef HAVE_SYS_UC_ACCESS_H
+# include <sys/uc_access.h>
+#endif
+
+#include "tdep-ia64/rse.h"
+
+#define NUM_RUNS 1024
+//#define NUM_RUNS 1
+#define MAX_CHECKS 1024
+//#define MAX_CHECKS 2
+#define MAX_VALUES_PER_FUNC 4
+
+#define panic(args...) \
+ do { printf (args); ++nerrors; } while (0)
+
+typedef void save_func_t (void *funcs, unsigned long *vals);
+typedef unw_word_t *check_func_t (unw_cursor_t *c, unsigned long *vals);
+
+extern void flushrs (void);
+
+extern save_func_t save_static_to_stacked;
+static check_func_t check_static_to_stacked;
+
+extern save_func_t save_static_to_fr;
+static check_func_t check_static_to_fr;
+
+extern save_func_t save_static_to_br;
+static check_func_t check_static_to_br;
+
+extern save_func_t save_static_to_mem;
+static check_func_t check_static_to_mem;
+
+extern save_func_t save_static_to_mem2;
+static check_func_t check_static_to_mem2;
+
+extern save_func_t save_static_to_mem3;
+static check_func_t check_static_to_mem3;
+
+extern save_func_t save_static_to_mem4;
+static check_func_t check_static_to_mem4;
+
+extern save_func_t save_static_to_mem5;
+static check_func_t check_static_to_mem5;
+
+extern save_func_t save_static_to_scratch;
+static check_func_t check_static_to_scratch;
+
+extern save_func_t rotate_regs;
+static check_func_t check_rotate_regs;
+
+extern save_func_t save_pr;
+static check_func_t check_pr;
+
+static int verbose;
+static int nerrors;
+
+static int num_checks;
+static save_func_t *funcs[MAX_CHECKS + 1];
+static check_func_t *checks[MAX_CHECKS];
+static unw_word_t values[MAX_CHECKS*MAX_VALUES_PER_FUNC];
+
+static struct
+ {
+ save_func_t *func;
+ check_func_t *check;
+ }
+all_funcs[] =
+ {
+ { save_static_to_stacked, check_static_to_stacked },
+ { save_static_to_fr, check_static_to_fr },
+ { save_static_to_br, check_static_to_br },
+ { save_static_to_mem, check_static_to_mem },
+ { save_static_to_mem2, check_static_to_mem2 },
+ { save_static_to_mem3, check_static_to_mem3 },
+ { save_static_to_mem4, check_static_to_mem4 },
+ { save_static_to_mem5, check_static_to_mem5 },
+ { save_static_to_scratch, check_static_to_scratch },
+ { save_pr, check_pr },
+ { rotate_regs, check_rotate_regs },
+ };
+
+static unw_word_t
+random_word (void)
+{
+ unw_word_t val = random ();
+
+ if (sizeof (unw_word_t) > 4)
+ val |= ((unw_word_t) random ()) << 32;
+
+ return val;
+}
+
+void
+sighandler (int signal, void *siginfo, void *context)
+{
+ unsigned long *bsp, *arg1;
+ save_func_t **arg0;
+ ucontext_t *uc = context;
+
+#if defined(__linux)
+ {
+ long sof;
+ int sp;
+
+ if (verbose)
+ printf ("sighandler: signal %d sp=%p nat=%08lx pr=%lx\n",
+ signal, &sp, uc->uc_mcontext.sc_nat, uc->uc_mcontext.sc_pr);
+ sof = uc->uc_mcontext.sc_cfm & 0x7f;
+ bsp = (unsigned long *) rse_skip_regs (uc->uc_mcontext.sc_ar_bsp, -sof);
+ }
+#elif defined(__hpux)
+ if (__uc_get_ar (uc, UNW_IA64_AR_BSP - UNW_IA64_AR, &bsp) != 0)
+ {
+ panic ("%s: reading of ar.bsp failed, errno=%d", __FUNCTION__, errno);
+ return;
+ }
+#endif
+
+ flushrs ();
+ arg0 = (save_func_t **) *bsp;
+ bsp = (unsigned long *) rse_skip_regs ((uint64_t) bsp, 1);
+ arg1 = (unsigned long *) *bsp;
+
+ (*arg0[0]) (arg0 + 1, arg1);
+
+ /* skip over the instruction which triggered sighandler() */
+#if defined(__linux)
+ ++uc->uc_mcontext.sc_ip;
+#elif defined(HAVE_SYS_UC_ACCESS_H)
+ {
+ unsigned long ip;
+
+ if (__uc_get_ip (uc, &ip) != 0)
+ {
+ panic ("%s: reading of ip failed, errno=%d", __FUNCTION__, errno);
+ return;
+ }
+ if (__uc_set_ip (uc, ip) != 0)
+ {
+ panic ("%s: writing of ip failed, errno=%d", __FUNCTION__, errno);
+ return;
+ }
+ }
+#endif
+}
+
+static void
+enable_sighandler (void)
+{
+ struct sigaction act;
+
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = (void (*)(int)) sighandler;
+ act.sa_flags = SA_SIGINFO | SA_NODEFER;
+ if (sigaction (SIGSEGV, &act, NULL) < 0)
+ panic ("sigaction: %s\n", strerror (errno));
+}
+
+static void
+disable_sighandler (void)
+{
+ struct sigaction act;
+
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = SIG_DFL;
+ act.sa_flags = SA_SIGINFO | SA_NODEFER;
+ if (sigaction (SIGSEGV, &act, NULL) < 0)
+ panic ("sigaction: %s\n", strerror (errno));
+}
+
+static unw_word_t *
+check_static_to_stacked (unw_cursor_t *c, unw_word_t *vals)
+{
+ unw_word_t r[4];
+ unw_word_t nat[4];
+ int i, ret;
+
+ if (verbose)
+ printf (" %s()\n", __FUNCTION__);
+
+ vals -= 4;
+
+ for (i = 0; i < 4; ++i)
+ if ((ret = unw_get_reg (c, UNW_IA64_GR + 4 + i, &r[i])) < 0)
+ panic ("%s: failed to read register r%d, error=%d\n",
+ __FUNCTION__, 4 + i, ret);
+
+ for (i = 0; i < 4; ++i)
+ if ((ret = unw_get_reg (c, UNW_IA64_NAT + 4 + i, &nat[i])) < 0)
+ panic ("%s: failed to read register nat%d, error=%d\n",
+ __FUNCTION__, 4 + i, ret);
+
+ for (i = 0; i < 4; ++i)
+ {
+ if (verbose)
+ printf (" r%d = %c%016lx (expected %c%016lx)\n",
+ 4 + i, nat[i] ? '*' : ' ', r[i],
+ (vals[i] & 1) ? '*' : ' ', vals[i]);
+
+ if (vals[i] & 1)
+ {
+ if (!nat[i])
+ panic ("%s: r%d not a NaT!\n", __FUNCTION__, 4 + i);
+ }
+ else
+ {
+ if (nat[i])
+ panic ("%s: r%d a NaT!\n", __FUNCTION__, 4 + i);
+ if (r[i] != vals[i])
+ panic ("%s: r%d=%lx instead of %lx!\n",
+ __FUNCTION__, 4 + i, r[i], vals[i]);
+ }
+ }
+ return vals;
+}
+
+static unw_word_t *
+check_static_to_fr (unw_cursor_t *c, unw_word_t *vals)
+{
+ unw_word_t r4;
+ unw_word_t nat4;
+ int ret;
+
+ if (verbose)
+ printf (" %s()\n", __FUNCTION__);
+
+ vals -= 1;
+
+ if ((ret = unw_get_reg (c, UNW_IA64_GR + 4, &r4)) < 0)
+ panic ("%s: failed to read register r4, error=%d\n", __FUNCTION__, ret);
+
+ if ((ret = unw_get_reg (c, UNW_IA64_NAT + 4, &nat4)) < 0)
+ panic ("%s: failed to read register nat4, error=%d\n", __FUNCTION__, ret);
+
+ if (verbose)
+ printf (" r4 = %c%016lx (expected %c%016lx)\n",
+ nat4 ? '*' : ' ', r4, (vals[0] & 1) ? '*' : ' ', vals[0]);
+
+ if (vals[0] & 1)
+ {
+ if (!nat4)
+ panic ("%s: r4 not a NaT!\n", __FUNCTION__);
+ }
+ else
+ {
+ if (nat4)
+ panic ("%s: r4 a NaT!\n", __FUNCTION__);
+ if (r4 != vals[0])
+ panic ("%s: r4=%lx instead of %lx!\n", __FUNCTION__, r4, vals[0]);
+ }
+ return vals;
+}
+
+static unw_word_t *
+check_static_to_br (unw_cursor_t *c, unw_word_t *vals)
+{
+ unw_word_t r4, nat4;
+ int ret;
+
+ if (verbose)
+ printf (" %s()\n", __FUNCTION__);
+
+ vals -= 1;
+
+ if ((ret = unw_get_reg (c, UNW_IA64_GR + 4, &r4)) < 0)
+ panic ("%s: failed to read register r4, error=%d\n", __FUNCTION__, ret);
+
+ if ((ret = unw_get_reg (c, UNW_IA64_NAT + 4, &nat4)) < 0)
+ panic ("%s: failed to read register nat4, error=%d\n", __FUNCTION__, ret);
+
+ if (verbose)
+ printf (" r4 = %c%016lx (expected %c%016lx)\n",
+ nat4 ? '*' : ' ', r4, (vals[0] & 1) ? '*' : ' ', vals[0]);
+
+ if (vals[0] & 1)
+ {
+ if (!nat4)
+ panic ("%s: r4 not a NaT!\n", __FUNCTION__);
+ }
+ else
+ {
+ if (nat4)
+ panic ("%s: r4 a NaT!\n", __FUNCTION__);
+ if (r4 != vals[0])
+ panic ("%s: r4=%lx instead of %lx!\n", __FUNCTION__, r4, vals[0]);
+ }
+ return vals;
+}
+
+static unw_word_t *
+check_static_to_mem (unw_cursor_t *c, unw_word_t *vals)
+{
+ unw_word_t r5, nat5;
+ int ret;
+
+ if (verbose)
+ printf (" %s()\n", __FUNCTION__);
+
+ vals -= 1;
+
+ if ((ret = unw_get_reg (c, UNW_IA64_GR + 5, &r5)) < 0)
+ panic ("%s: failed to read register r5, error=%d\n", __FUNCTION__, ret);
+
+ if ((ret = unw_get_reg (c, UNW_IA64_NAT + 5, &nat5)) < 0)
+ panic ("%s: failed to read register nat5, error=%d\n", __FUNCTION__, ret);
+
+ if (verbose)
+ printf (" r5 = %c%016lx (expected %c%016lx)\n",
+ nat5 ? '*' : ' ', r5, (vals[0] & 1) ? '*' : ' ', vals[0]);
+
+ if (vals[0] & 1)
+ {
+ if (!nat5)
+ panic ("%s: r5 not a NaT!\n", __FUNCTION__);
+ }
+ else
+ {
+ if (nat5)
+ panic ("%s: r5 a NaT!\n", __FUNCTION__);
+ if (r5 != vals[0])
+ panic ("%s: r5=%lx instead of %lx!\n", __FUNCTION__, r5, vals[0]);
+ }
+ return vals;
+}
+
+static unw_word_t *
+check_static_to_memN (unw_cursor_t *c, unw_word_t *vals, const char *func)
+{
+ unw_word_t r6, nat6;
+ int ret;
+
+ if (verbose)
+ printf (" %s()\n", func);
+
+ vals -= 1;
+
+ if ((ret = unw_get_reg (c, UNW_IA64_GR + 6, &r6)) < 0)
+ panic ("%s: failed to read register r6, error=%d\n", __FUNCTION__, ret);
+
+ if ((ret = unw_get_reg (c, UNW_IA64_NAT + 6, &nat6)) < 0)
+ panic ("%s: failed to read register nat6, error=%d\n", __FUNCTION__, ret);
+
+ if (verbose)
+ printf (" r6 = %c%016lx (expected %c%016lx)\n",
+ nat6 ? '*' : ' ', r6, (vals[0] & 1) ? '*' : ' ', vals[0]);
+
+ if (vals[0] & 1)
+ {
+ if (!nat6)
+ panic ("%s: r6 not a NaT!\n", __FUNCTION__);
+ }
+ else
+ {
+ if (nat6)
+ panic ("%s: r6 a NaT!\n", __FUNCTION__);
+ if (r6 != vals[0])
+ panic ("%s: r6=%lx instead of %lx!\n", __FUNCTION__, r6, vals[0]);
+ }
+ return vals;
+}
+
+static unw_word_t *
+check_static_to_mem2 (unw_cursor_t *c, unw_word_t *vals)
+{
+ return check_static_to_memN (c, vals, __FUNCTION__);
+}
+
+static unw_word_t *
+check_static_to_mem3 (unw_cursor_t *c, unw_word_t *vals)
+{
+ return check_static_to_memN (c, vals, __FUNCTION__);
+}
+
+static unw_word_t *
+check_static_to_mem4 (unw_cursor_t *c, unw_word_t *vals)
+{
+ return check_static_to_memN (c, vals, __FUNCTION__);
+}
+
+static unw_word_t *
+check_static_to_mem5 (unw_cursor_t *c, unw_word_t *vals)
+{
+ return check_static_to_memN (c, vals, __FUNCTION__);
+}
+
+static unw_word_t *
+check_static_to_scratch (unw_cursor_t *c, unw_word_t *vals)
+{
+ unw_word_t r[4], nat[4], ec, expected;
+ unw_fpreg_t f4;
+ int i, ret;
+
+ if (verbose)
+ printf (" %s()\n", __FUNCTION__);
+
+ vals -= 4;
+
+ while (!unw_is_signal_frame (c))
+ if ((ret = unw_step (c)) < 0)
+ panic ("%s: unw_step (ret=%d): Failed to skip over signal handler\n",
+ __FUNCTION__, ret);
+ if ((ret = unw_step (c)) < 0)
+ panic ("%s: unw_step (ret=%d): Failed to skip over signal handler\n",
+ __FUNCTION__, ret);
+
+ for (i = 0; i < 4; ++i)
+ if ((ret = unw_get_reg (c, UNW_IA64_GR + 4 + i, &r[i])) < 0)
+ panic ("%s: failed to read register r%d, error=%d\n",
+ __FUNCTION__, 4 + i, ret);
+
+ for (i = 0; i < 4; ++i)
+ if ((ret = unw_get_reg (c, UNW_IA64_NAT + 4 + i, &nat[i])) < 0)
+ panic ("%s: failed to read register nat%d, error=%d\n",
+ __FUNCTION__, 4 + i, ret);
+
+ for (i = 0; i < 4; ++i)
+ {
+ if (verbose)
+ printf (" r%d = %c%016lx (expected %c%016lx)\n",
+ 4 + i, nat[i] ? '*' : ' ', r[i],
+ (vals[i] & 1) ? '*' : ' ', vals[i]);
+
+ if (vals[i] & 1)
+ {
+ if (!nat[i])
+ panic ("%s: r%d not a NaT!\n", __FUNCTION__, 4 + i);
+ }
+ else
+ {
+ if (nat[i])
+ panic ("%s: r%d a NaT!\n", __FUNCTION__, 4 + i);
+ if (r[i] != vals[i])
+ panic ("%s: r%d=%lx instead of %lx!\n",
+ __FUNCTION__, 4 + i, r[i], vals[i]);
+ }
+ }
+ if ((ret = unw_get_fpreg (c, UNW_IA64_FR + 4, &f4)) < 0)
+ panic ("%s: failed to read f4, error=%d\n", __FUNCTION__, ret);
+
+ /* These tests are little-endian specific: */
+ if (nat[0])
+ {
+ if (f4.raw.bits[0] != 0 || f4.raw.bits[1] != 0x1fffe)
+ panic ("%s: f4=%016lx.%016lx instead of NaTVal!\n",
+ __FUNCTION__, f4.raw.bits[1], f4.raw.bits[0]);
+ }
+ else
+ {
+ if (f4.raw.bits[0] != r[0] || f4.raw.bits[1] != 0x1003e)
+ panic ("%s: f4=%016lx.%016lx instead of %lx!\n",
+ __FUNCTION__, f4.raw.bits[1], f4.raw.bits[0], r[0]);
+ }
+
+ if ((unw_get_reg (c, UNW_IA64_AR_EC, &ec)) < 0)
+ panic ("%s: failed to read register ar.ec, error=%d\n", __FUNCTION__, ret);
+
+ expected = vals[0] & 0x3f;
+ if (ec != expected)
+ panic ("%s: ar.ec=%016lx instead of %016lx!\n",
+ __FUNCTION__, ec, expected);
+
+ return vals;
+}
+
+static unw_word_t *
+check_pr (unw_cursor_t *c, unw_word_t *vals)
+{
+ unw_word_t pr, expected;
+ int ret;
+# define BIT(n) ((unw_word_t) 1 << (n))
+# define DONTCARE (BIT( 6) | BIT( 7) | BIT( 8) | BIT( 9) | BIT(10) \
+ | BIT(11) | BIT(12) | BIT(13) | BIT(14) | BIT(15))
+
+ if (verbose)
+ printf (" %s()\n", __FUNCTION__);
+
+ vals -= 1;
+
+ if ((ret = unw_get_reg (c, UNW_IA64_PR, &pr)) < 0)
+ panic ("%s: failed to read register pr, error=%d\n", __FUNCTION__, ret);
+
+ pr &= ~DONTCARE;
+ expected = (vals[0] & ~DONTCARE) | 1;
+
+ if (verbose)
+ printf (" pr = %016lx (expected %016lx)\n", pr, expected);
+
+ if (pr != expected)
+ panic ("%s: pr=%lx instead of %lx!\n", __FUNCTION__, pr, expected);
+
+ if ((ret = unw_set_reg (c, UNW_IA64_PR, vals[0])) < 0)
+ panic ("%s: failed to write register pr, error=%d\n", __FUNCTION__, ret);
+
+ if ((ret = unw_get_reg (c, UNW_IA64_PR, &pr)) < 0)
+ panic ("%s: failed to read register pr, error=%d\n", __FUNCTION__, ret);
+
+ if (pr != vals[0])
+ panic ("%s: secondary pr=%lx instead of %lx!\n",
+ __FUNCTION__, pr, vals[0]);
+ return vals;
+}
+
+static unw_word_t *
+check_rotate_regs (unw_cursor_t *c, unw_word_t *vals)
+{
+ if (verbose)
+ printf (" %s()\n", __FUNCTION__);
+ return check_pr (c, vals - 1);
+}
+
+static void
+start_checks (void *funcs, unsigned long *vals)
+{
+ unw_context_t uc;
+ unw_cursor_t c;
+ int i, ret;
+
+ disable_sighandler ();
+
+ unw_getcontext (&uc);
+
+ if ((ret = unw_init_local (&c, &uc)) < 0)
+ panic ("%s: unw_init_local (ret=%d)\n", __FUNCTION__, ret);
+
+ if ((ret = unw_step (&c)) < 0)
+ panic ("%s: unw_step (ret=%d)\n", __FUNCTION__, ret);
+
+ for (i = 0; i < num_checks; ++i)
+ {
+ vals = (*checks[num_checks - 1 - i]) (&c, vals);
+
+ if ((ret = unw_step (&c)) < 0)
+ panic ("%s: unw_step (ret=%d)\n", __FUNCTION__, ret);
+ }
+}
+
+static void
+run_check (int test)
+{
+ int index, i;
+
+ if (test == 1)
+ /* Make first test always go the full depth... */
+ num_checks = MAX_CHECKS;
+ else
+ num_checks = (random () % MAX_CHECKS) + 1;
+
+ for (i = 0; i < num_checks * MAX_VALUES_PER_FUNC; ++i)
+ values[i] = random_word ();
+
+ for (i = 0; i < num_checks; ++i)
+ {
+ if (test == 1)
+ /* Make first test once go through each test... */
+ index = i % (int) ARRAY_SIZE (all_funcs);
+ else
+ index = random () % (int) ARRAY_SIZE (all_funcs);
+ funcs[i] = all_funcs[index].func;
+ checks[i] = all_funcs[index].check;
+ }
+
+ funcs[num_checks] = start_checks;
+
+ enable_sighandler ();
+ (*funcs[0]) (funcs + 1, values);
+}
+
+int
+main (int argc, char **argv)
+{
+ int i;
+
+ if (argc > 1)
+ verbose = 1;
+
+ for (i = 0; i < NUM_RUNS; ++i)
+ {
+ if (verbose)
+ printf ("Run %d\n", i + 1);
+ run_check (i + 1);
+ }
+
+ if (nerrors > 0)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
+ exit (-1);
+ }
+ if (verbose)
+ printf ("SUCCESS.\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gia64-test-rbs.c b/src/pal/src/libunwind/tests/Gia64-test-rbs.c
new file mode 100644
index 0000000000..2181e70fd3
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gia64-test-rbs.c
@@ -0,0 +1,193 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file tests corner-cases of unwinding across multiple stacks.
+ In particular, it verifies that the extreme case with a frame of 96
+ stacked registers that are all backed up by separate stacks works
+ as expected. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libunwind.h>
+#include "compiler.h"
+
+#include "ia64-test-rbs.h"
+
+#define panic(args...) \
+ do { fprintf (stderr, args); ++nerrors; return -9999; } while (0)
+
+/* The loadrs field in ar.rsc is 14 bits wide, which limits all ia64
+ implementations to at most 2048 physical stacked registers
+ (actually, slightly less than that, because loadrs also counts RNaT
+ slots). Since we can dirty 93 stacked registers per recursion, we
+ need to recurse RECURSION_DEPTH times to ensure all physical
+ stacked registers are in use. */
+#define MAX_PHYS_STACKED 2048
+#define RECURSION_DEPTH ((MAX_PHYS_STACKED + 92) / 93)
+
+typedef int spill_func_t (long iteration, int (*next_func[])());
+
+extern int loadup (long iteration, int *values, int (*next_func[])());
+extern char resumption_point_label;
+
+#define DCL(n) \
+ extern int rbs_spill_##n (long iteration, int (*next_func[])())
+ DCL(2); DCL(3); DCL(4); DCL(5); DCL(6); DCL(7);
+ DCL(8); DCL(9); DCL(10); DCL(11); DCL(12); DCL(13); DCL(14); DCL(15);
+ DCL(16); DCL(17); DCL(18); DCL(19); DCL(20); DCL(21); DCL(22); DCL(23);
+ DCL(24); DCL(25); DCL(26); DCL(27); DCL(28); DCL(29); DCL(30); DCL(31);
+ DCL(32); DCL(33); DCL(34); DCL(35); DCL(36); DCL(37); DCL(38); DCL(39);
+ DCL(40); DCL(41); DCL(42); DCL(43); DCL(44); DCL(45); DCL(46); DCL(47);
+ DCL(48); DCL(49); DCL(50); DCL(51); DCL(52); DCL(53); DCL(54); DCL(55);
+ DCL(56); DCL(57); DCL(58); DCL(59); DCL(60); DCL(61); DCL(62); DCL(63);
+ DCL(64); DCL(65); DCL(66); DCL(67); DCL(68); DCL(69); DCL(70); DCL(71);
+ DCL(72); DCL(73); DCL(74); DCL(75); DCL(76); DCL(77); DCL(78); DCL(79);
+ DCL(80); DCL(81); DCL(82); DCL(83); DCL(84); DCL(85); DCL(86); DCL(87);
+ DCL(88); DCL(89); DCL(90); DCL(91); DCL(92); DCL(93); DCL(94);
+
+#define SPL(n) rbs_spill_##n
+spill_func_t *spill_funcs[] =
+ {
+ SPL(2), SPL(3), SPL(4), SPL(5), SPL(6), SPL(7),
+ SPL(8), SPL(9), SPL(10), SPL(11), SPL(12), SPL(13), SPL(14), SPL(15),
+ SPL(16), SPL(17), SPL(18), SPL(19), SPL(20), SPL(21), SPL(22), SPL(23),
+ SPL(24), SPL(25), SPL(26), SPL(27), SPL(28), SPL(29), SPL(30), SPL(31),
+ SPL(32), SPL(33), SPL(34), SPL(35), SPL(36), SPL(37), SPL(38), SPL(39),
+ SPL(40), SPL(41), SPL(42), SPL(43), SPL(44), SPL(45), SPL(46), SPL(47),
+ SPL(48), SPL(49), SPL(50), SPL(51), SPL(52), SPL(53), SPL(54), SPL(55),
+ SPL(56), SPL(57), SPL(58), SPL(59), SPL(60), SPL(61), SPL(62), SPL(63),
+ SPL(64), SPL(65), SPL(66), SPL(67), SPL(68), SPL(69), SPL(70), SPL(71),
+ SPL(72), SPL(73), SPL(74), SPL(75), SPL(76), SPL(77), SPL(78), SPL(79),
+ SPL(80), SPL(81), SPL(82), SPL(83), SPL(84), SPL(85), SPL(86), SPL(87),
+ SPL(88), SPL(89), SPL(90), SPL(91), SPL(92), SPL(93), SPL(94)
+ };
+
+static int verbose;
+static int nerrors;
+static int unwind_count;
+
+static int
+unwind_and_resume (long iteration, int (*next_func[])())
+{
+ unw_context_t uc;
+ unw_cursor_t c;
+ unw_word_t ip;
+ int i, ret;
+
+ if (verbose)
+ printf (" %s(iteration=%ld, next_func=%p)\n",
+ __FUNCTION__, iteration, next_func);
+
+ unw_getcontext (&uc);
+ if ((ret = unw_init_local (&c, &uc)) < 0)
+ panic ("unw_init_local (ret=%d)", ret);
+
+ for (i = 0; i < unwind_count; ++i)
+ if ((ret = unw_step (&c)) < 0)
+ panic ("unw_step (ret=%d)", ret);
+
+ if (unw_get_reg (&c, UNW_REG_IP, &ip) < 0
+ || unw_set_reg (&c, UNW_REG_IP, (unw_word_t) &resumption_point_label) < 0
+ || unw_set_reg (&c, UNW_REG_EH + 0, 0) /* ret val */
+ || unw_set_reg (&c, UNW_REG_EH + 1, ip))
+ panic ("failed to redirect to resumption_point\n");
+
+ if (verbose)
+ {
+ unw_word_t bsp;
+ if (unw_get_reg (&c, UNW_IA64_BSP, &bsp) < 0)
+ panic ("unw_get_reg() failed\n");
+ printf (" bsp=%lx, old ip=%lx, new ip=%p\n", bsp,
+ ip, &resumption_point_label);
+ }
+
+ ret = unw_resume (&c);
+ panic ("unw_resume() returned (ret=%d)!!\n", ret);
+ return 0;
+}
+
+static int
+run_check (int test)
+{
+ int nfuncs, nspills, n, ret, i, reg_values[88];
+ spill_func_t *func[NSTACKS + 1];
+
+ /* First, generate a set of 88 random values which loadup() will load
+ into loc2-loc89 (r37-r124). */
+ for (i = 0; i < (int) ARRAY_SIZE (reg_values); ++i)
+ {
+ reg_values[i] = random ();
+ /* Generate NaTs with a reasonably probability (1/16th): */
+ if (reg_values[i] < 0x10000000)
+ reg_values[i] = 0;
+ }
+
+ nspills = 0;
+ nfuncs = 0;
+ do
+ {
+ n = random () % (int) ARRAY_SIZE (spill_funcs);
+ func[nfuncs++] = spill_funcs[n];
+ nspills += 2 + n;
+ }
+ while (nspills < 128);
+ func[nfuncs++] = unwind_and_resume;
+
+ unwind_count = 1 + (random () % (nfuncs + RECURSION_DEPTH - 1));
+
+ if (verbose)
+ printf ("test%d: nfuncs=%d, unwind_count=%d\n",
+ test, nfuncs, unwind_count);
+
+ ret = loadup (RECURSION_DEPTH, reg_values, func);
+ if (ret < 0)
+ panic ("test%d: load() returned %d\n", test, ret);
+ else if (ret != RECURSION_DEPTH + nfuncs - unwind_count)
+ panic ("test%d: resumed wrong frame: expected %d, got %d\n",
+ test, RECURSION_DEPTH + nfuncs - unwind_count, ret);
+ return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ int i;
+
+ if (argc > 1)
+ verbose = 1;
+
+ for (i = 0; i < 100000; ++i)
+ run_check (i + 1);
+
+ if (nerrors > 0)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
+ exit (-1);
+ }
+ if (verbose)
+ printf ("SUCCESS.\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gia64-test-readonly.c b/src/pal/src/libunwind/tests/Gia64-test-readonly.c
new file mode 100644
index 0000000000..25f0506102
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gia64-test-readonly.c
@@ -0,0 +1,89 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file verifies that read-only registers cannot be written to. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libunwind.h>
+
+#define panic(args...) \
+ do { printf (args); ++nerrors; } while (0)
+
+static int verbose;
+static int nerrors;
+
+extern void test_func (void (*) (void));
+
+void
+checker (void)
+{
+ unw_fpreg_t fpval;
+ unw_context_t uc;
+ unw_cursor_t c;
+ int ret;
+
+ fpval.raw.bits[0] = 100;
+ fpval.raw.bits[1] = 101;
+
+ unw_getcontext (&uc);
+
+ if ((ret = unw_init_local (&c, &uc)) < 0)
+ panic ("%s: unw_init_local (ret=%d)\n", __FUNCTION__, ret);
+
+ if ((ret = unw_step (&c)) < 0)
+ panic ("%s: unw_step (ret=%d)\n", __FUNCTION__, ret);
+
+ if ((ret = unw_step (&c)) < 0)
+ panic ("%s: unw_step (ret=%d)\n", __FUNCTION__, ret);
+
+ if ((ret = unw_set_reg (&c, UNW_IA64_IP, 99)) != -UNW_EREADONLYREG)
+ panic ("%s: unw_set_reg (ip) returned %d instead of %d\n",
+ __FUNCTION__, ret, -UNW_EREADONLYREG);
+ if ((ret = unw_set_reg (&c, UNW_IA64_AR_LC, 99)) != -UNW_EREADONLYREG)
+ panic ("%s: unw_set_reg (ar.lc) returned %d instead of %d\n",
+ __FUNCTION__, ret, -UNW_EREADONLYREG);
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc > 1)
+ verbose = 1;
+
+ test_func (checker);
+
+ if (nerrors > 0)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
+ exit (-1);
+ }
+ if (verbose)
+ printf ("SUCCESS.\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gia64-test-stack.c b/src/pal/src/libunwind/tests/Gia64-test-stack.c
new file mode 100644
index 0000000000..05874b291f
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gia64-test-stack.c
@@ -0,0 +1,176 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file tests corner-cases of unwinding across multiple stacks.
+ In particular, it verifies that the extreme case with a frame of 96
+ stacked registers that are all backed up by separate stacks works
+ as expected. */
+
+#include <libunwind.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ia64-test-stack.h"
+
+#define panic(args...) \
+ { printf (args); ++nerrors; }
+
+/* The loadrs field in ar.rsc is 14 bits wide, which limits all ia64
+ implementations to at most 2048 physical stacked registers
+ (actually, slightly less than that, because loadrs also counts RNaT
+ slots). Since we can dirty 95 stacked registers per recursion, we
+ need to recurse RECURSION_DEPTH times to ensure all physical
+ stacked registers are in use. */
+#define MAX_PHYS_STACKED 2048
+#define RECURSION_DEPTH ((MAX_PHYS_STACKED + 94) / 95)
+
+extern void touch_all (unsigned long recursion_depth);
+extern void flushrs (void);
+
+int nerrors;
+int verbose;
+
+void
+do_unwind_tests (void)
+{
+ unw_word_t ip, sp, bsp, v0, v1, v2, v3, n0, n1, n2, n3, cfm, sof, sol, r32;
+ int ret, reg, i, l;
+ unw_context_t uc;
+ unw_cursor_t c;
+
+ if (verbose)
+ printf ("do_unwind_tests: here we go!\n");
+
+ /* do a full stack-dump: */
+ unw_getcontext (&uc);
+ unw_init_local (&c, &uc);
+ i = 0;
+ do
+ {
+ if (verbose)
+ {
+ if ((ret = unw_get_reg (&c, UNW_IA64_IP, &ip)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_SP, &sp)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_BSP, &bsp)) < 0)
+ break;
+ printf ("ip=0x%16lx sp=0x%16lx bsp=0x%16lx\n", ip, sp, bsp);
+
+ for (reg = 32; reg < 128; reg += 4)
+ {
+ v0 = v1 = v2 = v3 = 0;
+ n0 = n1 = n2 = n3 = 0;
+ (void)
+ ((ret = unw_get_reg (&c, UNW_IA64_GR + reg, &v0)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_NAT + reg, &n0)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_GR + reg + 1, &v1)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_NAT + reg + 1, &n1)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_GR + reg + 2, &v2)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_NAT + reg + 2, &n2)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_GR + reg + 3, &v3)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_NAT + reg + 3, &n3)) < 0);
+ if (reg < 100)
+ printf (" r%d", reg);
+ else
+ printf (" r%d", reg);
+ printf (" %c%016lx %c%016lx %c%016lx %c%016lx\n",
+ n0 ? '*' : ' ', v0, n1 ? '*' : ' ', v1,
+ n2 ? '*' : ' ', v2, n3 ? '*' : ' ', v3);
+ if (ret < 0)
+ break;
+ }
+ }
+
+ if (i >= 1 && i <= NSTACKS)
+ {
+ if ((ret = unw_get_reg (&c, UNW_IA64_CFM, &cfm)) < 0)
+ break;
+ sof = cfm & 0x7f;
+ if (sof != (unw_word_t) (i & 1))
+ panic ("\texpected sof=%d, found sof=%lu\n", i - 1, sof);
+ if (sof == 1)
+ {
+ if ((ret = unw_get_reg (&c, UNW_IA64_GR + 32, &r32)) < 0)
+ break;
+ if (r32 != (unw_word_t) (i - 1))
+ panic ("\texpected r32=%d, found r32=%lu\n", i - 1, r32);
+ }
+ }
+ else if (i > NSTACKS && i <= NSTACKS + RECURSION_DEPTH)
+ {
+ if ((ret = unw_get_reg (&c, UNW_IA64_CFM, &cfm)) < 0)
+ break;
+ sof = cfm & 0x7f;
+ sol = (cfm >> 7) & 0x7f;
+ if (sof != 96)
+ panic ("\texpected sof=96, found sof=%lu\n", sof);
+ if (sol != 95)
+ panic ("\texpected sol=95, found sol=%lu\n", sol);
+
+ for (l = 2; l <= 93; ++l)
+ {
+ if ((ret = unw_get_reg (&c, UNW_IA64_GR + 33 + l, &v0)) < 0
+ || (ret = unw_get_reg (&c, UNW_IA64_NAT + 33 + l, &n0)) < 0)
+ break;
+ switch (l)
+ {
+ case 2: case 31: case 73: case 93:
+ if (!n0)
+ panic ("\texpected loc%d to be a NaT!\n", l);
+ break;
+
+ default:
+ if (n0)
+ panic ("\tloc%d is unexpectedly a NaT!\n", l);
+ v1 = ((unw_word_t) (i - NSTACKS) << 32) + l;
+ if (v0 != v1)
+ panic ("\tloc%d expected to be %lx, found to be %lx\n",
+ l, v1, v0);
+ }
+ }
+ }
+ ++i;
+ }
+ while ((ret = unw_step (&c)) > 0);
+
+ if (ret < 0)
+ panic ("libunwind returned %d\n", ret);
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc > 1)
+ ++verbose;
+
+ touch_all (RECURSION_DEPTH);
+ if (nerrors)
+ {
+ printf ("FAILURE: detected %d errors\n", nerrors);
+ exit (-1);
+ }
+ if (verbose)
+ printf ("SUCCESS\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gperf-simple.c b/src/pal/src/libunwind/tests/Gperf-simple.c
new file mode 100644
index 0000000000..e181918214
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gperf-simple.c
@@ -0,0 +1,264 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <libunwind.h>
+#include "compiler.h"
+
+#include <sys/resource.h>
+#include <sys/time.h>
+
+#define panic(args...) \
+ do { fprintf (stderr, args); exit (-1); } while (0)
+
+long dummy;
+
+static long iterations = 10000;
+static int maxlevel = 100;
+
+#define KB 1024
+#define MB (1024*1024)
+
+static char big[64*MB]; /* should be >> max. cache size */
+
+static inline double
+gettime (void)
+{
+ struct timeval tv;
+
+ gettimeofday (&tv, NULL);
+ return tv.tv_sec + 1e-6*tv.tv_usec;
+}
+
+static int NOINLINE
+measure_unwind (int maxlevel, double *step)
+{
+ double stop, start;
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ int ret, level = 0;
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local() failed\n");
+
+ start = gettime ();
+
+ do
+ {
+ ret = unw_step (&cursor);
+ if (ret < 0)
+ panic ("unw_step() failed\n");
+ ++level;
+ }
+ while (ret > 0);
+
+ stop = gettime ();
+
+ if (level <= maxlevel)
+ panic ("Unwound only %d levels, expected at least %d levels\n",
+ level, maxlevel);
+
+ *step = (stop - start) / (double) level;
+ return 0;
+}
+
+static int f1 (int, int, double *);
+
+static int NOINLINE
+g1 (int level, int maxlevel, double *step)
+{
+ if (level == maxlevel)
+ return measure_unwind (maxlevel, step);
+ else
+ /* defeat last-call/sibcall optimization */
+ return f1 (level + 1, maxlevel, step) + level;
+}
+
+static int NOINLINE
+f1 (int level, int maxlevel, double *step)
+{
+ if (level == maxlevel)
+ return measure_unwind (maxlevel, step);
+ else
+ /* defeat last-call/sibcall optimization */
+ return g1 (level + 1, maxlevel, step) + level;
+}
+
+static void
+doit (const char *label)
+{
+ double step, min_step, first_step, sum_step;
+ int i;
+
+ sum_step = first_step = 0.0;
+ min_step = 1e99;
+ for (i = 0; i < iterations; ++i)
+ {
+ f1 (0, maxlevel, &step);
+
+ sum_step += step;
+
+ if (step < min_step)
+ min_step = step;
+
+ if (i == 0)
+ first_step = step;
+ }
+ printf ("%s: unw_step : 1st=%9.3f min=%9.3f avg=%9.3f nsec\n", label,
+ 1e9*first_step, 1e9*min_step, 1e9*sum_step/iterations);
+}
+
+static long
+sum (void *buf, size_t size)
+{
+ long s = 0;
+ char *cp = buf;
+ size_t i;
+
+ for (i = 0; i < size; i += 8)
+ s += cp[i];
+ return s;
+}
+
+static void
+measure_init (void)
+{
+# define N 100
+# define M 10 /* must be at least 2 to get steady-state */
+ double stop, start, get_cold, get_warm, init_cold, init_warm, delta;
+ struct
+ {
+ unw_cursor_t c;
+ char padding[1024]; /* should be > 2 * max. cacheline size */
+ }
+ cursor[N];
+ struct
+ {
+ unw_context_t uc;
+ char padding[1024]; /* should be > 2 * max. cacheline size */
+ }
+ uc[N];
+ int i, j;
+
+ /* Run each test M times and take the minimum to filter out noise
+ such dynamic linker resolving overhead, context-switches,
+ page-in, cache, and TLB effects. */
+
+ get_cold = 1e99;
+ for (j = 0; j < M; ++j)
+ {
+ dummy += sum (big, sizeof (big)); /* flush the cache */
+ for (i = 0; i < N; ++i)
+ uc[i].padding[511] = i; /* warm up the TLB */
+ start = gettime ();
+ for (i = 0; i < N; ++i)
+ unw_getcontext (&uc[i].uc);
+ stop = gettime ();
+ delta = (stop - start) / N;
+ if (delta < get_cold)
+ get_cold = delta;
+ }
+
+ init_cold = 1e99;
+ for (j = 0; j < M; ++j)
+ {
+ dummy += sum (big, sizeof (big)); /* flush cache */
+ for (i = 0; i < N; ++i)
+ uc[i].padding[511] = i; /* warm up the TLB */
+ start = gettime ();
+ for (i = 0; i < N; ++i)
+ unw_init_local (&cursor[i].c, &uc[i].uc);
+ stop = gettime ();
+ delta = (stop - start) / N;
+ if (delta < init_cold)
+ init_cold = delta;
+ }
+
+ get_warm = 1e99;
+ for (j = 0; j < M; ++j)
+ {
+ start = gettime ();
+ for (i = 0; i < N; ++i)
+ unw_getcontext (&uc[0].uc);
+ stop = gettime ();
+ delta = (stop - start) / N;
+ if (delta < get_warm)
+ get_warm = delta;
+ }
+
+ init_warm = 1e99;
+ for (j = 0; j < M; ++j)
+ {
+ start = gettime ();
+ for (i = 0; i < N; ++i)
+ unw_init_local (&cursor[0].c, &uc[0].uc);
+ stop = gettime ();
+ delta = (stop - start) / N;
+ if (delta < init_warm)
+ init_warm = delta;
+ }
+
+ printf ("unw_getcontext : cold avg=%9.3f nsec, warm avg=%9.3f nsec\n",
+ 1e9 * get_cold, 1e9 * get_warm);
+ printf ("unw_init_local : cold avg=%9.3f nsec, warm avg=%9.3f nsec\n",
+ 1e9 * init_cold, 1e9 * init_warm);
+}
+
+int
+main (int argc, char **argv)
+{
+ struct rlimit rlim;
+
+ rlim.rlim_cur = RLIM_INFINITY;
+ rlim.rlim_max = RLIM_INFINITY;
+ setrlimit (RLIMIT_STACK, &rlim);
+
+ memset (big, 0xaa, sizeof (big));
+
+ if (argc > 1)
+ {
+ maxlevel = atol (argv[1]);
+ if (argc > 2)
+ iterations = atol (argv[2]);
+ }
+
+ measure_init ();
+
+ doit ("default ");
+
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_NONE);
+ doit ("no cache ");
+
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL);
+ doit ("global cache ");
+
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
+ doit ("per-thread cache");
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gperf-trace.c b/src/pal/src/libunwind/tests/Gperf-trace.c
new file mode 100644
index 0000000000..4d24fa5ca8
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gperf-trace.c
@@ -0,0 +1,250 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <libunwind.h>
+#include "compiler.h"
+
+#include <sys/resource.h>
+#include <sys/time.h>
+
+#define panic(args...) \
+ do { fprintf (stderr, args); exit (-1); } while (0)
+
+long dummy;
+
+static long iterations = 10000;
+static int maxlevel = 100;
+
+#define KB 1024
+#define MB (1024*1024)
+
+static char big[64*MB]; /* should be >> max. cache size */
+
+static inline double
+gettime (void)
+{
+ struct timeval tv;
+
+ gettimeofday (&tv, NULL);
+ return tv.tv_sec + 1e-6*tv.tv_usec;
+}
+
+static int NOINLINE
+measure_unwind (int maxlevel, double *step)
+{
+ double stop, start;
+ int level = 0;
+ void *buffer[128];
+
+ start = gettime ();
+ level = unw_backtrace(buffer, 128);
+ stop = gettime ();
+
+ if (level <= maxlevel)
+ panic ("Unwound only %d levels, expected at least %d levels\n",
+ level, maxlevel);
+
+ *step = (stop - start) / (double) level;
+ return 0;
+}
+
+static int f1 (int, int, double *);
+
+static int NOINLINE
+g1 (int level, int maxlevel, double *step)
+{
+ if (level == maxlevel)
+ return measure_unwind (maxlevel, step);
+ else
+ /* defeat last-call/sibcall optimization */
+ return f1 (level + 1, maxlevel, step) + level;
+}
+
+static int NOINLINE
+f1 (int level, int maxlevel, double *step)
+{
+ if (level == maxlevel)
+ return measure_unwind (maxlevel, step);
+ else
+ /* defeat last-call/sibcall optimization */
+ return g1 (level + 1, maxlevel, step) + level;
+}
+
+static void
+doit (const char *label)
+{
+ double step, min_step, first_step, sum_step;
+ int i;
+
+ sum_step = first_step = 0.0;
+ min_step = 1e99;
+ for (i = 0; i < iterations; ++i)
+ {
+ f1 (0, maxlevel, &step);
+
+ sum_step += step;
+
+ if (step < min_step)
+ min_step = step;
+
+ if (i == 0)
+ first_step = step;
+ }
+ printf ("%s: unw_step : 1st=%9.3f min=%9.3f avg=%9.3f nsec\n", label,
+ 1e9*first_step, 1e9*min_step, 1e9*sum_step/iterations);
+}
+
+static long
+sum (void *buf, size_t size)
+{
+ long s = 0;
+ char *cp = buf;
+ size_t i;
+
+ for (i = 0; i < size; i += 8)
+ s += cp[i];
+ return s;
+}
+
+static void
+measure_init (void)
+{
+# define N 100
+# define M 10 /* must be at least 2 to get steady-state */
+ double stop, start, get_cold, get_warm, init_cold, init_warm, delta;
+ struct
+ {
+ unw_cursor_t c;
+ char padding[1024]; /* should be > 2 * max. cacheline size */
+ }
+ cursor[N];
+ struct
+ {
+ unw_context_t uc;
+ char padding[1024]; /* should be > 2 * max. cacheline size */
+ }
+ uc[N];
+ int i, j;
+
+ /* Run each test M times and take the minimum to filter out noise
+ such dynamic linker resolving overhead, context-switches,
+ page-in, cache, and TLB effects. */
+
+ get_cold = 1e99;
+ for (j = 0; j < M; ++j)
+ {
+ dummy += sum (big, sizeof (big)); /* flush the cache */
+ for (i = 0; i < N; ++i)
+ uc[i].padding[511] = i; /* warm up the TLB */
+ start = gettime ();
+ for (i = 0; i < N; ++i)
+ unw_getcontext (&uc[i].uc);
+ stop = gettime ();
+ delta = (stop - start) / N;
+ if (delta < get_cold)
+ get_cold = delta;
+ }
+
+ init_cold = 1e99;
+ for (j = 0; j < M; ++j)
+ {
+ dummy += sum (big, sizeof (big)); /* flush cache */
+ for (i = 0; i < N; ++i)
+ uc[i].padding[511] = i; /* warm up the TLB */
+ start = gettime ();
+ for (i = 0; i < N; ++i)
+ unw_init_local (&cursor[i].c, &uc[i].uc);
+ stop = gettime ();
+ delta = (stop - start) / N;
+ if (delta < init_cold)
+ init_cold = delta;
+ }
+
+ get_warm = 1e99;
+ for (j = 0; j < M; ++j)
+ {
+ start = gettime ();
+ for (i = 0; i < N; ++i)
+ unw_getcontext (&uc[0].uc);
+ stop = gettime ();
+ delta = (stop - start) / N;
+ if (delta < get_warm)
+ get_warm = delta;
+ }
+
+ init_warm = 1e99;
+ for (j = 0; j < M; ++j)
+ {
+ start = gettime ();
+ for (i = 0; i < N; ++i)
+ unw_init_local (&cursor[0].c, &uc[0].uc);
+ stop = gettime ();
+ delta = (stop - start) / N;
+ if (delta < init_warm)
+ init_warm = delta;
+ }
+
+ printf ("unw_getcontext : cold avg=%9.3f nsec, warm avg=%9.3f nsec\n",
+ 1e9 * get_cold, 1e9 * get_warm);
+ printf ("unw_init_local : cold avg=%9.3f nsec, warm avg=%9.3f nsec\n",
+ 1e9 * init_cold, 1e9 * init_warm);
+}
+
+int
+main (int argc, char **argv)
+{
+ struct rlimit rlim;
+
+ rlim.rlim_cur = RLIM_INFINITY;
+ rlim.rlim_max = RLIM_INFINITY;
+ setrlimit (RLIMIT_STACK, &rlim);
+
+ memset (big, 0xaa, sizeof (big));
+
+ if (argc > 1)
+ {
+ maxlevel = atol (argv[1]);
+ if (argc > 2)
+ iterations = atol (argv[2]);
+ }
+
+ measure_init ();
+
+ doit ("default ");
+
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_NONE);
+ doit ("no cache ");
+
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL);
+ doit ("global cache ");
+
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
+ doit ("per-thread cache");
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gtest-bt.c b/src/pal/src/libunwind/tests/Gtest-bt.c
new file mode 100644
index 0000000000..beae2a3ccd
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-bt.c
@@ -0,0 +1,263 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "compiler.h"
+
+#include <errno.h>
+#if HAVE_EXECINFO_H
+# include <execinfo.h>
+#else
+ extern int backtrace (void **, int);
+#endif
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ucontext.h>
+#include <unistd.h>
+#include <libunwind.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+#define SIG_STACK_SIZE 0x100000
+
+int verbose;
+int num_errors;
+
+/* These variables are global because they
+ * cause the signal stack to overflow */
+char buf[512], name[256];
+unw_cursor_t cursor;
+unw_context_t uc;
+
+static void
+do_backtrace (void)
+{
+ unw_word_t ip, sp, off;
+ unw_proc_info_t pi;
+ int ret;
+
+ if (verbose)
+ printf ("\texplicit backtrace:\n");
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local failed!\n");
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+ buf[0] = '\0';
+ if (unw_get_proc_name (&cursor, name, sizeof (name), &off) == 0)
+ {
+ if (off)
+ snprintf (buf, sizeof (buf), "<%s+0x%lx>", name, (long) off);
+ else
+ snprintf (buf, sizeof (buf), "<%s>", name);
+ }
+ if (verbose)
+ {
+ printf ("%016lx %-32s (sp=%016lx)\n", (long) ip, buf, (long) sp);
+
+ if (unw_get_proc_info (&cursor, &pi) == 0)
+ {
+ printf ("\tproc=0x%lx-0x%lx\n\thandler=0x%lx lsda=0x%lx gp=0x%lx",
+ (long) pi.start_ip, (long) pi.end_ip,
+ (long) pi.handler, (long) pi.lsda, (long) pi.gp);
+ }
+
+#if UNW_TARGET_IA64
+ {
+ unw_word_t bsp;
+
+ unw_get_reg (&cursor, UNW_IA64_BSP, &bsp);
+ printf (" bsp=%lx", bsp);
+ }
+#endif
+ printf ("\n");
+ }
+
+ ret = unw_step (&cursor);
+ if (ret < 0)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ printf ("FAILURE: unw_step() returned %d for ip=%lx\n",
+ ret, (long) ip);
+ ++num_errors;
+ }
+ }
+ while (ret > 0);
+
+ {
+ void *buffer[20];
+ int i, n;
+
+ if (verbose)
+ printf ("\n\tvia backtrace():\n");
+ n = backtrace (buffer, 20);
+ if (verbose)
+ for (i = 0; i < n; ++i)
+ printf ("[%d] ip=%p\n", i, buffer[i]);
+ }
+}
+
+void
+foo (long val UNUSED)
+{
+ do_backtrace ();
+}
+
+void
+bar (long v)
+{
+ extern long f (long);
+ int arr[v];
+
+ /* This is a vain attempt to use up lots of registers to force
+ the frame-chain info to be saved on the memory stack on ia64.
+ It happens to work with gcc v3.3.4 and gcc v3.4.1 but perhaps
+ not with any other compiler. */
+ foo (f (arr[0]) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + f (v))
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ )))))))))))))))))))))))))))))))))))))))))))))))))))))));
+}
+
+void
+sighandler (int signal, void *siginfo UNUSED, void *context)
+{
+ ucontext_t *uc UNUSED;
+ int sp;
+
+ uc = context;
+
+ if (verbose)
+ {
+ printf ("sighandler: got signal %d, sp=%p", signal, &sp);
+#if UNW_TARGET_IA64
+# if defined(__linux__)
+ printf (" @ %lx", uc->uc_mcontext.sc_ip);
+# else
+ {
+ uint16_t reason;
+ uint64_t ip;
+
+ __uc_get_reason (uc, &reason);
+ __uc_get_ip (uc, &ip);
+ printf (" @ %lx (reason=%d)", ip, reason);
+ }
+# endif
+#elif UNW_TARGET_X86
+#if defined __linux__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.gregs[REG_EIP]);
+#elif defined __FreeBSD__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.mc_eip);
+#endif
+#elif UNW_TARGET_X86_64
+#if defined __linux__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.gregs[REG_RIP]);
+#elif defined __FreeBSD__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.mc_rip);
+#endif
+#endif
+ printf ("\n");
+ }
+ do_backtrace();
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ struct sigaction act;
+ stack_t stk;
+
+ verbose = (argc > 1);
+
+ if (verbose)
+ printf ("Normal backtrace:\n");
+
+ bar (1);
+
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = (void (*)(int)) sighandler;
+ act.sa_flags = SA_SIGINFO;
+ if (sigaction (SIGTERM, &act, NULL) < 0)
+ panic ("sigaction: %s\n", strerror (errno));
+
+ if (verbose)
+ printf ("\nBacktrace across signal handler:\n");
+ kill (getpid (), SIGTERM);
+
+ if (verbose)
+ printf ("\nBacktrace across signal handler on alternate stack:\n");
+ stk.ss_sp = malloc (SIG_STACK_SIZE);
+ if (!stk.ss_sp)
+ panic ("failed to allocate %u bytes\n", SIG_STACK_SIZE);
+ stk.ss_size = SIG_STACK_SIZE;
+ stk.ss_flags = 0;
+ if (sigaltstack (&stk, NULL) < 0)
+ panic ("sigaltstack: %s\n", strerror (errno));
+
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = (void (*)(int)) sighandler;
+ act.sa_flags = SA_ONSTACK | SA_SIGINFO;
+ if (sigaction (SIGTERM, &act, NULL) < 0)
+ panic ("sigaction: %s\n", strerror (errno));
+ kill (getpid (), SIGTERM);
+
+ if (num_errors > 0)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", num_errors);
+ exit (-1);
+ }
+ if (verbose)
+ printf ("SUCCESS.\n");
+
+ signal (SIGTERM, SIG_DFL);
+ stk.ss_flags = SS_DISABLE;
+ sigaltstack (&stk, NULL);
+ free (stk.ss_sp);
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gtest-concurrent.c b/src/pal/src/libunwind/tests/Gtest-concurrent.c
new file mode 100644
index 0000000000..6f3447fd84
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-concurrent.c
@@ -0,0 +1,136 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Verify that multi-threaded concurrent unwinding works as expected. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "compiler.h"
+
+#include <libunwind.h>
+#include <limits.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define NTHREADS 128
+
+#define panic(args...) \
+ do { fprintf (stderr, args); ++nerrors; } while (0)
+
+int verbose;
+int nerrors;
+int got_usr1, got_usr2;
+char *sigusr1_sp;
+
+void
+handler (int sig UNUSED)
+{
+ unw_word_t ip;
+ unw_context_t uc;
+ unw_cursor_t c;
+ int ret;
+
+ unw_getcontext (&uc);
+ unw_init_local (&c, &uc);
+ do
+ {
+ unw_get_reg (&c, UNW_REG_IP, &ip);
+ if (verbose)
+ printf ("%lx: IP=%lx\n", (long) pthread_self (), (unsigned long) ip);
+ }
+ while ((ret = unw_step (&c)) > 0);
+
+ if (ret < 0)
+ panic ("unw_step() returned %d\n", ret);
+}
+
+void *
+worker (void *arg UNUSED)
+{
+ signal (SIGUSR1, handler);
+
+ if (verbose)
+ printf ("sending SIGUSR1\n");
+ pthread_kill (pthread_self (), SIGUSR1);
+ return NULL;
+}
+
+static void
+doit (void)
+{
+ pthread_t th[NTHREADS];
+ pthread_attr_t attr;
+ int i;
+
+ pthread_attr_init (&attr);
+ pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN + 64*1024);
+
+ for (i = 0; i < NTHREADS; ++i)
+ if (pthread_create (th + i, &attr, worker, NULL))
+ {
+ fprintf (stderr, "FAILURE: Failed to create %u threads "
+ "(after %u threads)\n",
+ NTHREADS, i);
+ exit (-1);
+ }
+
+ for (i = 0; i < NTHREADS; ++i)
+ pthread_join (th[i], NULL);
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ if (argc > 1)
+ verbose = 1;
+
+ if (verbose)
+ printf ("Caching: none\n");
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_NONE);
+ doit ();
+
+ if (verbose)
+ printf ("Caching: global\n");
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL);
+ doit ();
+
+ if (verbose)
+ printf ("Caching: per-thread\n");
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
+ doit ();
+
+ if (nerrors)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
+ exit (-1);
+ }
+
+ if (verbose)
+ printf ("SUCCESS\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gtest-dyn1.c b/src/pal/src/libunwind/tests/Gtest-dyn1.c
new file mode 100644
index 0000000000..bc7dc9cf7f
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-dyn1.c
@@ -0,0 +1,223 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file tests dynamic code-generation via function-cloning. */
+
+#include "flush-cache.h"
+
+#include "compiler.h"
+
+#include <libunwind.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+#include <sys/mman.h>
+
+#if UNW_TARGET_ARM
+#define MAX_FUNC_SIZE 96 /* FIXME: arch/compiler dependent */
+#else
+#define MAX_FUNC_SIZE 2048 /* max. size of cloned function */
+#endif
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+typedef void (*template_t) (int, void (*)(),
+ int (*)(const char *, ...), const char *,
+ const char **);
+
+int verbose;
+
+static const char *strarr[] =
+ {
+ "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x", NULL
+ };
+
+#ifdef __ia64__
+struct fdesc
+ {
+ long code;
+ long gp;
+ };
+# define get_fdesc(fdesc,func) (fdesc = *(struct fdesc *) &(func))
+# define get_funcp(fdesc) ((template_t) &(fdesc))
+# define get_gp(fdesc) ((fdesc).gp)
+#elif __arm__
+struct fdesc
+ {
+ long code;
+ long is_thumb;
+ };
+/* Workaround GCC bug: https://bugs.launchpad.net/gcc-linaro/+bug/721531 */
+# define get_fdesc(fdesc,func) ({long tmp = (long) &(func); \
+ (fdesc).code = (long) &(func) & ~0x1; \
+ (fdesc).is_thumb = tmp & 0x1;})
+/*# define get_fdesc(fdesc,func) ({(fdesc).code = (long) &(func) & ~0x1; \
+ (fdesc).is_thumb = (long) &(func) & 0x1;})*/
+# define get_funcp(fdesc) ((template_t) ((fdesc).code | (fdesc).is_thumb))
+# define get_gp(fdesc) (0)
+#else
+struct fdesc
+ {
+ long code;
+ };
+# define get_fdesc(fdesc,func) (fdesc.code = (long) &(func))
+# define get_funcp(fdesc) ((template_t) (fdesc).code)
+# define get_gp(fdesc) (0)
+#endif
+
+void
+template (int i, template_t self,
+ int (*printer)(const char *, ...), const char *fmt, const char **arr)
+{
+ (*printer) (fmt, arr[11 - i][0], arr[11 - i] + 1);
+ if (i > 0)
+ (*self) (i - 1, self, printer, fmt, arr);
+}
+
+static void
+sighandler (int signal)
+{
+ unw_cursor_t cursor;
+ char name[128], off[32];
+ unw_word_t ip, offset;
+ unw_context_t uc;
+ int count;
+
+ if (verbose)
+ printf ("caught signal %d\n", signal);
+
+ unw_getcontext (&uc);
+ unw_init_local (&cursor, &uc);
+
+ count = 0;
+ while (!unw_is_signal_frame (&cursor))
+ {
+ if (unw_step (&cursor) < 0)
+ panic ("failed to find signal frame!\n");
+
+ if (count++ > 20)
+ {
+ panic ("Too many steps to the signal frame (%d)\n", count);
+ break;
+ }
+ }
+ unw_step (&cursor);
+
+ count = 0;
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ name[0] = '\0';
+ off[0] = '\0';
+ if (unw_get_proc_name (&cursor, name, sizeof (name), &offset) == 0
+ && offset > 0)
+ snprintf (off, sizeof (off), "+0x%lx", (long) offset);
+ if (verbose)
+ printf ("ip = %lx <%s%s>\n", (long) ip, name, off);
+ ++count;
+
+ if (count > 20)
+ {
+ panic ("Too many steps (%d)\n", count);
+ break;
+ }
+
+ }
+ while (unw_step (&cursor) > 0);
+
+ if (count != 13)
+ panic ("FAILURE: expected 13, not %d frames below signal frame\n", count);
+
+ if (verbose)
+ printf ("SUCCESS\n");
+ exit (0);
+}
+
+int
+dev_null (const char *format UNUSED, ...)
+{
+ return 0;
+}
+
+int
+main (int argc, char *argv[] UNUSED)
+{
+ unw_dyn_region_info_t *region;
+ unw_dyn_info_t di;
+ struct fdesc fdesc;
+ template_t funcp;
+ void *mem;
+
+ if (argc > 1)
+ ++verbose;
+
+ mem = malloc (getpagesize ());
+
+ get_fdesc (fdesc, template);
+
+ if (verbose)
+ printf ("old code @ %p, new code @ %p\n", (void *) fdesc.code, mem);
+
+ memcpy (mem, (void *) fdesc.code, MAX_FUNC_SIZE);
+ mprotect ((void *) ((long) mem & ~(getpagesize () - 1)),
+ 2*getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC);
+
+ flush_cache (mem, MAX_FUNC_SIZE);
+
+ signal (SIGSEGV, sighandler);
+
+ /* register the new function: */
+ region = alloca (_U_dyn_region_info_size (2));
+ region->next = NULL;
+ region->insn_count = 3 * (MAX_FUNC_SIZE / 16);
+ region->op_count = 2;
+ _U_dyn_op_alias (&region->op[0], 0, -1, fdesc.code);
+ _U_dyn_op_stop (&region->op[1]);
+
+ memset (&di, 0, sizeof (di));
+ di.start_ip = (long) mem;
+ di.end_ip = (long) mem + 16*region->insn_count/3;
+ di.gp = get_gp (fdesc);
+ di.format = UNW_INFO_FORMAT_DYNAMIC;
+ di.u.pi.name_ptr = (unw_word_t) "copy_of_template";
+ di.u.pi.regions = region;
+
+ _U_dyn_register (&di);
+
+ /* call new function: */
+ fdesc.code = (long) mem;
+ funcp = get_funcp (fdesc);
+
+ if (verbose)
+ (*funcp) (10, funcp, printf, "iteration %c%s\n", strarr);
+ else
+ (*funcp) (10, funcp, dev_null, "iteration %c%s\n", strarr);
+
+ _U_dyn_cancel (&di);
+ return -1;
+}
diff --git a/src/pal/src/libunwind/tests/Gtest-exc.c b/src/pal/src/libunwind/tests/Gtest-exc.c
new file mode 100644
index 0000000000..1170bdd03f
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-exc.c
@@ -0,0 +1,162 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This illustrates the basics of using the unwind interface for
+ exception handling. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <libunwind.h>
+
+#ifdef HAVE_IA64INTRIN_H
+# include <ia64intrin.h>
+#endif
+
+#define panic(args...) \
+ { ++nerrors; fprintf (stderr, args); }
+
+int nerrors = 0;
+int verbose = 0;
+int depth = 13;
+volatile int got_here = 0;
+
+extern void b (int);
+
+void
+raise_exception (void)
+{
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ int i;
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ {
+ panic ("unw_init_local() failed!\n");
+ return;
+ }
+
+ /* unwind to top-most frame a(), skipping over b() and raise_exception(): */
+ for (i = 0; i < depth + 2; ++i)
+ if (unw_step (&cursor) < 0)
+ {
+ panic ("unw_step() failed!\n");
+ return;
+ }
+ unw_resume (&cursor); /* transfer control to exception handler */
+}
+
+uintptr_t
+get_bsp (void)
+{
+#if UNW_TARGET_IA64
+# ifdef __INTEL_COMPILER
+ return __getReg (_IA64_REG_AR_BSP);
+# else
+ return (uintptr_t) __builtin_ia64_bsp ();
+# endif
+#else
+ return 0;
+#endif
+}
+
+int
+a (int n)
+{
+ long stack;
+ int result = 99;
+
+ if (verbose)
+ printf ("a(n=%d): sp=%p bsp=0x%lx\n",
+ n, &stack, (unsigned long) get_bsp ());
+
+ if (n > 0)
+ a (n - 1);
+ else
+ b (16);
+
+ if (verbose)
+ {
+ printf ("exception handler: here we go (sp=%p, bsp=0x%lx)...\n",
+ &stack, (unsigned long) get_bsp ());
+ /* This call works around a bug in gcc (up-to pre3.4) which
+ causes invalid assembly code to be generated when
+ __builtin_ia64_bsp() gets predicated. */
+ getpid ();
+ }
+ if (n == depth)
+ {
+ result = 0;
+ got_here = 1;
+ }
+ return result;
+}
+
+void
+b (int n)
+{
+ if ((n & 1) == 0)
+ {
+ if (verbose)
+ printf ("b(n=%d) calling raise_exception()\n", n);
+ raise_exception ();
+ }
+ panic ("FAILURE: b() returned from raise_exception()!!\n");
+}
+
+int
+main (int argc, char **argv)
+{
+ int result;
+
+ if (argc > 1)
+ {
+ ++verbose;
+ depth = atol (argv[1]);
+ if (depth < 1)
+ {
+ fprintf (stderr, "Usage: %s depth\n"
+ " depth must be >= 1\n", argv[0]);
+ exit (-1);
+ }
+ }
+
+ result = a (depth);
+ if (result != 0 || !got_here || nerrors > 0)
+ {
+ fprintf (stderr,
+ "FAILURE: test failed: result=%d got_here=%d nerrors=%d\n",
+ result, got_here, nerrors);
+ exit (-1);
+ }
+
+ if (verbose)
+ printf ("SUCCESS!\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gtest-init.cxx b/src/pal/src/libunwind/tests/Gtest-init.cxx
new file mode 100644
index 0000000000..afded01927
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-init.cxx
@@ -0,0 +1,107 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This file tests unwinding from a constructor from within an
+ atexit() handler. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <libunwind.h>
+#include "compiler.h"
+
+int verbose, errors;
+
+#define panic(args...) \
+ { ++errors; fprintf (stderr, args); return; }
+
+class Test_Class {
+ public:
+ Test_Class (void);
+};
+
+static Test_Class t;
+
+static void
+do_backtrace (void)
+{
+ char name[128], off[32];
+ unw_word_t ip, offset;
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ int ret, count = 0;
+
+ unw_getcontext (&uc);
+ unw_init_local (&cursor, &uc);
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ name[0] = '\0';
+ off[0] = '\0';
+ if (unw_get_proc_name (&cursor, name, sizeof (name), &offset) == 0
+ && offset > 0)
+ snprintf (off, sizeof (off), "+0x%lx", (long) offset);
+ if (verbose)
+ printf (" [%lx] <%s%s>\n", (long) ip, name, off);
+ if (++count > 32)
+ panic ("FAILURE: didn't reach beginning of unwind-chain\n");
+ }
+ while ((ret = unw_step (&cursor)) > 0);
+
+ if (ret < 0)
+ panic ("FAILURE: unw_step() returned %d\n", ret);
+}
+
+static void
+b (void)
+{
+ do_backtrace();
+}
+
+static void
+a (void)
+{
+ if (verbose)
+ printf ("do_backtrace() from atexit()-handler:\n");
+ b();
+ if (errors)
+ abort (); /* cannot portably call exit() from an atexit() handler */
+}
+
+Test_Class::Test_Class (void)
+{
+ if (verbose)
+ printf ("do_backtrace() from constructor:\n");
+ b();
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ verbose = argc > 1;
+ return atexit (a);
+}
diff --git a/src/pal/src/libunwind/tests/Gtest-nomalloc.c b/src/pal/src/libunwind/tests/Gtest-nomalloc.c
new file mode 100644
index 0000000000..5b97fc7091
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-nomalloc.c
@@ -0,0 +1,110 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2009 Google, Inc
+ Contributed by Arun Sharma <arun.sharma@google.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <libunwind.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+int verbose;
+int num_errors;
+int in_unwind;
+
+void *
+malloc(size_t s)
+{
+ static void * (*func)();
+
+ if(!func)
+ func = (void *(*)()) dlsym(RTLD_NEXT, "malloc");
+
+ if (in_unwind) {
+ num_errors++;
+ return NULL;
+ } else {
+ return func(s);
+ }
+}
+
+static void
+do_backtrace (void)
+{
+ unw_word_t ip, sp;
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ int ret;
+
+ in_unwind = 1;
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local failed!\n");
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+
+ ret = unw_step (&cursor);
+ if (ret < 0)
+ {
+ ++num_errors;
+ }
+ }
+ while (ret > 0);
+ in_unwind = 0;
+}
+
+void
+foo3 (void)
+{
+ do_backtrace ();
+}
+
+void
+foo2 (void)
+{
+ foo3 ();
+}
+
+void
+foo1 (void)
+{
+ foo2 ();
+}
+
+int
+main (void)
+{
+ foo1();
+
+ if (num_errors > 0)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", num_errors);
+ exit (-1);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gtest-resume-sig-rt.c b/src/pal/src/libunwind/tests/Gtest-resume-sig-rt.c
new file mode 100644
index 0000000000..df515fc195
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-resume-sig-rt.c
@@ -0,0 +1,31 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* The purpose of this test is to invoke different code paths in libunwind (on
+ * some architectures), that are executed when the SA_SIGINFO sigaction() flag
+ * is used.
+ */
+
+#define TEST_WITH_SIGINFO 1
+#include "Gtest-resume-sig.c"
diff --git a/src/pal/src/libunwind/tests/Gtest-resume-sig.c b/src/pal/src/libunwind/tests/Gtest-resume-sig.c
new file mode 100644
index 0000000000..18ec65da71
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-resume-sig.c
@@ -0,0 +1,200 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Verify that unw_resume() restores the signal mask at proper time. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "compiler.h"
+
+#include <libunwind.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#ifdef HAVE_IA64INTRIN_H
+# include <ia64intrin.h>
+#endif
+
+#define panic(args...) \
+ do { fprintf (stderr, args); ++nerrors; } while (0)
+
+int verbose;
+int nerrors;
+int got_usr1, got_usr2;
+char *sigusr1_sp;
+
+uintptr_t
+get_bsp (void)
+{
+#if UNW_TARGET_IA64
+# ifdef __INTEL_COMPILER
+ return __getReg (_IA64_REG_AR_BSP);
+# else
+ return (uintptr_t) __builtin_ia64_bsp ();
+# endif
+#else
+ return 0;
+#endif
+}
+
+#ifdef TEST_WITH_SIGINFO
+void
+handler (int sig,
+ siginfo_t *si UNUSED,
+ void *ucontext UNUSED)
+#else
+void
+handler (int sig)
+#endif
+{
+ unw_word_t ip;
+ sigset_t mask;
+ unw_context_t uc;
+ unw_cursor_t c;
+ char foo;
+ int ret;
+ // The test rely on SIGUSR2 mask to be cleared when the handler returns.
+ // For local context from the signal handler, there doesn't seem to be a way
+ // currently to set it so just clear the whole struct to make sure the signal mask is cleared.
+ // This should probably be fixed to avoid signal mask being set to random values
+ // by `unw_resume` if the context was not pre-zeroed.,
+ // Using the signal ucontext direction should also work automatically but currently doesn't
+ // on ARM/AArch64 (or any other archs that doesn't have a proper sigreturn implementation)
+ memset(&uc, 0x0, sizeof(uc));
+
+#if UNW_TARGET_IA64
+ if (verbose)
+ printf ("bsp = %llx\n", (unsigned long long) get_bsp ());
+#endif
+
+ if (verbose)
+ printf ("got signal %d\n", sig);
+
+ if (sig == SIGUSR1)
+ {
+ ++got_usr1;
+ sigusr1_sp = &foo;
+
+ sigemptyset (&mask);
+ sigaddset (&mask, SIGUSR2);
+ sigprocmask (SIG_BLOCK, &mask, NULL);
+ kill (getpid (), SIGUSR2); /* pend SIGUSR2 */
+
+ signal (SIGUSR1, SIG_IGN);
+
+ if ((ret = unw_getcontext (&uc)) < 0)
+ panic ("unw_getcontext() failed: ret=%d\n", ret);
+ if ((ret = unw_init_local (&c, &uc)) < 0)
+ panic ("unw_init_local() failed: ret=%d\n", ret);
+
+ if ((ret = unw_step (&c)) < 0) /* step to signal trampoline */
+ panic ("unw_step(1) failed: ret=%d\n", ret);
+
+ if ((ret = unw_step (&c)) < 0) /* step to kill() */
+ panic ("unw_step(2) failed: ret=%d\n", ret);
+
+#if defined(UNW_TARGET_TILEGX)
+ if ((ret = unw_step (&c)) < 0) /* step to signal trampoline */
+ panic ("unw_step(2) failed: ret=%d\n", ret);
+#endif
+
+ if ((ret = unw_get_reg (&c, UNW_REG_IP, &ip)) < 0)
+ panic ("unw_get_reg(IP) failed: ret=%d\n", ret);
+ if (verbose)
+ printf ("resuming at 0x%lx, with SIGUSR2 pending\n",
+ (unsigned long) ip);
+ unw_resume (&c);
+ }
+ else if (sig == SIGUSR2)
+ {
+ ++got_usr2;
+ if (got_usr1)
+ {
+ if (verbose)
+ printf ("OK: stack still at %p\n", &foo);
+ }
+ signal (SIGUSR2, SIG_IGN);
+ }
+ else
+ panic ("Got unexpected signal %d\n", sig);
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ struct sigaction sa;
+ float d = 1.0;
+ int n = 0;
+
+ if (argc > 1)
+ verbose = 1;
+
+ memset (&sa, 0, sizeof(sa));
+#ifdef TEST_WITH_SIGINFO
+ sa.sa_sigaction = handler;
+ sa.sa_flags = SA_SIGINFO;
+#else
+ sa.sa_handler = handler;
+#endif
+
+ if (sigaction (SIGUSR1, &sa, NULL) != 0 ||
+ sigaction (SIGUSR2, &sa, NULL) != 0)
+ {
+ fprintf (stderr, "sigaction() failed: %s\n", strerror (errno));
+ return -1;
+ }
+
+ /* Use the FPU a bit; otherwise we get spurious errors should the
+ signal handler need to use the FPU for any reason. This seems to
+ happen on x86-64. */
+ while (d > 0.0)
+ {
+ d /= 2.0;
+ ++n;
+ }
+ if (n > 9999)
+ return -1; /* can't happen, but don't tell the compiler... */
+
+ if (verbose)
+ printf ("sending SIGUSR1\n");
+ kill (getpid (), SIGUSR1);
+
+ if (!got_usr2)
+ panic ("failed to get SIGUSR2\n");
+
+ if (nerrors)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
+ exit (-1);
+ }
+
+ if (verbose)
+ printf ("SUCCESS\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Gtest-trace.c b/src/pal/src/libunwind/tests/Gtest-trace.c
new file mode 100644
index 0000000000..fc1f646eac
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Gtest-trace.c
@@ -0,0 +1,282 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "compiler.h"
+
+#include <errno.h>
+#if HAVE_EXECINFO_H
+# include <execinfo.h>
+#else
+ extern int backtrace (void **, int);
+#endif
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ucontext.h>
+#include <unistd.h>
+#include <libunwind.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+#define SIG_STACK_SIZE 0x100000
+
+int verbose;
+int num_errors;
+
+/* These variables are global because they
+ * cause the signal stack to overflow */
+char buf[512], name[256];
+void *addresses[3][128];
+unw_cursor_t cursor;
+unw_context_t uc;
+
+static void
+do_backtrace (void)
+{
+ unw_word_t ip;
+ int ret = -UNW_ENOINFO;
+ int depth = 0;
+ int i, n, m;
+
+ if (verbose)
+ printf ("\tnormal trace:\n");
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local failed!\n");
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ addresses[0][depth] = (void *) ip;
+ }
+ while ((ret = unw_step (&cursor)) > 0 && ++depth < 128);
+
+ if (ret < 0)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ printf ("FAILURE: unw_step() returned %d for ip=%lx\n", ret, (long) ip);
+ ++num_errors;
+ }
+
+ if (verbose)
+ for (i = 0; i < depth; ++i)
+ printf ("\t #%-3d ip=%p\n", i, addresses[0][i]);
+
+ if (verbose)
+ printf ("\n\tvia backtrace():\n");
+
+ n = backtrace (addresses[1], 128);
+
+ if (verbose)
+ for (i = 0; i < n; ++i)
+ printf ("\t #%-3d ip=%p\n", i, addresses[1][i]);
+
+ if (verbose)
+ printf ("\n\tvia unw_backtrace():\n");
+
+ m = unw_backtrace (addresses[2], 128);
+
+ if (verbose)
+ for (i = 0; i < m; ++i)
+ printf ("\t #%-3d ip=%p\n", i, addresses[2][i]);
+
+ if (m != depth+1)
+ {
+ printf ("FAILURE: unw_step() loop and unw_backtrace() depths differ: %d vs. %d\n", depth, m);
+ ++num_errors;
+ }
+
+ if (n != depth+1)
+ {
+ printf ("FAILURE: unw_step() loop and backtrace() depths differ: %d vs. %d\n", depth, n);
+ ++num_errors;
+ }
+
+ if (n == m)
+ for (i = 1; i < n; ++i)
+ /* Allow one in difference in comparison, trace returns adjusted addresses. */
+ if (labs((unw_word_t) addresses[1][i] - (unw_word_t) addresses[2][i]) > 1)
+ {
+ printf ("FAILURE: backtrace() and unw_backtrace() addresses differ at %d: %p vs. %p\n",
+ i, addresses[1][i], addresses[2][i]);
+ ++num_errors;
+ }
+
+ if (n == depth+1)
+ for (i = 1; i < depth; ++i)
+ /* Allow one in difference in comparison, trace returns adjusted addresses. */
+ if (labs((unw_word_t) addresses[0][i] - (unw_word_t) addresses[1][i]) > 1)
+ {
+ printf ("FAILURE: unw_step() loop and backtrace() addresses differ at %d: %p vs. %p\n",
+ i, addresses[0][i], addresses[1][i]);
+ ++num_errors;
+ }
+}
+
+void
+foo (long val UNUSED)
+{
+ do_backtrace ();
+}
+
+void
+bar (long v)
+{
+ extern long f (long);
+ int arr[v];
+
+ /* This is a vain attempt to use up lots of registers to force
+ the frame-chain info to be saved on the memory stack on ia64.
+ It happens to work with gcc v3.3.4 and gcc v3.4.1 but perhaps
+ not with any other compiler. */
+ foo (f (arr[0]) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + f (v))
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ )))))))))))))))))))))))))))))))))))))))))))))))))))))));
+}
+
+void
+sighandler (int signal, void *siginfo UNUSED, void *context)
+{
+ ucontext_t *uc UNUSED;
+ int sp;
+
+ uc = context;
+
+ if (verbose)
+ {
+ printf ("sighandler: got signal %d, sp=%p", signal, &sp);
+#if UNW_TARGET_IA64
+# if defined(__linux__)
+ printf (" @ %lx", uc->uc_mcontext.sc_ip);
+# else
+ {
+ uint16_t reason;
+ uint64_t ip;
+
+ __uc_get_reason (uc, &reason);
+ __uc_get_ip (uc, &ip);
+ printf (" @ %lx (reason=%d)", ip, reason);
+ }
+# endif
+#elif UNW_TARGET_X86
+#if defined __linux__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.gregs[REG_EIP]);
+#elif defined __FreeBSD__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.mc_eip);
+#endif
+#elif UNW_TARGET_X86_64
+#if defined __linux__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.gregs[REG_RIP]);
+#elif defined __FreeBSD__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.mc_rip);
+#endif
+#elif defined UNW_TARGET_ARM
+#if defined __linux__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.arm_pc);
+#elif defined __FreeBSD__
+ printf (" @ %lx", (unsigned long) uc->uc_mcontext.__gregs[_REG_PC]);
+#endif
+#endif
+ printf ("\n");
+ }
+ do_backtrace();
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ struct sigaction act;
+ stack_t stk;
+
+ verbose = (argc > 1);
+
+ if (verbose)
+ printf ("Normal backtrace:\n");
+
+ bar (1);
+
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = (void (*)(int)) sighandler;
+ act.sa_flags = SA_SIGINFO;
+ if (sigaction (SIGTERM, &act, NULL) < 0)
+ panic ("sigaction: %s\n", strerror (errno));
+
+ if (verbose)
+ printf ("\nBacktrace across signal handler:\n");
+ kill (getpid (), SIGTERM);
+
+ if (verbose)
+ printf ("\nBacktrace across signal handler on alternate stack:\n");
+ stk.ss_sp = malloc (SIG_STACK_SIZE);
+ if (!stk.ss_sp)
+ panic ("failed to allocate %u bytes\n", SIG_STACK_SIZE);
+ stk.ss_size = SIG_STACK_SIZE;
+ stk.ss_flags = 0;
+ if (sigaltstack (&stk, NULL) < 0)
+ panic ("sigaltstack: %s\n", strerror (errno));
+
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = (void (*)(int)) sighandler;
+ act.sa_flags = SA_ONSTACK | SA_SIGINFO;
+ if (sigaction (SIGTERM, &act, NULL) < 0)
+ panic ("sigaction: %s\n", strerror (errno));
+ kill (getpid (), SIGTERM);
+
+ if (num_errors > 0)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", num_errors);
+ exit (-1);
+ }
+
+ if (verbose)
+ printf ("SUCCESS.\n");
+
+ signal (SIGTERM, SIG_DFL);
+ stk.ss_flags = SS_DISABLE;
+ sigaltstack (&stk, NULL);
+ free (stk.ss_sp);
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Lia64-test-nat.c b/src/pal/src/libunwind/tests/Lia64-test-nat.c
new file mode 100644
index 0000000000..15ef0caccc
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Lia64-test-nat.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gia64-test-nat.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Lia64-test-rbs.c b/src/pal/src/libunwind/tests/Lia64-test-rbs.c
new file mode 100644
index 0000000000..b838ebe42f
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Lia64-test-rbs.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gia64-test-rbs.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Lia64-test-readonly.c b/src/pal/src/libunwind/tests/Lia64-test-readonly.c
new file mode 100644
index 0000000000..cd23e92613
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Lia64-test-readonly.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gia64-test-readonly.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Lia64-test-stack.c b/src/pal/src/libunwind/tests/Lia64-test-stack.c
new file mode 100644
index 0000000000..3647629c90
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Lia64-test-stack.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gia64-test-stack.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Lperf-simple.c b/src/pal/src/libunwind/tests/Lperf-simple.c
new file mode 100644
index 0000000000..cdf38c207a
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Lperf-simple.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gperf-simple.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Lperf-trace.c b/src/pal/src/libunwind/tests/Lperf-trace.c
new file mode 100644
index 0000000000..1c3cf21c21
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Lperf-trace.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gperf-trace.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Lrs-race.c b/src/pal/src/libunwind/tests/Lrs-race.c
new file mode 100644
index 0000000000..6fe4972020
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Lrs-race.c
@@ -0,0 +1,1514 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2005 Hewlett-Packard Co
+ Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Verify that register state caches work under all caching policies
+ in a multi-threaded environment with a large number IPs */
+
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#include "compiler.h"
+
+#include <stdio.h>
+#include <pthread.h>
+#include <stdlib.h>
+
+/* ITERS=1000, NTHREAD=10 caught some bugs in the past */
+#ifndef ITERS
+#define ITERS 100
+#endif
+
+#ifndef NTHREAD
+#define NTHREAD 2
+#endif
+
+int verbose;
+
+void
+foo_0 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_1 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_2 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_3 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_4 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_5 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_6 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_7 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_8 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_9 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_10 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_11 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_12 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_13 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_14 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_15 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_16 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_17 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_18 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_19 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_20 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_21 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_22 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_23 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_24 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_25 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_26 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_27 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_28 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_29 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_30 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_31 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_32 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_33 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_34 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_35 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_36 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_37 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_38 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_39 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_40 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_41 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_42 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_43 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_44 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_45 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_46 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_47 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_48 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_49 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_50 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_51 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_52 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_53 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_54 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_55 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_56 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_57 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_58 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_59 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_60 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_61 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_62 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_63 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_64 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_65 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_66 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_67 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_68 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_69 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_70 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_71 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_72 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_73 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_74 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_75 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_76 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_77 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_78 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_79 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_80 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_81 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_82 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_83 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_84 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_85 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_86 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_87 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_88 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_89 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_90 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_91 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_92 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_93 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_94 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_95 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_96 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_97 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_98 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_99 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_100 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_101 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_102 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_103 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_104 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_105 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_106 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_107 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_108 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_109 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_110 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_111 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_112 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_113 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_114 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_115 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_116 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_117 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_118 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_119 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_120 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_121 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_122 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_123 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_124 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_125 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_126 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_127 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void
+foo_128 (void)
+{
+ void *buf[20];
+ int n;
+
+ if ((n = unw_backtrace (buf, 20)) < 3)
+ abort ();
+}
+
+void *
+bar(void *p UNUSED)
+{
+ int i;
+ for (i = 0; i < ITERS; ++i) {
+ foo_0 ();
+ foo_1 ();
+ foo_2 ();
+ foo_3 ();
+ foo_4 ();
+ foo_5 ();
+ foo_6 ();
+ foo_7 ();
+ foo_8 ();
+ foo_9 ();
+ foo_10 ();
+ foo_11 ();
+ foo_12 ();
+ foo_13 ();
+ foo_14 ();
+ foo_15 ();
+ foo_16 ();
+ foo_17 ();
+ foo_18 ();
+ foo_19 ();
+ foo_20 ();
+ foo_21 ();
+ foo_22 ();
+ foo_23 ();
+ foo_24 ();
+ foo_25 ();
+ foo_26 ();
+ foo_27 ();
+ foo_28 ();
+ foo_29 ();
+ foo_30 ();
+ foo_31 ();
+ foo_32 ();
+ foo_33 ();
+ foo_34 ();
+ foo_35 ();
+ foo_36 ();
+ foo_37 ();
+ foo_38 ();
+ foo_39 ();
+ foo_40 ();
+ foo_41 ();
+ foo_42 ();
+ foo_43 ();
+ foo_44 ();
+ foo_45 ();
+ foo_46 ();
+ foo_47 ();
+ foo_48 ();
+ foo_49 ();
+ foo_50 ();
+ foo_51 ();
+ foo_52 ();
+ foo_53 ();
+ foo_54 ();
+ foo_55 ();
+ foo_56 ();
+ foo_57 ();
+ foo_58 ();
+ foo_59 ();
+ foo_60 ();
+ foo_61 ();
+ foo_62 ();
+ foo_63 ();
+ foo_64 ();
+ foo_65 ();
+ foo_66 ();
+ foo_67 ();
+ foo_68 ();
+ foo_69 ();
+ foo_70 ();
+ foo_71 ();
+ foo_72 ();
+ foo_73 ();
+ foo_74 ();
+ foo_75 ();
+ foo_76 ();
+ foo_77 ();
+ foo_78 ();
+ foo_79 ();
+ foo_80 ();
+ foo_81 ();
+ foo_82 ();
+ foo_83 ();
+ foo_84 ();
+ foo_85 ();
+ foo_86 ();
+ foo_87 ();
+ foo_88 ();
+ foo_89 ();
+ foo_90 ();
+ foo_91 ();
+ foo_92 ();
+ foo_93 ();
+ foo_94 ();
+ foo_95 ();
+ foo_96 ();
+ foo_97 ();
+ foo_98 ();
+ foo_99 ();
+ foo_100 ();
+ foo_101 ();
+ foo_102 ();
+ foo_103 ();
+ foo_104 ();
+ foo_105 ();
+ foo_106 ();
+ foo_107 ();
+ foo_108 ();
+ foo_109 ();
+ foo_110 ();
+ foo_111 ();
+ foo_112 ();
+ foo_113 ();
+ foo_114 ();
+ foo_115 ();
+ foo_116 ();
+ foo_117 ();
+ foo_118 ();
+ foo_119 ();
+ foo_120 ();
+ foo_121 ();
+ foo_122 ();
+ foo_123 ();
+ foo_124 ();
+ foo_125 ();
+ foo_126 ();
+ foo_127 ();
+ foo_128 ();
+ }
+ return NULL;
+}
+
+int doit (void)
+{
+ pthread_t tid[NTHREAD];
+ int i;
+
+ for (i = 0; i < NTHREAD; ++i)
+ if (pthread_create (&tid[i], NULL, bar, NULL))
+ return 1;
+
+ for (i = 0; i < NTHREAD; ++i)
+ if (pthread_join (tid[i], NULL))
+ return 1;
+
+ return 0;
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ if (argc > 1)
+ verbose = 1;
+
+ if (verbose)
+ printf ("Caching: none\n");
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_NONE);
+ doit ();
+
+ if (verbose)
+ printf ("Caching: global\n");
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL);
+ doit ();
+
+ if (verbose)
+ printf ("Caching: per-thread\n");
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
+ doit ();
+
+ if (verbose)
+ printf ("SUCCESS\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Ltest-bt.c b/src/pal/src/libunwind/tests/Ltest-bt.c
new file mode 100644
index 0000000000..3489bf0b51
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-bt.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-bt.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-concurrent.c b/src/pal/src/libunwind/tests/Ltest-concurrent.c
new file mode 100644
index 0000000000..9462607ec8
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-concurrent.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-concurrent.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-cxx-exceptions.cxx b/src/pal/src/libunwind/tests/Ltest-cxx-exceptions.cxx
new file mode 100644
index 0000000000..24bcd13e3d
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-cxx-exceptions.cxx
@@ -0,0 +1,80 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2010 stefan.demharter@gmx.net
+ Copyright (C) 2010 arun.sharma@google.com
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <libunwind.h>
+#include "compiler.h"
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+static int verbose;
+
+struct Test
+{
+ public: // --- ctor/dtor ---
+ Test() { ++counter_; }
+ ~Test() { -- counter_; }
+ Test(const Test&) { ++counter_; }
+
+ public: // --- static members ---
+ static int counter_;
+};
+
+int Test::counter_ = 0;
+
+// Called by foo
+extern "C" void bar()
+{
+ Test t;
+ try {
+ Test t;
+ throw 5;
+ } catch (...) {
+ Test t;
+ if (verbose)
+ printf("Throwing an int\n");
+ throw 6;
+ }
+}
+
+int main(int argc, char **argv UNUSED)
+{
+ if (argc > 1)
+ verbose = 1;
+ try {
+ Test t;
+ bar();
+ } catch (int) {
+ // Dtor of all Test-object has to be called.
+ if (Test::counter_ != 0)
+ panic("Counter non-zero\n");
+ return Test::counter_;
+ } catch (...) {
+ // An int was thrown - we should not get here.
+ panic("Int was thrown why are we here?\n");
+ }
+ exit(0);
+}
diff --git a/src/pal/src/libunwind/tests/Ltest-dyn1.c b/src/pal/src/libunwind/tests/Ltest-dyn1.c
new file mode 100644
index 0000000000..c2cab6b9a0
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-dyn1.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-dyn1.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-exc.c b/src/pal/src/libunwind/tests/Ltest-exc.c
new file mode 100644
index 0000000000..36a234ca82
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-exc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-exc.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-init-local-signal-lib.c b/src/pal/src/libunwind/tests/Ltest-init-local-signal-lib.c
new file mode 100644
index 0000000000..7474f71f49
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-init-local-signal-lib.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+/* To prevent inlining and optimizing away */
+int foo(volatile int* f) {
+ return *f;
+}
diff --git a/src/pal/src/libunwind/tests/Ltest-init-local-signal.c b/src/pal/src/libunwind/tests/Ltest-init-local-signal.c
new file mode 100644
index 0000000000..4bde218f3b
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-init-local-signal.c
@@ -0,0 +1,60 @@
+#include "libunwind.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <stdlib.h>
+
+#include <signal.h>
+#include <stdio.h>
+#include <assert.h>
+
+int stepper(unw_cursor_t* c) {
+ int steps = 0;
+ int ret = 1;
+ while (ret) {
+
+ ret = unw_step(c);
+ if (!ret) {
+ break;
+ }
+ steps++;
+ }
+ return steps;
+}
+
+/* Verify that we can step from both ucontext, and from getcontext()
+ * roughly the same. This tests that the IP from ucontext is used
+ * correctly (see impl of unw_init_local2) */
+void handler(int num, siginfo_t* info, void* ucontext) {
+ unw_cursor_t c;
+ unw_context_t context;
+ unw_getcontext(&context);
+ int ret = unw_init_local2(&c, ucontext, UNW_INIT_SIGNAL_FRAME);
+ assert(!ret);
+ int ucontext_steps = stepper(&c);
+
+ ret = unw_init_local(&c, &context);
+ (void)ret;
+ assert(!ret);
+ int getcontext_steps = stepper(&c);
+ if (ucontext_steps == getcontext_steps - 2) {
+ exit(0);
+ }
+ printf("unw_getcontext steps was %i, ucontext steps was %i, should be %i\n",
+ getcontext_steps, ucontext_steps, getcontext_steps - 2);
+ exit(-1);
+}
+
+int foo(volatile int* f);
+
+int main(){
+ struct sigaction a;
+ memset(&a, 0, sizeof(struct sigaction));
+ a.sa_sigaction = &handler;
+ a.sa_flags = SA_SIGINFO;
+ sigaction(SIGSEGV, &a, NULL);
+
+ foo(NULL);
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Ltest-init.cxx b/src/pal/src/libunwind/tests/Ltest-init.cxx
new file mode 100644
index 0000000000..58a6ea4279
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-init.cxx
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-init.cxx"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-mem-validate.c b/src/pal/src/libunwind/tests/Ltest-mem-validate.c
new file mode 100644
index 0000000000..1cacb9f028
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-mem-validate.c
@@ -0,0 +1,143 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Copyright (c) 2003 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "compiler.h"
+
+#include <libunwind.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/resource.h>
+#include <sys/mman.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+void * stack_start;
+
+#define PAGE_SIZE 4096
+
+void do_backtrace (void)
+{
+ void* buffer[1024];
+ int size = 1024;
+ mprotect((void*)((uintptr_t)stack_start & ~(PAGE_SIZE - 1)),
+ PAGE_SIZE, PROT_NONE);
+
+ unw_cursor_t cursor;
+ unw_word_t ip, sp;
+ unw_context_t uc;
+ int ret;
+ int steps = 0;
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local failed!\n");
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+
+ ret = unw_step (&cursor);
+ if (ret < 0)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ }
+ steps ++;
+ }
+ while (ret > 0);
+
+ if (steps < 5)
+ {
+ exit(-1);
+ }
+
+ mprotect((void*)((uintptr_t)stack_start & ~(PAGE_SIZE - 1)),
+ PAGE_SIZE, PROT_READ|PROT_WRITE);
+}
+
+void consume_and_run (int depth)
+{
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ char string[1024];
+
+ sprintf (string, "hello %p %p\n", &cursor, &uc);
+ if (depth == 0) {
+ do_backtrace();
+ } else {
+ consume_and_run(depth - 1);
+ }
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ int start;
+ unw_context_t uc;
+ unw_cursor_t cursor;
+
+ stack_start = &start;
+
+ // Initialize pipe mem validate check, opens file descriptors
+ unw_getcontext(&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local failed!\n");
+
+ int i;
+ for (i = 3; i < 10; i++)
+ {
+
+ pid_t childpid = fork();
+ if (!childpid)
+ {
+ /* Close fds and make sure we still work */
+ int ret = close(i);
+ }
+
+ int status;
+ if (childpid)
+ {
+ wait(&status);
+ if (WIFEXITED(status))
+ return WEXITSTATUS(status);
+ else
+ return -1;
+ }
+ else
+ {
+ consume_and_run (10);
+
+ return 0;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Ltest-nocalloc.c b/src/pal/src/libunwind/tests/Ltest-nocalloc.c
new file mode 100644
index 0000000000..f5c31b2a3e
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-nocalloc.c
@@ -0,0 +1,137 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2011 Google, Inc
+ Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <pthread.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+int num_mallocs;
+int num_callocs;
+int in_unwind;
+
+void *
+calloc(size_t n, size_t s)
+{
+ static void * (*func)(size_t, size_t);
+
+#ifdef __GLIBC__
+ /* In glibc, dlsym() calls calloc. Calling dlsym(RTLD_NEXT, "calloc") here
+ causes infinite recursion. Instead, we simply use it by its other
+ name. */
+ extern void *__libc_calloc(size_t, size_t);
+ if (!func)
+ func = &__libc_calloc;
+#else
+ if(!func)
+ func = dlsym(RTLD_NEXT, "calloc");
+#endif
+
+ if (in_unwind) {
+ num_callocs++;
+ return NULL;
+ } else {
+ return func(n, s);
+ }
+}
+
+void *
+malloc(size_t s)
+{
+ static void * (*func)(size_t);
+
+ if(!func)
+ func = dlsym(RTLD_NEXT, "malloc");
+
+ if (in_unwind) {
+ num_mallocs++;
+ return NULL;
+ } else {
+ return func(s);
+ }
+}
+
+static void
+do_backtrace (void)
+{
+ const int num_levels = 100;
+ void *pc[num_levels];
+
+ in_unwind = 1;
+ unw_backtrace(pc, num_levels);
+ in_unwind = 0;
+}
+
+void
+foo3 (void)
+{
+ do_backtrace ();
+}
+
+void
+foo2 (void)
+{
+ foo3 ();
+}
+
+void
+foo1 (void)
+{
+ foo2 ();
+}
+
+int
+main (void)
+{
+ int i, num_errors;
+
+ /* Create (and leak) 100 TSDs, then call backtrace()
+ and check that it doesn't call malloc()/calloc(). */
+ for (i = 0; i < 100; ++i) {
+ pthread_key_t key;
+ if (pthread_key_create (&key, NULL))
+ panic ("FAILURE: unable to create key %d\n", i);
+ }
+ /* Call backtrace right after thread creation,
+ * where we are sure that we're not inside malloc */
+ do_backtrace();
+ num_mallocs = num_callocs = 0;
+ foo1 ();
+ num_errors = num_mallocs + num_callocs;
+ if (num_errors > 0)
+ {
+ fprintf (stderr,
+ "FAILURE: detected %d error%s (malloc: %d, calloc: %d)\n",
+ num_errors, num_errors > 1 ? "s" : "",
+ num_mallocs, num_callocs);
+ exit (-1);
+ }
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Ltest-nomalloc.c b/src/pal/src/libunwind/tests/Ltest-nomalloc.c
new file mode 100644
index 0000000000..74d6331286
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-nomalloc.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-nomalloc.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-resume-sig-rt.c b/src/pal/src/libunwind/tests/Ltest-resume-sig-rt.c
new file mode 100644
index 0000000000..01fd6dc7d7
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-resume-sig-rt.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-resume-sig-rt.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-resume-sig.c b/src/pal/src/libunwind/tests/Ltest-resume-sig.c
new file mode 100644
index 0000000000..0047b524aa
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-resume-sig.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-resume-sig.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-trace.c b/src/pal/src/libunwind/tests/Ltest-trace.c
new file mode 100644
index 0000000000..fb0e9c10bd
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-trace.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if !defined(UNW_REMOTE_ONLY)
+#include "Gtest-trace.c"
+#endif
diff --git a/src/pal/src/libunwind/tests/Ltest-varargs.c b/src/pal/src/libunwind/tests/Ltest-varargs.c
new file mode 100644
index 0000000000..17ac600be6
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Ltest-varargs.c
@@ -0,0 +1,84 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#include "compiler.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int ok;
+int verbose;
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 3)
+void a (int, ...) __attribute__((optimize(0)));
+void b (void) __attribute__((optimize(0)));
+void c (void) __attribute__((optimize(0)));
+#endif
+
+void NOINLINE
+b (void)
+{
+ void *v[20];
+ int i, n;
+
+ n = unw_backtrace(v, 20);
+
+ /* Check that the number of addresses given by unw_backtrace() looks
+ * reasonable. If the compiler inlined everything, then this check will also
+ * break. */
+ if (n >= 7)
+ ok = 1;
+
+ if (verbose)
+ for (i = 0; i < n; ++i)
+ printf ("[%d] %p\n", i, v[i]);
+}
+
+void NOINLINE
+c (void)
+{
+ b ();
+}
+
+void NOINLINE
+a (int d, ...)
+{
+ switch (d)
+ {
+ case 5:
+ a (4, 2,4);
+ break;
+ case 4:
+ a (3, 1,3,5);
+ break;
+ case 3:
+ a (2, 11, 13, 17, 23);
+ break;
+ case 2:
+ a (1);
+ break;
+ case 1:
+ c ();
+ }
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ if (argc > 1)
+ verbose = 1;
+
+ a (5, 3, 4, 5, 6);
+
+ if (!ok)
+ {
+ fprintf (stderr, "FAILURE: expected deeper backtrace.\n");
+ return 1;
+ }
+
+ if (verbose)
+ printf ("SUCCESS.\n");
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/Makefile.am b/src/pal/src/libunwind/tests/Makefile.am
new file mode 100644
index 0000000000..4b0b9db7d1
--- /dev/null
+++ b/src/pal/src/libunwind/tests/Makefile.am
@@ -0,0 +1,234 @@
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
+EXTRA_DIST = run-ia64-test-dyn1 run-ptrace-mapper run-ptrace-misc \
+ run-check-namespace run-coredump-unwind \
+ run-coredump-unwind-mdi check-namespace.sh.in \
+ Gtest-nomalloc.c
+
+MAINTAINERCLEANFILES = Makefile.in
+
+noinst_PROGRAMS_arch =
+noinst_PROGRAMS_cdep =
+noinst_PROGRAMS_common =
+check_PROGRAMS_arch =
+check_PROGRAMS_cdep =
+check_PROGRAMS_common = test-proc-info test-static-link \
+ test-strerror
+check_SCRIPTS_arch =
+check_SCRIPTS_cdep =
+check_SCRIPTS_common = run-check-namespace
+
+if REMOTE_ONLY
+
+perf:
+
+else
+ LIBUNWIND_local = $(top_builddir)/src/libunwind.la
+if ARCH_IA64
+ noinst_PROGRAMS_arch += ia64-test-dyn1
+ check_SCRIPTS_arch += run-ia64-test-dyn1
+ check_PROGRAMS_arch += Gia64-test-stack Lia64-test-stack \
+ Gia64-test-nat Lia64-test-nat \
+ Gia64-test-rbs Lia64-test-rbs \
+ Gia64-test-readonly Lia64-test-readonly \
+ ia64-test-setjmp ia64-test-sig
+else #!ARCH_IA64
+if ARCH_PPC64
+if USE_ALTIVEC
+ noinst_PROGRAMS_arch += ppc64-test-altivec
+endif #USE_ALTIVEC
+endif #ARCH_PPC64
+endif #!ARCH_IA64
+ check_PROGRAMS_cdep += Gtest-bt Ltest-bt Gtest-exc Ltest-exc \
+ Gtest-init Ltest-init \
+ Gtest-concurrent Ltest-concurrent \
+ Gtest-resume-sig Ltest-resume-sig \
+ Gtest-resume-sig-rt Ltest-resume-sig-rt \
+ Gtest-trace Ltest-trace \
+ Ltest-init-local-signal \
+ Ltest-mem-validate \
+ test-async-sig test-flush-cache test-init-remote \
+ test-mem test-reg-state Ltest-varargs \
+ Ltest-nomalloc Ltest-nocalloc Lrs-race
+ noinst_PROGRAMS_cdep += forker Gperf-simple Lperf-simple \
+ Gperf-trace Lperf-trace
+
+if BUILD_PTRACE
+ check_SCRIPTS_cdep += run-ptrace-mapper run-ptrace-misc
+ check_PROGRAMS_cdep += test-ptrace
+ noinst_PROGRAMS_cdep += mapper test-ptrace-misc
+endif
+
+if BUILD_SETJMP
+ check_PROGRAMS_cdep += test-setjmp
+endif
+
+if SUPPORT_CXX_EXCEPTIONS
+ check_PROGRAMS_cdep += Ltest-cxx-exceptions
+endif
+
+if OS_LINUX
+if BUILD_COREDUMP
+ check_SCRIPTS_cdep += run-coredump-unwind
+ noinst_PROGRAMS_cdep += crasher test-coredump-unwind
+
+if HAVE_LZMA
+ check_SCRIPTS_cdep += run-coredump-unwind-mdi
+endif # HAVE_LZMA
+endif # BUILD_COREDUMP
+endif # OS_LINUX
+
+perf: perf-startup Gperf-simple Lperf-simple Lperf-trace
+ @echo "########## Basic performance of generic libunwind:"
+ @./Gperf-simple
+ @echo "########## Basic performance of local-only libunwind:"
+ @./Lperf-simple
+ @echo "########## Performance of fast unwind:"
+ @./Lperf-trace
+ @echo "########## Startup overhead:"
+ @$(srcdir)/perf-startup @arch@
+
+endif
+
+check_PROGRAMS = $(check_PROGRAMS_common) $(check_PROGRAMS_cdep) \
+ $(check_PROGRAMS_arch)
+check_SCRIPTS = $(check_SCRIPTS_common) $(check_SCRIPTS_cdep) \
+ $(check_SCRIPTS_arch)
+
+
+TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+XFAIL_TESTS =
+
+if ARCH_IA64
+ check_PROGRAMS_cdep += Gtest-dyn1 Ltest-dyn1
+endif
+
+# Use if arch defines but does not support PTRACE_SINGLESTEP
+# ptrace request used in the tests.
+XFAIL_TESTS_PTRACE_SINGLESTEP = run-ptrace-mapper run-ptrace-misc
+
+if ARCH_MIPS
+XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP)
+endif
+
+if ARCH_ARM
+# ARM Linux kernel >=2.6.39 removed PTRACE_SINGLESTEP emulation
+XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP)
+endif
+
+# This is meant for multilib binaries, -m32.
+# ptrace gives EBADREG when testing,
+# but generally everything else works.
+if NO_PTRACE_TEST
+ XFAIL_TESTS += run-ptrace-mapper test-ptrace Ltest-init-local-signal
+endif
+
+noinst_PROGRAMS = $(noinst_PROGRAMS_common) $(noinst_PROGRAMS_cdep) \
+ $(noinst_PROGRAMS_arch)
+
+Lia64_test_readonly_SOURCES = Lia64-test-readonly.c ia64-test-readonly-asm.S
+Gia64_test_readonly_SOURCES = Gia64-test-readonly.c ia64-test-readonly-asm.S
+Lia64_test_stack_SOURCES = Lia64-test-stack.c ia64-test-stack-asm.S \
+ ia64-test-stack.h
+Gia64_test_stack_SOURCES = Gia64-test-stack.c ia64-test-stack-asm.S \
+ ia64-test-stack.h
+Lia64_test_rbs_SOURCES = Lia64-test-rbs.c ia64-test-rbs-asm.S ia64-test-rbs.h
+Gia64_test_rbs_SOURCES = Gia64-test-rbs.c ia64-test-rbs-asm.S ia64-test-rbs.h
+Lia64_test_nat_SOURCES = Lia64-test-nat.c ia64-test-nat-asm.S
+Gia64_test_nat_SOURCES = Gia64-test-nat.c ia64-test-nat-asm.S
+ia64_test_dyn1_SOURCES = ia64-test-dyn1.c ia64-dyn-asm.S flush-cache.S \
+ flush-cache.h
+ppc64_test_altivec_SOURCES = ppc64-test-altivec.c ppc64-test-altivec-utils.c
+Gtest_init_SOURCES = Gtest-init.cxx
+Ltest_init_SOURCES = Ltest-init.cxx
+Ltest_cxx_exceptions_SOURCES = Ltest-cxx-exceptions.cxx
+
+Ltest_init_local_signal_SOURCES = Ltest-init-local-signal.c Ltest-init-local-signal-lib.c
+
+Gtest_dyn1_SOURCES = Gtest-dyn1.c flush-cache.S flush-cache.h
+Ltest_dyn1_SOURCES = Ltest-dyn1.c flush-cache.S flush-cache.h
+test_static_link_SOURCES = test-static-link-loc.c test-static-link-gen.c
+test_static_link_LDFLAGS = -static
+forker_LDFLAGS = -static
+Gtest_bt_SOURCES = Gtest-bt.c ident.c
+Ltest_bt_SOURCES = Ltest-bt.c ident.c
+test_ptrace_misc_SOURCES = test-ptrace-misc.c ident.c
+Ltest_nomalloc_SOURCES = Ltest-nomalloc.c
+Ltest_nocalloc_SOURCES = Ltest-nocalloc.c
+Gtest_trace_SOURCES = Gtest-trace.c ident.c
+Ltest_trace_SOURCES = Ltest-trace.c ident.c
+Ltest_mem_validate_SOURCES = Ltest-mem-validate.c
+
+LIBUNWIND = $(top_builddir)/src/libunwind-$(arch).la
+LIBUNWIND_ptrace = $(top_builddir)/src/libunwind-ptrace.la
+LIBUNWIND_coredump = $(top_builddir)/src/libunwind-coredump.la
+
+if USE_ELF32
+LIBUNWIND_ELF = $(top_builddir)/src/libunwind-elf32.la
+endif
+if USE_ELF64
+LIBUNWIND_ELF = $(top_builddir)/src/libunwind-elf64.la
+endif
+if USE_ELFXX
+LIBUNWIND_ELF = $(top_builddir)/src/libunwind-elfxx.la
+endif
+
+LIBUNWIND_setjmp = $(top_builddir)/src/libunwind-setjmp.la \
+ $(LIBUNWIND_ELF) $(LIBUNWIND)
+
+test_async_sig_LDADD = $(LIBUNWIND_local) -lpthread
+test_flush_cache_LDADD = $(LIBUNWIND_local)
+test_init_remote_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+test_mem_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+test_reg_state_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+test_ptrace_LDADD = $(LIBUNWIND_ptrace) $(LIBUNWIND)
+test_proc_info_LDADD = $(LIBUNWIND)
+test_static_link_LDADD = $(LIBUNWIND)
+test_strerror_LDADD = $(LIBUNWIND)
+Lrs_race_LDADD = $(LIBUNWIND_local) -lpthread
+Ltest_varargs_LDADD = $(LIBUNWIND_local)
+Ltest_init_local_signal_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+
+Gtest_bt_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gtest_concurrent_LDADD = $(LIBUNWIND) $(LIBUNWIND_local) -lpthread
+Gtest_dyn1_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gtest_exc_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gtest_init_LDADD = $(LIBUNWIND) $(LIBUNWIND_local) @BACKTRACELIB@
+Gtest_resume_sig_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gtest_resume_sig_rt_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gperf_simple_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gtest_trace_LDADD=$(LIBUNWIND) $(LIBUNWIND_local)
+Gperf_trace_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+
+Ltest_bt_LDADD = $(LIBUNWIND_local)
+Ltest_concurrent_LDADD = $(LIBUNWIND_local) -lpthread
+Ltest_dyn1_LDADD = $(LIBUNWIND_local)
+Ltest_exc_LDADD = $(LIBUNWIND_local)
+Ltest_init_LDADD = $(LIBUNWIND_local)
+Ltest_nomalloc_LDADD = $(LIBUNWIND_local) @DLLIB@
+Ltest_nocalloc_LDADD = $(LIBUNWIND_local) @DLLIB@ -lpthread
+Ltest_resume_sig_LDADD = $(LIBUNWIND_local)
+Ltest_resume_sig_rt_LDADD = $(LIBUNWIND_local)
+Lperf_simple_LDADD = $(LIBUNWIND_local)
+Ltest_trace_LDADD = $(LIBUNWIND_local)
+Lperf_trace_LDADD = $(LIBUNWIND_local)
+Ltest_mem_validate_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+
+test_setjmp_LDADD = $(LIBUNWIND_setjmp)
+ia64_test_setjmp_LDADD = $(LIBUNWIND_setjmp)
+
+if BUILD_COREDUMP
+test_coredump_unwind_LDADD = $(LIBUNWIND_coredump) $(LIBUNWIND) @BACKTRACELIB@
+endif
+
+Gia64_test_nat_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gia64_test_stack_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gia64_test_rbs_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Gia64_test_readonly_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
+Lia64_test_nat_LDADD = $(LIBUNWIND_local)
+Lia64_test_stack_LDADD = $(LIBUNWIND_local)
+Lia64_test_rbs_LDADD = $(LIBUNWIND_local)
+Lia64_test_readonly_LDADD = $(LIBUNWIND_local)
+ia64_test_dyn1_LDADD = $(LIBUNWIND)
+ia64_test_sig_LDADD = $(LIBUNWIND)
+ppc64_test_altivec_LDADD = $(LIBUNWIND)
diff --git a/src/pal/src/libunwind/tests/check-namespace.sh.in b/src/pal/src/libunwind/tests/check-namespace.sh.in
new file mode 100644
index 0000000000..6d0081732d
--- /dev/null
+++ b/src/pal/src/libunwind/tests/check-namespace.sh.in
@@ -0,0 +1,367 @@
+#!/bin/sh
+verbose=false
+if [ "$1" = "-v" ]; then
+ verbose=true
+ shift
+fi
+
+build_plat=@build_arch@
+plat=@arch@
+os=@target_os@
+num_errors=0
+
+LIBUNWIND=../src/.libs/libunwind.so
+LIBUNWIND_GENERIC=../src/.libs/libunwind-${plat}.so
+
+fetch_symtab () {
+ filename=$1
+
+ if [ ! -r $filename ]; then
+ return
+ fi
+
+ if $verbose; then
+ echo "Checking $filename..."
+ fi
+
+ #
+ # Unfortunately, "nm --defined" is a GNU-extension. For portability,
+ # build the list of defined symbols by hand.
+ #
+ symtab=`nm -g $filename`
+ saved_IFS="$IFS"
+ IFS=""
+ undef=`nm -g -u $filename`
+ for line in $undef; do
+ symtab=`echo "$symtab" | grep -v "^${line}"\$`
+ done;
+ IFS="$saved_IFS"
+}
+
+ignore () {
+ sym=$1
+ symtab=`echo "$symtab" | grep -v " ${sym}\$"`
+}
+
+match () {
+ sym=$1
+ if `echo "$symtab" | grep -q " ${sym}\$"`; then
+ symtab=`echo "$symtab" | grep -v " ${sym}\$"`
+ else
+ echo " ERROR: Symbol \"$sym\" missing."
+ num_errors=`expr $num_errors + 1`
+ fi
+}
+
+#
+# Filter out miscellaneous symbols that get defined by the
+# linker for each shared object.
+#
+filter_misc () {
+ ignore _DYNAMIC
+ ignore _GLOBAL_OFFSET_TABLE_
+ ignore __bss_start
+ ignore _edata
+ ignore _end
+ ignore _Uelf32_get_proc_name
+ ignore _Uelf32_valid_object
+ ignore _Uelf64_get_proc_name
+ ignore _Uelf64_valid_object
+ ignore _U.*debug_level
+ ignore ICRT.INTERNAL # ICC 8.x defines this
+
+ # Ignore symbols generated by the ARM Linux default linker script.
+ # For details see the binutils sources (src/ld/emulparams/armelf_linux.sh).
+ if [ ${plat} = "arm" ]; then
+ ignore __bss_start__
+ ignore __bss_end__
+ ignore __end__
+ ignore _bss_end__
+ fi
+
+ if [ ${plat} = "mips" ]; then
+ ignore _fbss
+ ignore _fdata
+ ignore _ftext
+ ignore _gp
+ fi
+}
+
+check_local_unw_abi () {
+ match _UL${plat}_apply_reg_state
+ match _UL${plat}_reg_states_iterate
+ match _UL${plat}_create_addr_space
+ match _UL${plat}_destroy_addr_space
+ match _UL${plat}_get_fpreg
+ match _UL${plat}_get_proc_info
+ match _UL${plat}_get_proc_info_by_ip
+ match _UL${plat}_get_proc_name
+ match _UL${plat}_get_reg
+ match _UL${plat}_get_save_loc
+ match _UL${plat}_init_local
+ match _UL${plat}_init_local2
+ match _UL${plat}_init_remote
+ match _UL${plat}_is_signal_frame
+ match _UL${plat}_local_addr_space
+ match _UL${plat}_resume
+ match _UL${plat}_set_caching_policy
+ match _UL${plat}_set_cache_size
+ match _UL${plat}_set_reg
+ match _UL${plat}_set_fpreg
+ match _UL${plat}_step
+
+ match _U${plat}_flush_cache
+ match _U${plat}_get_accessors
+ match _U${plat}_getcontext
+ match _U${plat}_regname
+ match _U${plat}_strerror
+
+ match _U_dyn_cancel
+ match _U_dyn_info_list_addr
+ match _U_dyn_register
+
+ match unw_backtrace
+ match backtrace
+
+ case ${plat} in
+ arm)
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _UL${plat}_search_unwind_table
+ match _UL${plat}_dwarf_search_unwind_table
+ match _UL${plat}_dwarf_find_unwind_table
+ ;;
+ hppa)
+ match _UL${plat}_dwarf_search_unwind_table
+ match _UL${plat}_dwarf_find_unwind_table
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_setcontext
+ ;;
+ ia64)
+ match _UL${plat}_search_unwind_table
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ ;;
+ x86)
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _UL${plat}_dwarf_search_unwind_table
+ match _UL${plat}_dwarf_find_unwind_table
+ ;;
+ x86_64)
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _UL${plat}_dwarf_search_unwind_table
+ match _UL${plat}_dwarf_find_unwind_table
+ match _U${plat}_setcontext
+ ;;
+ ppc*)
+ match _U${plat}_get_func_addr
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _UL${plat}_dwarf_search_unwind_table
+ match _UL${plat}_dwarf_find_unwind_table
+ ;;
+ tilegx)
+ match _U${plat}_is_fpreg
+ match _UL${plat}_dwarf_search_unwind_table
+ match _UL${plat}_dwarf_find_unwind_table
+ match _UL${plat}_local_addr_space_init
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match ${plat}_lock
+ ;;
+
+ *)
+ match _U${plat}_is_fpreg
+ match _UL${plat}_dwarf_search_unwind_table
+ match _UL${plat}_dwarf_find_unwind_table
+ ;;
+ esac
+
+ if [ x@enable_debug_frame@ = xyes ]; then
+ match _UL${plat}_dwarf_find_debug_frame
+ fi
+
+}
+
+check_generic_unw_abi () {
+ match _U${plat}_apply_reg_state
+ match _U${plat}_reg_states_iterate
+ match _U${plat}_create_addr_space
+ match _U${plat}_destroy_addr_space
+ match _U${plat}_flush_cache
+ match _U${plat}_get_accessors
+ match _U${plat}_get_fpreg
+ match _U${plat}_get_proc_info
+ match _U${plat}_get_proc_info_by_ip
+ match _U${plat}_get_proc_name
+ match _U${plat}_get_reg
+ match _U${plat}_get_save_loc
+ match _U${plat}_init_local
+ match _U${plat}_init_local2
+ match _U${plat}_init_remote
+ match _U${plat}_is_signal_frame
+ match _U${plat}_local_addr_space
+ match _U${plat}_regname
+ match _U${plat}_resume
+ match _U${plat}_set_caching_policy
+ match _U${plat}_set_cache_size
+ match _U${plat}_set_fpreg
+ match _U${plat}_set_reg
+ match _U${plat}_step
+ match _U${plat}_strerror
+
+ case ${plat} in
+ arm)
+ match _U${plat}_is_fpreg
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_search_unwind_table
+ match _U${plat}_dwarf_search_unwind_table
+ match _U${plat}_dwarf_find_unwind_table
+ ;;
+ hppa)
+ match _U${plat}_dwarf_search_unwind_table
+ match _U${plat}_dwarf_find_unwind_table
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ ;;
+ ia64)
+ match _U${plat}_search_unwind_table
+ match _U${plat}_find_dyn_list
+ if [ $plat = $build_plat ]; then
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ case $os in
+ linux*)
+ match _U${plat}_get_kernel_table
+ ;;
+ esac
+ fi
+ ;;
+ x86)
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _U${plat}_dwarf_search_unwind_table
+ match _U${plat}_dwarf_find_unwind_table
+ ;;
+ x86_64)
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _U${plat}_dwarf_search_unwind_table
+ match _U${plat}_dwarf_find_unwind_table
+ ;;
+ ppc*)
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_get_func_addr
+ match _U${plat}_is_fpreg
+ match _U${plat}_dwarf_search_unwind_table
+ match _U${plat}_dwarf_find_unwind_table
+ ;;
+ tilegx)
+ match _U${plat}_dwarf_search_unwind_table
+ match _U${plat}_dwarf_find_unwind_table
+ match _U${plat}_get_elf_image
+ match _U${plat}_get_exe_image_path
+ match _U${plat}_is_fpreg
+ match _U${plat}_local_addr_space_init
+ match ${plat}_lock
+ ;;
+ *)
+ match _U${plat}_is_fpreg
+ match _U${plat}_dwarf_search_unwind_table
+ match _U${plat}_dwarf_find_unwind_table
+ ;;
+ esac
+
+ if [ x@enable_debug_frame@ = xyes ]; then
+ match _U${plat}_dwarf_find_debug_frame
+ fi
+}
+
+check_cxx_abi () {
+ match _Unwind_Backtrace
+ match _Unwind_DeleteException
+ match _Unwind_FindEnclosingFunction
+ match _Unwind_ForcedUnwind
+ match _Unwind_GetBSP
+ match _Unwind_GetCFA
+ match _Unwind_GetDataRelBase
+ match _Unwind_GetGR
+ match _Unwind_GetIP
+ match _Unwind_GetIPInfo
+ match _Unwind_GetLanguageSpecificData
+ match _Unwind_GetRegionStart
+ match _Unwind_GetTextRelBase
+ match _Unwind_RaiseException
+ match _Unwind_Resume
+ match _Unwind_Resume_or_Rethrow
+ match _Unwind_SetGR
+ match _Unwind_SetIP
+ match __libunwind_Unwind_Backtrace
+ match __libunwind_Unwind_DeleteException
+ match __libunwind_Unwind_FindEnclosingFunction
+ match __libunwind_Unwind_ForcedUnwind
+ match __libunwind_Unwind_GetBSP
+ match __libunwind_Unwind_GetCFA
+ match __libunwind_Unwind_GetDataRelBase
+ match __libunwind_Unwind_GetGR
+ match __libunwind_Unwind_GetIP
+ match __libunwind_Unwind_GetIPInfo
+ match __libunwind_Unwind_GetLanguageSpecificData
+ match __libunwind_Unwind_GetRegionStart
+ match __libunwind_Unwind_GetTextRelBase
+ match __libunwind_Unwind_RaiseException
+ match __libunwind_Unwind_Resume
+ match __libunwind_Unwind_Resume_or_Rethrow
+ match __libunwind_Unwind_SetGR
+ match __libunwind_Unwind_SetIP
+ case $os in
+ linux*)
+ # needed only for Intel 8.0 bug-compatibility
+ match _ReadSLEB
+ match _ReadULEB
+ ;;
+ esac
+}
+
+check_empty () {
+ if [ -n "$symtab" ]; then
+ printf " ERROR: Extraneous symbols:\n$symtab\n"
+ num_errors=`expr $num_errors + 1`
+ fi
+}
+
+if [ $plat = $build_plat ]; then
+ fetch_symtab $LIBUNWIND
+ filter_misc
+ check_local_unw_abi
+ if [ x@enable_cxx_exceptions@ = xyes ]; then
+ check_cxx_abi
+ fi
+ check_empty
+fi
+
+fetch_symtab $LIBUNWIND_GENERIC
+filter_misc
+check_generic_unw_abi
+check_empty
+
+if [ $num_errors -gt 0 ]; then
+ echo "FAILURE: Detected $num_errors errors"
+ exit 1
+fi
+
+if $verbose; then
+ echo " SUCCESS: all checks passed"
+fi
+exit 0
diff --git a/src/pal/src/libunwind/tests/crasher.c b/src/pal/src/libunwind/tests/crasher.c
new file mode 100644
index 0000000000..24c78054c9
--- /dev/null
+++ b/src/pal/src/libunwind/tests/crasher.c
@@ -0,0 +1,124 @@
+/* This program should crash and produce coredump */
+
+#include "compiler.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+#endif
+
+#if defined(__linux__)
+void write_maps(char *fname)
+{
+ char buf[512], path[128];
+ char exec;
+ uintmax_t addr;
+ FILE *maps = fopen("/proc/self/maps", "r");
+ FILE *out = fopen(fname, "w");
+
+ if (!maps || !out)
+ exit(EXIT_FAILURE);
+
+ while (fgets(buf, sizeof(buf), maps))
+ {
+ if (sscanf(buf, "%jx-%*x %*c%*c%c%*c %*x %*s %*d /%126[^\n]", &addr, &exec, path+1) != 3)
+ continue;
+
+ if (exec != 'x')
+ continue;
+
+ path[0] = '/';
+ fprintf(out, "0x%jx:%s ", addr, path);
+ }
+ fprintf(out, "\n");
+
+ fclose(out);
+ fclose(maps);
+}
+#elif defined(__FreeBSD__)
+void
+write_maps(char *fname)
+{
+ FILE *out;
+ char *buf, *bp, *eb;
+ struct kinfo_vmentry *kv;
+ int mib[4], error;
+ size_t len;
+
+ out = fopen(fname, "w");
+ if (out == NULL)
+ exit(EXIT_FAILURE);
+
+ len = 0;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_VMMAP;
+ mib[3] = getpid();
+ error = sysctl(mib, 4, NULL, &len, NULL, 0);
+ if (error == -1)
+ exit(EXIT_FAILURE);
+ len = len * 4 / 3;
+ buf = malloc(len);
+ if (buf == NULL)
+ exit(EXIT_FAILURE);
+ error = sysctl(mib, 4, buf, &len, NULL, 0);
+ if (error == -1)
+ exit(EXIT_FAILURE);
+
+ for (bp = buf, eb = buf + len; bp < eb; bp += kv->kve_structsize) {
+ kv = (struct kinfo_vmentry *)(uintptr_t)bp;
+ if (kv->kve_type == KVME_TYPE_VNODE &&
+ (kv->kve_protection & KVME_PROT_EXEC) != 0) {
+ fprintf(out, "0x%jx:%s ", kv->kve_start, kv->kve_path);
+ }
+ }
+
+ fprintf(out, "\n");
+ fclose(out);
+ free(buf);
+}
+#else
+#error Port me
+#endif
+
+#ifdef __GNUC__
+int c(int x) NOINLINE ALIAS(b);
+#define compiler_barrier() asm volatile("");
+#else
+int c(int x);
+#define compiler_barrier()
+#endif
+
+int NOINLINE a(void)
+{
+ *(volatile int *)32 = 1;
+ return 1;
+}
+
+int NOINLINE b(int x)
+{
+ int r;
+
+ compiler_barrier();
+
+ if (x)
+ r = a();
+ else
+ r = c(1);
+ return r + 1;
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc > 1)
+ write_maps(argv[1]);
+ b(0);
+ return 0;
+}
+
diff --git a/src/pal/src/libunwind/tests/flush-cache.S b/src/pal/src/libunwind/tests/flush-cache.S
new file mode 100644
index 0000000000..3ee47269e1
--- /dev/null
+++ b/src/pal/src/libunwind/tests/flush-cache.S
@@ -0,0 +1,104 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef HAVE__BUILTIN___CLEAR_CACHE
+
+#if defined(__ia64__)
+
+ .global flush_cache
+
+ .proc flush_cache
+flush_cache:
+ .prologue
+ alloc r2=ar.pfs,2,0,0,0
+ add r8=31,in1 // round up to 32 byte-boundary
+ ;;
+ shr.u r8=r8,5 // we flush 32 bytes per iteration
+ ;;
+ add r8=-1,r8
+ .save ar.lc, r3
+ mov r3=ar.lc // save ar.lc
+ ;;
+ .body
+
+ mov ar.lc=r8
+ ;;
+.loop: fc in0 // issuable on M0 only
+ add in0=32,in0
+ br.cloop.sptk.few .loop
+ ;;
+ sync.i
+ ;;
+ srlz.i
+ ;;
+ mov ar.lc=r3 // restore ar.lc
+ br.ret.sptk.many rp
+ .endp flush_cache
+
+#elif defined(__i386__) || defined (__x86_64__)
+
+ .globl flush_cache
+flush_cache:
+ ret
+
+#elif defined(__hppa__)
+
+# warning FIX ME!!
+
+ .globl flush_cache
+flush_cache:
+ .proc
+ .callinfo
+ bv %r0(%rp)
+ .procend
+#elif defined(__powerpc64__)
+# warning IMPLEMENT ME FOR PPC64!!
+ .globl flush_cache
+flush_cache:
+ lwz 11, 0(1) ;
+ lwz 0, 4(11) ;
+ mtlr 0 ;
+ lwz 31, -4(11) ;
+ mr 1, 11 ;
+ blr
+#elif defined(__powerpc__)
+# warning IMPLEMENT ME FOR PPC32!!
+ .globl flush_cache
+flush_cache:
+ lwz 11, 0(1) ;
+ lwz 0, 4(11) ;
+ mtlr 0 ;
+ lwz 31, -4(11) ;
+ mr 1, 11 ;
+ blr
+#elif defined(__arm__)
+ .text
+ .globl flush_cache
+flush_cache:
+ bx lr
+#elif defined(__tilegx__)
+ .text
+ .globl flush_cache
+flush_cache:
+
+ andi r0, r0, -64
+1: {
+ flush r0 ;
+ addi r0, r0, 64
+ }
+ {
+ bgtz r1, 1b ;
+ addi r1, r1, -64
+ }
+ jrp lr
+#else
+# error Need flush_cache code for this architecture.
+#endif
+
+#if defined ( __linux__) && !defined (__arm__)
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
+
+#endif
diff --git a/src/pal/src/libunwind/tests/flush-cache.h b/src/pal/src/libunwind/tests/flush-cache.h
new file mode 100644
index 0000000000..8227d85b3f
--- /dev/null
+++ b/src/pal/src/libunwind/tests/flush-cache.h
@@ -0,0 +1,38 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef FLUSH_CACHE_H
+#define FLUSH_CACHE_H
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE__BUILTIN___CLEAR_CACHE
+#define flush_cache(ADDR, LEN) \
+ __builtin___clear_cache((ADDR), (ADDR) + (LEN))
+#else
+#include <stddef.h>
+extern void flush_cache (void *addr, size_t len);
+#endif
+
+#endif /* FLUSH_CACHE_H */
diff --git a/src/pal/src/libunwind/tests/forker.c b/src/pal/src/libunwind/tests/forker.c
new file mode 100644
index 0000000000..b03f86a7f0
--- /dev/null
+++ b/src/pal/src/libunwind/tests/forker.c
@@ -0,0 +1,76 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+int
+main (int argc, char **argv, char **envp)
+{
+ char *program, **child_argv;
+ struct timeval start, stop;
+ double secs;
+ int status, i;
+ long count;
+ pid_t pid;
+
+ count = atol (argv[1]);
+ program = argv[2];
+
+ child_argv = alloca ((argc - 1) * sizeof (char *));
+ for (i = 0; i < argc - 2; ++i)
+ child_argv[i] = argv[2 + i];
+ child_argv[i] = NULL;
+
+ gettimeofday (&start, NULL);
+ for (i = 0; i < count; ++i)
+ {
+ pid = fork ();
+ if (pid == 0)
+ {
+ execve (program, child_argv, envp);
+ _exit (-1);
+ }
+ else
+ {
+ waitpid (pid, &status, 0);
+ if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
+ {
+ fprintf (stderr, "%s: child failed\n", argv[0]);
+ exit (-1);
+ }
+ }
+ }
+ gettimeofday (&stop, NULL);
+
+ secs = ((stop.tv_sec + 1e-6 * stop.tv_usec)
+ - (start.tv_sec + 1e-6 * start.tv_usec));
+ printf ("%lu nsec/execution\n",
+ (unsigned long) (1e9 * secs / (double) count));
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/ia64-dyn-asm.S b/src/pal/src/libunwind/tests/ia64-dyn-asm.S
new file mode 100644
index 0000000000..79582e9e1b
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-dyn-asm.S
@@ -0,0 +1,102 @@
+ .globl func_add1, func_add1_end
+ .proc func_add1
+func_add1:
+{.mib; add r8 = 1, r32
+ nop.i 0
+ br.ret.sptk.many rp
+}
+func_add1_end:
+ .endp func_add1
+
+ .globl func_add3, func_add3_end
+ .proc func_add3
+func_add3:
+{.mmi; alloc loc0 = ar.pfs, 2, 1, 2, 0
+ mov r2 = sp
+ add sp = -16, sp
+} ;;
+{.mii; ld8 r8 = [in1], 8 // load the function pointer
+ mov r3 = rp
+ mov rp = loc0 // trash rp
+} ;;
+{.mmi; ld8 r9 = [r8], 8 // load the entry-point
+ st8 [r2] = r3
+ mov out0 = in0
+} ;;
+{.mii; ld8 gp = [r8] // load the gp
+ mov b6 = r9
+ mov out1 = in1
+}
+{.mib; nop 0
+ nop 0
+ br.call.sptk rp = b6
+}
+{.mmi; add r2 = 16, sp
+ ;;
+ ld8 r3 = [r2] // r3 = saved rp
+ mov ar.pfs = loc0
+} ;;
+{.mii; nop 0
+ mov rp = r3
+ adds sp = 16, sp
+} ;;
+{.mib; st8 [sp] = in0 // trash rp save location
+ add r8 = 2, r8
+ br.ret.sptk.many rp
+}
+func_add3_end:
+ .endp func_add3
+
+ .globl func_vframe, func_vframe_end
+ .proc func_vframe
+func_vframe:
+{.mii; alloc r16 = ar.pfs, 1, 2, 0, 0 // 0
+ mov loc0 = rp
+ mov loc1 = sp
+} ;;
+{.mmi; sub sp = sp, in0
+ st8 [loc1] = r16
+ mov r2 = -99 // 0
+} ;;
+{.mii; nop 0
+ mov rp = r2
+ mov ar.pfs = r0
+}
+{.mib; mov r16 = r2
+ tbit.nz p6, p0 = in0, 4
+(p6) br.cond.sptk.many .exit
+} ;;
+{.mmi; ld8 r16 = [loc1]
+ ;;
+ mov r3 = loc0 // 8 move saved rp to r3
+ mov ar.pfs = r16
+} ;;
+{.mmi; mov sp = loc1 // 10
+ st8 [loc1] = r0 // trash saved pfs
+ mov loc0 = r2
+} ;;
+{.mib; mov r8 = 10
+ mov rp = r3
+ br.ret.sptk.many rp
+}
+.exit:
+{.mmi; ld8 r16 = [loc1]
+ ;;
+ sub sp = 32, sp
+ mov ar.pfs = r16
+} ;;
+{.mmi; mov sp = loc1
+ st8 [loc1] = r0 // trash saved pfs
+ mov rp = loc0
+}
+{.mib; nop 0
+ mov r8 = 4
+ br.ret.sptk.many rp
+}
+func_vframe_end:
+ .endp func_vframe
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/tests/ia64-test-dyn1.c b/src/pal/src/libunwind/tests/ia64-test-dyn1.c
new file mode 100644
index 0000000000..90127dd5b9
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-dyn1.c
@@ -0,0 +1,223 @@
+#include "flush-cache.h"
+
+#include <assert.h>
+#include <libunwind.h>
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <sys/mman.h>
+
+int verbose;
+
+#ifdef __ia64__
+# define GET_ENTRY(fdesc) (((uintptr_t *) (fdesc))[0])
+# define GET_GP(fdesc) (((uintptr_t *) (fdesc))[0])
+# define EXTRA 16
+#else
+# define GET_ENTRY(fdesc) ((uintptr_t ) (fdesc))
+# define GET_GP(fdesc) (0)
+# define EXTRA 0
+#endif
+
+int
+make_executable (void *addr, size_t len)
+{
+ if (mprotect ((void *) (((long) addr) & -getpagesize ()), len,
+ PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
+ {
+ perror ("mprotect");
+ return -1;
+ }
+ flush_cache (addr, len);
+ return 0;
+}
+
+void *
+create_func (unw_dyn_info_t *di, const char *name, long (*func) (),
+ void *end, unw_dyn_region_info_t *region)
+{
+ void *mem, *memend, *addr, *fptr;
+ unw_word_t gp = 0;
+ size_t len;
+
+ len = (uintptr_t) end - GET_ENTRY (func) + EXTRA;
+ mem = malloc (len);
+ if (verbose)
+ printf ("%s: cloning %s at %p (%zu bytes)\n",
+ __FUNCTION__, name, mem, len);
+ memend = (char *) mem + len;
+
+#ifdef __ia64__
+ addr = (void *) GET_ENTRY (func);
+
+ /* build function descriptor: */
+ ((long *) mem)[0] = (long) mem + 16; /* entry point */
+ ((long *) mem)[1] = GET_GP (func); /* global-pointer */
+ fptr = mem;
+ mem = (void *) ((long) mem + 16);
+#else
+ fptr = mem;
+#endif
+
+ len = (char *) memend - (char *) mem;
+ memcpy (mem, addr, len);
+
+ if (make_executable (mem, len) < 0)
+ return NULL;
+
+ if (di)
+ {
+ memset (di, 0, sizeof (*di));
+ di->start_ip = (unw_word_t) mem;
+ di->end_ip = (unw_word_t) memend;
+ di->gp = gp;
+ di->format = UNW_INFO_FORMAT_DYNAMIC;
+ di->u.pi.name_ptr = (unw_word_t) name;
+ di->u.pi.regions = region;
+ }
+ return fptr;
+}
+
+int
+main (int argc, char **argv)
+{
+ extern long func_add1 (long);
+ extern char func_add1_end[];
+ extern long func_add3 (long, long (*[])());
+ extern char func_add3_end[];
+ extern long func_vframe (long);
+ extern char func_vframe_end[];
+ unw_dyn_region_info_t *r_pro, *r_epi, *r, *rtmp;
+ unw_dyn_info_t di0, di1, di2, di3;
+ long (*add1) (long);
+ long (*add3_0) (long);
+ long (*add3_1) (long, void *[]);
+ long (*vframe) (long);
+ void *flist[2];
+ long ret;
+ int i;
+
+ signal (SIGUSR1, SIG_IGN);
+ signal (SIGUSR2, SIG_IGN);
+
+ if (argc != 1)
+ verbose = 1;
+
+ add1 = (long (*)(long))
+ create_func (&di0, "func_add1", func_add1, func_add1_end, NULL);
+
+ /* Describe the epilogue of func_add3: */
+ i = 0;
+ r_epi = alloca (_U_dyn_region_info_size (5));
+ r_epi->op_count = 5;
+ r_epi->next = NULL;
+ r_epi->insn_count = -9;
+ _U_dyn_op_pop_frames (&r_epi->op[i++],
+ _U_QP_TRUE, /* when=*/ 5, /* num_frames=*/ 1);
+ _U_dyn_op_stop (&r_epi->op[i++]);
+ assert ((unsigned) i <= r_epi->op_count);
+
+ /* Describe the prologue of func_add3: */
+ i = 0;
+ r_pro = alloca (_U_dyn_region_info_size (4));
+ r_pro->op_count = 4;
+ r_pro->next = r_epi;
+ r_pro->insn_count = 8;
+ _U_dyn_op_save_reg (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 0,
+ /* reg=*/ UNW_IA64_AR_PFS, /* dst=*/ UNW_IA64_GR + 34);
+ _U_dyn_op_add (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 2,
+ /* reg= */ UNW_IA64_SP, /* val=*/ -16);
+ _U_dyn_op_save_reg (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 4,
+ /* reg=*/ UNW_IA64_RP, /* dst=*/ UNW_IA64_GR + 3);
+ _U_dyn_op_spill_sp_rel (&r_pro->op[i++], _U_QP_TRUE, /* when=*/ 7,
+ /* reg=*/ UNW_IA64_RP, /* off=*/ 16);
+ assert ((unsigned) i <= r_pro->op_count);
+
+ /* Create regions for func_vframe: */
+ i = 0;
+ r = alloca (_U_dyn_region_info_size (16));
+ r->op_count = 16;
+ r->next = NULL;
+ r->insn_count = 4;
+ _U_dyn_op_label_state (&r->op[i++], /* label=*/ 100402);
+ _U_dyn_op_pop_frames (&r->op[i++], _U_QP_TRUE, /* when=*/ 3, /* frames=*/ 1);
+ _U_dyn_op_stop (&r->op[i++]);
+ assert ((unsigned) i <= r->op_count);
+
+ i = 0;
+ rtmp = r;
+ r = alloca (_U_dyn_region_info_size (16));
+ r->op_count = 16;
+ r->next = rtmp;
+ r->insn_count = 16;
+ _U_dyn_op_save_reg (&r->op[i++], _U_QP_TRUE, /* when=*/ 8,
+ /* reg=*/ UNW_IA64_RP, /* dst=*/ UNW_IA64_GR + 3);
+ _U_dyn_op_pop_frames (&r->op[i++], _U_QP_TRUE, /* when=*/ 10,
+ /* num_frames=*/ 1);
+ _U_dyn_op_stop (&r->op[i++]);
+ assert ((unsigned) i <= r->op_count);
+
+ i = 0;
+ rtmp = r;
+ r = alloca (_U_dyn_region_info_size (16));
+ r->op_count = 16;
+ r->next = rtmp;
+ r->insn_count = 5;
+ _U_dyn_op_save_reg (&r->op[i++], _U_QP_TRUE, /* when=*/ 1,
+ /* reg=*/ UNW_IA64_RP, /* dst=*/ UNW_IA64_GR + 33);
+ _U_dyn_op_save_reg (&r->op[i++], _U_QP_TRUE, /* when=*/ 2,
+ /* reg=*/ UNW_IA64_SP, /* dst=*/ UNW_IA64_GR + 34);
+ _U_dyn_op_spill_fp_rel (&r->op[i++], _U_QP_TRUE, /* when=*/ 4,
+ /* reg=*/ UNW_IA64_AR_PFS, /* off=*/ 16);
+ _U_dyn_op_label_state (&r->op[i++], /* label=*/ 100402);
+ _U_dyn_op_stop (&r->op[i++]);
+ assert ((unsigned) i <= r->op_count);
+
+ /* Create two functions which can share the region-list: */
+ add3_0 = (long (*) (long))
+ create_func (&di1, "func_add3/0", func_add3, func_add3_end, r_pro);
+ add3_1 = (long (*) (long, void *[]))
+ create_func (&di2, "func_add3/1", func_add3, func_add3_end, r_pro);
+ vframe = (long (*) (long))
+ create_func (&di3, "func_vframe", func_vframe, func_vframe_end, r);
+
+ _U_dyn_register (&di1);
+ _U_dyn_register (&di2);
+ _U_dyn_register (&di3);
+ _U_dyn_register (&di0);
+
+ flist[0] = add3_0;
+ flist[1] = add1;
+
+ kill (getpid (), SIGUSR1); /* do something ptmon can latch onto */
+ ret = (*add3_1) (13, flist);
+ if (ret != 18)
+ {
+ fprintf (stderr, "FAILURE: (*add3_1)(13) returned %ld\n", ret);
+ exit (-1);
+ }
+
+ ret = (*vframe) (48);
+ if (ret != 4)
+ {
+ fprintf (stderr, "FAILURE: (*vframe)(16) returned %ld\n", ret);
+ exit (-1);
+ }
+ ret = (*vframe) (64);
+ if (ret != 10)
+ {
+ fprintf (stderr, "FAILURE: (*vframe)(32) returned %ld\n", ret);
+ exit (-1);
+ }
+ kill (getpid (), SIGUSR2); /* do something ptmon can latch onto */
+
+ _U_dyn_cancel (&di0);
+ _U_dyn_cancel (&di1);
+ _U_dyn_cancel (&di3);
+ _U_dyn_cancel (&di2);
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/ia64-test-nat-asm.S b/src/pal/src/libunwind/tests/ia64-test-nat-asm.S
new file mode 100644
index 0000000000..eea5ac2783
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-nat-asm.S
@@ -0,0 +1,508 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .text
+
+#define CALL_NEXT_PTR(gp_save_reg, arg0, arg1) \
+ ld8 r2 = [arg0], 8;; /* read the next function pointer */ \
+ ld8 r3 = [r2], 8;; /* read the function's entry-point */ \
+ ld8 r2 = [r2];; /* read the function's gp */ \
+ mov b6 = r3; \
+ mov gp_save_reg = gp; \
+ mov out0 = arg0; \
+ mov out1 = arg1; \
+ mov gp = r2; \
+ br.call.sptk.many rp = b6;; \
+ mov gp = gp_save_reg
+
+#define CALL_NEXT(gp_save_reg) CALL_NEXT_PTR(gp_save_reg, in0, in1)
+
+#define LOAD_VAL(reg) \
+ ld8 reg = [in1], 8;; \
+ tbit.nz p15, p0 = reg, 0;; \
+(p15) ld8.s reg = [r0]
+
+
+ .global flushrs
+ .proc flushrs
+flushrs:
+ flushrs;;
+ br.ret.sptk.many rp
+ .endp flushrs
+
+ /* Save r4-r7 into stacked registers, load them up with the
+ values passed via the pointer in in1 and then call the
+ function passed via the pointer in in0. */
+
+ .global save_static_to_stacked
+ .proc save_static_to_stacked
+save_static_to_stacked:
+ .prologue
+ .regstk 2, 7, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 7, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+ .spillreg r4, loc2
+ mov loc2 = r4
+ .spillreg r5, loc3
+ mov loc3 = r5
+ .spillreg r6, loc4
+ mov loc4 = r6
+ .spillreg r7, loc5
+ mov loc5 = r7
+ .body
+ LOAD_VAL(r4)
+ LOAD_VAL(r5)
+ LOAD_VAL(r6)
+ LOAD_VAL(r7)
+ CALL_NEXT(loc6)
+
+ mov r4 = loc2
+ mov r5 = loc3
+ mov r6 = loc4
+ mov r7 = loc5
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ br.ret.sptk.many rp
+ .endp save_static_to_stacked
+
+ /* Save f2 to the memory stack, save r4 to f2, then load
+ r4 with the value passed via in1 and call the function
+ passed via in0. */
+
+ .global save_static_to_fr
+ .proc save_static_to_fr
+save_static_to_fr:
+ .prologue
+ .regstk 2, 3, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 3, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+ .fframe 16
+ .spillpsp f2, 0
+ stf.spill [sp] = f2, -16
+ .spillreg r4, f2
+ setf.sig f2 = r4
+
+ .body
+
+ ld8 r4 = [in1], 8;;
+ tbit.nz p6, p0 = r4, 0;;
+(p6) ld8.s r4 = [r0]
+
+ CALL_NEXT(loc2)
+
+ getf.sig r4 = f2 // restore r4
+ .restore sp
+ add sp = 16, sp;;
+ ldf.fill f2 = [sp] // restore r2
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ br.ret.sptk.many rp
+ .endp save_static_to_fr
+
+ /* If r4 is not a NaT, save b3 to a stacked register and
+ then save r4 in b3. The non-NaTness of r4 is saved in
+ p1. */
+
+ .global save_static_to_br
+ .proc save_static_to_br
+save_static_to_br:
+ .prologue
+ .regstk 2, 6, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 6, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+
+ .save pr, loc2
+ mov loc2 = pr // save predicates
+
+ .spillreg b3, loc3
+ mov loc3 = b3
+
+ tnat.z p1, p2 = r4;;
+ .spillreg.p p1, r4, b3
+(p1) mov b3 = r4
+ .spillreg.p p2, r4, loc4
+(p2) mov loc4 = r4
+
+ .body
+
+ LOAD_VAL(r4)
+ CALL_NEXT(loc5)
+
+ .pred.rel.mutex p1, p2
+(p1) mov r4 = b3 // restore r4
+(p2) mov r4 = loc4
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ mov pr = loc2, -1
+ mov b3 = loc3 // restore b3
+ br.ret.sptk.many rp
+ .endp save_static_to_br
+
+ /* Spill r4 into memory and then save r5 in r4. */
+
+ .global save_static_to_mem
+ .proc save_static_to_mem
+save_static_to_mem:
+ .prologue
+ .regstk 2, 4, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 4, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+ .save ar.unat, loc2
+ mov loc2 = ar.unat
+
+ .fframe 16
+ .spillpsp r4, 0
+ st8.spill [sp] = r4, -16
+
+ .spillreg r5, r4
+ mov r4 = r5
+
+ .body
+
+ LOAD_VAL(r5)
+ CALL_NEXT(loc3)
+
+ mov r5 = r4 // restore r5
+ .restore sp
+ add sp = 16, sp;;
+ ld8.fill r4 = [sp] // restore r4
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ mov ar.unat = loc2 // restore ar.unat
+ br.ret.sptk.many rp
+ .endp save_static_to_mem
+
+ /* Spill r6 into memory and save primary ar.unat in a register. */
+
+ .global save_static_to_mem2
+ .proc save_static_to_mem2
+save_static_to_mem2:
+ .prologue
+ .regstk 2, 5, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 5, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+ .save ar.unat, loc2
+ mov loc2 = ar.unat
+
+ .fframe 16
+ .spillpsp r6, 0
+ st8.spill [sp] = r6, -16;;
+ .save @priunat, loc3
+ mov loc3 = ar.unat
+ mov ar.unat = 0 // trash ar.unat
+
+ .body
+
+ LOAD_VAL(r6)
+ CALL_NEXT(loc4)
+
+ mov ar.unat = loc3 // restore primary UNaT
+ .restore sp
+ add sp = 16, sp;;
+ ld8.fill r6 = [sp] // restore r6
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ mov ar.unat = loc2 // restore ar.unat
+ br.ret.sptk.many rp
+ .endp save_static_to_mem2
+
+ /* Spill r6 into memory and save primary ar.unat in memory. */
+
+ .global save_static_to_mem3
+ .proc save_static_to_mem3
+save_static_to_mem3:
+ .prologue
+ .regstk 2, 5, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 5, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+ .save ar.unat, loc2
+ mov loc2 = ar.unat
+
+ add r2 = 8, sp
+ .fframe 16
+ .spillpsp r6, 0
+ st8.spill [sp] = r6, -16;;
+ mov r3 = ar.unat;;
+ .savepsp @priunat, -8
+ st8 [r2] = r3
+ mov ar.unat = 0 // trash ar.unat
+
+ .body
+
+ LOAD_VAL(r6)
+ CALL_NEXT(loc4)
+
+ add r2 = 24, sp;;
+ ld8 r3 = [r2];;
+ mov ar.unat = r3 // restore primary UNaT
+ .restore sp
+ add sp = 16, sp;;
+ ld8.fill r6 = [sp] // restore r6
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ mov ar.unat = loc2 // restore ar.unat
+ br.ret.sptk.many rp
+ .endp save_static_to_mem3
+
+ /* Spill r6 into memory and save primary ar.unat in register,
+ then in memory. */
+
+ .global save_static_to_mem4
+ .proc save_static_to_mem4
+save_static_to_mem4:
+ .prologue
+ .regstk 2, 5, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 5, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+ .save ar.unat, loc2
+ mov loc2 = ar.unat
+
+ add r2 = 8, sp
+ .fframe 16
+ .spillpsp r6, 0
+ st8.spill [sp] = r6, -16;;
+ .save @priunat, r3
+ mov r3 = ar.unat;;
+ mov ar.unat = 0 // trash ar.unat
+ .savepsp @priunat, -8
+ st8 [r2] = r3
+ mov r3 = r0 // trash register pri UNaT location
+ .body
+
+ LOAD_VAL(r6)
+ CALL_NEXT(loc4)
+
+ add r2 = 24, sp;;
+ ld8 r3 = [r2];;
+ mov ar.unat = r3 // restore primary UNaT
+ .restore sp
+ add sp = 16, sp;;
+ ld8.fill r6 = [sp] // restore r6
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ mov ar.unat = loc2 // restore ar.unat
+ br.ret.sptk.many rp
+ .endp save_static_to_mem4
+
+ /* Spill r6 into memory and save primary ar.unat in register,
+ then in memory. */
+
+ .global save_static_to_mem5
+ .proc save_static_to_mem5
+save_static_to_mem5:
+ .prologue
+ .regstk 2, 5, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 5, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+ .save ar.unat, loc2
+ mov loc2 = ar.unat
+
+ add r2 = 8, sp
+ .fframe 16
+ .spillpsp r6, 0
+ st8.spill [sp] = r6, -16;;
+ mov r3 = ar.unat;;
+ mov ar.unat = 0 // trash ar.unat
+ .savepsp @priunat, -8
+ st8 [r2] = r3
+ .save @priunat, loc3
+ mov loc3 = r3
+ st8 [r2] = r0 // trash memory pri UNaT location
+ .body
+
+ LOAD_VAL(r6)
+ CALL_NEXT(loc4)
+
+ add r2 = 24, sp;;
+ ld8 r3 = [r2];;
+ mov ar.unat = loc3 // restore primary UNaT
+ .restore sp
+ add sp = 16, sp;;
+ ld8.fill r6 = [sp] // restore r6
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ mov ar.unat = loc2 // restore ar.unat
+ br.ret.sptk.many rp
+ .endp save_static_to_mem5
+
+ /* Save r4-r7 to various scratch registers, then trigger
+ a segfault. */
+
+ .global save_static_to_scratch
+ .proc save_static_to_scratch
+save_static_to_scratch:
+ .prologue
+
+ .spillreg r4, r16
+ mov r16 = r4 // save r4 in r16
+ tnat.nz p6, p7 = r5;;
+ .spillreg.p p6, r5, f31
+(p6) setf.sig f31 = r5 // save r5 in f31 if it's a NaT
+ .spillreg.p p7, r5, b6
+(p7) mov b6 = r5 // in b6 if it not
+ .spillreg r6, f32
+ setf.sig f32 = r6 // save r6 in f32 (fph partition)
+ .spillsp r7, 0
+ st8.spill [sp] = r7 // save r7 in the scratch stack space
+ .spillreg f4, f6
+ mov f6 = f4;;
+ .body
+
+ ld8 r2 = [in1]
+ ;;
+ mov ar.ec = r2
+
+ LOAD_VAL(r4)
+ LOAD_VAL(r5)
+ LOAD_VAL(r6)
+ LOAD_VAL(r7)
+ setf.sig f4 = r4
+
+ /* Now force a SIGSEGV. Make sure the ld8 is at the beginning of a
+ bundle, so the signal-handler can skip over it simply by
+ incrementing the IP. */
+ {
+ .mmi
+ ld8 r2 = [r0]
+ nop.m 0
+ nop.i 0 ;;
+ }
+
+ mov f4 = f6
+ mov r4 = r16
+ .pred.rel.mutex p6, p7
+(p6) getf.sig r5 = f31
+(p7) mov r5 = b6
+ getf.sig r6 = f32
+ ld8.fill r7 = [sp]
+
+ br.ret.sptk.many rp
+ .endp save_static_to_scratch
+
+ /* Rotate registers a bit in a vain attempt to sow some confusion.
+ Care must be taken not to write any rotating general register
+ after rotation, because we keep the preserved state
+ there... */
+
+ .global rotate_regs
+ .proc rotate_regs
+rotate_regs:
+ .prologue
+ .regstk 2, 14, 2, 16
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 14, 2, 16
+ .save rp, loc1
+ mov loc1 = rp
+ .save pr, loc2
+ mov loc2 = pr
+ .save ar.lc, loc3
+ mov loc3 = ar.lc
+ .spillreg r4, loc4
+ mov loc4 = r4
+
+ ld8 r2 = [in1], 8;;
+ mov pr = r2, -1
+
+ ld8 r2 = [in1], 8;;
+ mov r8 = in0
+ mov r9 = in1
+ and r2 = 127, r2;;
+ mov ar.ec = 0
+ mov ar.lc = r2;;
+
+ // use p6 to preserve p63 as it gets rotated into p16:
+(p16) cmp.eq.unc p6,p0 = r0,r0;;
+1:
+(p6) cmp.eq.unc p16,p0 = r0,r0
+(p63) cmp.eq.unc p6,p0 = r0,r0
+ br.ctop.dptk.few 1b;;
+
+(p6) cmp.eq.unc p63,p0 = r0,r0
+
+ CALL_NEXT_PTR(r4, r8, r9)
+
+ clrrrb
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ mov pr = loc2, -1
+ mov ar.lc = loc3
+ mov r4 = loc4
+ br.ret.sptk.many rp
+
+ .endp rotate_regs
+
+ .global save_pr
+ .proc save_pr
+save_pr:
+ .prologue
+ .regstk 2, 4, 2, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 2, 4, 2, 0
+ .save rp, loc1
+ mov loc1 = rp
+ .save pr, loc2
+ mov loc2 = pr
+
+ ld8 r2 = [in1], 8;;
+ mov pr = r2, -1
+
+ CALL_NEXT(loc3)
+
+ mov ar.pfs = loc0
+ mov rp = loc1
+ mov pr = loc2, -1
+ br.ret.sptk.many rp
+
+ .endp save_pr
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/tests/ia64-test-rbs-asm.S b/src/pal/src/libunwind/tests/ia64-test-rbs-asm.S
new file mode 100644
index 0000000000..9a6d33fb1d
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-rbs-asm.S
@@ -0,0 +1,275 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "ia64-test-rbs.h"
+
+ .common stackmem, NSTACKS*STACK_SIZE, 16
+
+ .text
+
+#define SAVED_SP_OFF 0
+#define SAVED_RP_OFF 8
+#define SAVED_PFS_OFF 16
+#define SAVED_RNAT_OFF 24
+#define SAVED_BSP_OFF 32
+#define SAVED_BSPSTORE_OFF 40
+#define FRAME_SIZE 48
+
+#define SPILL(n) \
+ /* int rbs_spill_#n(long iteration, int (*next_func[])()) */ \
+ .globl rbs_spill_##n; \
+ .proc rbs_spill_##n; \
+rbs_spill_##n: \
+ .prologue; \
+ alloc r18 = ar.pfs, 2, (n)-2, 2, 0;/* read ar.pfs */ \
+ /* first, calculate address of new stack: */ \
+ addl r2 = @ltoff(stackmem), gp; \
+ add r8 = 1, in0; \
+ ;; \
+ ld8 r2 = [r2]; /* r2 = &stackmem */ \
+ shl r3 = in0, STACK_SIZE_SHIFT; \
+ shladd r8 = r8, 3, in1; /* r8 = &next_func[iteration+1] */ \
+ ;; \
+ ld8 r8 = [r8]; /* r8 = next_func[iteration+1] */ \
+ add r2 = r2, r3; /* r2 = stackmem[iteration] */ \
+ ;; \
+ ld8 r9 = [r8], 8;; /* r9 = target's entry-point */ \
+ ld8 gp = [r8]; /* r22 = target's gp */ \
+ addl r3 = STACK_SIZE-FRAME_SIZE, r2; /* r3 = &stackframe */ \
+ ;; \
+ mov b6 = r9; \
+ st8 [r3] = sp; \
+ .vframesp SAVED_SP_OFF+16; \
+ adds sp = -16, r3; /* switch the memory stack */ \
+ ;; \
+ adds r3 = (SAVED_RP_OFF - SAVED_SP_OFF), r3; \
+ mov r16 = rp; \
+ ;; \
+ .savesp rp, SAVED_RP_OFF+16; \
+ st8 [r3] = r16, (SAVED_PFS_OFF - SAVED_RP_OFF); \
+ ;; \
+ .savesp ar.pfs, SAVED_PFS_OFF+16; \
+ st8 [r3] = r18, (SAVED_BSP_OFF - SAVED_PFS_OFF); \
+ mov r16 = ar.bsp; \
+ mov r17 = ar.bspstore; \
+ mov r18 = ar.rnat; \
+ ;; \
+ .savesp ar.bsp, SAVED_BSP_OFF+16; \
+ st8 [r3] = r16, (SAVED_BSPSTORE_OFF - SAVED_BSP_OFF); \
+ ;; \
+ .savesp ar.bspstore, SAVED_BSPSTORE_OFF+16; \
+ st8 [r3] = r17, (SAVED_RNAT_OFF - SAVED_BSPSTORE_OFF); \
+ mov out1 = in1; \
+ ;; \
+ .savesp ar.rnat, SAVED_RNAT_OFF+16; \
+ st8 [r3] = r18; \
+ .body; \
+ mov ar.bspstore = r2; /* switch the backing store */ \
+ adds out0 = 1, in0; \
+ ;; \
+ br.call.sptk.many rp = b6; \
+1: /* switch back to stack: */ \
+ adds r3 = SAVED_SP_OFF+16, sp; \
+ cmp.ge p8, p0 = r8, r0; \
+ ;; \
+(p8) add r8 = 1, r8; \
+ ld8 r16 = [r3], (SAVED_RP_OFF-SAVED_SP_OFF);; /* saved sp */ \
+ ld8 r17 = [r3], (SAVED_PFS_OFF-SAVED_RP_OFF);; /* saved rp */ \
+ ld8 r18 = [r3], (SAVED_RNAT_OFF-SAVED_PFS_OFF);;/* saved pfs */ \
+ ld8 r19 = [r3], (SAVED_BSP_OFF-SAVED_RNAT_OFF);;/* saved rnat */ \
+ ld8 r20 = [r3], (SAVED_BSPSTORE_OFF-SAVED_BSP_OFF);;/* saved bsp */ \
+ ld8 r21 = [r3];; /* saved bspstore */ \
+ mov rp = r17; \
+ mov ar.pfs = r18; \
+ shl r3 = in0, STACK_SIZE_SHIFT; \
+ addl r2 = @ltoff(stackmem), gp;; \
+ ld8 r2 = [r2];; /* r2 = &stackmem */ \
+ add r2 = r2, r3; /* r2 = stackmem[iteration] */ \
+ mov r3 = ar.bsp;; \
+ sub r2 = r3, r2;; /* r2 = dirty_size */ \
+ shl r2 = r2, 16;; \
+ mov ar.rsc = r2;; \
+ alloc r3 = ar.pfs, 0, 0, 0, 0;; \
+ loadrs;; \
+ mov ar.bspstore = r21;; /* this also restores ar.bsp */ \
+ mov ar.rnat = r19; \
+ .restore sp; \
+ mov sp = r16; \
+ br.ret.sptk.many rp; \
+ .endp rbs_spill_##n
+
+ SPILL(2); SPILL(3)
+ SPILL(4); SPILL(5); SPILL(6); SPILL(7)
+ SPILL(8); SPILL(9); SPILL(10); SPILL(11)
+ SPILL(12); SPILL(13); SPILL(14); SPILL(15)
+ SPILL(16); SPILL(17); SPILL(18); SPILL(19)
+ SPILL(20); SPILL(21); SPILL(22); SPILL(23)
+ SPILL(24); SPILL(25); SPILL(26); SPILL(27)
+ SPILL(28); SPILL(29); SPILL(30); SPILL(31)
+ SPILL(32); SPILL(33); SPILL(34); SPILL(35)
+ SPILL(36); SPILL(37); SPILL(38); SPILL(39)
+ SPILL(40); SPILL(41); SPILL(42); SPILL(43)
+ SPILL(44); SPILL(45); SPILL(46); SPILL(47)
+ SPILL(48); SPILL(49); SPILL(50); SPILL(51)
+ SPILL(52); SPILL(53); SPILL(54); SPILL(55)
+ SPILL(56); SPILL(57); SPILL(58); SPILL(59)
+ SPILL(60); SPILL(61); SPILL(62); SPILL(63)
+ SPILL(64); SPILL(65); SPILL(66); SPILL(67)
+ SPILL(68); SPILL(69); SPILL(70); SPILL(71)
+ SPILL(72); SPILL(73); SPILL(74); SPILL(75)
+ SPILL(76); SPILL(77); SPILL(78); SPILL(79)
+ SPILL(80); SPILL(81); SPILL(82); SPILL(83)
+ SPILL(84); SPILL(85); SPILL(86); SPILL(87)
+ SPILL(88); SPILL(89); SPILL(90); SPILL(91)
+ SPILL(92); SPILL(93); SPILL(94)
+
+#define LD_LOC(n) \
+ ld4 loc##n = [in1], 4;; \
+ cmp.eq p8, p9 = r0, loc##n;; \
+(p9) or loc##n = loc##n, r8; \
+(p8) ld4.s loc##n = [r0]
+
+#define CK_LOC(n) \
+ ld4 r16 = [in1], 4;; \
+ cmp.eq p8, p9 = r0, r16; \
+ or r16 = r16, r9;; \
+(p8) tnat.z p10, p0 = loc##n; \
+(p9) cmp.ne p10, p0 = r16, loc##n; \
+ ;; \
+(p10) mov r8 = -n; \
+(p10) br.cond.spnt.many .fail
+
+ /* int loadup(long iteration, int *values, next_func[]) */
+
+ .global loadup
+ .proc loadup
+loadup:
+ .prologue
+ .save ar.pfs, r36
+ alloc loc1 = ar.pfs, 3, 90, 3, 0
+ .save rp, loc0
+ mov loc0 = rp
+ .body
+ cmp.eq p6, p7 = 1, in0
+ ;;
+ mov ar.rsc = 0 // put RSE into enforced lazy mode
+(p6) mov out1 = in2
+(p7) mov out2 = in2
+
+(p6) ld8 r17 = [in2] // get address of function descriptor
+(p7) add out0 = -1, in0
+(p7) mov out1 = in1
+
+ ;;
+(p6) ld8 r16 = [r17], 8 // load entry point
+ shl r8 = in0, 32 // store iteration # in top 32 bits
+ mov r18 = in1
+ ;;
+(p6) ld8 r1 = [r17] // load gp
+(p6) mov b6 = r16
+
+(p6) mov out0 = 0
+ ;;
+ LD_LOC( 2); LD_LOC( 3)
+ LD_LOC( 4); LD_LOC( 5); LD_LOC( 6); LD_LOC( 7)
+ LD_LOC( 8); LD_LOC( 9); LD_LOC(10); LD_LOC(11)
+ LD_LOC(12); LD_LOC(13); LD_LOC(14); LD_LOC(15)
+ LD_LOC(16); LD_LOC(17); LD_LOC(18); LD_LOC(19)
+ LD_LOC(20); LD_LOC(21); LD_LOC(22); LD_LOC(23)
+ LD_LOC(24); LD_LOC(25); LD_LOC(26); LD_LOC(27)
+ LD_LOC(28); LD_LOC(29); LD_LOC(30); LD_LOC(31)
+ LD_LOC(32); LD_LOC(33); LD_LOC(34); LD_LOC(35)
+ LD_LOC(36); LD_LOC(37); LD_LOC(38); LD_LOC(39)
+ LD_LOC(40); LD_LOC(41); LD_LOC(42); LD_LOC(43)
+ LD_LOC(44); LD_LOC(45); LD_LOC(46); LD_LOC(47)
+ LD_LOC(48); LD_LOC(49); LD_LOC(50); LD_LOC(51)
+ LD_LOC(52); LD_LOC(53); LD_LOC(54); LD_LOC(55)
+ LD_LOC(56); LD_LOC(57); LD_LOC(58); LD_LOC(59)
+ LD_LOC(60); LD_LOC(61); LD_LOC(62); LD_LOC(63)
+ LD_LOC(64); LD_LOC(65); LD_LOC(66); LD_LOC(67)
+ LD_LOC(68); LD_LOC(69); LD_LOC(70); LD_LOC(71)
+ LD_LOC(72); LD_LOC(73); LD_LOC(74); LD_LOC(75)
+ LD_LOC(76); LD_LOC(77); LD_LOC(78); LD_LOC(79)
+ LD_LOC(80); LD_LOC(81); LD_LOC(82); LD_LOC(83)
+ LD_LOC(84); LD_LOC(85); LD_LOC(86); LD_LOC(87)
+ LD_LOC(88); LD_LOC(89)
+ ;;
+{ .mbb
+ mov in1 = r18
+(p6) br.call.sptk.many rp = b6
+(p7) br.call.sptk.many rp = loadup
+}
+ cmp.lt p8, p9 = r8, r0
+ shl r9 = in0, 32 // store iteration # in top 32 bits
+(p8) br.cond.spnt.few .fail
+ ;;
+ add r8 = 1, r8
+ CK_LOC( 2); CK_LOC( 3)
+ CK_LOC( 4); CK_LOC( 5); CK_LOC( 6); CK_LOC( 7)
+ CK_LOC( 8); CK_LOC( 9); CK_LOC(10); CK_LOC(11)
+ CK_LOC(12); CK_LOC(13); CK_LOC(14); CK_LOC(15)
+ CK_LOC(16); CK_LOC(17); CK_LOC(18); CK_LOC(19)
+ CK_LOC(20); CK_LOC(21); CK_LOC(22); CK_LOC(23)
+ CK_LOC(24); CK_LOC(25); CK_LOC(26); CK_LOC(27)
+ CK_LOC(28); CK_LOC(29); CK_LOC(30); CK_LOC(31)
+ CK_LOC(32); CK_LOC(33); CK_LOC(34); CK_LOC(35)
+ CK_LOC(36); CK_LOC(37); CK_LOC(38); CK_LOC(39)
+ CK_LOC(40); CK_LOC(41); CK_LOC(42); CK_LOC(43)
+ CK_LOC(44); CK_LOC(45); CK_LOC(46); CK_LOC(47)
+ CK_LOC(48); CK_LOC(49); CK_LOC(50); CK_LOC(51)
+ CK_LOC(52); CK_LOC(53); CK_LOC(54); CK_LOC(55)
+ CK_LOC(56); CK_LOC(57); CK_LOC(58); CK_LOC(59)
+ CK_LOC(60); CK_LOC(61); CK_LOC(62); CK_LOC(63)
+ CK_LOC(64); CK_LOC(65); CK_LOC(66); CK_LOC(67)
+ CK_LOC(68); CK_LOC(69); CK_LOC(70); CK_LOC(71)
+ CK_LOC(72); CK_LOC(73); CK_LOC(74); CK_LOC(75)
+ CK_LOC(76); CK_LOC(77); CK_LOC(78); CK_LOC(79)
+ CK_LOC(80); CK_LOC(81); CK_LOC(82); CK_LOC(83)
+ CK_LOC(84); CK_LOC(85); CK_LOC(86); CK_LOC(87)
+ CK_LOC(88); CK_LOC(89)
+.fail:
+ mov rp = loc0
+ mov ar.pfs = loc1
+ br.ret.sptk.many rp
+ .endp loadup
+
+ .global resumption_point_label
+ .proc resumption_point
+resumption_point:
+resumption_point_label:
+ .prologue
+ .save rp, r16
+ .save ar.pfs, r0
+ .body
+ mov r8 = r15
+ mov b6 = r16
+ ;;
+ br.cond.sptk.many b6
+ .endp resumption_point
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/tests/ia64-test-rbs.h b/src/pal/src/libunwind/tests/ia64-test-rbs.h
new file mode 100644
index 0000000000..3315ad6380
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-rbs.h
@@ -0,0 +1,3 @@
+#define NSTACKS 128
+#define STACK_SIZE_SHIFT 17
+#define STACK_SIZE (1 << STACK_SIZE_SHIFT)
diff --git a/src/pal/src/libunwind/tests/ia64-test-readonly-asm.S b/src/pal/src/libunwind/tests/ia64-test-readonly-asm.S
new file mode 100644
index 0000000000..acd3ada2c6
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-readonly-asm.S
@@ -0,0 +1,55 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+ .text
+
+ .global test_func
+ .proc test_func
+test_func:
+ .prologue
+ .regstk 1, 3, 0, 0
+ .save ar.pfs, loc0
+ alloc loc0 = ar.pfs, 1, 3, 0, 0
+ mov loc1 = rp
+ .save rp, r0
+ .save ar.lc, r0
+ .body
+ mov loc2 = gp
+ ld8 r2 = [in0], 8;;
+ ld8 r1 = [in0];;
+ mov b6 = r2
+ br.call.sptk.many rp = b6
+
+ mov gp = loc2
+ mov rp = loc1
+ mov ar.pfs = loc0
+ br.ret.sptk.many rp
+
+ .endp test_func
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/tests/ia64-test-setjmp.c b/src/pal/src/libunwind/tests/ia64-test-setjmp.c
new file mode 100644
index 0000000000..50eaa01bc3
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-setjmp.c
@@ -0,0 +1,155 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Test to verify that we can siglongjmp() into a frame whose register
+ window is not backed by valid memory. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+
+#ifdef HAVE_IA64INTRIN_H
+# include <ia64intrin.h>
+#endif
+
+static sigjmp_buf env;
+static int return_level;
+static uintptr_t return_bsp;
+static int verbose;
+
+uintptr_t
+get_bsp (void)
+{
+#ifdef __INTEL_COMPILER
+ return __getReg (_IA64_REG_AR_BSP);
+#else
+ return (uintptr_t) __builtin_ia64_bsp ();
+#endif
+}
+
+static void
+sighandler (int signal, void *siginfo, void *sigcontext)
+{
+ ucontext_t *uc = sigcontext;
+ int local = 0;
+
+ if (verbose)
+ printf ("got signal, stack at %p, saved bsp=0x%lx\n",
+ &local, uc->uc_mcontext.sc_ar_bsp);
+ siglongjmp (env, 1);
+}
+
+/* Direct call of doit () at the end of doit () would get optimized by GCC to
+ a branch. */
+static void doit (int n);
+typedef void (*doit_type) (int);
+static volatile doit_type doit_pointer = doit;
+
+static void
+doit (int n)
+{
+ uintptr_t guard_page_addr, bsp = get_bsp ();
+ void *ret;
+
+ if (n == 0)
+ {
+ size_t page_size = getpagesize ();
+
+ guard_page_addr = (bsp + page_size - 1) & -page_size;
+ if (verbose)
+ printf ("guard_page_addr = 0x%lx\n", (unsigned long) guard_page_addr);
+ ret = mmap ((void *) guard_page_addr, page_size, PROT_NONE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (ret != (void *) guard_page_addr)
+ {
+ if (ret == MAP_FAILED)
+ perror ("mmap");
+ else
+ fprintf (stderr, "mmap() returned %p, expected 0x%lx\n",
+ ret, guard_page_addr);
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ if (sigsetjmp (env, 1))
+ {
+ return_level = n;
+ return_bsp = bsp;
+ }
+ else
+ (*doit_pointer) (n + 1);
+}
+
+int
+main (int argc, char **argv)
+{
+ struct sigaction sa;
+ stack_t ss;
+
+ if (argc > 1)
+ verbose = 1;
+
+ ss.ss_sp = malloc (2 * SIGSTKSZ);
+ if (ss.ss_sp == NULL)
+ {
+ puts ("failed to allocate alternate stack");
+ return EXIT_FAILURE;
+ }
+ ss.ss_flags = 0;
+ ss.ss_size = 2 * SIGSTKSZ;
+ if (sigaltstack (&ss, NULL) < 0)
+ {
+ printf ("sigaltstack failed: %s\n", strerror (errno));
+ return EXIT_FAILURE;
+ }
+
+ sa.sa_handler = (void (*) (int)) sighandler;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
+ if (sigaction (SIGSEGV, &sa, NULL) < 0)
+ {
+ printf ("sigaction failed: %s\n", strerror (errno));
+ exit (1);
+ }
+
+ doit (0);
+
+ if (verbose)
+ {
+ printf ("sigsetjmp returned at level %d bsp=0x%lx\n",
+ return_level, return_bsp);
+ puts ("Test succeeded!");
+ }
+ return EXIT_SUCCESS;
+}
diff --git a/src/pal/src/libunwind/tests/ia64-test-sig.c b/src/pal/src/libunwind/tests/ia64-test-sig.c
new file mode 100644
index 0000000000..473efe91d7
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-sig.c
@@ -0,0 +1,102 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2001-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This test uses the unwind interface to modify the IP in an ancestor
+ frame while still returning to the parent frame. */
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libunwind-ia64.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+int verbose;
+
+static void
+sighandler (int signal)
+{
+ unw_cursor_t cursor, cursor2;
+ unw_word_t ip;
+ unw_context_t uc;
+
+ if (verbose)
+ printf ("caught signal %d\n", signal);
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init() failed!\n");
+
+ /* get cursor for caller of sighandler: */
+ if (unw_step (&cursor) < 0)
+ panic ("unw_step() failed!\n");
+
+ cursor2 = cursor;
+ while (!unw_is_signal_frame (&cursor2))
+ if (unw_step (&cursor2) < 0)
+ panic ("failed to find signal frame!\n");
+
+ if (unw_step (&cursor2) < 0)
+ panic ("unw_step() failed!\n");
+
+ if (unw_get_reg (&cursor2, UNW_REG_IP, &ip) < 0)
+ panic ("failed to get IP!\n");
+
+ /* skip faulting instruction (doesn't handle MLX template) */
+ ++ip;
+ if ((ip & 0x3) == 0x3)
+ ip += 13;
+
+ if (unw_set_reg (&cursor2, UNW_REG_IP, ip) < 0)
+ panic ("failed to set IP!\n");
+
+ unw_resume (&cursor); /* update context & return to caller of sighandler() */
+
+ panic ("unexpected return from unw_resume()!\n");
+}
+
+static void
+doit (volatile char *p)
+{
+ int ch;
+
+ ch = *p; /* trigger SIGSEGV */
+
+ if (verbose)
+ printf ("doit: finishing execution!\n");
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc > 1)
+ verbose = 1;
+
+ signal (SIGSEGV, sighandler);
+ doit (0);
+ if (verbose)
+ printf ("SUCCESS\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/ia64-test-stack-asm.S b/src/pal/src/libunwind/tests/ia64-test-stack-asm.S
new file mode 100644
index 0000000000..0aea33a441
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-stack-asm.S
@@ -0,0 +1,183 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "ia64-test-stack.h"
+
+ .common stackmem, NSTACKS*STACK_SIZE, 16
+
+ .global do_unwind_tests
+
+ .text
+
+#define SAVED_SP_OFF 0
+#define SAVED_RP_OFF 8
+#define SAVED_PFS_OFF 16
+#define SAVED_RNAT_OFF 24
+#define SAVED_BSP_OFF 32
+#define SAVED_BSPSTORE_OFF 40
+#define FRAME_SIZE 48
+
+ .proc stack_it
+stack_it:
+ .prologue
+ alloc r18 = ar.pfs, 0, 0, 0, 0 // read ar.pfs
+ // first, calculate address of new stack:
+ addl r2 = @ltoff(stackmem), gp
+ shl r3 = r8, STACK_SIZE_SHIFT
+ ;;
+ ld8 r2 = [r2] // r2 = &stackmem
+ ;;
+ add r2 = r2, r3 // r2 = stackmem[iteration]
+ ;;
+ addl r3 = STACK_SIZE-FRAME_SIZE, r2 // r3 = &stackframe
+ ;;
+ st8 [r3] = sp
+ .vframesp SAVED_SP_OFF+16
+ adds sp = -16, r3 // switch the memory stack
+ ;;
+ adds r3 = (SAVED_RP_OFF - SAVED_SP_OFF), r3
+ mov r16 = rp
+ ;;
+ .savesp rp, SAVED_RP_OFF+16
+ st8 [r3] = r16, (SAVED_PFS_OFF - SAVED_RP_OFF)
+ ;;
+ .savesp ar.pfs, SAVED_PFS_OFF+16
+ st8 [r3] = r18, (SAVED_BSP_OFF - SAVED_PFS_OFF)
+
+ mov r16 = ar.bsp
+ mov r17 = ar.bspstore
+ mov r18 = ar.rnat
+ ;;
+ .savesp ar.bsp, SAVED_BSP_OFF+16
+ st8 [r3] = r16, (SAVED_BSPSTORE_OFF - SAVED_BSP_OFF)
+ ;;
+ .savesp ar.bspstore, SAVED_BSPSTORE_OFF+16
+ st8 [r3] = r17, (SAVED_RNAT_OFF - SAVED_BSPSTORE_OFF)
+ ;;
+ .savesp ar.rnat, SAVED_RNAT_OFF+16
+ st8 [r3] = r18
+ ;;
+ mov ar.bspstore = r2 // switch the backing store
+
+ .body
+
+ // for even iterations, allocate a local variable:
+ tbit.nz p6, p0 = r8, 0
+(p6) br.cond.sptk.few .skip
+ ;;
+ alloc r2 = ar.pfs, 0, 1, 0, 0
+ mov loc0 = r8
+ ;;
+.skip: cmp.ne p6, p7 = 0, r8
+ ;;
+{ .mbb
+(p6) adds r8 = -1, r8
+(p6) br.call.sptk.many rp = stack_it // next iteration
+(p7) br.call.sptk.many rp = do_unwind_tests // time for introspection...
+}
+ // switch back to stack:
+
+ adds r3 = SAVED_SP_OFF+16, sp
+ ;;
+ ld8 r16 = [r3], (SAVED_RP_OFF-SAVED_SP_OFF);; // saved sp
+ ld8 r17 = [r3], (SAVED_PFS_OFF-SAVED_RP_OFF);; // saved rp
+ ld8 r18 = [r3], (SAVED_RNAT_OFF-SAVED_PFS_OFF);; // saved pfs
+ ld8 r19 = [r3], (SAVED_BSP_OFF-SAVED_RNAT_OFF);; // saved rnat
+ ld8 r20 = [r3], (SAVED_BSPSTORE_OFF-SAVED_BSP_OFF);; // saved bsp
+ ld8 r21 = [r3];; // saved bspstore
+
+ mov rp = r17
+ mov ar.pfs = r18
+ mov ar.bspstore = r21 // this also restores ar.bsp
+ ;;
+ mov ar.rnat = r19
+
+ .restore sp
+ mov sp = r16
+ br.ret.sptk.many rp
+ .endp stack_it
+
+
+#define SET_LOC(n) add loc##n = n, r8
+#define SET_NAT(n) ld8.s loc##n = [r0]
+
+ .global touch_all
+ .proc touch_all
+touch_all:
+ .prologue
+ .save ar.pfs, r34
+ alloc loc1 = ar.pfs, 1, 94, 1, 0
+ .save rp, loc0
+ mov loc0 = rp
+ .body
+
+ mov ar.rsc = 0 // put RSE into enforced lazy mode
+ shl r8 = in0, 32 // store iteration # in top 32 bits
+ add out0 = -1, in0
+ cmp.eq p6, p7 = 1, in0
+ ;;
+ SET_LOC( 2); SET_LOC( 3)
+ SET_LOC( 4); SET_LOC( 5); SET_LOC( 6); SET_LOC( 7)
+ SET_LOC( 8); SET_LOC( 9); SET_LOC(10); SET_LOC(11)
+ SET_LOC(12); SET_LOC(13); SET_LOC(14); SET_LOC(15)
+ SET_LOC(16); SET_LOC(17); SET_LOC(18); SET_LOC(19)
+ SET_LOC(20); SET_LOC(21); SET_LOC(22); SET_LOC(23)
+ SET_LOC(24); SET_LOC(25); SET_LOC(26); SET_LOC(27)
+ SET_LOC(28); SET_LOC(29); SET_LOC(30); SET_LOC(31)
+ SET_LOC(32); SET_LOC(33); SET_LOC(34); SET_LOC(35)
+ SET_LOC(36); SET_LOC(37); SET_LOC(38); SET_LOC(39)
+ SET_LOC(40); SET_LOC(41); SET_LOC(42); SET_LOC(43)
+ SET_LOC(44); SET_LOC(45); SET_LOC(46); SET_LOC(47)
+ SET_LOC(48); SET_LOC(49); SET_LOC(50); SET_LOC(51)
+ SET_LOC(52); SET_LOC(53); SET_LOC(54); SET_LOC(55)
+ SET_LOC(56); SET_LOC(57); SET_LOC(58); SET_LOC(59)
+ SET_LOC(60); SET_LOC(61); SET_LOC(62); SET_LOC(63)
+ SET_LOC(64); SET_LOC(65); SET_LOC(66); SET_LOC(67)
+ SET_LOC(68); SET_LOC(69); SET_LOC(70); SET_LOC(71)
+ SET_LOC(72); SET_LOC(73); SET_LOC(74); SET_LOC(75)
+ SET_LOC(76); SET_LOC(77); SET_LOC(78); SET_LOC(79)
+ SET_LOC(80); SET_LOC(81); SET_LOC(82); SET_LOC(83)
+ SET_LOC(84); SET_LOC(85); SET_LOC(86); SET_LOC(87)
+ SET_LOC(88); SET_LOC(89); SET_LOC(90); SET_LOC(91)
+ SET_LOC(92); SET_LOC(93)
+ ;;
+ SET_NAT(2); SET_NAT(31); SET_NAT(73); SET_NAT(93)
+ ;;
+{ .mbb
+ mov r8=NSTACKS-1
+(p6) br.call.sptk.many rp = stack_it
+(p7) br.call.sptk.many rp = touch_all
+}
+ ;;
+
+ mov rp = loc0
+ mov ar.pfs = loc1
+ br.ret.sptk.many rp
+ .endp touch_all
+
+#ifdef __linux__
+ /* We do not need executable stack. */
+ .section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pal/src/libunwind/tests/ia64-test-stack.h b/src/pal/src/libunwind/tests/ia64-test-stack.h
new file mode 100644
index 0000000000..5665a79d95
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ia64-test-stack.h
@@ -0,0 +1,3 @@
+#define NSTACKS 1024
+#define STACK_SIZE_SHIFT 17
+#define STACK_SIZE (1 << STACK_SIZE_SHIFT)
diff --git a/src/pal/src/libunwind/tests/ident.c b/src/pal/src/libunwind/tests/ident.c
new file mode 100644
index 0000000000..9024e292f5
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ident.c
@@ -0,0 +1,5 @@
+long
+f (long val)
+{
+ return val;
+}
diff --git a/src/pal/src/libunwind/tests/mapper.c b/src/pal/src/libunwind/tests/mapper.c
new file mode 100644
index 0000000000..b47ae780f8
--- /dev/null
+++ b/src/pal/src/libunwind/tests/mapper.c
@@ -0,0 +1,78 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This program creates lots of mappings such that on Linux the
+ reading of /proc/PID/maps gets very slow. With proper caching,
+ test-ptrace should still run at acceptable speed once
+ /proc/PID/maps has been scanned. If the program dies with a
+ SIGALRM, it means it was running unexpectedly slow. */
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+# define MAP_ANONYMOUS MAP_ANON
+#endif
+#if !defined(MAP_NORESERVE)
+# define MAP_NORESERVE 0
+#endif
+
+int
+main (void)
+{
+ long n = 0;
+
+ signal (SIGUSR1, SIG_IGN);
+ signal (SIGUSR2, SIG_IGN);
+
+ printf ("Starting mmap test...\n");
+ for (n = 0; n < 30000; ++n)
+ {
+ if (mmap (NULL, 1, (n & 1) ? PROT_READ : PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS
+#ifdef MAP_NORESERVE
+ | MAP_NORESERVE
+#endif
+ ,
+ -1, 0) == MAP_FAILED)
+ {
+ printf ("Failed after %ld successful maps\n", n - 1);
+ exit (0);
+ }
+ }
+
+ alarm (80); /* die if we don't finish in 80 seconds */
+
+ printf ("Turning on single-stepping...\n");
+ kill (getpid (), SIGUSR1); /* tell test-ptrace to start single-stepping */
+ printf ("Va bene?\n");
+ kill (getpid (), SIGUSR2); /* tell test-ptrace to stop single-stepping */
+ printf ("Turned single-stepping off...\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/perf-startup b/src/pal/src/libunwind/tests/perf-startup
new file mode 100755
index 0000000000..1c24e9a9bc
--- /dev/null
+++ b/src/pal/src/libunwind/tests/perf-startup
@@ -0,0 +1,19 @@
+#!/bin/sh
+platform=$1
+LIBUNWIND=../src/.libs/libunwind.so
+LIBUNWIND_PLAT=../src/.libs/libunwind-$platform.so
+warmup=$(./forker 2000 /bin/true | cut -f1 -d' ')
+
+nsec1=$(./forker 2000 /bin/true | cut -f1 -d' ')
+printf "\"/bin/true\"\t\t\t\t\t\t: $nsec1 nsec/execution\n"
+
+nsec2=$(LD_PRELOAD=$LIBUNWIND ./forker 2000 /bin/true | cut -f1 -d' ')
+printf "\"LD_PRELOAD=$LIBUNWIND /bin/true\"\t: $nsec2 nsec/execution\n"
+
+nsec3=$(LD_PRELOAD=$LIBUNWIND_PLAT ./forker 2000 /bin/true | cut -f1 -d' ')
+printf "\"LD_PRELOAD=$LIBUNWIND_PLAT /bin/true\"\t: $nsec3 nsec/execution\n"
+
+echo
+
+printf "Overhead of preloading $LIBUNWIND\t: $(($nsec2 - $nsec1)) nsec\n"
+printf "Overhead of preloading $LIBUNWIND_PLAT\t: $(($nsec3 - $nsec1)) nsec\n"
diff --git a/src/pal/src/libunwind/tests/ppc64-test-altivec-utils.c b/src/pal/src/libunwind/tests/ppc64-test-altivec-utils.c
new file mode 100644
index 0000000000..bd67ff7d6e
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ppc64-test-altivec-utils.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <altivec.h>
+
+union si_overlay
+{
+ vector signed int v;
+ int ints[4];
+};
+
+vector signed int
+vec_init ()
+{
+ vector signed int v;
+ static int count = 1;
+
+ ((union si_overlay *) &v)->ints[0] = count++;
+ ((union si_overlay *) &v)->ints[1] = count++;
+ ((union si_overlay *) &v)->ints[2] = count++;
+ ((union si_overlay *) &v)->ints[3] = count++;
+ return v;
+}
+
+void
+vec_print (vector signed int v)
+{
+ printf ("%08x %08x %08x %08x",
+ ((union si_overlay *) &v)->ints[0],
+ ((union si_overlay *) &v)->ints[1],
+ ((union si_overlay *) &v)->ints[2],
+ ((union si_overlay *) &v)->ints[3]);
+}
+
diff --git a/src/pal/src/libunwind/tests/ppc64-test-altivec.c b/src/pal/src/libunwind/tests/ppc64-test-altivec.c
new file mode 100644
index 0000000000..a3e95eefbb
--- /dev/null
+++ b/src/pal/src/libunwind/tests/ppc64-test-altivec.c
@@ -0,0 +1,177 @@
+
+
+#include <libunwind.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <altivec.h>
+
+#include <sys/resource.h>
+
+#define panic(args...) { fprintf (stderr, args); abort(); }
+
+extern vector signed int vec_init ();
+extern void vec_print (vector signed int v);
+
+vector signed int vec_stack (int count);
+
+int
+main ()
+{
+ printf ("&vec_stack = %016lx\n", (unsigned long) vec_stack);
+ vec_stack (3);
+ return 0;
+}
+
+
+vector signed int
+vec_stack (int count)
+{
+ register vector signed int v1;
+ register vector signed int v2;
+ register vector signed int v3;
+ register vector signed int v4;
+ register vector signed int v5;
+ register vector signed int v6;
+ register vector signed int v7;
+ register vector signed int v8;
+ register vector signed int v9;
+
+ unw_fpreg_t vr;
+
+ unw_cursor_t cursor;
+ unw_word_t ip, sp;
+ unw_context_t uc;
+ int ret;
+ int verbose = 1;
+
+ /* if (count == 0) return vec_init(); */
+
+ if (count == 0)
+ {
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ {
+ panic ("unw_init_local failed!\n");
+ }
+ else
+ {
+ do
+ {
+ if ((ret = unw_get_reg (&cursor, UNW_REG_IP, &ip)) < 0)
+ {
+ panic ("FAILURE: unw_get_reg returned %d for UNW_REG_IP\n",
+ ret);
+ }
+ if ((ret = unw_get_reg (&cursor, UNW_REG_SP, &sp)) < 0)
+ {
+ panic ("FAILURE: unw_get_reg returned %d for UNW_REG_SP\n",
+ ret);
+ }
+ if ((ret = unw_get_fpreg (&cursor, UNW_PPC64_V30, &vr)) < 0)
+ {
+ panic
+ ("FAILURE: unw_get_vreg returned %d for UNW_PPC64_V30\n",
+ ret);
+ }
+
+
+ if (verbose)
+ {
+ const char *regname = unw_regname (UNW_PPC64_V30);
+ char proc_name_buffer[256];
+ unw_word_t offset;
+ unsigned int * vec_half1, * vec_half2;
+ vec_half1 = (unsigned int *)&vr;
+ vec_half2 = vec_half1 + 1;
+ printf ("ip = %016lx, sp=%016lx\n", (long) ip, (long) sp);
+ printf ("vr30 = %08x %08x %08x %08x\n",
+ (unsigned int) (*vec_half1 >> 16),
+ (unsigned int) (*vec_half1 & 0xffffffff),
+ (unsigned int) (*vec_half2 >> 16),
+ (unsigned int) (*vec_half2 & 0xffffffff));
+ ret =
+ unw_get_proc_name (&cursor, proc_name_buffer,
+ sizeof (proc_name_buffer), &offset);
+ if (ret == 0)
+ {
+ printf ("proc name = %s, offset = %lx\n",
+ proc_name_buffer, offset);
+ }
+ else
+ {
+ panic ("unw_get_proc_name returned %d\n", ret);
+ }
+ printf ("unw_regname(UNW_PPC_V30) = %s\n\n", regname);
+ }
+
+ ret = unw_step (&cursor);
+ if (ret < 0)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ panic ("FAILURE: unw_step() returned %d for ip=%lx\n", ret,
+ (long) ip);
+ }
+ }
+ while (ret > 0);
+ }
+ }
+
+ v1 = vec_init ();
+ v2 = vec_init ();
+ v3 = vec_init ();
+ v4 = vec_init ();
+ v5 = vec_init ();
+ v6 = vec_init ();
+
+ /* make use of all of the registers in some calculation */
+ v7 =
+ vec_nor (v1, vec_add (v2, vec_sub (v3, vec_and (v4, vec_or (v5, v6)))));
+
+ /*
+ * "force" the registers to be non-volatile by making a call and also
+ * using the registers after the call.
+ */
+ v8 = vec_stack (count - 1);
+
+ /*
+ * Use the result from the previous call, plus all of the non-volatile
+ * registers in another calculation.
+ */
+ v9 =
+ vec_nor (v1,
+ vec_add (v2,
+ vec_sub (v3,
+ vec_and (v4, vec_or (v5, vec_xor (v6, v8))))));
+
+ printf ("v1 - ");
+ vec_print (v1);
+ printf ("\n");
+ printf ("v2 - ");
+ vec_print (v2);
+ printf ("\n");
+ printf ("v3 - ");
+ vec_print (v3);
+ printf ("\n");
+ printf ("v4 - ");
+ vec_print (v4);
+ printf ("\n");
+ printf ("v5 - ");
+ vec_print (v5);
+ printf ("\n");
+ printf ("v6 - ");
+ vec_print (v6);
+ printf ("\n");
+ printf ("v7 - ");
+ vec_print (v7);
+ printf ("\n");
+ printf ("v8 - ");
+ vec_print (v8);
+ printf ("\n");
+ printf ("v9 - ");
+ vec_print (v9);
+ printf ("\n");
+
+ return v9;
+}
diff --git a/src/pal/src/libunwind/tests/run-check-namespace b/src/pal/src/libunwind/tests/run-check-namespace
new file mode 100755
index 0000000000..d57c8642a2
--- /dev/null
+++ b/src/pal/src/libunwind/tests/run-check-namespace
@@ -0,0 +1,3 @@
+#!/bin/sh
+chmod +x ./check-namespace.sh
+./check-namespace.sh $*
diff --git a/src/pal/src/libunwind/tests/run-coredump-unwind b/src/pal/src/libunwind/tests/run-coredump-unwind
new file mode 100755
index 0000000000..8d07742574
--- /dev/null
+++ b/src/pal/src/libunwind/tests/run-coredump-unwind
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# this function is slight modification of the one used in RPM
+# found at https://bugzilla.redhat.com/show_bug.cgi?id=834073
+# written by Alexander Larsson <alexl@redhat.com>
+add_minidebug()
+{
+ debuginfo="$1" ## we don't have separate debuginfo file
+ binary="$1"
+
+ dynsyms=`mktemp`
+ funcsyms=`mktemp`
+ keep_symbols=`mktemp`
+ mini_debuginfo=`mktemp`
+
+ # Extract the dynamic symbols from the main binary, there is no need to also have these
+ # in the normal symbol table
+ nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms"
+ # Extract all the text (i.e. function) symbols from the debuginfo
+ nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > "$funcsyms"
+ # Keep all the function symbols not already in the dynamic symbol table
+ comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols"
+ # Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections
+ objcopy -S --remove-section .gdb_index --remove-section .comment --keep-symbols="$keep_symbols" "$debuginfo" "$mini_debuginfo" &> /dev/null
+ #Inject the compressed data into the .gnu_debugdata section of the original binary
+ xz "$mini_debuginfo"
+ mini_debuginfo="${mini_debuginfo}.xz"
+ objcopy --add-section .gnu_debugdata="$mini_debuginfo" "$binary"
+ rm -f "$dynsyms" "$funcsyms" "$keep_symbols" "$mini_debuginfo"
+
+ strip "$binary" ## throw away the symbol table
+}
+
+
+TESTDIR=`pwd`
+TEMPDIR=`mktemp --tmpdir -d libunwind-test-XXXXXXXXXX`
+trap "rm -r -- $TEMPDIR" EXIT
+
+cp crasher $TEMPDIR/crasher
+if [ "$1" = "-minidebuginfo" ]; then
+ add_minidebug $TEMPDIR/crasher
+fi
+
+# create core dump
+(
+ cd $TEMPDIR
+ ulimit -c 10000
+ ./crasher backing_files
+) 2>/dev/null
+COREFILE=$TEMPDIR/core*
+
+# magic option -testcase enables checking for the specific contents of the stack
+./test-coredump-unwind $COREFILE -testcase `cat $TEMPDIR/backing_files`
diff --git a/src/pal/src/libunwind/tests/run-coredump-unwind-mdi b/src/pal/src/libunwind/tests/run-coredump-unwind-mdi
new file mode 100755
index 0000000000..d0a315b8e3
--- /dev/null
+++ b/src/pal/src/libunwind/tests/run-coredump-unwind-mdi
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# This test intends to test the unw_get_proc_name function on binaries without
+# the symbol table but with so called MiniDebuginfo available. In particular,
+# it is tested using the coredump accessors. For more info about MiniDebugInfo
+# see e.g. http://fedoraproject.org/wiki/Features/MiniDebugInfo
+
+${0%/*}/run-coredump-unwind -minidebuginfo
diff --git a/src/pal/src/libunwind/tests/run-ia64-test-dyn1 b/src/pal/src/libunwind/tests/run-ia64-test-dyn1
new file mode 100755
index 0000000000..acce944ca1
--- /dev/null
+++ b/src/pal/src/libunwind/tests/run-ia64-test-dyn1
@@ -0,0 +1,2 @@
+#!/bin/sh
+./test-ptrace -t ./ia64-test-dyn1
diff --git a/src/pal/src/libunwind/tests/run-ptrace-mapper b/src/pal/src/libunwind/tests/run-ptrace-mapper
new file mode 100755
index 0000000000..dc3010d4b3
--- /dev/null
+++ b/src/pal/src/libunwind/tests/run-ptrace-mapper
@@ -0,0 +1,2 @@
+#!/bin/sh
+./test-ptrace -c -n -t ./mapper $*
diff --git a/src/pal/src/libunwind/tests/run-ptrace-misc b/src/pal/src/libunwind/tests/run-ptrace-misc
new file mode 100755
index 0000000000..c3a6552f1d
--- /dev/null
+++ b/src/pal/src/libunwind/tests/run-ptrace-misc
@@ -0,0 +1,2 @@
+#!/bin/sh
+./test-ptrace -c -t ./test-ptrace-misc
diff --git a/src/pal/src/libunwind/tests/test-async-sig.c b/src/pal/src/libunwind/tests/test-async-sig.c
new file mode 100644
index 0000000000..2ce8b4bb71
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-async-sig.c
@@ -0,0 +1,193 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* Check whether basic unwinding truly is async-signal safe. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "compiler.h"
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/time.h>
+
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+
+static const int nerrors_max = 100;
+
+struct itimerval interval =
+ {
+ .it_interval = { .tv_sec = 0, .tv_usec = 0 },
+ .it_value = { .tv_sec = 0, .tv_usec = 1000 }
+ };
+
+int verbose;
+int nerrors;
+int sigcount;
+
+#ifndef CONFIG_BLOCK_SIGNALS
+/* When libunwind is configured with --enable-block-signals=no, the caller
+ is responsible for preventing recursion via signal handlers.
+ We use a simple global here. In a multithreaded program, one would use
+ a thread-local variable. */
+int recurcount;
+#endif
+
+#define panic(args...) \
+ { ++nerrors; fprintf (stderr, args); return; }
+
+static void
+do_backtrace (int may_print, int get_proc_name)
+{
+ char buf[512], name[256];
+ unw_cursor_t cursor;
+ unw_word_t ip, sp, off;
+ unw_context_t uc;
+ int ret;
+ int depth = 0;
+
+#ifndef CONFIG_BLOCK_SIGNALS
+ if (recurcount > 0)
+ return;
+ recurcount += 1;
+#endif
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local failed!\n");
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+
+ buf[0] = '\0';
+ if (get_proc_name || (may_print && verbose))
+ {
+ ret = unw_get_proc_name (&cursor, name, sizeof (name), &off);
+ if (ret == 0 && (may_print && verbose))
+ {
+ if (off)
+ snprintf (buf, sizeof (buf), "<%s+0x%lx>", name, (long) off);
+ else
+ {
+ size_t len = strlen (name);
+ buf[0] = '<';
+ memcpy (buf + 1, name, len);
+ buf[len + 1] = '>';
+ buf[len + 2] = '\0';
+ }
+ }
+ }
+
+ if (may_print && verbose)
+ printf ("%016lx %-32s (sp=%016lx)\n", (long) ip, buf, (long) sp);
+
+ ret = unw_step (&cursor);
+ if (ret < 0)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ panic ("FAILURE: unw_step() returned %d for ip=%lx\n",
+ ret, (long) ip);
+ }
+ if (depth++ > 100)
+ {
+ panic ("FAILURE: unw_step() looping over %d iterations\n", depth);
+ break;
+ }
+ }
+ while (ret > 0);
+
+#ifndef CONFIG_BLOCK_SIGNALS
+ recurcount -= 1;
+#endif
+}
+
+void
+sighandler (int signal)
+{
+ if (verbose)
+ printf ("sighandler(signal=%d, count=%d)\n", signal, sigcount);
+
+ do_backtrace (1, 1);
+
+ ++sigcount;
+
+ if (sigcount == 100)
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL);
+ else if (sigcount == 200)
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
+ else if (sigcount == 300 || nerrors > nerrors_max)
+ {
+ if (nerrors > nerrors_max)
+ panic ("Too many errors (%d)\n", nerrors);
+ if (nerrors)
+ {
+ fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
+ exit (-1);
+ }
+ if (verbose)
+ printf ("SUCCESS.\n");
+ exit (0);
+ }
+ setitimer (ITIMER_VIRTUAL, &interval, NULL);
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ struct sigaction act;
+ long i = 0;
+
+ if (argc > 1)
+ verbose = 1;
+
+ unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_NONE);
+
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = sighandler;
+ act.sa_flags = SA_SIGINFO;
+ sigaction (SIGVTALRM, &act, NULL);
+
+ setitimer (ITIMER_VIRTUAL, &interval, NULL);
+
+ while (1)
+ {
+ if (0 && verbose)
+ printf ("%s: starting backtrace\n", __FUNCTION__);
+ do_backtrace (0, (i++ % 100) == 0);
+ if (nerrors > nerrors_max)
+ {
+ fprintf (stderr, "Too many errors (%d)\n", nerrors);
+ exit (-1);
+ }
+ }
+ return (0);
+}
diff --git a/src/pal/src/libunwind/tests/test-coredump-unwind.c b/src/pal/src/libunwind/tests/test-coredump-unwind.c
new file mode 100644
index 0000000000..53498237c2
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-coredump-unwind.c
@@ -0,0 +1,395 @@
+/*
+ * Example program for unwinding core dumps.
+ *
+ * Compile a-la:
+ * gcc -Os -Wall \
+ * -Wl,--start-group \
+ * -lunwind -lunwind-x86 -lunwind-coredump \
+ * example-core-unwind.c \
+ * -Wl,--end-group \
+ * -oexample-core-unwind
+ *
+ * Run:
+ * eu-unstrip -n --core COREDUMP
+ * figure out which virtual addresses in COREDUMP correspond to which mapped executable files
+ * (binary and libraries), then supply them like this:
+ * ./example-core-unwind COREDUMP 0x400000:/bin/crashed_program 0x3458600000:/lib/libc.so.6 [...]
+ *
+ * Note: Program eu-unstrip is part of elfutils, virtual addresses of shared
+ * libraries can be determined by ldd (at least on linux).
+ */
+
+#include "compiler.h"
+
+#undef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#undef __USE_GNU
+#define __USE_GNU 1
+
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <string.h>
+#include <syslog.h>
+#include <sys/poll.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/param.h>
+#include <termios.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdbool.h>
+#include <limits.h>
+#include <pwd.h>
+#include <grp.h>
+
+/* For SIGSEGV handler code */
+#include <execinfo.h>
+#include <sys/ucontext.h>
+
+#include <libunwind-coredump.h>
+
+
+/* Utility logging functions */
+
+enum {
+ LOGMODE_NONE = 0,
+ LOGMODE_STDIO = (1 << 0),
+ LOGMODE_SYSLOG = (1 << 1),
+ LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO,
+};
+const char *msg_prefix = "";
+const char *msg_eol = "\n";
+int logmode = LOGMODE_STDIO;
+int xfunc_error_retval = EXIT_FAILURE;
+
+void xfunc_die(void)
+{
+ exit(xfunc_error_retval);
+}
+
+static void verror_msg_helper(const char *s,
+ va_list p,
+ const char* strerr,
+ int flags)
+{
+ char *msg;
+ int prefix_len, strerr_len, msgeol_len, used;
+
+ if (!logmode)
+ return;
+
+ used = vasprintf(&msg, s, p);
+ if (used < 0)
+ return;
+
+ /* This is ugly and costs +60 bytes compared to multiple
+ * fprintf's, but is guaranteed to do a single write.
+ * This is needed for e.g. when multiple children
+ * can produce log messages simultaneously. */
+
+ prefix_len = msg_prefix[0] ? strlen(msg_prefix) + 2 : 0;
+ strerr_len = strerr ? strlen(strerr) : 0;
+ msgeol_len = strlen(msg_eol);
+ /* +3 is for ": " before strerr and for terminating NUL */
+ char *msg1 = (char*) realloc(msg, prefix_len + used + strerr_len + msgeol_len + 3);
+ if (!msg1)
+ {
+ free(msg);
+ return;
+ }
+ msg = msg1;
+ /* TODO: maybe use writev instead of memmoving? Need full_writev? */
+ if (prefix_len)
+ {
+ char *p;
+ memmove(msg + prefix_len, msg, used);
+ used += prefix_len;
+ p = stpcpy(msg, msg_prefix);
+ p[0] = ':';
+ p[1] = ' ';
+ }
+ if (strerr)
+ {
+ if (s[0])
+ {
+ msg[used++] = ':';
+ msg[used++] = ' ';
+ }
+ strcpy(&msg[used], strerr);
+ used += strerr_len;
+ }
+ strcpy(&msg[used], msg_eol);
+
+ if (flags & LOGMODE_STDIO)
+ {
+ fflush(stdout);
+ write(STDERR_FILENO, msg, used + msgeol_len);
+ }
+ msg[used] = '\0'; /* remove msg_eol (usually "\n") */
+ if (flags & LOGMODE_SYSLOG)
+ {
+ syslog(LOG_ERR, "%s", msg + prefix_len);
+ }
+ free(msg);
+}
+
+void log_msg(const char *s, ...)
+{
+ va_list p;
+ va_start(p, s);
+ verror_msg_helper(s, p, NULL, logmode);
+ va_end(p);
+}
+/* It's a macro, not function, since it collides with log() from math.h */
+#undef log
+#define log(...) log_msg(__VA_ARGS__)
+
+void error_msg(const char *s, ...)
+{
+ va_list p;
+ va_start(p, s);
+ verror_msg_helper(s, p, NULL, logmode);
+ va_end(p);
+}
+
+void error_msg_and_die(const char *s, ...)
+{
+ va_list p;
+ va_start(p, s);
+ verror_msg_helper(s, p, NULL, logmode);
+ va_end(p);
+ xfunc_die();
+}
+
+void perror_msg(const char *s, ...)
+{
+ va_list p;
+ va_start(p, s);
+ /* Guard against "<error message>: Success" */
+ verror_msg_helper(s, p, errno ? strerror(errno) : NULL, logmode);
+ va_end(p);
+}
+
+void perror_msg_and_die(const char *s, ...)
+{
+ va_list p;
+ va_start(p, s);
+ /* Guard against "<error message>: Success" */
+ verror_msg_helper(s, p, errno ? strerror(errno) : NULL, logmode);
+ va_end(p);
+ xfunc_die();
+}
+
+void die_out_of_memory(void)
+{
+ error_msg_and_die("Out of memory, exiting");
+}
+
+/* End of utility logging functions */
+
+
+
+static
+void handle_sigsegv(int sig, siginfo_t *info, void *ucontext)
+{
+ long ip = 0;
+ ucontext_t *uc UNUSED;
+
+ uc = ucontext;
+#if defined(__linux__)
+#ifdef UNW_TARGET_X86
+ ip = uc->uc_mcontext.gregs[REG_EIP];
+#elif defined(UNW_TARGET_X86_64)
+ ip = uc->uc_mcontext.gregs[REG_RIP];
+#elif defined(UNW_TARGET_ARM)
+ ip = uc->uc_mcontext.arm_pc;
+#endif
+#elif defined(__FreeBSD__)
+#ifdef __i386__
+ ip = uc->uc_mcontext.mc_eip;
+#elif defined(__amd64__)
+ ip = uc->uc_mcontext.mc_rip;
+#else
+#error Port me
+#endif
+#else
+#error Port me
+#endif
+ dprintf(2, "signal:%d address:0x%lx ip:0x%lx\n",
+ sig,
+ /* this is void*, but using %p would print "(null)"
+ * even for ptrs which are not exactly 0, but, say, 0x123:
+ */
+ (long)info->si_addr,
+ ip);
+
+ {
+ /* glibc extension */
+ void *array[50];
+ int size;
+ size = backtrace(array, 50);
+#ifdef __linux__
+ backtrace_symbols_fd(array, size, 2);
+#endif
+ }
+
+ _exit(1);
+}
+
+static void install_sigsegv_handler(void)
+{
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_sigaction = handle_sigsegv;
+ sa.sa_flags = SA_SIGINFO;
+ sigaction(SIGSEGV, &sa, NULL);
+ sigaction(SIGILL, &sa, NULL);
+ sigaction(SIGFPE, &sa, NULL);
+ sigaction(SIGBUS, &sa, NULL);
+}
+
+int
+main(int argc UNUSED, char **argv)
+{
+ unw_addr_space_t as;
+ struct UCD_info *ui;
+ unw_cursor_t c;
+ int ret;
+
+#define TEST_FRAMES 4
+#define TEST_NAME_LEN 32
+ int testcase = 0;
+ int test_cur = 0;
+ long test_start_ips[TEST_FRAMES];
+ char test_names[TEST_FRAMES][TEST_NAME_LEN];
+
+ install_sigsegv_handler();
+
+ const char *progname = strrchr(argv[0], '/');
+ if (progname)
+ progname++;
+ else
+ progname = argv[0];
+
+ if (!argv[1])
+ error_msg_and_die("Usage: %s COREDUMP [VADDR:BINARY_FILE]...", progname);
+
+ msg_prefix = progname;
+
+ as = unw_create_addr_space(&_UCD_accessors, 0);
+ if (!as)
+ error_msg_and_die("unw_create_addr_space() failed");
+
+ ui = _UCD_create(argv[1]);
+ if (!ui)
+ error_msg_and_die("_UCD_create('%s') failed", argv[1]);
+ ret = unw_init_remote(&c, as, ui);
+ if (ret < 0)
+ error_msg_and_die("unw_init_remote() failed: ret=%d\n", ret);
+
+ argv += 2;
+
+ /* Enable checks for the crasher test program? */
+ if (*argv && !strcmp(*argv, "-testcase"))
+ {
+ testcase = 1;
+ logmode = LOGMODE_NONE;
+ argv++;
+ }
+
+ while (*argv)
+ {
+ char *colon;
+ unsigned long vaddr = strtoul(*argv, &colon, 16);
+ if (*colon != ':')
+ error_msg_and_die("Bad format: '%s'", *argv);
+ if (_UCD_add_backing_file_at_vaddr(ui, vaddr, colon + 1) < 0)
+ error_msg_and_die("Can't add backing file '%s'", colon + 1);
+ argv++;
+ }
+
+ for (;;)
+ {
+ unw_word_t ip;
+ ret = unw_get_reg(&c, UNW_REG_IP, &ip);
+ if (ret < 0)
+ error_msg_and_die("unw_get_reg(UNW_REG_IP) failed: ret=%d\n", ret);
+
+ unw_proc_info_t pi;
+ ret = unw_get_proc_info(&c, &pi);
+ if (ret < 0)
+ error_msg_and_die("unw_get_proc_info(ip=0x%lx) failed: ret=%d\n", (long) ip, ret);
+
+ if (!testcase)
+ printf("\tip=0x%08lx proc=%08lx-%08lx handler=0x%08lx lsda=0x%08lx\n",
+ (long) ip,
+ (long) pi.start_ip, (long) pi.end_ip,
+ (long) pi.handler, (long) pi.lsda);
+
+ if (testcase && test_cur < TEST_FRAMES)
+ {
+ unw_word_t off;
+
+ test_start_ips[test_cur] = (long) pi.start_ip;
+ if (unw_get_proc_name(&c, test_names[test_cur], sizeof(test_names[0]), &off) != 0)
+ {
+ test_names[test_cur][0] = '\0';
+ }
+ test_cur++;
+ }
+
+ log("step");
+ ret = unw_step(&c);
+ log("step done:%d", ret);
+ if (ret < 0)
+ error_msg_and_die("FAILURE: unw_step() returned %d", ret);
+ if (ret == 0)
+ break;
+ }
+ log("stepping ended");
+
+ /* Check that the second and third frames are equal, but distinct of the
+ * others */
+ if (testcase &&
+ (test_cur != 4
+ || test_start_ips[1] != test_start_ips[2]
+ || test_start_ips[0] == test_start_ips[1]
+ || test_start_ips[2] == test_start_ips[3]
+ )
+ )
+ {
+ fprintf(stderr, "FAILURE: start IPs incorrect\n");
+ return -1;
+ }
+
+ if (testcase &&
+ ( strcmp(test_names[0], "a")
+ || strcmp(test_names[1], "b")
+ || strcmp(test_names[2], "b")
+ || strcmp(test_names[3], "main")
+ )
+ )
+ {
+ fprintf(stderr, "FAILURE: procedure names are missing/incorrect\n");
+ return -1;
+ }
+
+ _UCD_destroy(ui);
+ unw_destroy_addr_space(as);
+
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/test-flush-cache.c b/src/pal/src/libunwind/tests/test-flush-cache.c
new file mode 100644
index 0000000000..1611cf48ef
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-flush-cache.c
@@ -0,0 +1,143 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Copyright (c) 2003 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdio.h>
+#include <string.h>
+
+#define UNW_LOCAL_ONLY /* must define this for consistency with backtrace() */
+#include <libunwind.h>
+
+int verbose;
+
+int
+f257 (void)
+{
+ void *buffer[300];
+ int i, n;
+
+ if (verbose)
+ printf ("First backtrace:\n");
+ n = unw_backtrace (buffer, 300);
+ if (verbose)
+ for (i = 0; i < n; ++i)
+ printf ("[%d] ip=%p\n", i, buffer[i]);
+
+ unw_set_cache_size (unw_local_addr_space, 1023, 0);
+ unw_flush_cache (unw_local_addr_space, 0, 0);
+
+ if (verbose)
+ printf ("\nSecond backtrace:\n");
+ n = unw_backtrace (buffer, 300);
+ if (verbose)
+ for (i = 0; i < n; ++i)
+ printf ("[%d] ip=%p\n", i, buffer[i]);
+ return 0;
+}
+
+#define F(n,m) \
+int \
+f##n (void) \
+{ \
+ return f##m (); \
+}
+
+/* Here, we rely on the fact that the script-cache's hash-table is 256
+ entries big. With 257 functions, we're guaranteed to get at least
+ one hash-collision. */
+F(256,257) F(255,256) F(254,255) F(253,254)
+F(252,253) F(251,252) F(250,251) F(249,250)
+F(248,249) F(247,248) F(246,247) F(245,246)
+F(244,245) F(243,244) F(242,243) F(241,242)
+F(240,241) F(239,240) F(238,239) F(237,238)
+F(236,237) F(235,236) F(234,235) F(233,234)
+F(232,233) F(231,232) F(230,231) F(229,230)
+F(228,229) F(227,228) F(226,227) F(225,226)
+F(224,225) F(223,224) F(222,223) F(221,222)
+F(220,221) F(219,220) F(218,219) F(217,218)
+F(216,217) F(215,216) F(214,215) F(213,214)
+F(212,213) F(211,212) F(210,211) F(209,210)
+F(208,209) F(207,208) F(206,207) F(205,206)
+F(204,205) F(203,204) F(202,203) F(201,202)
+F(200,201) F(199,200) F(198,199) F(197,198)
+F(196,197) F(195,196) F(194,195) F(193,194)
+F(192,193) F(191,192) F(190,191) F(189,190)
+F(188,189) F(187,188) F(186,187) F(185,186)
+F(184,185) F(183,184) F(182,183) F(181,182)
+F(180,181) F(179,180) F(178,179) F(177,178)
+F(176,177) F(175,176) F(174,175) F(173,174)
+F(172,173) F(171,172) F(170,171) F(169,170)
+F(168,169) F(167,168) F(166,167) F(165,166)
+F(164,165) F(163,164) F(162,163) F(161,162)
+F(160,161) F(159,160) F(158,159) F(157,158)
+F(156,157) F(155,156) F(154,155) F(153,154)
+F(152,153) F(151,152) F(150,151) F(149,150)
+F(148,149) F(147,148) F(146,147) F(145,146)
+F(144,145) F(143,144) F(142,143) F(141,142)
+F(140,141) F(139,140) F(138,139) F(137,138)
+F(136,137) F(135,136) F(134,135) F(133,134)
+F(132,133) F(131,132) F(130,131) F(129,130)
+F(128,129) F(127,128) F(126,127) F(125,126)
+F(124,125) F(123,124) F(122,123) F(121,122)
+F(120,121) F(119,120) F(118,119) F(117,118)
+F(116,117) F(115,116) F(114,115) F(113,114)
+F(112,113) F(111,112) F(110,111) F(109,110)
+F(108,109) F(107,108) F(106,107) F(105,106)
+F(104,105) F(103,104) F(102,103) F(101,102)
+F(100,101) F(99,100) F(98,99) F(97,98)
+F(96,97) F(95,96) F(94,95) F(93,94)
+F(92,93) F(91,92) F(90,91) F(89,90)
+F(88,89) F(87,88) F(86,87) F(85,86)
+F(84,85) F(83,84) F(82,83) F(81,82)
+F(80,81) F(79,80) F(78,79) F(77,78)
+F(76,77) F(75,76) F(74,75) F(73,74)
+F(72,73) F(71,72) F(70,71) F(69,70)
+F(68,69) F(67,68) F(66,67) F(65,66)
+F(64,65) F(63,64) F(62,63) F(61,62)
+F(60,61) F(59,60) F(58,59) F(57,58)
+F(56,57) F(55,56) F(54,55) F(53,54)
+F(52,53) F(51,52) F(50,51) F(49,50)
+F(48,49) F(47,48) F(46,47) F(45,46)
+F(44,45) F(43,44) F(42,43) F(41,42)
+F(40,41) F(39,40) F(38,39) F(37,38)
+F(36,37) F(35,36) F(34,35) F(33,34)
+F(32,33) F(31,32) F(30,31) F(29,30)
+F(28,29) F(27,28) F(26,27) F(25,26)
+F(24,25) F(23,24) F(22,23) F(21,22)
+F(20,21) F(19,20) F(18,19) F(17,18)
+F(16,17) F(15,16) F(14,15) F(13,14)
+F(12,13) F(11,12) F(10,11) F(9,10)
+F(8,9) F(7,8) F(6,7) F(5,6)
+F(4,5) F(3,4) F(2,3) F(1,2)
+
+int
+main (int argc, char **argv)
+{
+ if (argc > 1 && strcmp (argv[1], "-v") == 0)
+ verbose = 1;
+
+ return f1 ();
+}
diff --git a/src/pal/src/libunwind/tests/test-init-remote.c b/src/pal/src/libunwind/tests/test-init-remote.c
new file mode 100644
index 0000000000..66f2d6a1e0
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-init-remote.c
@@ -0,0 +1,103 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Copyright (c) 2002 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This test simply verifies that unw_init_remote() can be used in
+ lieu of unw_init_local(). This was broken for a while on ia64. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "compiler.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libunwind.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+int verbose;
+
+static int
+do_backtrace (void)
+{
+ char buf[512], name[256];
+ unw_word_t ip, sp, off;
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ int ret;
+
+ unw_getcontext (&uc);
+ if (unw_init_remote (&cursor, unw_local_addr_space, &uc) < 0)
+ panic ("unw_init_remote failed!\n");
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+ buf[0] = '\0';
+ if (unw_get_proc_name (&cursor, name, sizeof (name), &off) == 0)
+ {
+ if (off)
+ snprintf (buf, sizeof (buf), "<%s+0x%lx>", name, (long) off);
+ else
+ snprintf (buf, sizeof (buf), "<%s>", name);
+ }
+ if (verbose)
+ printf ("%016lx %-32s (sp=%016lx)\n", (long) ip, buf, (long) sp);
+
+ ret = unw_step (&cursor);
+ if (ret < 0)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ printf ("FAILURE: unw_step() returned %d for ip=%lx\n",
+ ret, (long) ip);
+ return -1;
+ }
+ }
+ while (ret > 0);
+
+ return 0;
+}
+
+static int
+foo (void)
+{
+ return do_backtrace ();
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ verbose = (argc > 1);
+
+ if (verbose)
+ printf ("Normal backtrace:\n");
+ return foo ();
+}
diff --git a/src/pal/src/libunwind/tests/test-mem.c b/src/pal/src/libunwind/tests/test-mem.c
new file mode 100644
index 0000000000..52c977488a
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-mem.c
@@ -0,0 +1,103 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Copyright (c) 2003 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "compiler.h"
+
+#include <libunwind.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/resource.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+int verbose;
+
+static void
+do_backtrace (void)
+{
+ unw_cursor_t cursor;
+ unw_word_t ip, sp;
+ unw_context_t uc;
+ int ret;
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local failed!\n");
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+
+ if (verbose)
+ printf ("%016lx (sp=%016lx)\n", (long) ip, (long) sp);
+
+ ret = unw_step (&cursor);
+ if (ret < 0)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ panic ("FAILURE: unw_step() returned %d for ip=%lx\n",
+ ret, (long) ip);
+ }
+ }
+ while (ret > 0);
+}
+
+int
+consume_some_stack_space (void)
+{
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ char string[1024];
+
+ memset (&cursor, 0, sizeof (cursor));
+ memset (&uc, 0, sizeof (uc));
+ return sprintf (string, "hello %p %p\n", &cursor, &uc);
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ struct rlimit rlim;
+
+ verbose = argc > 1;
+
+ if (consume_some_stack_space () > 9999)
+ exit (-1); /* can't happen, but don't let the compiler know... */
+
+ rlim.rlim_cur = 0;
+ rlim.rlim_max = RLIM_INFINITY;
+ setrlimit (RLIMIT_DATA, &rlim);
+ setrlimit (RLIMIT_AS, &rlim);
+
+ do_backtrace ();
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/test-proc-info.c b/src/pal/src/libunwind/tests/test-proc-info.c
new file mode 100644
index 0000000000..c4145bc374
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-proc-info.c
@@ -0,0 +1,171 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Copyright (c) 2003 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* This test program checks whether proc_info lookup failures are
+ cached. They must NOT be cached because it could otherwise turn
+ temporary failures into permanent ones. Furthermore, we allow apps
+ to return -UNW_ESTOPUNWIND to terminate unwinding (though this
+ feature is deprecated and dynamic unwind info should be used
+ instead). */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <libunwind.h>
+#include "compiler.h"
+
+int errors;
+
+#define panic(args...) \
+ { ++errors; fprintf (stderr, args); return -1; }
+
+static int
+find_proc_info (unw_addr_space_t as UNUSED,
+ unw_word_t ip UNUSED,
+ unw_proc_info_t *pip UNUSED,
+ int need_unwind_info UNUSED,
+ void *arg UNUSED)
+{
+ return -UNW_ESTOPUNWIND;
+}
+
+static int
+access_mem (unw_addr_space_t as UNUSED,
+ unw_word_t addr UNUSED,
+ unw_word_t *valp, int write,
+ void *arg UNUSED)
+{
+ if (!write)
+ *valp = 0;
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as UNUSED,
+ unw_regnum_t regnum UNUSED,
+ unw_word_t *valp, int write,
+ void *arg UNUSED)
+{
+ if (!write)
+ *valp = 32;
+ return 0;
+}
+
+static int
+access_fpreg (unw_addr_space_t as UNUSED,
+ unw_regnum_t regnum UNUSED,
+ unw_fpreg_t *valp, int write,
+ void *arg UNUSED)
+{
+ if (!write)
+ memset (valp, 0, sizeof (*valp));
+ return 0;
+}
+
+static int
+get_dyn_info_list_addr (unw_addr_space_t as UNUSED,
+ unw_word_t *dilap UNUSED,
+ void *arg UNUSED)
+{
+ return -UNW_ENOINFO;
+}
+
+static void
+put_unwind_info (unw_addr_space_t as UNUSED,
+ unw_proc_info_t *pi UNUSED,
+ void *arg UNUSED)
+{
+ ++errors;
+ fprintf (stderr, "%s() got called!\n", __FUNCTION__);
+}
+
+static int
+resume (unw_addr_space_t as UNUSED,
+ unw_cursor_t *reg UNUSED,
+ void *arg UNUSED)
+{
+ panic ("%s() got called!\n", __FUNCTION__);
+}
+
+static int
+get_proc_name (unw_addr_space_t as UNUSED,
+ unw_word_t ip UNUSED,
+ char *buf UNUSED,
+ size_t buf_len UNUSED,
+ unw_word_t *offp UNUSED,
+ void *arg UNUSED)
+{
+ panic ("%s() got called!\n", __FUNCTION__);
+}
+
+int
+main (int argc, char **argv)
+{
+ unw_accessors_t acc;
+ unw_addr_space_t as;
+ int ret, verbose = 0;
+ unw_cursor_t c;
+
+ if (argc > 1 && strcmp (argv[1], "-v") == 0)
+ verbose = 1;
+
+ memset (&acc, 0, sizeof (acc));
+ acc.find_proc_info = find_proc_info;
+ acc.put_unwind_info = put_unwind_info;
+ acc.get_dyn_info_list_addr = get_dyn_info_list_addr;
+ acc.access_mem = access_mem;
+ acc.access_reg = access_reg;
+ acc.access_fpreg = access_fpreg;
+ acc.resume = resume;
+ acc.get_proc_name = get_proc_name;
+
+ as = unw_create_addr_space (&acc, 0);
+ if (!as)
+ panic ("unw_create_addr_space() failed\n");
+
+ unw_set_caching_policy (as, UNW_CACHE_GLOBAL);
+
+ ret = unw_init_remote (&c, as, NULL);
+ if (ret < 0)
+ panic ("unw_init_remote() returned %d instead of 0\n", ret);
+
+ ret = unw_step (&c);
+ if (ret != -UNW_ESTOPUNWIND)
+ panic ("First call to unw_step() returned %d instead of %d\n",
+ ret, -UNW_ESTOPUNWIND);
+
+ ret = unw_step (&c);
+ if (ret != -UNW_ESTOPUNWIND)
+ panic ("Second call to unw_step() returned %d instead of %d\n",
+ ret, -UNW_ESTOPUNWIND);
+
+ unw_destroy_addr_space (as);
+
+ if (verbose)
+ printf ("SUCCESS\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/test-ptrace-misc.c b/src/pal/src/libunwind/tests/test-ptrace-misc.c
new file mode 100644
index 0000000000..374059dc44
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-ptrace-misc.c
@@ -0,0 +1,120 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "compiler.h"
+
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+
+pid_t self;
+int global[64];
+
+int
+func (int arg)
+{
+ int sum = 0, i, max, arr[1024];
+
+ if (arg == 0)
+ {
+ sum = global[2];
+ sum += sum + sum * getppid ();
+ return sum;
+ }
+ else
+ {
+ max = arg;
+ if (max >= 64)
+ max = 64;
+
+ for (i = 0; i < max; ++i)
+ arr[i] = func (arg - 1);
+
+ for (i = 0; i < max; ++i)
+ if (arr[i] > 16)
+ sum += arr[i];
+ else
+ sum -= arr[i];
+ }
+ return sum;
+}
+
+int
+bar (int v)
+{
+ extern long f (long);
+ int arr[1] = { v };
+ uintptr_t r;
+
+ /* This is a vain attempt to use up lots of registers to force
+ the frame-chain info to be saved on the memory stack on ia64.
+ It happens to work with gcc v3.3.4 and gcc v3.4.1 but perhaps
+ not with any other compiler. */
+ r = (uintptr_t) malloc(f (arr[0])
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v)
+ + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + (f (v) + f (v))
+ ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
+ )))))))))))))))))))))))))))))))))))))))))))))))))))))));
+ if (r < 2)
+ v = r;
+
+ kill (self, SIGUSR1); /* tell test-ptrace to start single-stepping */
+ v = func (v);
+ kill (self, SIGUSR2); /* tell test-ptrace to stop single-stepping */
+ return v;
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ int val = argc;
+
+ signal (SIGUSR1, SIG_IGN);
+ signal (SIGUSR2, SIG_IGN);
+
+ self = getpid ();
+
+ printf ("sum = %d\n", bar (val));
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/test-ptrace.c b/src/pal/src/libunwind/tests/test-ptrace.c
new file mode 100644
index 0000000000..e7c7883f38
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-ptrace.c
@@ -0,0 +1,370 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <config.h>
+
+#ifdef HAVE_TTRACE
+
+int
+main (void)
+{
+ printf ("FAILURE: ttrace() not supported yet\n");
+ return -1;
+}
+
+#else /* !HAVE_TTRACE */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <libunwind-ptrace.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/ptrace.h>
+#include <sys/wait.h>
+
+extern char **environ;
+
+static const int nerrors_max = 100;
+
+int nerrors;
+int verbose;
+int print_names = 1;
+
+enum
+ {
+ INSTRUCTION,
+ SYSCALL,
+ TRIGGER
+ }
+trace_mode = SYSCALL;
+
+#define panic(args...) \
+ do { fprintf (stderr, args); ++nerrors; } while (0)
+
+static unw_addr_space_t as;
+static struct UPT_info *ui;
+
+static int killed;
+
+void
+do_backtrace (void)
+{
+ unw_word_t ip, sp, start_ip = 0, off;
+ int n = 0, ret;
+ unw_proc_info_t pi;
+ unw_cursor_t c;
+ char buf[512];
+ size_t len;
+
+ ret = unw_init_remote (&c, as, ui);
+ if (ret < 0)
+ panic ("unw_init_remote() failed: ret=%d\n", ret);
+
+ do
+ {
+ if ((ret = unw_get_reg (&c, UNW_REG_IP, &ip)) < 0
+ || (ret = unw_get_reg (&c, UNW_REG_SP, &sp)) < 0)
+ panic ("unw_get_reg/unw_get_proc_name() failed: ret=%d\n", ret);
+
+ if (n == 0)
+ start_ip = ip;
+
+ buf[0] = '\0';
+ if (print_names)
+ unw_get_proc_name (&c, buf, sizeof (buf), &off);
+
+ if (verbose)
+ {
+ if (off)
+ {
+ len = strlen (buf);
+ if (len >= sizeof (buf) - 32)
+ len = sizeof (buf) - 32;
+ sprintf (buf + len, "+0x%lx", (unsigned long) off);
+ }
+ printf ("%016lx %-32s (sp=%016lx)\n", (long) ip, buf, (long) sp);
+ }
+
+ if ((ret = unw_get_proc_info (&c, &pi)) < 0)
+ panic ("unw_get_proc_info(ip=0x%lx) failed: ret=%d\n", (long) ip, ret);
+ else if (verbose)
+ printf ("\tproc=%016lx-%016lx\n\thandler=%lx lsda=%lx",
+ (long) pi.start_ip, (long) pi.end_ip,
+ (long) pi.handler, (long) pi.lsda);
+
+#if UNW_TARGET_IA64
+ {
+ unw_word_t bsp;
+
+ if ((ret = unw_get_reg (&c, UNW_IA64_BSP, &bsp)) < 0)
+ panic ("unw_get_reg() failed: ret=%d\n", ret);
+ else if (verbose)
+ printf (" bsp=%lx", bsp);
+ }
+#endif
+ if (verbose)
+ printf ("\n");
+
+ ret = unw_step (&c);
+ if (ret < 0)
+ {
+ unw_get_reg (&c, UNW_REG_IP, &ip);
+ panic ("FAILURE: unw_step() returned %d for ip=%lx (start ip=%lx)\n",
+ ret, (long) ip, (long) start_ip);
+ }
+
+ if (++n > 64)
+ {
+ /* guard against bad unwind info in old libraries... */
+ panic ("too deeply nested---assuming bogus unwind (start ip=%lx)\n",
+ (long) start_ip);
+ break;
+ }
+ if (nerrors > nerrors_max)
+ {
+ panic ("Too many errors (%d)!\n", nerrors);
+ break;
+ }
+ }
+ while (ret > 0);
+
+ if (ret < 0)
+ panic ("unwind failed with ret=%d\n", ret);
+
+ if (verbose)
+ printf ("================\n\n");
+}
+
+static pid_t target_pid;
+static void target_pid_kill (void)
+{
+ kill (target_pid, SIGKILL);
+}
+
+int
+main (int argc, char **argv)
+{
+ int status, pid, pending_sig, optind = 1, state = 1;
+
+ as = unw_create_addr_space (&_UPT_accessors, 0);
+ if (!as)
+ panic ("unw_create_addr_space() failed");
+
+ if (argc == 1)
+ {
+ static char *args[] = { "self", "/bin/ls", "/usr", NULL };
+
+ /* automated test case */
+ argv = args;
+
+ /* Unless the args array is 'walked' the child
+ process is unable to access it and dies with a segfault */
+ fprintf(stderr, "Automated test (%s,%s,%s,%s)\n",
+ args[0],args[1],args[2],args[3]);
+ }
+ else if (argc > 1)
+ while (argv[optind][0] == '-')
+ {
+ if (strcmp (argv[optind], "-v") == 0)
+ ++optind, verbose = 1;
+ else if (strcmp (argv[optind], "-i") == 0)
+ ++optind, trace_mode = INSTRUCTION; /* backtrace at each insn */
+ else if (strcmp (argv[optind], "-s") == 0)
+ ++optind, trace_mode = SYSCALL; /* backtrace at each syscall */
+ else if (strcmp (argv[optind], "-t") == 0)
+ /* Execute until raise(SIGUSR1), then backtrace at each insn
+ until raise(SIGUSR2). */
+ ++optind, trace_mode = TRIGGER;
+ else if (strcmp (argv[optind], "-c") == 0)
+ /* Enable caching of unwind-info. */
+ ++optind, unw_set_caching_policy (as, UNW_CACHE_GLOBAL);
+ else if (strcmp (argv[optind], "-n") == 0)
+ /* Don't look-up and print symbol names. */
+ ++optind, print_names = 0;
+ else
+ fprintf(stderr, "unrecognized option: %s\n", argv[optind++]);
+ if (optind >= argc)
+ break;
+ }
+
+ target_pid = fork ();
+ if (!target_pid)
+ {
+ /* child */
+
+ if (!verbose)
+ dup2 (open ("/dev/null", O_WRONLY), 1);
+
+#if HAVE_DECL_PTRACE_TRACEME
+ ptrace (PTRACE_TRACEME, 0, 0, 0);
+#elif HAVE_DECL_PT_TRACE_ME
+ ptrace (PT_TRACE_ME, 0, 0, 0);
+#else
+#error Trace me
+#endif
+
+ if ((argc > 1) && (optind == argc)) {
+ fprintf(stderr, "Need to specify a command line for the child\n");
+ exit (-1);
+ }
+ execve (argv[optind], argv + optind, environ);
+ _exit (-1);
+ }
+ atexit (target_pid_kill);
+
+ ui = _UPT_create (target_pid);
+
+ while (nerrors <= nerrors_max)
+ {
+ pid = wait4 (-1, &status, 0, NULL);
+ if (pid == -1)
+ {
+ if (errno == EINTR)
+ continue;
+
+ panic ("wait4() failed (errno=%d)\n", errno);
+ }
+ pending_sig = 0;
+ if (WIFSIGNALED (status) || WIFEXITED (status)
+ || (WIFSTOPPED (status) && WSTOPSIG (status) != SIGTRAP))
+ {
+ if (WIFEXITED (status))
+ {
+ if (WEXITSTATUS (status) != 0)
+ panic ("child's exit status %d\n", WEXITSTATUS (status));
+ break;
+ }
+ else if (WIFSIGNALED (status))
+ {
+ if (!killed)
+ panic ("child terminated by signal %d\n", WTERMSIG (status));
+ break;
+ }
+ else
+ {
+ pending_sig = WSTOPSIG (status);
+ /* Avoid deadlock: */
+ if (WSTOPSIG (status) == SIGKILL)
+ break;
+ if (trace_mode == TRIGGER)
+ {
+ if (WSTOPSIG (status) == SIGUSR1)
+ state = 0;
+ else if (WSTOPSIG (status) == SIGUSR2)
+ state = 1;
+ }
+ if (WSTOPSIG (status) != SIGUSR1 && WSTOPSIG (status) != SIGUSR2)
+ {
+ static int count = 0;
+
+ if (count++ > 100)
+ {
+ panic ("Too many child unexpected signals (now %d)\n",
+ WSTOPSIG (status));
+ killed = 1;
+ }
+ }
+ }
+ }
+
+ switch (trace_mode)
+ {
+ case TRIGGER:
+ if (state)
+#if HAVE_DECL_PTRACE_CONT
+ ptrace (PTRACE_CONT, target_pid, 0, 0);
+#elif HAVE_DECL_PT_CONTINUE
+ ptrace (PT_CONTINUE, target_pid, (caddr_t)1, 0);
+#else
+#error Port me
+#endif
+ else
+ {
+ do_backtrace ();
+#if HAVE_DECL_PTRACE_SINGLESTEP
+ if (ptrace (PTRACE_SINGLESTEP, target_pid, 0, pending_sig) < 0)
+ {
+ panic ("ptrace(PTRACE_SINGLESTEP) failed (errno=%d)\n", errno);
+ killed = 1;
+ }
+#elif HAVE_DECL_PT_STEP
+ if (ptrace (PT_STEP, target_pid, (caddr_t)1, pending_sig) < 0)
+ {
+ panic ("ptrace(PT_STEP) failed (errno=%d)\n", errno);
+ killed = 1;
+ }
+#else
+#error Singlestep me
+#endif
+ }
+ break;
+
+ case SYSCALL:
+ if (!state)
+ do_backtrace ();
+ state ^= 1;
+#if HAVE_DECL_PTRACE_SYSCALL
+ ptrace (PTRACE_SYSCALL, target_pid, 0, pending_sig);
+#elif HAVE_DECL_PT_SYSCALL
+ ptrace (PT_SYSCALL, target_pid, (caddr_t)1, pending_sig);
+#else
+#error Syscall me
+#endif
+ break;
+
+ case INSTRUCTION:
+ do_backtrace ();
+#if HAVE_DECL_PTRACE_SINGLESTEP
+ ptrace (PTRACE_SINGLESTEP, target_pid, 0, pending_sig);
+#elif HAVE_DECL_PT_STEP
+ ptrace (PT_STEP, target_pid, (caddr_t)1, pending_sig);
+#else
+#error Singlestep me
+#endif
+ break;
+ }
+ if (killed)
+ kill (target_pid, SIGKILL);
+ }
+
+ _UPT_destroy (ui);
+ unw_destroy_addr_space (as);
+
+ if (nerrors)
+ {
+ printf ("FAILURE: detected %d errors\n", nerrors);
+ exit (-1);
+ }
+ if (verbose)
+ printf ("SUCCESS\n");
+
+ return 0;
+}
+
+#endif /* !HAVE_TTRACE */
diff --git a/src/pal/src/libunwind/tests/test-reg-state.c b/src/pal/src/libunwind/tests/test-reg-state.c
new file mode 100644
index 0000000000..ac713ea68a
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-reg-state.c
@@ -0,0 +1,133 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Copyright (c) 2003 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "compiler.h"
+
+#include <libunwind.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+#include <sys/resource.h>
+
+#define panic(args...) \
+ { fprintf (stderr, args); exit (-1); }
+
+int verbose;
+
+struct cb_data
+{
+ unw_word_t ip;
+ void* reg_state;
+ size_t len;
+};
+
+static int
+dwarf_reg_states_callback(void *token,
+ void *rs,
+ size_t size,
+ unw_word_t start_ip, unw_word_t end_ip)
+{
+ struct cb_data *data = token;
+ if (start_ip <= data->ip && data->ip < end_ip)
+ {
+ data->reg_state = mmap(NULL, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ memcpy(data->reg_state, rs, size);
+ data->len = size;
+ }
+ return 0;
+}
+
+static void
+do_backtrace (void)
+{
+ unw_cursor_t cursor;
+ unw_word_t ip, sp;
+ unw_context_t uc;
+ int ret;
+
+ unw_getcontext (&uc);
+ if (unw_init_local (&cursor, &uc) < 0)
+ panic ("unw_init_local failed!\n");
+
+ do
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ unw_get_reg (&cursor, UNW_REG_SP, &sp);
+
+ if (verbose)
+ printf ("%016lx (sp=%016lx)\n", (long) ip, (long) sp);
+
+ struct cb_data data = {.ip = ip, .reg_state = NULL};
+ ret = unw_reg_states_iterate(&cursor, dwarf_reg_states_callback, &data);
+ if (ret > 0)
+ {
+ ret = unw_apply_reg_state (&cursor, data.reg_state);
+ munmap(data.reg_state, data.len);
+ }
+ if (ret < 0)
+ {
+ unw_get_reg (&cursor, UNW_REG_IP, &ip);
+ panic ("FAILURE: unw_step() returned %d for ip=%lx\n",
+ ret, (long) ip);
+ }
+ }
+ while (ret > 0);
+}
+
+int
+consume_some_stack_space (void)
+{
+ unw_cursor_t cursor;
+ unw_context_t uc;
+ char string[1024];
+
+ memset (&cursor, 0, sizeof (cursor));
+ memset (&uc, 0, sizeof (uc));
+ return sprintf (string, "hello %p %p\n", &cursor, &uc);
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ struct rlimit rlim;
+
+ verbose = argc > 1;
+
+ if (consume_some_stack_space () > 9999)
+ exit (-1); /* can't happen, but don't let the compiler know... */
+
+ rlim.rlim_cur = 0;
+ rlim.rlim_max = RLIM_INFINITY;
+ setrlimit (RLIMIT_DATA, &rlim);
+
+ do_backtrace ();
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/test-setjmp.c b/src/pal/src/libunwind/tests/test-setjmp.c
new file mode 100644
index 0000000000..769b71b222
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-setjmp.c
@@ -0,0 +1,285 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* The setjmp()/longjmp(), sigsetjmp()/siglongjmp(). */
+
+#include "compiler.h"
+
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int nerrors;
+int verbose;
+
+static jmp_buf jbuf;
+static sigjmp_buf sigjbuf;
+static sigset_t sigset4;
+
+void
+raise_longjmp (jmp_buf jbuf, int i, int n)
+{
+ while (i < n)
+ raise_longjmp (jbuf, i + 1, n);
+
+ longjmp (jbuf, n);
+}
+
+void
+test_setjmp (void)
+{
+ volatile int i;
+ jmp_buf jbuf;
+ int ret;
+
+ for (i = 0; i < 10; ++i)
+ {
+ if ((ret = setjmp (jbuf)))
+ {
+ if (verbose)
+ printf ("%s: secondary setjmp () return, ret=%d\n",
+ __FUNCTION__, ret);
+ if (ret != i + 1)
+ {
+ fprintf (stderr, "%s: setjmp() returned %d, expected %d\n",
+ __FUNCTION__, ret, i + 1);
+ ++nerrors;
+ }
+ continue;
+ }
+ if (verbose)
+ printf ("%s.%d: done with setjmp(); calling children\n",
+ __FUNCTION__, i + 1);
+
+ raise_longjmp (jbuf, 0, i + 1);
+
+ fprintf (stderr, "%s: raise_longjmp() returned unexpectedly\n",
+ __FUNCTION__);
+ ++nerrors;
+ }
+}
+
+
+void
+raise_siglongjmp (sigjmp_buf jbuf, int i, int n)
+{
+ while (i < n)
+ raise_siglongjmp (jbuf, i + 1, n);
+
+ siglongjmp (jbuf, n);
+}
+
+void
+test_sigsetjmp (void)
+{
+ sigjmp_buf jbuf;
+ volatile int i;
+ int ret;
+
+ for (i = 0; i < 10; ++i)
+ {
+ if ((ret = sigsetjmp (jbuf, 1)))
+ {
+ if (verbose)
+ printf ("%s: secondary sigsetjmp () return, ret=%d\n",
+ __FUNCTION__, ret);
+ if (ret != i + 1)
+ {
+ fprintf (stderr, "%s: sigsetjmp() returned %d, expected %d\n",
+ __FUNCTION__, ret, i + 1);
+ ++nerrors;
+ }
+ continue;
+ }
+ if (verbose)
+ printf ("%s.%d: done with sigsetjmp(); calling children\n",
+ __FUNCTION__, i + 1);
+
+ raise_siglongjmp (jbuf, 0, i + 1);
+
+ fprintf (stderr, "%s: raise_siglongjmp() returned unexpectedly\n",
+ __FUNCTION__);
+ ++nerrors;
+ }
+}
+
+void
+sighandler (int signal)
+{
+ if (verbose)
+ printf ("%s: got signal %d\n", __FUNCTION__, signal);
+
+ sigprocmask (SIG_BLOCK, NULL, (sigset_t *) &sigset4);
+ if (verbose)
+ printf ("%s: back from sigprocmask\n", __FUNCTION__);
+
+ siglongjmp (sigjbuf, 1);
+ printf ("%s: siglongjmp() returned unexpectedly!\n", __FUNCTION__);
+}
+
+int
+main (int argc, char **argv UNUSED)
+{
+ volatile sigset_t sigset1, sigset2, sigset3;
+ volatile struct sigaction act;
+
+ if (argc > 1)
+ verbose = 1;
+
+ sigemptyset ((sigset_t *) &sigset1);
+ sigaddset ((sigset_t *) &sigset1, SIGUSR1);
+ sigemptyset ((sigset_t *) &sigset2);
+ sigaddset ((sigset_t *) &sigset2, SIGUSR2);
+
+ memset ((void *) &act, 0, sizeof (act));
+ act.sa_handler = sighandler;
+ sigaction (SIGTERM, (struct sigaction *) &act, NULL);
+
+ test_setjmp ();
+ test_sigsetjmp ();
+
+ /* _setjmp() MUST NOT change signal mask: */
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset1, NULL);
+ if (_setjmp (jbuf))
+ {
+ sigemptyset ((sigset_t *) &sigset3);
+ sigprocmask (SIG_BLOCK, NULL, (sigset_t *) &sigset3);
+ if (memcmp ((sigset_t *) &sigset3, (sigset_t *) &sigset2,
+ sizeof (sigset_t)) != 0)
+ {
+ fprintf (stderr, "FAILURE: _longjmp() manipulated signal mask!\n");
+ ++nerrors;
+ }
+ else if (verbose)
+ printf ("OK: _longjmp() seems not to change signal mask\n");
+ }
+ else
+ {
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset2, NULL);
+ _longjmp (jbuf, 1);
+ }
+
+ /* sigsetjmp(jbuf, 1) MUST preserve signal mask: */
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset1, NULL);
+ if (sigsetjmp (sigjbuf, 1))
+ {
+ sigemptyset ((sigset_t *) &sigset3);
+ sigprocmask (SIG_BLOCK, NULL, (sigset_t *) &sigset3);
+ if (memcmp ((sigset_t *) &sigset3, (sigset_t *) &sigset1,
+ sizeof (sigset_t)) != 0)
+ {
+ fprintf (stderr,
+ "FAILURE: siglongjmp() didn't restore signal mask!\n");
+ ++nerrors;
+ }
+ else if (verbose)
+ printf ("OK: siglongjmp() restores signal mask when asked to\n");
+ }
+ else
+ {
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset2, NULL);
+ siglongjmp (sigjbuf, 1);
+ }
+
+ /* sigsetjmp(jbuf, 0) MUST NOT preserve signal mask: */
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset1, NULL);
+ if (sigsetjmp (sigjbuf, 0))
+ {
+ sigemptyset ((sigset_t *) &sigset3);
+ sigprocmask (SIG_BLOCK, NULL, (sigset_t *) &sigset3);
+ if (memcmp ((sigset_t *) &sigset3, (sigset_t *) &sigset2,
+ sizeof (sigset_t)) != 0)
+ {
+ fprintf (stderr,
+ "FAILURE: siglongjmp() changed signal mask!\n");
+ ++nerrors;
+ }
+ else if (verbose)
+ printf ("OK: siglongjmp() leaves signal mask alone when asked to\n");
+ }
+ else
+ {
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset2, NULL);
+ siglongjmp (sigjbuf, 1);
+ }
+
+ /* sigsetjmp(jbuf, 1) MUST preserve signal mask: */
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset1, NULL);
+ if (sigsetjmp (sigjbuf, 1))
+ {
+ sigemptyset ((sigset_t *) &sigset3);
+ sigprocmask (SIG_BLOCK, NULL, (sigset_t *) &sigset3);
+ if (memcmp ((sigset_t *) &sigset3, (sigset_t *) &sigset1,
+ sizeof (sigset_t)) != 0)
+ {
+ fprintf (stderr,
+ "FAILURE: siglongjmp() didn't restore signal mask!\n");
+ ++nerrors;
+ }
+ else if (verbose)
+ printf ("OK: siglongjmp() restores signal mask when asked to\n");
+ }
+ else
+ {
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset2, NULL);
+ kill (getpid (), SIGTERM);
+ fprintf (stderr, "FAILURE: unexpected return from kill()\n");
+ ++nerrors;
+ }
+
+ /* sigsetjmp(jbuf, 0) MUST NOT preserve signal mask: */
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset1, NULL);
+ if (sigsetjmp (sigjbuf, 0))
+ {
+ sigemptyset ((sigset_t *) &sigset3);
+ sigprocmask (SIG_BLOCK, NULL, (sigset_t *) &sigset3);
+ if (memcmp ((sigset_t *) &sigset3, (sigset_t *) &sigset4,
+ sizeof (sigset_t)) != 0)
+ {
+ fprintf (stderr,
+ "FAILURE: siglongjmp() changed signal mask!\n");
+ ++nerrors;
+ }
+ else if (verbose)
+ printf ("OK: siglongjmp() leaves signal mask alone when asked to\n");
+ }
+ else
+ {
+ sigprocmask (SIG_SETMASK, (sigset_t *) &sigset2, NULL);
+ kill (getpid (), SIGTERM);
+ fprintf (stderr, "FAILURE: unexpected return from kill()\n");
+ ++nerrors;
+ }
+
+ if (nerrors > 0)
+ {
+ fprintf (stderr, "FAILURE: detected %d failures\n", nerrors);
+ exit (-1);
+ }
+ if (verbose)
+ printf ("SUCCESS\n");
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/test-static-link-gen.c b/src/pal/src/libunwind/tests/test-static-link-gen.c
new file mode 100644
index 0000000000..d61e7a51c6
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-static-link-gen.c
@@ -0,0 +1,74 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Copyright (c) 2003 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include <stdio.h>
+
+#include <libunwind.h>
+
+extern int verbose;
+
+static void *funcs[] =
+ {
+ (void *) &unw_get_reg,
+ (void *) &unw_get_fpreg,
+ (void *) &unw_set_reg,
+ (void *) &unw_set_fpreg,
+ (void *) &unw_resume,
+ (void *) &unw_create_addr_space,
+ (void *) &unw_destroy_addr_space,
+ (void *) &unw_get_accessors,
+ (void *) &unw_flush_cache,
+ (void *) &unw_set_caching_policy,
+ (void *) &unw_set_cache_size,
+ (void *) &unw_regname,
+ (void *) &unw_get_proc_info,
+ (void *) &unw_get_save_loc,
+ (void *) &unw_is_signal_frame,
+ (void *) &unw_get_proc_name
+ };
+
+int
+test_generic (void)
+{
+ if (verbose)
+ printf (__FILE__": funcs[0]=%p\n", funcs[0]);
+
+#ifndef UNW_REMOTE_ONLY
+ {
+ unw_context_t uc;
+ unw_cursor_t c;
+
+ unw_getcontext (&uc);
+ unw_init_local (&c, &uc);
+ unw_init_remote (&c, unw_local_addr_space, &uc);
+
+ return unw_step (&c);
+ }
+#else
+ return 0;
+#endif
+}
diff --git a/src/pal/src/libunwind/tests/test-static-link-loc.c b/src/pal/src/libunwind/tests/test-static-link-loc.c
new file mode 100644
index 0000000000..1c7aa0378c
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-static-link-loc.c
@@ -0,0 +1,102 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Copyright (c) 2003 Hewlett-Packard Co.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+/* The purpose of this program is simply to link in all libunwind-API
+ functions both in their local-only and generic variants and to make
+ sure that the final result can be linked statically. */
+
+#include <stdio.h>
+
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#include "compiler.h"
+
+extern int test_generic (void);
+
+int verbose;
+
+#ifdef UNW_REMOTE_ONLY
+
+int
+test_local (void)
+{
+ return 0;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+static void *funcs[] =
+ {
+ (void *) &unw_get_reg,
+ (void *) &unw_get_fpreg,
+ (void *) &unw_set_reg,
+ (void *) &unw_set_fpreg,
+ (void *) &unw_resume,
+ (void *) &unw_create_addr_space,
+ (void *) &unw_destroy_addr_space,
+ (void *) &unw_get_accessors,
+ (void *) &unw_flush_cache,
+ (void *) &unw_set_caching_policy,
+ (void *) &unw_set_cache_size,
+ (void *) &unw_regname,
+ (void *) &unw_get_proc_info,
+ (void *) &unw_get_save_loc,
+ (void *) &unw_is_signal_frame,
+ (void *) &unw_get_proc_name,
+ (void *) &_U_dyn_register,
+ (void *) &_U_dyn_cancel
+ };
+
+int
+test_local (void)
+{
+ unw_context_t uc;
+ unw_cursor_t c;
+
+ if (verbose)
+ printf (__FILE__": funcs[0]=%p\n", funcs[0]);
+
+ unw_getcontext (&uc);
+ unw_init_local (&c, &uc);
+ unw_init_remote (&c, unw_local_addr_space, &uc);
+ return unw_step (&c);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+int
+main (int argc, char **argv UNUSED)
+{
+ if (argc > 1)
+ verbose = 1;
+
+ if (test_local () < 0)
+ return -1;
+ if (test_generic () < 0)
+ return -1;
+ return 0;
+}
diff --git a/src/pal/src/libunwind/tests/test-strerror.c b/src/pal/src/libunwind/tests/test-strerror.c
new file mode 100644
index 0000000000..f7ae61ed17
--- /dev/null
+++ b/src/pal/src/libunwind/tests/test-strerror.c
@@ -0,0 +1,18 @@
+#include "compiler.h"
+#include <libunwind.h>
+#include <stdio.h>
+
+int
+main (int argc, char **argv UNUSED)
+{
+ int i, verbose = argc > 1;
+ const char *msg;
+
+ for (i = 0; i < 16; ++i)
+ {
+ msg = unw_strerror (-i);
+ if (verbose)
+ printf ("%6d -> %s\n", -i, msg);
+ }
+ return 0;
+}
diff --git a/src/pal/src/locale/unicode.cpp b/src/pal/src/locale/unicode.cpp
index c9c1ae1c4d..05e916efcf 100644
--- a/src/pal/src/locale/unicode.cpp
+++ b/src/pal/src/locale/unicode.cpp
@@ -353,116 +353,6 @@ IsValidCodePage(
return retval;
}
-#if ENABLE_DOWNLEVEL_FOR_NLS
-/*++
-Function:
-GetStringTypeEx
-
-See MSDN doc.
---*/
-BOOL
-PALAPI
-GetStringTypeExW(
- IN LCID Locale,
- IN DWORD dwInfoType,
- IN LPCWSTR lpSrcStr,
- IN int cchSrc,
- OUT LPWORD lpCharType)
-{
-
-
- int i = 0;
-#if !HAVE_COREFOUNDATION
- UnicodeDataRec unicodeDataRec;
-#endif /* !HAVE_COREFOUNDATION */
- BOOL bRet = TRUE;
- wchar_t wcstr ;
- PERF_ENTRY(GetStringTypeExW);
- ENTRY("GetStringTypeExW(Locale=%#x, dwInfoType=%#x, lpSrcStr=%p (%S), "
- "cchSrc=%d, lpCharType=%p)\n",
- Locale, dwInfoType, lpSrcStr?lpSrcStr:W16_NULLSTRING, lpSrcStr?lpSrcStr:W16_NULLSTRING, cchSrc, lpCharType);
-
- if((Locale != LOCALE_USER_DEFAULT)||(dwInfoType != CT_CTYPE1)
- || (cchSrc != 1) || (lpSrcStr == (LPCWSTR)lpCharType))
- {
- ASSERT("One of the input parameters is invalid\n");
- SetLastError(ERROR_INVALID_PARAMETER);
- bRet = FALSE;
- goto GetStringTypeExExit;
- }
-
-
- /*
- * get length if needed...
- */
- if(cchSrc == -1)
- {
- cchSrc = PAL_wcslen(lpSrcStr);
- }
-
- /*
- * Loop through each character of the source string and update
- * lpCharType accordingly.
- */
- for(i = 0; i < cchSrc; i++)
- {
- wcstr = lpSrcStr[i];
-#if HAVE_COREFOUNDATION
- lpCharType[i] = 0;
- if (PAL_iswlower(wcstr))
- {
- lpCharType[i] |= C1_LOWER;
- }
- if (PAL_iswupper(wcstr))
- {
- lpCharType[i] |= C1_UPPER;
- }
- if (PAL_iswalpha(wcstr))
- {
- lpCharType[i] |= C1_ALPHA;
- }
- if (PAL_iswdigit(wcstr))
- {
- lpCharType[i] |= C1_DIGIT;
- }
- if (PAL_iswspace(wcstr))
- {
- lpCharType[i] |= C1_SPACE;
- }
- if (PAL_iswblank(wcstr))
- {
- lpCharType[i] |= C1_BLANK;
- }
- if (PAL_iswcntrl(wcstr))
- {
- lpCharType[i] |= C1_CNTRL;
- }
- if (PAL_iswpunct(wcstr))
- {
- lpCharType[i] |= C1_PUNCT;
- }
-#else /* HAVE_COREFOUNDATION */
- /*
- * Get the unicode data record for that character.
- */
- if(GetUnicodeData(wcstr, &unicodeDataRec))
- {
- lpCharType[i] = unicodeDataRec.C1_TYPE_FLAGS;
- }
- else
- {
- lpCharType[i] = 0;
- }
-#endif /* HAVE_COREFOUNDATION */
- }
-
- GetStringTypeExExit:
- LOGEXIT("GetStringTypeEx returns BOOL %d\n", bRet);
- PERF_EXIT(GetStringTypeExW);
- return bRet;
-}
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
/*++
Function:
GetCPInfo
diff --git a/src/pal/src/locale/utf8.cpp b/src/pal/src/locale/utf8.cpp
index 87493a9673..d797f4557b 100644
--- a/src/pal/src/locale/utf8.cpp
+++ b/src/pal/src/locale/utf8.cpp
@@ -346,7 +346,7 @@ protected:
throw ArgumentException("String 'chars' contains invalid Unicode code points.");
// Now we aren't going to be false, so its OK to update chars
- chars = &charTemp;
+ *chars = charTemp;
}
return true;
@@ -412,7 +412,7 @@ protected:
class DecoderReplacementFallbackBuffer : public DecoderFallbackBuffer
{
// Store our default string
- WCHAR strDefault[4];
+ WCHAR strDefault[2];
int strDefaultLength;
int fallbackCount = -1;
int fallbackIndex = -1;
@@ -421,11 +421,8 @@ public:
// Construction
DecoderReplacementFallbackBuffer(DecoderReplacementFallback* fallback)
{
- // 2X in case we're a surrogate pair
wcscpy_s(strDefault, sizeof(strDefault), fallback->GetDefaultString());
- wcscat_s(strDefault, sizeof(strDefault), fallback->GetDefaultString());
- strDefaultLength = 2 * PAL_wcslen((const WCHAR *)fallback->GetDefaultString());
-
+ strDefaultLength = PAL_wcslen((const WCHAR *)fallback->GetDefaultString());
}
// Fallback Methods
@@ -1081,9 +1078,14 @@ class UTF8Encoding
return begin <= c && c <= end;
}
- size_t PtrDiff(void* ptr1, void* ptr2)
+ size_t PtrDiff(WCHAR* ptr1, WCHAR* ptr2)
{
- return (BYTE*)ptr2 - (BYTE*)ptr1;
+ return ptr1 - ptr2;
+ }
+
+ size_t PtrDiff(BYTE* ptr1, BYTE* ptr2)
+ {
+ return ptr1 - ptr2;
}
void ThrowBytesOverflow()
@@ -1118,6 +1120,28 @@ class UTF8Encoding
}
}
+ // During GetChars we had an invalid byte sequence
+ // pSrc is backed up to the start of the bad sequence if we didn't have room to
+ // fall it back. Otherwise pSrc remains where it is.
+ bool FallbackInvalidByteSequence(BYTE** pSrc, int ch, DecoderFallbackBuffer* fallback, WCHAR** pTarget)
+ {
+ // Get our byte[]
+ BYTE* pStart = *pSrc;
+ BYTE* bytesUnknown;
+ int size = GetBytesUnknown(pStart, ch, &bytesUnknown);
+
+ // Do the actual fallback
+ if (!fallback->InternalFallback(bytesUnknown, *pSrc, pTarget, size))
+ {
+ // Oops, it failed, back up to pStart
+ *pSrc = pStart;
+ return false;
+ }
+
+ // It worked
+ return true;
+ }
+
int FallbackInvalidByteSequence(BYTE* pSrc, int ch, DecoderFallbackBuffer *fallback)
{
// Get our byte[]
@@ -1211,7 +1235,7 @@ class UTF8Encoding
public:
UTF8Encoding(bool isThrowException)
- : encoderReplacementFallback(W("\xFFFD"))
+ : encoderReplacementFallback(W("\xFFFD")), decoderReplacementFallback(W("\xFFFD"))
{
if (isThrowException)
{
@@ -1704,8 +1728,9 @@ public:
fallback = decoderFallback->CreateFallbackBuffer();
fallback->InternalInitialize(bytes, pAllocatedBufferEnd);
}
- // This'll back us up the appropriate # of bytes if we didn't get anywhere
- if (!FallbackInvalidByteSequence(pSrc, ch, fallback))
+
+ // That'll back us up the appropriate # of bytes if we didn't get anywhere
+ if (!FallbackInvalidByteSequence(&pSrc, ch, fallback, &pTarget))
{
// Ran out of buffer space
// Need to throw an exception?
diff --git a/src/pal/src/misc/fmtmessage.cpp b/src/pal/src/misc/fmtmessage.cpp
index 70b854aa9c..fcf749b51f 100644
--- a/src/pal/src/misc/fmtmessage.cpp
+++ b/src/pal/src/misc/fmtmessage.cpp
@@ -336,11 +336,7 @@ FormatMessageW(
}
if ( !( dwFlags & FORMAT_MESSAGE_FROM_STRING ) &&
- ( dwLanguageId != 0
-#if ENABLE_DOWNLEVEL_FOR_NLS
- && dwLanguageId != MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT )
-#endif
- ) )
+ ( dwLanguageId != 0) )
{
ERROR( "Invalid language indentifier.\n" );
SetLastError( ERROR_RESOURCE_LANG_NOT_FOUND );
diff --git a/src/pal/src/sharedmemory/sharedmemory.cpp b/src/pal/src/sharedmemory/sharedmemory.cpp
index 9db1998c0e..46c07143a1 100644
--- a/src/pal/src/sharedmemory/sharedmemory.cpp
+++ b/src/pal/src/sharedmemory/sharedmemory.cpp
@@ -62,6 +62,7 @@ DWORD SharedMemoryException::GetErrorCode() const
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SharedMemoryHelpers
+const mode_t SharedMemoryHelpers::PermissionsMask_CurrentUser_ReadWriteExecute = S_IRUSR | S_IWUSR | S_IXUSR;
const mode_t SharedMemoryHelpers::PermissionsMask_AllUsers_ReadWrite =
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
const mode_t SharedMemoryHelpers::PermissionsMask_AllUsers_ReadWriteExecute =
@@ -92,10 +93,16 @@ SIZE_T SharedMemoryHelpers::AlignUp(SIZE_T value, SIZE_T alignment)
return AlignDown(value + (alignment - 1), alignment);
}
-bool SharedMemoryHelpers::EnsureDirectoryExists(const char *path, bool isGlobalLockAcquired, bool createIfNotExist)
+bool SharedMemoryHelpers::EnsureDirectoryExists(
+ const char *path,
+ bool isGlobalLockAcquired,
+ bool createIfNotExist,
+ bool isSystemDirectory)
{
_ASSERTE(path != nullptr);
+ _ASSERTE(!(isSystemDirectory && createIfNotExist)); // should not create or change permissions on system directories
_ASSERTE(SharedMemoryManager::IsCreationDeletionProcessLockAcquired());
+ _ASSERTE(!isGlobalLockAcquired || SharedMemoryManager::IsCreationDeletionFileLockAcquired());
// Check if the path already exists
struct stat statInfo;
@@ -155,7 +162,24 @@ bool SharedMemoryHelpers::EnsureDirectoryExists(const char *path, bool isGlobalL
throw SharedMemoryException(static_cast<DWORD>(SharedMemoryError::IO));
}
- // Check the directory's permissions and try to update them
+ if (isSystemDirectory)
+ {
+ // For system directories (such as SHARED_MEMORY_TEMP_DIRECTORY_PATH), require sufficient permissions only for the
+ // current user. For instance, "docker run --mount ..." to mount /tmp to some directory on the host mounts the
+ // destination directory with the same permissions as the source directory, which may not include some permissions for
+ // other users. In the docker container, other user permissions are typically not relevant and relaxing the permissions
+ // requirement allows for that scenario to work without having to work around it by first giving sufficient permissions
+ // for all users.
+ if ((statInfo.st_mode & PermissionsMask_CurrentUser_ReadWriteExecute) == PermissionsMask_CurrentUser_ReadWriteExecute)
+ {
+ return true;
+ }
+ throw SharedMemoryException(static_cast<DWORD>(SharedMemoryError::IO));
+ }
+
+ // For non-system directories (such as SHARED_MEMORY_RUNTIME_TEMP_DIRECTORY_PATH), require sufficient permissions for all
+ // users and try to update them if requested to create the directory, so that shared memory files may be shared by all
+ // processes on the system.
if ((statInfo.st_mode & PermissionsMask_AllUsers_ReadWriteExecute) == PermissionsMask_AllUsers_ReadWriteExecute)
{
return true;
@@ -214,6 +238,8 @@ int SharedMemoryHelpers::CreateOrOpenFile(LPCSTR path, bool createIfNotExist, bo
{
_ASSERTE(path != nullptr);
_ASSERTE(path[0] != '\0');
+ _ASSERTE(SharedMemoryManager::IsCreationDeletionProcessLockAcquired());
+ _ASSERTE(!createIfNotExist || SharedMemoryManager::IsCreationDeletionFileLockAcquired());
// Try to open the file
int openFlags = O_RDWR;
@@ -1032,7 +1058,8 @@ void SharedMemoryManager::AcquireCreationDeletionFileLock()
if (!SharedMemoryHelpers::EnsureDirectoryExists(
SHARED_MEMORY_TEMP_DIRECTORY_PATH,
false /* isGlobalLockAcquired */,
- false /* createIfNotExist */))
+ false /* createIfNotExist */,
+ true /* isSystemDirectory */))
{
throw SharedMemoryException(static_cast<DWORD>(SharedMemoryError::IO));
}
diff --git a/src/pal/src/synchobj/mutex.cpp b/src/pal/src/synchobj/mutex.cpp
index ccebd3b261..d5f4edd110 100644
--- a/src/pal/src/synchobj/mutex.cpp
+++ b/src/pal/src/synchobj/mutex.cpp
@@ -1159,6 +1159,7 @@ SharedMemoryProcessDataHeader *NamedMutexProcessData::CreateOrOpen(
{
// If the shared memory file was created, the creation/deletion file lock would have been acquired so that we can
// initialize the shared data
+ _ASSERTE(SharedMemoryManager::IsCreationDeletionFileLockAcquired());
autoCleanup.m_acquiredCreationDeletionFileLock = true;
}
if (processDataHeader == nullptr)
diff --git a/src/pal/tests/palsuite/locale_info/CMakeLists.txt b/src/pal/tests/palsuite/locale_info/CMakeLists.txt
index 52482daa41..c9756e97a3 100644
--- a/src/pal/tests/palsuite/locale_info/CMakeLists.txt
+++ b/src/pal/tests/palsuite/locale_info/CMakeLists.txt
@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 2.8.12.2)
# add_subdirectory(CompareStringA)
# add_subdirectory(CompareStringW)
# add_subdirectory(GetLocaleInfoW)
-# add_subdirectory(GetStringTypeExW)
# add_subdirectory(GetSystemDefaultLangID)
# add_subdirectory(GetThreadLocale)
# add_subdirectory(GetTimeZoneInformation)
diff --git a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/CMakeLists.txt b/src/pal/tests/palsuite/locale_info/GetStringTypeExW/CMakeLists.txt
deleted file mode 100644
index ef14ea5352..0000000000
--- a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-add_subdirectory(test2)
-
diff --git a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/CMakeLists.txt b/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/CMakeLists.txt
deleted file mode 100644
index 9d6e4e2be8..0000000000
--- a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test1.cpp
-)
-
-add_executable(paltest_getstringtypeexw_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_getstringtypeexw_test1 coreclrpal)
-
-target_link_libraries(paltest_getstringtypeexw_test1
- ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/test1.cpp b/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/test1.cpp
deleted file mode 100644
index e15c3d66cd..0000000000
--- a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/test1.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.
-
-/*============================================================================
-**
-** Source: test1.c
-**
-** Purpose: Tests GetStringTypeExW with values that will ensure all possible
-** flags get set once.
-**
-**
-**==========================================================================*/
-
-#include <palsuite.h>
-
-
-int __cdecl main(int argc, char *argv[])
-{
- WCHAR wideStr[] = {'9',' '};
- WORD values1[] = { C1_DIGIT, C1_SPACE };
- int len = 2;
- WORD Info[256];
- BOOL ret;
- int i;
-
- if (PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
- for (i=0; i<len; i++)
- {
- ret = GetStringTypeExW(LOCALE_USER_DEFAULT, CT_CTYPE1, &wideStr[i], 1, &Info[i]);
- if (!ret)
- {
- Fail("GetStringTypeExW failed!\n");
- }
-
- if ((Info[i] & values1[i])!= values1[i])
- {
-
- Fail("GetStringTypeExW returned wrong type info for %c (%d)\n"
- "Expected %#x, got %#x\n", wideStr[i], wideStr[i],
- values1[i], Info[i]);
-
- }
- }
-
- PAL_Terminate();
-
- return PASS;
-}
-
diff --git a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/testinfo.dat b/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/testinfo.dat
deleted file mode 100644
index b0fbea4c05..0000000000
--- a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test1/testinfo.dat
+++ /dev/null
@@ -1,13 +0,0 @@
-# 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.
-
-Version = 1.0
-Section = Locale Information
-Function = GetStringTypeExW
-Name = Test #1 for GetStringTypeExW
-TYPE = DEFAULT
-EXE1 = test1
-Description
-=Tests GetStringTypeExW with values that will ensure all possible
-=flags get set once.
diff --git a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/CMakeLists.txt b/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/CMakeLists.txt
deleted file mode 100644
index 7f90601ef9..0000000000
--- a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test2.cpp
-)
-
-add_executable(paltest_getstringtypeexw_test2
- ${SOURCES}
-)
-
-add_dependencies(paltest_getstringtypeexw_test2 coreclrpal)
-
-target_link_libraries(paltest_getstringtypeexw_test2
- ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/test2.cpp b/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/test2.cpp
deleted file mode 100644
index 6dca7e8ac5..0000000000
--- a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/test2.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// 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.
-
-/*============================================================================
-**
-** Source: test2.c
-**
-** Purpose: Tests GetStringTypeExW with values from every possible unicode
-** category.
-**
-**
-**==========================================================================*/
-
-#include <palsuite.h>
-
-
-/*
- * A random selection of unicode characters, each representing a distinct
- * unicode category
- */
-WCHAR TestStr[] =
-{
- 0x05D0, /* 4, HEBREW LETTER ALEF */
- 0x0488, /* 7, COMBINING CYRILLIC HUNDRED THOUSANDS SIGN */
- 0x0030, /* 8, DIGIT ZERO */
- 0x0020, /* 22, SPACE */
-};
-
-#define TEST_LEN (sizeof(TestStr) / sizeof(WCHAR))
-
-WORD TestFlags[TEST_LEN] =
-{
- C1_ALPHA,
- 0,
- C1_DIGIT,
- C1_BLANK|C1_SPACE
-};
-
-int __cdecl main(int argc, char *argv[])
-{
- WORD Info;
- BOOL ret;
- int i;
-
- /* check only the bits listed in rotor_pal.doc */
- const WORD PAL_VALID_C1_BITS = C1_DIGIT | C1_SPACE;
-
- if (PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
- for (i=0; i <TEST_LEN; i++)
- {
- ret = GetStringTypeExW(LOCALE_USER_DEFAULT, CT_CTYPE1, &TestStr[i], 1, &Info);
-
- if (!ret)
- {
- Fail("GetStringTypeExW failed!\n");
- }
-
- if ((Info & PAL_VALID_C1_BITS) != (TestFlags[i] & PAL_VALID_C1_BITS))
- {
-
- Fail("GetStringTypeExW (test #%i) returned wrong type info for %c (%d)\n"
- "Expected %#x, got %#x\n", i, TestStr[i], TestStr[i],
- TestFlags[i], Info);
-
- }
- }
-
- PAL_Terminate();
-
- return PASS;
-}
-
-
diff --git a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/testinfo.dat b/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/testinfo.dat
deleted file mode 100644
index 361d29b450..0000000000
--- a/src/pal/tests/palsuite/locale_info/GetStringTypeExW/test2/testinfo.dat
+++ /dev/null
@@ -1,12 +0,0 @@
-# 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.
-
-Version = 1.0
-Section = Locale Information
-Function = GetStringTypeExW
-Name = Test #2 for GetStringTypeExW
-TYPE = DEFAULT
-EXE1 = test2
-Description
-=Tests GetStringTypeExW with values from every possible unicode category.
diff --git a/src/pal/tests/palsuite/locale_info/MultiByteToWideChar/test4/test4.cpp b/src/pal/tests/palsuite/locale_info/MultiByteToWideChar/test4/test4.cpp
index 1d7234640b..7d382de298 100644
--- a/src/pal/tests/palsuite/locale_info/MultiByteToWideChar/test4/test4.cpp
+++ b/src/pal/tests/palsuite/locale_info/MultiByteToWideChar/test4/test4.cpp
@@ -152,57 +152,57 @@ int __cdecl main(int argc, char *argv[])
// Strings with errors
// Incomplete 2 byte encoded character standalone
- W(""),
+ W("\xFFFD"),
// Incomplete 3 byte encoded character 1 byte missing standalone
- W(""),
+ W("\xFFFD"),
// Incomplete 3 byte encoded character 2 bytes missing standalone
- W(""),
+ W("\xFFFD"),
// Incomplete surrogate character 1 byte missing standalone
- W(""),
+ W("\xFFFD"),
// Incomplete surrogate character 2 bytes missing standalone
- W(""),
+ W("\xFFFD"),
// Incomplete surrogate character 3 bytes missing standalone
- W(""),
+ W("\xFFFD"),
// Trailing byte with no lead byte standalone
- W(""),
+ W("\xFFFD"),
// Incomplete 2 byte encoded character 1 byte missing between 1 byte chars
- W("\x0041\x0042"),
+ W("\x0041\xFFFD\x0042"),
// Incomplete 3 byte encoded character 1 byte missing between 1 byte chars
- W("\x0041\x0042"),
+ W("\x0041\xFFFD\x0042"),
// Incomplete 3 byte encoded character 2 bytes missing between 1 byte chars
- W("\x0041\x0042"),
+ W("\x0041\xFFFD\x0042"),
// Trailing byte with no lead byte between 1 byte chars
- W("\x0041\x0042"),
+ W("\x0041\xFFFD\x0042"),
// Incomplete 2 byte encoded character 1 byte missing before 1 byte char
- W("\x0042"),
+ W("\xFFFD\x0042"),
// Incomplete 3 byte encoded character 1 byte missing before 1 byte char
- W("\x0042"),
+ W("\xFFFD\x0042"),
// Incomplete 3 byte encoded character 2 bytes missing before 1 byte char
- W("\x0042"),
+ W("\xFFFD\x0042"),
// Trailing byte with no lead byte before 1 byte char
- W("\x0042"),
+ W("\xFFFD\x0042"),
// Incomplete 2 byte encoded character 1 byte missing after 1 byte char
- W("\x0041"),
+ W("\x0041\xFFFD"),
// Incomplete 3 byte encoded character 1 byte missing after 1 byte char
- W("\x0041"),
+ W("\x0041\xFFFD"),
// Incomplete 3 byte encoded character 2 bytes missing after 1 byte char
- W("\x0041"),
+ W("\x0041\xFFFD"),
// Trailing byte with no lead byte after 1 byte char
- W("\x0041"),
+ W("\x0041\xFFFD"),
// Incomplete 2 byte encoded character 1 byte missing between 2 byte chars
- W("\x0080\x00FF"),
+ W("\x0080\xFFFD\x00FF"),
// Incomplete 3 byte encoded character 1 byte missing between 2 byte chars
- W("\x0080\x00FF"),
+ W("\x0080\xFFFD\x00FF"),
// Incomplete 3 byte encoded character 2 bytes missing between 2 byte chars
- W("\x0080\x00FF"),
+ W("\x0080\xFFFD\x00FF"),
// Trailing byte with no lead byte between 2 byte chars
- W("\x0080\x00FF"),
+ W("\x0080\xFFFD\x00FF"),
// 2 byte encoded character in non-shortest form encodings (these are not allowed)
- W(""),
+ W("\xFFFD\xFFFD"),
// 3 byte encoded character in non-shortest form encodings (these are not allowed)
- W(""),
+ W("\xFFFD\xFFFD"),
// 4 byte encoded character in non-shortest form encodings (these are not allowed)
- W(""),
+ W("\xFFFD\xFFFD\xFFFD"),
};
for (int i = 0; i < (sizeof(utf8Strings) / sizeof(utf8Strings[0])); i++)
diff --git a/src/utilcode/CMakeLists.txt b/src/utilcode/CMakeLists.txt
index 79088c1536..9629e5140f 100644
--- a/src/utilcode/CMakeLists.txt
+++ b/src/utilcode/CMakeLists.txt
@@ -66,9 +66,7 @@ if(WIN32)
appxutil.cpp
dacutil.cpp
dlwrap.cpp
- downlevel.cpp
loadrc.cpp
- newapis.cpp
securitywrapper.cpp
securityutil.cpp
stacktrace.cpp
diff --git a/src/utilcode/assemblyfilehash.cpp b/src/utilcode/assemblyfilehash.cpp
deleted file mode 100644
index c19b715322..0000000000
--- a/src/utilcode/assemblyfilehash.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-// 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.
-
-
-#include "stdafx.h"
-#include <stdlib.h>
-#include "utilcode.h"
-#include "strongname.h"
-#include "assemblyfilehash.h"
-#include "ex.h"
-#include "corperm.h"
-
-#include <wincrypt.h>
-
-HRESULT AssemblyFileHash::ReadData()
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- NOTHROW;
- GC_NOTRIGGER;
- INJECT_FAULT(return E_OUTOFMEMORY;);
-#ifdef MODE_PREEMPTIVE
- MODE_PREEMPTIVE;
-#endif
- }
- CONTRACTL_END;
- NewArrayHolder<BYTE> pBuffer;
-
- DWORD dwFileSize = SafeGetFileSize( m_hFile, NULL );
-
- if (dwFileSize == 0xffffffff)
- return HRESULT_FROM_GetLastError();
-
- pBuffer = new (nothrow)BYTE[dwFileSize];
- if(pBuffer==NULL)
- return E_OUTOFMEMORY;
-
- DWORD cbBuffer = dwFileSize;
- DWORD cbRead;
-
- if (!ReadFile( m_hFile, pBuffer, cbBuffer, &cbRead, NULL ) ||
- cbRead != cbBuffer)
- return HRESULT_FROM_GetLastError();
-
- pBuffer.SuppressRelease();
- this->m_pbData = pBuffer;
- this->m_cbData = cbBuffer;
- this->m_bDataOwner = TRUE;
- this->m_NeedToReadData=FALSE;
-
- return S_OK;
-
-}
-
-HRESULT AssemblyFileHash::SetFileName(LPCWSTR wszFileName)
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- NOTHROW;
- GC_NOTRIGGER;
- INJECT_FAULT(return E_OUTOFMEMORY;);
-#ifdef MODE_PREEMPTIVE
- MODE_PREEMPTIVE;
-#endif
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- HandleHolder hFile;
-
- hFile = WszCreateFile(wszFileName,
- GENERIC_READ,
- FILE_SHARE_READ,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL);
-
- if (hFile == INVALID_HANDLE_VALUE)
- return HRESULT_FROM_GetLastError();
-
- IfFailRet(SetFileHandle(hFile));
- hFile.SuppressRelease();
- return S_OK;
-}
-
-
-HRESULT AssemblyFileHash::HashData(HCRYPTHASH hHash)
-{
- WRAPPER_NO_CONTRACT;
- if(!CryptHashData(hHash, m_pbData, m_cbData, 0))
- return HRESULT_FROM_GetLastError();
- return S_OK;
-}
-
-HRESULT AssemblyFileHash::CalculateHash(DWORD algid)
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- NOTHROW;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- if(m_NeedToReadData)
- IfFailRet(ReadData());
-
- _ASSERTE(!m_NeedToReadData);
-
- HCRYPTPROV pProvider = NULL;
- HCRYPTHASH hHash = NULL;
- DWORD count;
-
- if(!WszCryptAcquireContext(&pProvider,
- NULL,
- NULL,
- //PROV_RSA_SIG,
- PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT))
- IfFailGo(HRESULT_FROM_GetLastError());
-
-
- if(!CryptCreateHash(pProvider,
- algid,
- 0,
- 0,
- &hHash))
- IfFailGo(HRESULT_FROM_GetLastError());
-
- IfFailGo(HashData(hHash));
-
- count = sizeof(m_cbHash);
- if(!CryptGetHashParam(hHash,
- HP_HASHSIZE,
- (PBYTE) &m_cbHash,
- &count,
- 0))
- IfFailGo(HRESULT_FROM_GetLastError());
-
- if(m_cbHash > 0) {
- m_pbHash = new (nothrow) BYTE[m_cbHash];
- if (!m_pbHash)
- IfFailGo(E_OUTOFMEMORY);
-
- if(!CryptGetHashParam(hHash,
- HP_HASHVAL,
- m_pbHash,
- &m_cbHash,
- 0))
- IfFailGo(HRESULT_FROM_GetLastError());
- }
-
- ErrExit:
-
- if(hHash)
- CryptDestroyHash(hHash);
- if(pProvider)
- CryptReleaseContext(pProvider, 0);
- return hr;
-}
-
-
-
-
diff --git a/src/utilcode/ccomprc.cpp b/src/utilcode/ccomprc.cpp
index bc649e7b6e..205c3ff331 100644
--- a/src/utilcode/ccomprc.cpp
+++ b/src/utilcode/ccomprc.cpp
@@ -5,7 +5,6 @@
#include "stdafx.h" // Standard header.
#include <utilcode.h> // Utility helpers.
#include <corerror.h>
-#include "newapis.h"
#include "ndpversion.h"
#include "../dlls/mscorrc/resource.h"
@@ -83,7 +82,7 @@ int GetMUILanguageID(LocaleIDValue* pResult)
*pResult= langId;
#else // FEATURE_USE_LCID
_ASSERTE(sizeof(LocaleID)/sizeof(WCHAR) >=LOCALE_NAME_MAX_LENGTH);
- return NewApis::GetSystemDefaultLocaleName(*pResult, LOCALE_NAME_MAX_LENGTH);
+ return ::GetSystemDefaultLocaleName(*pResult, LOCALE_NAME_MAX_LENGTH);
#endif //FEATURE_USE_LCID
return 1;
}
@@ -118,7 +117,7 @@ void GetMUILanguageName(__out SString* pResult)
#ifdef FEATURE_USE_LCID
lcid=langid;
#else
- lcid=NewApis::LocaleNameToLCID(langid,0);
+ lcid=::LocaleNameToLCID(langid,0);
#endif
return BuildMUIDirectory(lcid, pResult);
diff --git a/src/utilcode/clrhost.cpp b/src/utilcode/clrhost.cpp
index 15678a9861..e573175190 100644
--- a/src/utilcode/clrhost.cpp
+++ b/src/utilcode/clrhost.cpp
@@ -14,7 +14,6 @@
#include "hostimpl.h"
#include "clrnt.h"
#include "contract.h"
-#include "tls.h"
CoreClrCallbacks g_CoreClrCallbacks;
diff --git a/src/utilcode/clrhost_nodependencies.cpp b/src/utilcode/clrhost_nodependencies.cpp
index d5aeb2a150..62453b7e81 100644
--- a/src/utilcode/clrhost_nodependencies.cpp
+++ b/src/utilcode/clrhost_nodependencies.cpp
@@ -14,7 +14,6 @@
#include "hostimpl.h"
#include "clrnt.h"
#include "contract.h"
-#include "tls.h"
#if defined __llvm__
# if defined(__has_feature) && __has_feature(address_sanitizer)
diff --git a/src/utilcode/downlevel.cpp b/src/utilcode/downlevel.cpp
deleted file mode 100644
index 6ff7b82815..0000000000
--- a/src/utilcode/downlevel.cpp
+++ /dev/null
@@ -1,2736 +0,0 @@
-// 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.
-////////////////////////////////////////////////////////////////////////////
-//
-// File: downlevel.cpp
-//
-
-
-//
-// Purpose: functions that need to be emulated on downlevel platforms.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "stdafx.h"
-
-#if defined(ENABLE_DOWNLEVEL_FOR_NLS)
-
-#ifndef LOCALE_SNAME
-#define LOCALE_SNAME 0x0000005c
-#endif
-#include "downlevel.h"
-#include "newapis.h"
-#include "utilcode.h"
-#include "sstring.h"
-#include "ex.h"
-
-#define LCID_AZ_CYRL_AZ 0x0082c
-
-//
-// Macro to check if more than one bit is set.
-// Returns 1 if more than one bit set, 0 otherwise.
-//
-#define MORE_THAN_ONE(f, bits) (((f & bits) - 1) & (f & bits))
-
-struct LCIDEntry
-{
- LCID lcid;
- LPCWSTR wszName;
-};
-
-// Known (ie: <= Vista) Name/LCID lookup table, sorted by LCID
-const static LCIDEntry s_lcids[]=
-{
- // Neutrals
- { 0x00001, W("ar") }, // Neutral Locale
- { 0x00002, W("bg") }, // Neutral Locale
- { 0x00003, W("ca") }, // Neutral Locale
- { 0x00004, W("zh-Hans") }, // Neutral Locale
- { 0x00005, W("cs") }, // Neutral Locale
- { 0x00006, W("da") }, // Neutral Locale
- { 0x00007, W("de") }, // Neutral Locale
- { 0x00008, W("el") }, // Neutral Locale
- { 0x00009, W("en") }, // Neutral Locale
- { 0x0000a, W("es") }, // Neutral Locale
- { 0x0000b, W("fi") }, // Neutral Locale
- { 0x0000c, W("fr") }, // Neutral Locale
- { 0x0000d, W("he") }, // Neutral Locale
- { 0x0000e, W("hu") }, // Neutral Locale
- { 0x0000f, W("is") }, // Neutral Locale
- { 0x00010, W("it") }, // Neutral Locale
- { 0x00011, W("ja") }, // Neutral Locale
- { 0x00012, W("ko") }, // Neutral Locale
- { 0x00013, W("nl") }, // Neutral Locale
- { 0x00014, W("no") }, // Neutral Locale
- { 0x00015, W("pl") }, // Neutral Locale
- { 0x00016, W("pt") }, // Neutral Locale
- { 0x00017, W("rm") }, // Neutral Locale
- { 0x00018, W("ro") }, // Neutral Locale
- { 0x00019, W("ru") }, // Neutral Locale
- { 0x0001a, W("hr") }, // Neutral Locale
- { 0x0001b, W("sk") }, // Neutral Locale
- { 0x0001c, W("sq") }, // Neutral Locale
- { 0x0001d, W("sv") }, // Neutral Locale
- { 0x0001e, W("th") }, // Neutral Locale
- { 0x0001f, W("tr") }, // Neutral Locale
- { 0x00020, W("ur") }, // Neutral Locale
- { 0x00021, W("id") }, // Neutral Locale
- { 0x00022, W("uk") }, // Neutral Locale
- { 0x00023, W("be") }, // Neutral Locale
- { 0x00024, W("sl") }, // Neutral Locale
- { 0x00025, W("et") }, // Neutral Locale
- { 0x00026, W("lv") }, // Neutral Locale
- { 0x00027, W("lt") }, // Neutral Locale
- { 0x00028, W("tg") }, // Neutral Locale
- { 0x00029, W("fa") }, // Neutral Locale
- { 0x0002a, W("vi") }, // Neutral Locale
- { 0x0002b, W("hy") }, // Neutral Locale
- { 0x0002c, W("az") }, // Neutral Locale
- { 0x0002d, W("eu") }, // Neutral Locale
- { 0x0002e, W("hsb") }, // Neutral Locale
- { 0x0002f, W("mk") }, // Neutral Locale
- { 0x00032, W("tn") }, // Neutral Locale
- { 0x00034, W("xh") }, // Neutral Locale
- { 0x00035, W("zu") }, // Neutral Locale
- { 0x00036, W("af") }, // Neutral Locale
- { 0x00037, W("ka") }, // Neutral Locale
- { 0x00038, W("fo") }, // Neutral Locale
- { 0x00039, W("hi") }, // Neutral Locale
- { 0x0003a, W("mt") }, // Neutral Locale
- { 0x0003b, W("se") }, // Neutral Locale
- { 0x0003c, W("ga") }, // Neutral Locale
- { 0x0003e, W("ms") }, // Neutral Locale
- { 0x0003f, W("kk") }, // Neutral Locale
- { 0x00040, W("ky") }, // Neutral Locale
- { 0x00041, W("sw") }, // Neutral Locale
- { 0x00042, W("tk") }, // Neutral Locale
- { 0x00043, W("uz") }, // Neutral Locale
- { 0x00044, W("tt") }, // Neutral Locale
- { 0x00045, W("bn") }, // Neutral Locale
- { 0x00046, W("pa") }, // Neutral Locale
- { 0x00047, W("gu") }, // Neutral Locale
- { 0x00048, W("or") }, // Neutral Locale
- { 0x00049, W("ta") }, // Neutral Locale
- { 0x0004a, W("te") }, // Neutral Locale
- { 0x0004b, W("kn") }, // Neutral Locale
- { 0x0004c, W("ml") }, // Neutral Locale
- { 0x0004d, W("as") }, // Neutral Locale
- { 0x0004e, W("mr") }, // Neutral Locale
- { 0x0004f, W("sa") }, // Neutral Locale
- { 0x00050, W("mn") }, // Neutral Locale
- { 0x00051, W("bo") }, // Neutral Locale
- { 0x00052, W("cy") }, // Neutral Locale
- { 0x00053, W("km") }, // Neutral Locale
- { 0x00054, W("lo") }, // Neutral Locale
- { 0x00056, W("gl") }, // Neutral Locale
- { 0x00057, W("kok") }, // Neutral Locale
- { 0x0005a, W("syr") }, // Neutral Locale
- { 0x0005b, W("si") }, // Neutral Locale
- { 0x0005d, W("iu") }, // Neutral Locale
- { 0x0005e, W("am") }, // Neutral Locale
- { 0x0005f, W("tzm") }, // Neutral Locale
- { 0x00061, W("ne") }, // Neutral Locale
- { 0x00062, W("fy") }, // Neutral Locale
- { 0x00063, W("ps") }, // Neutral Locale
- { 0x00064, W("fil") }, // Neutral Locale
- { 0x00065, W("dv") }, // Neutral Locale
- { 0x00068, W("ha") }, // Neutral Locale
- { 0x0006a, W("yo") }, // Neutral Locale
- { 0x0006b, W("quz") }, // Neutral Locale
- { 0x0006c, W("nso") }, // Neutral Locale
- { 0x0006d, W("ba") }, // Neutral Locale
- { 0x0006e, W("lb") }, // Neutral Locale
- { 0x0006f, W("kl") }, // Neutral Locale
- { 0x00070, W("ig") }, // Neutral Locale
- { 0x00078, W("ii") }, // Neutral Locale
- { 0x0007a, W("arn") }, // Neutral Locale
- { 0x0007c, W("moh") }, // Neutral Locale
- { 0x0007e, W("br") }, // Neutral Locale
- { 0x00080, W("ug") }, // Neutral Locale
- { 0x00081, W("mi") }, // Neutral Locale
- { 0x00082, W("oc") }, // Neutral Locale
- { 0x00083, W("co") }, // Neutral Locale
- { 0x00084, W("gsw") }, // Neutral Locale
- { 0x00085, W("sah") }, // Neutral Locale
- { 0x00086, W("qut") }, // Neutral Locale
- { 0x00087, W("rw") }, // Neutral Locale
- { 0x00088, W("wo") }, // Neutral Locale
- { 0x0008c, W("prs") }, // Neutral Locale
-
- // Specific Cultures
- { 0x00401, W("ar-SA") },
- { 0x00402, W("bg-BG") },
- { 0x00403, W("ca-ES") },
- { 0x00404, W("zh-TW") },
- { 0x00405, W("cs-CZ") },
- { 0x00406, W("da-DK") },
- { 0x00407, W("de-DE") },
- { 0x00408, W("el-GR") },
- { 0x00409, W("en-US") },
- // es-ES_tradnl only gets used if specifically asked for because
- // GetCultures() won't return it. (It's not a real locale, its an alt sort)
- { 0x0040a, W("es-ES_tradnl") },
- { 0x0040b, W("fi-FI") },
- { 0x0040c, W("fr-FR") },
- { 0x0040d, W("he-IL") },
- { 0x0040e, W("hu-HU") },
- { 0x0040f, W("is-IS") },
- { 0x00410, W("it-IT") },
- { 0x00411, W("ja-JP") },
- { 0x00412, W("ko-KR") },
- { 0x00413, W("nl-NL") },
- { 0x00414, W("nb-NO") },
- { 0x00415, W("pl-PL") },
- { 0x00416, W("pt-BR") },
- { 0x00417, W("rm-CH") },
- { 0x00418, W("ro-RO") },
- { 0x00419, W("ru-RU") },
- { 0x0041a, W("hr-HR") },
- { 0x0041b, W("sk-SK") },
- { 0x0041c, W("sq-AL") },
- { 0x0041d, W("sv-SE") },
- { 0x0041e, W("th-TH") },
- { 0x0041f, W("tr-TR") },
- { 0x00420, W("ur-PK") },
- { 0x00421, W("id-ID") },
- { 0x00422, W("uk-UA") },
- { 0x00423, W("be-BY") },
- { 0x00424, W("sl-SI") },
- { 0x00425, W("et-EE") },
- { 0x00426, W("lv-LV") },
- { 0x00427, W("lt-LT") },
- { 0x00428, W("tg-Cyrl-TJ") },
- { 0x00429, W("fa-IR") },
- { 0x0042a, W("vi-VN") },
- { 0x0042b, W("hy-AM") },
- { 0x0042c, W("az-Latn-AZ") },
- { 0x0042d, W("eu-ES") },
- { 0x0042e, W("hsb-DE") },
- { 0x0042f, W("mk-MK") },
- { 0x00432, W("tn-ZA") },
- { 0x00434, W("xh-ZA") },
- { 0x00435, W("zu-ZA") },
- { 0x00436, W("af-ZA") },
- { 0x00437, W("ka-GE") },
- { 0x00438, W("fo-FO") },
- { 0x00439, W("hi-IN") },
- { 0x0043a, W("mt-MT") },
- { 0x0043b, W("se-NO") },
- { 0x0043e, W("ms-MY") },
- { 0x0043f, W("kk-KZ") },
- { 0x00440, W("ky-KG") },
- { 0x00441, W("sw-KE") },
- { 0x00442, W("tk-TM") },
- { 0x00443, W("uz-Latn-UZ") },
- { 0x00444, W("tt-RU") },
- { 0x00445, W("bn-IN") },
- { 0x00446, W("pa-IN") },
- { 0x00447, W("gu-IN") },
- { 0x00448, W("or-IN") },
- { 0x00449, W("ta-IN") },
- { 0x0044a, W("te-IN") },
- { 0x0044b, W("kn-IN") },
- { 0x0044c, W("ml-IN") },
- { 0x0044d, W("as-IN") },
- { 0x0044e, W("mr-IN") },
- { 0x0044f, W("sa-IN") },
- { 0x00450, W("mn-MN") },
- { 0x00451, W("bo-CN") },
- { 0x00452, W("cy-GB") },
- { 0x00453, W("km-KH") },
- { 0x00454, W("lo-LA") },
- { 0x00456, W("gl-ES") },
- { 0x00457, W("kok-IN") },
- { 0x0045a, W("syr-SY") },
- { 0x0045b, W("si-LK") },
- { 0x0045d, W("iu-Cans-CA") },
- { 0x0045e, W("am-ET") },
- { 0x00461, W("ne-NP") },
- { 0x00462, W("fy-NL") },
- { 0x00463, W("ps-AF") },
- { 0x00464, W("fil-PH") },
- { 0x00465, W("dv-MV") },
- { 0x00468, W("ha-Latn-NG") },
- { 0x0046a, W("yo-NG") },
- { 0x0046b, W("quz-BO") },
- { 0x0046c, W("nso-ZA") },
- { 0x0046d, W("ba-RU") },
- { 0x0046e, W("lb-LU") },
- { 0x0046f, W("kl-GL") },
- { 0x00470, W("ig-NG") },
- { 0x00478, W("ii-CN") },
- { 0x0047a, W("arn-CL") },
- { 0x0047c, W("moh-CA") },
- { 0x0047e, W("br-FR") },
- { 0x00480, W("ug-CN") },
- { 0x00481, W("mi-NZ") },
- { 0x00482, W("oc-FR") },
- { 0x00483, W("co-FR") },
- { 0x00484, W("gsw-FR") },
- { 0x00485, W("sah-RU") },
- { 0x00486, W("qut-GT") },
- { 0x00487, W("rw-RW") },
- { 0x00488, W("wo-SN") },
- { 0x0048c, W("prs-AF") },
- { 0x00501, W("qps-ploc") },
- { 0x005fe, W("qps-ploca") },
- { 0x00801, W("ar-IQ") },
- { 0x00804, W("zh-CN") },
- { 0x00807, W("de-CH") },
- { 0x00809, W("en-GB") },
- { 0x0080a, W("es-MX") },
- { 0x0080c, W("fr-BE") },
- { 0x00810, W("it-CH") },
- { 0x00813, W("nl-BE") },
- { 0x00814, W("nn-NO") },
- { 0x00816, W("pt-PT") },
- { 0x0081a, W("sr-Latn-CS") },
- { 0x0081d, W("sv-FI") },
- { 0x0082c, W("az-Cyrl-AZ") },
- { 0x0082e, W("dsb-DE") },
- { 0x0083b, W("se-SE") },
- { 0x0083c, W("ga-IE") },
- { 0x0083e, W("ms-BN") },
- { 0x00843, W("uz-Cyrl-UZ") },
- { 0x00845, W("bn-BD") },
- { 0x00850, W("mn-Mong-CN") },
- { 0x0085d, W("iu-Latn-CA") },
- { 0x0085f, W("tzm-Latn-DZ") },
- { 0x0086b, W("quz-EC") },
- { 0x009ff, W("qps-plocm") },
- { 0x00c01, W("ar-EG") },
- { 0x00c04, W("zh-HK") },
- { 0x00c07, W("de-AT") },
- { 0x00c09, W("en-AU") },
- { 0x00c0a, W("es-ES") },
- { 0x00c0c, W("fr-CA") },
- { 0x00c1a, W("sr-Cyrl-CS") },
- { 0x00c3b, W("se-FI") },
- { 0x00c6b, W("quz-PE") },
- { 0x01001, W("ar-LY") },
- { 0x01004, W("zh-SG") },
- { 0x01007, W("de-LU") },
- { 0x01009, W("en-CA") },
- { 0x0100a, W("es-GT") },
- { 0x0100c, W("fr-CH") },
- { 0x0101a, W("hr-BA") },
- { 0x0103b, W("smj-NO") },
- { 0x01401, W("ar-DZ") },
- { 0x01404, W("zh-MO") },
- { 0x01407, W("de-LI") },
- { 0x01409, W("en-NZ") },
- { 0x0140a, W("es-CR") },
- { 0x0140c, W("fr-LU") },
- { 0x0141a, W("bs-Latn-BA") },
- { 0x0143b, W("smj-SE") },
- { 0x01801, W("ar-MA") },
- { 0x01809, W("en-IE") },
- { 0x0180a, W("es-PA") },
- { 0x0180c, W("fr-MC") },
- { 0x0181a, W("sr-Latn-BA") },
- { 0x0183b, W("sma-NO") },
- { 0x01c01, W("ar-TN") },
- { 0x01c09, W("en-ZA") },
- { 0x01c0a, W("es-DO") },
- { 0x01c1a, W("sr-Cyrl-BA") },
- { 0x01c3b, W("sma-SE") },
- { 0x02001, W("ar-OM") },
- { 0x02009, W("en-JM") },
- { 0x0200a, W("es-VE") },
- { 0x0201a, W("bs-Cyrl-BA") },
- { 0x0203b, W("sms-FI") },
- { 0x02401, W("ar-YE") },
- { 0x02409, W("en-029") },
- { 0x0240a, W("es-CO") },
- { 0x0243b, W("smn-FI") },
- { 0x02801, W("ar-SY") },
- { 0x02809, W("en-BZ") },
- { 0x0280a, W("es-PE") },
- { 0x02c01, W("ar-JO") },
- { 0x02c09, W("en-TT") },
- { 0x02c0a, W("es-AR") },
- { 0x03001, W("ar-LB") },
- { 0x03009, W("en-ZW") },
- { 0x0300a, W("es-EC") },
- { 0x03401, W("ar-KW") },
- { 0x03409, W("en-PH") },
- { 0x0340a, W("es-CL") },
- { 0x03801, W("ar-AE") },
- { 0x0380a, W("es-UY") },
- { 0x03c01, W("ar-BH") },
- { 0x03c0a, W("es-PY") },
- { 0x04001, W("ar-QA") },
- { 0x04009, W("en-IN") },
- { 0x0400a, W("es-BO") },
- { 0x04409, W("en-MY") },
- { 0x0440a, W("es-SV") },
- { 0x04809, W("en-SG") },
- { 0x0480a, W("es-HN") },
- { 0x04c0a, W("es-NI") },
- { 0x0500a, W("es-PR") },
- { 0x0540a, W("es-US") },
-
- // Multiple neutrals
- { 0x0781a, W("bs") }, // Neutral Locale
- { 0x07c04, W("zh-Hant") }, // Neutral Locale
- { 0x07c1a, W("sr") }, // Neutral Locale
-
- // Alt Sorts
- { 0x1007f, W("x-IV_mathan") },
- { 0x10407, W("de-DE_phoneb") },
- { 0x1040e, W("hu-HU_technl") },
- { 0x10437, W("ka-GE_modern") },
- { 0x20804, W("zh-CN_stroke") },
- { 0x21004, W("zh-SG_stroke") },
- { 0x21404, W("zh-MO_stroke") },
- { 0x30404, W("zh-TW_pronun") },
- { 0x40411, W("ja-JP_radstr") }
-
- // TODO: Turkic? (Necessary ?)
-};
-
-// Known (ie: <= Vista) Name/LCID lookup table, sorted by Name
-const static LCIDEntry s_names[]=
-{
- { 0x00036, W("af") }, // Neutral Locale
- { 0x00436, W("af-ZA") },
- { 0x0005e, W("am") }, // Neutral Locale
- { 0x0045e, W("am-ET") },
- { 0x00001, W("ar") }, // Neutral Locale
- { 0x03801, W("ar-AE") },
- { 0x03c01, W("ar-BH") },
- { 0x01401, W("ar-DZ") },
- { 0x00c01, W("ar-EG") },
- { 0x00801, W("ar-IQ") },
- { 0x02c01, W("ar-JO") },
- { 0x03401, W("ar-KW") },
- { 0x03001, W("ar-LB") },
- { 0x01001, W("ar-LY") },
- { 0x01801, W("ar-MA") },
- { 0x02001, W("ar-OM") },
- { 0x04001, W("ar-QA") },
- { 0x00401, W("ar-SA") },
- { 0x02801, W("ar-SY") },
- { 0x01c01, W("ar-TN") },
- { 0x02401, W("ar-YE") },
- { 0x0007a, W("arn") }, // Neutral Locale
- { 0x0047a, W("arn-CL") },
- { 0x0004d, W("as") }, // Neutral Locale
- { 0x0044d, W("as-IN") },
- { 0x0002c, W("az") }, // Neutral Locale
- { 0x0082c, W("az-Cyrl-AZ") },
- { 0x0042c, W("az-Latn-AZ") },
- { 0x0006d, W("ba") }, // Neutral Locale
- { 0x0046d, W("ba-RU") },
- { 0x00023, W("be") }, // Neutral Locale
- { 0x00423, W("be-BY") },
- { 0x00002, W("bg") }, // Neutral Locale
- { 0x00402, W("bg-BG") },
- { 0x00045, W("bn") }, // Neutral Locale
- { 0x00845, W("bn-BD") },
- { 0x00445, W("bn-IN") },
- { 0x00051, W("bo") }, // Neutral Locale
- { 0x00451, W("bo-CN") },
- { 0x0007e, W("br") }, // Neutral Locale
- { 0x0047e, W("br-FR") },
- { 0x0781a, W("bs") }, // Neutral Locale
- { 0x0201a, W("bs-Cyrl-BA") },
- { 0x0141a, W("bs-Latn-BA") },
- { 0x00003, W("ca") }, // Neutral Locale
- { 0x00403, W("ca-ES") },
- { 0x00083, W("co") }, // Neutral Locale
- { 0x00483, W("co-FR") },
- { 0x00005, W("cs") }, // Neutral Locale
- { 0x00405, W("cs-CZ") },
- { 0x00052, W("cy") }, // Neutral Locale
- { 0x00452, W("cy-GB") },
- { 0x00006, W("da") }, // Neutral Locale
- { 0x00406, W("da-DK") },
- { 0x00007, W("de") }, // Neutral Locale
- { 0x00c07, W("de-AT") },
- { 0x00807, W("de-CH") },
- { 0x00407, W("de-DE") },
- { 0x10407, W("de-DE_phoneb") }, // Alternate Sort
- { 0x01407, W("de-LI") },
- { 0x01007, W("de-LU") },
- { 0x0082e, W("dsb-DE") },
- { 0x00065, W("dv") }, // Neutral Locale
- { 0x00465, W("dv-MV") },
- { 0x00008, W("el") }, // Neutral Locale
- { 0x00408, W("el-GR") },
- { 0x00009, W("en") }, // Neutral Locale
- { 0x02409, W("en-029") },
- { 0x00c09, W("en-AU") },
- { 0x02809, W("en-BZ") },
- { 0x01009, W("en-CA") },
- { 0x00809, W("en-GB") },
- { 0x01809, W("en-IE") },
- { 0x04009, W("en-IN") },
- { 0x02009, W("en-JM") },
- { 0x04409, W("en-MY") },
- { 0x01409, W("en-NZ") },
- { 0x03409, W("en-PH") },
- { 0x04809, W("en-SG") },
- { 0x02c09, W("en-TT") },
- { 0x00409, W("en-US") },
- { 0x01c09, W("en-ZA") },
- { 0x03009, W("en-ZW") },
- { 0x0000a, W("es") }, // Neutral Locale
- { 0x02c0a, W("es-AR") },
- { 0x0400a, W("es-BO") },
- { 0x0340a, W("es-CL") },
- { 0x0240a, W("es-CO") },
- { 0x0140a, W("es-CR") },
- { 0x01c0a, W("es-DO") },
- { 0x0300a, W("es-EC") },
- { 0x00c0a, W("es-ES") },
- // es-ES_tradnl only gets used if specifically asked for because
- // GetCultures() won't return it. (It's not a real locale, its an alt sort)
- { 0x0040a, W("es-ES_tradnl") },
- { 0x0100a, W("es-GT") },
- { 0x0480a, W("es-HN") },
- { 0x0080a, W("es-MX") },
- { 0x04c0a, W("es-NI") },
- { 0x0180a, W("es-PA") },
- { 0x0280a, W("es-PE") },
- { 0x0500a, W("es-PR") },
- { 0x03c0a, W("es-PY") },
- { 0x0440a, W("es-SV") },
- { 0x0540a, W("es-US") },
- { 0x0380a, W("es-UY") },
- { 0x0200a, W("es-VE") },
- { 0x00025, W("et") }, // Neutral Locale
- { 0x00425, W("et-EE") },
- { 0x0002d, W("eu") }, // Neutral Locale
- { 0x0042d, W("eu-ES") },
- { 0x00029, W("fa") }, // Neutral Locale
- { 0x00429, W("fa-IR") },
- { 0x0000b, W("fi") }, // Neutral Locale
- { 0x0040b, W("fi-FI") },
- { 0x00064, W("fil") }, // Neutral Locale
- { 0x00464, W("fil-PH") },
- { 0x00038, W("fo") }, // Neutral Locale
- { 0x00438, W("fo-FO") },
- { 0x0000c, W("fr") }, // Neutral Locale
- { 0x0080c, W("fr-BE") },
- { 0x00c0c, W("fr-CA") },
- { 0x0100c, W("fr-CH") },
- { 0x0040c, W("fr-FR") },
- { 0x0140c, W("fr-LU") },
- { 0x0180c, W("fr-MC") },
- { 0x00062, W("fy") }, // Neutral Locale
- { 0x00462, W("fy-NL") },
- { 0x0003c, W("ga") }, // Neutral Locale
- { 0x0083c, W("ga-IE") },
- { 0x00056, W("gl") }, // Neutral Locale
- { 0x00456, W("gl-ES") },
- { 0x00084, W("gsw") }, // Neutral Locale
- { 0x00484, W("gsw-FR") },
- { 0x00047, W("gu") }, // Neutral Locale
- { 0x00447, W("gu-IN") },
- { 0x00068, W("ha") }, // Neutral Locale
- { 0x00468, W("ha-Latn-NG") },
- { 0x0000d, W("he") }, // Neutral Locale
- { 0x0040d, W("he-IL") },
- { 0x00039, W("hi") }, // Neutral Locale
- { 0x00439, W("hi-IN") },
- { 0x0001a, W("hr") }, // Neutral Locale
- { 0x0101a, W("hr-BA") },
- { 0x0041a, W("hr-HR") },
- { 0x0002e, W("hsb") }, // Neutral Locale
- { 0x0042e, W("hsb-DE") },
- { 0x0000e, W("hu") }, // Neutral Locale
- { 0x0040e, W("hu-HU") },
- { 0x1040e, W("hu-HU_technl") }, // Alternate Sort
- { 0x0002b, W("hy") }, // Neutral Locale
- { 0x0042b, W("hy-AM") },
- { 0x00021, W("id") }, // Neutral Locale
- { 0x00421, W("id-ID") },
- { 0x00070, W("ig") }, // Neutral Locale
- { 0x00470, W("ig-NG") },
- { 0x00078, W("ii") }, // Neutral Locale
- { 0x00478, W("ii-CN") },
- { 0x0000f, W("is") }, // Neutral Locale
- { 0x0040f, W("is-IS") },
- { 0x00010, W("it") }, // Neutral Locale
- { 0x00810, W("it-CH") },
- { 0x00410, W("it-IT") },
- { 0x0005d, W("iu") }, // Neutral Locale
- { 0x0045d, W("iu-Cans-CA") },
- { 0x0085d, W("iu-Latn-CA") },
- { 0x00011, W("ja") }, // Neutral Locale
- { 0x00411, W("ja-JP") },
- { 0x40411, W("ja-JP_radstr") }, // Alternate Sort
- { 0x00037, W("ka") }, // Neutral Locale
- { 0x00437, W("ka-GE") },
- { 0x10437, W("ka-GE_modern") }, // Alternate Sort
- { 0x0003f, W("kk") }, // Neutral Locale
- { 0x0043f, W("kk-KZ") },
- { 0x0006f, W("kl") }, // Neutral Locale
- { 0x0046f, W("kl-GL") },
- { 0x00053, W("km") }, // Neutral Locale
- { 0x00453, W("km-KH") },
- { 0x0004b, W("kn") }, // Neutral Locale
- { 0x0044b, W("kn-IN") },
- { 0x00012, W("ko") }, // Neutral Locale
- { 0x00412, W("ko-KR") },
- { 0x00057, W("kok") }, // Neutral Locale
- { 0x00457, W("kok-IN") },
- { 0x00040, W("ky") }, // Neutral Locale
- { 0x00440, W("ky-KG") },
- { 0x0006e, W("lb") }, // Neutral Locale
- { 0x0046e, W("lb-LU") },
- { 0x00054, W("lo") }, // Neutral Locale
- { 0x00454, W("lo-LA") },
- { 0x00027, W("lt") }, // Neutral Locale
- { 0x00427, W("lt-LT") },
- { 0x00026, W("lv") }, // Neutral Locale
- { 0x00426, W("lv-LV") },
- { 0x00081, W("mi") }, // Neutral Locale
- { 0x00481, W("mi-NZ") },
- { 0x0002f, W("mk") }, // Neutral Locale
- { 0x0042f, W("mk-MK") },
- { 0x0004c, W("ml") }, // Neutral Locale
- { 0x0044c, W("ml-IN") },
- { 0x00050, W("mn") }, // Neutral Locale
- { 0x00450, W("mn-MN") },
- { 0x00850, W("mn-Mong-CN") },
- { 0x0007c, W("moh") }, // Neutral Locale
- { 0x0047c, W("moh-CA") },
- { 0x0004e, W("mr") }, // Neutral Locale
- { 0x0044e, W("mr-IN") },
- { 0x0003e, W("ms") }, // Neutral Locale
- { 0x0083e, W("ms-BN") },
- { 0x0043e, W("ms-MY") },
- { 0x0003a, W("mt") }, // Neutral Locale
- { 0x0043a, W("mt-MT") },
- { 0x00414, W("nb-NO") },
- { 0x00061, W("ne") }, // Neutral Locale
- { 0x00461, W("ne-NP") },
- { 0x00013, W("nl") }, // Neutral Locale
- { 0x00813, W("nl-BE") },
- { 0x00413, W("nl-NL") },
- { 0x00814, W("nn-NO") },
- { 0x00014, W("no") }, // Neutral Locale
- { 0x0006c, W("nso") }, // Neutral Locale
- { 0x0046c, W("nso-ZA") },
- { 0x00082, W("oc") }, // Neutral Locale
- { 0x00482, W("oc-FR") },
- { 0x00048, W("or") }, // Neutral Locale
- { 0x00448, W("or-IN") },
- { 0x00046, W("pa") }, // Neutral Locale
- { 0x00446, W("pa-IN") },
- { 0x00015, W("pl") }, // Neutral Locale
- { 0x00415, W("pl-PL") },
- { 0x0008c, W("prs") }, // Neutral Locale
- { 0x0048c, W("prs-AF") },
- { 0x00063, W("ps") }, // Neutral Locale
- { 0x00463, W("ps-AF") },
- { 0x00016, W("pt") }, // Neutral Locale
- { 0x00416, W("pt-BR") },
- { 0x00816, W("pt-PT") },
- { 0x00501, W("qps-ploc") },
- { 0x005fe, W("qps-ploca") },
- { 0x009ff, W("qps-plocm") },
- { 0x00086, W("qut") }, // Neutral Locale
- { 0x00486, W("qut-GT") },
- { 0x0006b, W("quz") }, // Neutral Locale
- { 0x0046b, W("quz-BO") },
- { 0x0086b, W("quz-EC") },
- { 0x00c6b, W("quz-PE") },
- { 0x00017, W("rm") }, // Neutral Locale
- { 0x00417, W("rm-CH") },
- { 0x00018, W("ro") }, // Neutral Locale
- { 0x00418, W("ro-RO") },
- { 0x00019, W("ru") }, // Neutral Locale
- { 0x00419, W("ru-RU") },
- { 0x00087, W("rw") }, // Neutral Locale
- { 0x00487, W("rw-RW") },
- { 0x0004f, W("sa") }, // Neutral Locale
- { 0x0044f, W("sa-IN") },
- { 0x00085, W("sah") }, // Neutral Locale
- { 0x00485, W("sah-RU") },
- { 0x0003b, W("se") }, // Neutral Locale
- { 0x00c3b, W("se-FI") },
- { 0x0043b, W("se-NO") },
- { 0x0083b, W("se-SE") },
- { 0x0005b, W("si") }, // Neutral Locale
- { 0x0045b, W("si-LK") },
- { 0x0001b, W("sk") }, // Neutral Locale
- { 0x0041b, W("sk-SK") },
- { 0x00024, W("sl") }, // Neutral Locale
- { 0x00424, W("sl-SI") },
- { 0x0183b, W("sma-NO") },
- { 0x01c3b, W("sma-SE") },
- { 0x0103b, W("smj-NO") },
- { 0x0143b, W("smj-SE") },
- { 0x0243b, W("smn-FI") },
- { 0x0203b, W("sms-FI") },
- { 0x0001c, W("sq") }, // Neutral Locale
- { 0x0041c, W("sq-AL") },
- { 0x07c1a, W("sr") }, // Neutral Locale
- { 0x01c1a, W("sr-Cyrl-BA") },
- { 0x00c1a, W("sr-Cyrl-CS") },
- { 0x0181a, W("sr-Latn-BA") },
- { 0x0081a, W("sr-Latn-CS") },
- { 0x0001d, W("sv") }, // Neutral Locale
- { 0x0081d, W("sv-FI") },
- { 0x0041d, W("sv-SE") },
- { 0x00041, W("sw") }, // Neutral Locale
- { 0x00441, W("sw-KE") },
- { 0x0005a, W("syr") }, // Neutral Locale
- { 0x0045a, W("syr-SY") },
- { 0x00049, W("ta") }, // Neutral Locale
- { 0x00449, W("ta-IN") },
- { 0x0004a, W("te") }, // Neutral Locale
- { 0x0044a, W("te-IN") },
- { 0x00028, W("tg") }, // Neutral Locale
- { 0x00428, W("tg-Cyrl-TJ") },
- { 0x0001e, W("th") }, // Neutral Locale
- { 0x0041e, W("th-TH") },
- { 0x00042, W("tk") }, // Neutral Locale
- { 0x00442, W("tk-TM") },
- { 0x00032, W("tn") }, // Neutral Locale
- { 0x00432, W("tn-ZA") },
- { 0x0001f, W("tr") }, // Neutral Locale
- { 0x0041f, W("tr-TR") },
- { 0x00044, W("tt") }, // Neutral Locale
- { 0x00444, W("tt-RU") },
- { 0x0005f, W("tzm") }, // Neutral Locale
- { 0x0085f, W("tzm-Latn-DZ") },
- { 0x00080, W("ug") }, // Neutral Locale
- { 0x00480, W("ug-CN") },
- { 0x00022, W("uk") }, // Neutral Locale
- { 0x00422, W("uk-UA") },
- { 0x00020, W("ur") }, // Neutral Locale
- { 0x00420, W("ur-PK") },
- { 0x00043, W("uz") }, // Neutral Locale
- { 0x00843, W("uz-Cyrl-UZ") },
- { 0x00443, W("uz-Latn-UZ") },
- { 0x0002a, W("vi") }, // Neutral Locale
- { 0x0042a, W("vi-VN") },
- { 0x00088, W("wo") }, // Neutral Locale
- { 0x00488, W("wo-SN") },
- { 0x1007f, W("x-IV_mathan") }, // Alternate Sort
- { 0x00034, W("xh") }, // Neutral Locale
- { 0x00434, W("xh-ZA") },
- { 0x0006a, W("yo") }, // Neutral Locale
- { 0x0046a, W("yo-NG") },
- { 0x00804, W("zh-CN") },
- { 0x20804, W("zh-CN_stroke") }, // Alternate Sort
- { 0x00004, W("zh-Hans") }, // Neutral Locale
- { 0x07c04, W("zh-Hant") }, // Neutral Locale
- { 0x00c04, W("zh-HK") },
- { 0x01404, W("zh-MO") },
- { 0x21404, W("zh-MO_stroke") }, // Alternate Sort
- { 0x01004, W("zh-SG") },
- { 0x21004, W("zh-SG_stroke") }, // Alternate Sort
- { 0x00404, W("zh-TW") },
- { 0x30404, W("zh-TW_pronun") }, // Alternate Sort
- { 0x00035, W("zu") }, // Neutral Locale
- { 0x00435, W("zu-ZA") }
-};
-
-// This is the data from l_intl.nls as released for XP for the uppercase table.
-// This is used for casing with OrdinalCompareStringIgnoreCase
-// since XP is the only scenario that needs data and the only data that it needs
-// is uppercasing, we duplicate the table here.
-const static WORD s_pUppercaseIndexTableXP[] = {
-0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0170, 0x0180, 0x0100, 0x0190, 0x0100, 0x0100, 0x01a0, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x01b0, 0x01c0, 0x01c0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01d0, 0x01e0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01f0, 0x0200, 0x0210, 0x0220,
-0x0230, 0x0240, 0x0250, 0x0260, 0x0270, 0x0280, 0x0290, 0x02a0, 0x02b0, 0x02c0,
-0x02d0, 0x02e0, 0x02f0, 0x0300, 0x0310, 0x0320, 0x01c0, 0x01c0, 0x01c0, 0x0330,
-0x0340, 0x0350, 0x0360, 0x0370, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x0380,
-0x0390, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x01c0, 0x01c0, 0x01c0, 0x03f0,
-0x0400, 0x0410, 0x0420, 0x0430, 0x0440, 0x0450, 0x0460, 0x0470, 0x0480, 0x0490,
-0x04a0, 0x04b0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x04c0, 0x04d0,
-0x04e0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x04f0, 0x0500,
-0x0510, 0x0520, 0x0530, 0x0540, 0x0550, 0x0560, 0x0570, 0x0580, 0x0590, 0x05a0,
-0x05b0, 0x05c0, 0x05d0, 0x05e0, 0x05f0, 0x0600, 0x0610, 0x0620, 0x0630, 0x0640,
-0x0650, 0x0660, 0x01c0, 0x01c0, 0x01c0, 0x0670, 0x01c0, 0x0680, 0x0690, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x06a0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x06b0,
-0x06c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x06d0, 0x06e0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0x0000,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0x0079, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000,
-0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000,
-0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000,
-0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000,
-0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000,
-0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfffe, 0x0000, 0x0000, 0xfffe,
-0x0000, 0x0000, 0xfffe, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000,
-0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0xffb1,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000,
-0x0000, 0xfffe, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff2e,
-0xff32, 0x0000, 0xff33, 0xff33, 0x0000, 0xff36, 0x0000, 0xff35, 0x0000, 0x0000,
-0x0000, 0x0000, 0xff33, 0x0000, 0x0000, 0xff31, 0x0000, 0x0000, 0x0000, 0x0000,
-0xff2f, 0xff2d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff2d, 0x0000, 0x0000,
-0xff2b, 0x0000, 0x0000, 0xff2a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff26, 0x0000, 0x0000,
-0x0000, 0x0000, 0xff26, 0x0000, 0xff27, 0xff27, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0xff25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0xffda, 0xffdb, 0xffdb, 0xffdb, 0x0000, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe1, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffc0, 0xffc1, 0xffc1, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0x0000, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0,
-0xffb0, 0xffb0, 0xffb0, 0x0000, 0xffb0, 0xffb0, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000,
-0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffd0, 0xffd0, 0xffd0,
-0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0,
-0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0,
-0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0,
-0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008,
-0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008,
-0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0008, 0x0000, 0x0008, 0x0000, 0x0008, 0x0000, 0x0008, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008,
-0x0008, 0x0008, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x004a, 0x004a, 0x0056, 0x0056, 0x0056, 0x0056, 0x0064, 0x0064,
-0x0080, 0x0080, 0x0070, 0x0070, 0x007e, 0x007e, 0x0000, 0x0000, 0x0008, 0x0008,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0007, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff0, 0xfff0, 0xfff0, 0xfff0,
-0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0,
-0xfff0, 0xfff0, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6,
-0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6,
-0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
-};
-
-// This is the data from casing.nls as released for Win2K3/XP for the lowercase table.
-// This is used for casing when linguistic casing is needed
-// since Win2K3/XP is the only scenario that needs data, we duplicate the table here.
-// It does NOT contain Turkic I exception behavior
-const static WORD s_pLowercaseIndexTableLinguisticXP[] = {
-0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0170, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0180, 0x0190, 0x0100, 0x01a0, 0x0100, 0x0100, 0x01b0, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x01c0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01e0, 0x01f0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x0200, 0x0210, 0x01d0, 0x01d0, 0x0220, 0x0230,
-0x0240, 0x0250, 0x0260, 0x0270, 0x0280, 0x0290, 0x02a0, 0x02b0, 0x02c0, 0x02d0,
-0x02e0, 0x02f0, 0x0300, 0x0310, 0x0320, 0x0330, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x0340, 0x0350,
-0x0360, 0x01d0, 0x01d0, 0x0370, 0x0380, 0x01d0, 0x0390, 0x03a0, 0x03b0, 0x01d0,
-0x01d0, 0x01d0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x0430,
-0x0440, 0x0450, 0x01d0, 0x01d0, 0x01d0, 0x0460, 0x0470, 0x0480, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x0490, 0x04a0,
-0x04b0, 0x01d0, 0x01d0, 0x01d0, 0x04c0, 0x04d0, 0x04e0, 0x04f0, 0x0500, 0x0510,
-0x0520, 0x0530, 0x0540, 0x0550, 0x0560, 0x0570, 0x0580, 0x0590, 0x05a0, 0x05b0,
-0x05c0, 0x05d0, 0x05e0, 0x05f0, 0x0600, 0x0610, 0x0620, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x0630, 0x0640, 0x0650, 0x0660, 0x0670, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x0680, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x0690, 0x06a0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x06b0, 0x06c0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x01d0,
-0x01d0, 0x01d0, 0x01d0, 0x01d0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0xff39, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001,
-0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0xff87, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001,
-0x0000, 0x0000, 0x0000, 0x00d2, 0x0001, 0x0000, 0x0001, 0x0000, 0x00ce, 0x0001,
-0x0000, 0x00cd, 0x00cd, 0x0001, 0x0000, 0x0000, 0x004f, 0x00ca, 0x00cb, 0x0001,
-0x0000, 0x00cd, 0x00cf, 0x0000, 0x00d3, 0x00d1, 0x0001, 0x0000, 0x0000, 0x0000,
-0x00d3, 0x00d5, 0x0000, 0x00d6, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0000, 0x0001, 0x0000, 0x00da, 0x0000, 0x0000, 0x0001, 0x0000, 0x00da, 0x0001,
-0x0000, 0x00d9, 0x00d9, 0x0001, 0x0000, 0x0001, 0x0000, 0x00db, 0x0001, 0x0000,
-0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0002, 0x0001, 0x0000, 0x0002, 0x0001, 0x0000, 0x0002, 0x0001, 0x0000, 0x0001,
-0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001,
-0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0002, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0026, 0x0000,
-0x0025, 0x0025, 0x0025, 0x0000, 0x0040, 0x0000, 0x003f, 0x003f, 0x0000, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0xfff3, 0xfffa, 0xfff7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0000, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
-0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0000, 0x0050, 0x0050, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0001,
-0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0000, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
-0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
-0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
-0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x0030,
-0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
-0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
-0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
-0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
-0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8,
-0xfff8, 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xfff8,
-0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0xfff8, 0x0000, 0xfff8, 0x0000, 0xfff8, 0x0000, 0xfff8, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8,
-0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0xfff8, 0xfff8, 0xffb6, 0xffb6, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffaa, 0xffaa,
-0xffaa, 0xffaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, 0xfff8, 0xff9c, 0xff9c, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0xfff8, 0xfff8, 0xff90, 0xff90, 0xfff9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff80, 0xff80, 0xff82, 0xff82,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
-0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x001a, 0x001a, 0x001a, 0x001a,
-0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a,
-0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a, 0x001a,
-0x001a, 0x001a, 0x0000, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
-0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000
-};
-
-// This is the data from casing.nls as released for Win2K3/XP for the uppercase table.
-// This is used for casing when linguistic casing is needed
-// since Win2K3/XP is the only scenario that needs data, we duplicate the table here.
-// It does NOT contain Turkic I exception behavior
-const static WORD s_pUppercaseIndexTableLinguisticXP[] = {
-0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0170, 0x0180, 0x0100, 0x0190, 0x0100, 0x0100, 0x01a0, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
-0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x01b0, 0x01c0, 0x01c0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01d0, 0x01e0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01f0, 0x0200, 0x0210, 0x0220,
-0x0230, 0x0240, 0x0250, 0x0260, 0x0270, 0x0280, 0x0290, 0x02a0, 0x02b0, 0x02c0,
-0x02d0, 0x02e0, 0x02f0, 0x0300, 0x0310, 0x0320, 0x01c0, 0x01c0, 0x01c0, 0x0330,
-0x0340, 0x0350, 0x0360, 0x0370, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x0380,
-0x0390, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x01c0, 0x01c0, 0x01c0, 0x03f0,
-0x0400, 0x0410, 0x0420, 0x0430, 0x0440, 0x0450, 0x0460, 0x0470, 0x0480, 0x0490,
-0x04a0, 0x04b0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x04c0, 0x04d0,
-0x04e0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x04f0, 0x0500,
-0x0510, 0x0520, 0x0530, 0x0540, 0x0550, 0x0560, 0x0570, 0x0580, 0x0590, 0x05a0,
-0x05b0, 0x05c0, 0x05d0, 0x05e0, 0x05f0, 0x0600, 0x0610, 0x0620, 0x0630, 0x0640,
-0x0650, 0x0660, 0x01c0, 0x01c0, 0x01c0, 0x0670, 0x01c0, 0x0680, 0x0690, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x06a0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x06b0,
-0x06c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x06d0, 0x06e0, 0x01c0, 0x01c0,
-0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x01c0, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0x0000,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0x0079, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xff18, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000,
-0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000,
-0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000,
-0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000,
-0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000,
-0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xfffe, 0x0000, 0xffff, 0xfffe,
-0x0000, 0xffff, 0xfffe, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000,
-0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0xffb1,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000,
-0xffff, 0xfffe, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff2e,
-0xff32, 0x0000, 0xff33, 0xff33, 0x0000, 0xff36, 0x0000, 0xff35, 0x0000, 0x0000,
-0x0000, 0x0000, 0xff33, 0x0000, 0x0000, 0xff31, 0x0000, 0x0000, 0x0000, 0x0000,
-0xff2f, 0xff2d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff2d, 0x0000, 0x0000,
-0xff2b, 0x0000, 0x0000, 0xff2a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff26, 0x0000, 0x0000,
-0x0000, 0x0000, 0xff26, 0x0000, 0xff27, 0xff27, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0xff25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x001a, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0xffda, 0xffdb, 0xffdb, 0xffdb, 0xfffb, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe1, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffc0, 0xffc1, 0xffc1, 0x0000,
-0xffc2, 0xffc7, 0x0000, 0x0000, 0x0000, 0xffd1, 0xffca, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0xffaa, 0xffb0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0x0000, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0, 0xffb0,
-0xffb0, 0xffb0, 0xffb0, 0x0000, 0xffb0, 0xffb0, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000,
-0xffff, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffd0, 0xffd0, 0xffd0,
-0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0,
-0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0,
-0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0,
-0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff,
-0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008,
-0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008,
-0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0008, 0x0000, 0x0008, 0x0000, 0x0008, 0x0000, 0x0008, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0008, 0x0008,
-0x0008, 0x0008, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x004a, 0x004a, 0x0056, 0x0056, 0x0056, 0x0056, 0x0064, 0x0064,
-0x0080, 0x0080, 0x0070, 0x0070, 0x007e, 0x007e, 0x0000, 0x0000, 0x0008, 0x0008,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0007, 0x0000, 0x0000, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff0, 0xfff0, 0xfff0, 0xfff0,
-0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0,
-0xfff0, 0xfff0, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6,
-0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6,
-0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0xffe6, 0x0000, 0x0000,
-0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0,
-0xffe0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
-};
-
-static CRITSEC_COOKIE g_pDownlevelNlsCrst = NULL;
-
-static void DelayCreateCriticalSection()
-{
- // Lazily allocate a Crst to serialize update access to the info structure.
- // Carefully synchronize to ensure we don't leak a Crst in race conditions.
- if (g_pDownlevelNlsCrst == NULL)
- {
- CRITSEC_COOKIE pCrst = ClrCreateCriticalSection(CrstNls,
- (CrstFlags)(CRST_UNSAFE_COOPGC));
-
- if (InterlockedCompareExchangeT(&g_pDownlevelNlsCrst, pCrst, NULL) != NULL)
- {
- ClrDeleteCriticalSection(pCrst);
- }
- }
-}
-
-static void NormalizeCultureName(SString& sName)
-{
- for (SString::Iterator i = sName.Begin(); i[0] != W('\0'); ++i)
- {
- sName.Replace(i,towlower(i[0]));
- }
-}
-
-static inline BOOL IsTurkicILcid(LCID lcid)
-{
- return (PRIMARYLANGID(lcid) == LANG_TURKISH
- || (PRIMARYLANGID(lcid) == LANG_AZERI
- && lcid != LCID_AZ_CYRL_AZ));
-}
-
-namespace DownLevel
-{
-
- int GetSystemDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName)
- {
- LCID lcid=GetSystemDefaultLCID();
- if (lcid == 0)
- return 0;
- return NewApis::LCIDToLocaleName(lcid,lpLocaleName,cchLocaleName,0);
- };
-
- // Xp returns lcid 0x0404 (zh-TW) for GetUserDefaultUILanguage and GetSystemDefaultUILanguage
- // on a CHH sku (expected 0x0c04) as well as a CHT sku (as expected)
- inline LCID WorkAroundXpTaiwanHongKongBug(LCID lcid)
- {
- const LCID LANGID_ZH_TW = 0x0404;
- const LCID LANGID_ZH_HK = 0x0c04;
-
- if(lcid == LANGID_ZH_TW && !NewApis::IsZhTwSku())
- {
- lcid = LANGID_ZH_HK;
- }
- return lcid;
- }
-
- DWORD GetUserPreferredUILanguages (__in DWORD dwFlags, __out PULONG pulNumLanguages, __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer, __in PULONG pcchLanguagesBuffer)
- {
- _ASSERTE(dwFlags==MUI_LANGUAGE_NAME);
-
- LCID lcid=GetUserDefaultUILanguage();
- if (lcid == 0)
- return 0;
-
- lcid = WorkAroundXpTaiwanHongKongBug(lcid);
-
- WCHAR wszBuffer[LOCALE_NAME_MAX_LENGTH];
- if (NewApis::LCIDToLocaleName(lcid, wszBuffer, NumItems(wszBuffer), 0) == 0)
- return 0;
-
- SIZE_T sLen=wcslen(wszBuffer)+2;
- ULONG uLen = (ULONG)sLen;
- if (uLen != sLen)
- {
- SetLastError(ERROR_ARITHMETIC_OVERFLOW);
- return 0;
- }
-
- *pulNumLanguages=1;
- if (pwszLanguagesBuffer == NULL)
- {
- *pcchLanguagesBuffer=uLen;
- return 1;
- }
-
- if (sLen > *pcchLanguagesBuffer)
- {
- *pcchLanguagesBuffer=uLen;
- SetLastError(ERROR_BUFFER_OVERFLOW);
- return 0;
- }
-
- *pcchLanguagesBuffer=uLen;
- wcscpy_s(pwszLanguagesBuffer, sLen, wszBuffer);
- pwszLanguagesBuffer[sLen-1]=W('\0');
- SetLastError(0);
- return 1;
- }
-
-
- int GetUserDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName)
- {
- LCID lcid=GetUserDefaultLCID();
- if (lcid == 0)
- return 0;
- return NewApis::LCIDToLocaleName(lcid,lpLocaleName,cchLocaleName,0);
- }
-
- int GetDateFormatEx(__in LPCWSTR lpLocaleName, __in DWORD dwFlags, __in_opt CONST SYSTEMTIME* lpDate, __in_opt LPCWSTR lpFormat,
- __out_ecount(cchDate) LPWSTR lpDateStr, __in int cchDate, __in_opt LPCWSTR lpCalendar)
- {
- _ASSERTE(lpCalendar==NULL);
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
- if (lcid == 0)
- return 0;
- return GetDateFormatW(lcid, dwFlags, lpDate, lpFormat, lpDateStr, cchDate);
- }
-
-
- int GetLocaleInfoEx (__in LPCWSTR lpLocaleName, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData)
- {
- _ASSERTE((lpLCData == NULL && cchData == 0) || (lpLCData != NULL && cchData > 0));
-
- // Note that this'll return neutral LCIDs
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
- if (lcid == 0)
- return 0;
-
- int iRetCode = 0;
- // Special casing LOCALE_SPARENT to do Uplevel fallback.
- if ( (LCType & ~LOCALE_NOUSEROVERRIDE) == LOCALE_SPARENT )
- {
- // OS doesn't know some LCTypes
- iRetCode = UplevelFallback::GetLocaleInfoEx(lpLocaleName, lcid, LCType, lpLCData, cchData);
- }
- else
- {
- iRetCode=GetLocaleInfoW(lcid,LCType,lpLCData,cchData);
- if (iRetCode == 0 && GetLastError() == ERROR_INVALID_FLAGS)
- {
- // OS doesn't know some LCTypes
- iRetCode = UplevelFallback::GetLocaleInfoEx(lpLocaleName, lcid, LCType, lpLCData, cchData);
- }
- }
-
- return iRetCode;
- };
-
- //
- // TurkishCompareStringIgnoreCase
- // In downlevel platforms CompareString doesn't support Turkish I comparison. TurkishCompareStringIgnoreCase is to work around for this.
- // In Turkish and Azeri cultures:
- // ToUpper(i) = u0130 (Upper case I with dot above it)
- // ToLower(I) = u0131 (Lower case i with no dot above).
- // Toupper(i) != I
- // ToLower(I) != i
- // TurkishCompareStringIgnoreCase will scan the input strings and convert every i to u0130 and every I to u0131 and then call
- // the system CompareString.
- // if lpString1 not include i, I, u0130, and u0131 then we'll just call the system CompareString otherwise we'll scan the lpString2
- // to detect if we need to do the conversions mentioned above.
- //
-
- #define TURKISH_CAPITAL_I_DOT_ABOVE ((WCHAR) 0x0130)
- #define TURKISH_LOWERCASE_DOTLESS_I ((WCHAR) 0x0131)
- #define LATIN_LOWERCASE_I_DOT_ABOVE ('i')
- #define LATIN_CAPITAL_DOTLESS_I ('I')
-
- int TurkishCompareStringIgnoreCase(LCID lcid, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2)
- {
- int str1Index = 0;
- int str2Index = 0;
- BOOL fScanStr2 = FALSE;
-
- for (str1Index=0; str1Index<cchCount1; str1Index++)
- {
- if (lpString1[str1Index] == LATIN_LOWERCASE_I_DOT_ABOVE
- || lpString1[str1Index] == LATIN_CAPITAL_DOTLESS_I)
- {
- break;
- }
- else if (lpString1[str1Index] == TURKISH_CAPITAL_I_DOT_ABOVE
- || lpString1[str1Index] == TURKISH_LOWERCASE_DOTLESS_I)
- {
- fScanStr2 = TRUE;
- }
- }
-
- if (str1Index >= cchCount1)
- {
- if (!fScanStr2)
- {
- return ::CompareStringW(lcid, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2);
- }
-
- for (str2Index=0; str2Index<cchCount2; str2Index++)
- {
- if (lpString2[str2Index] == LATIN_LOWERCASE_I_DOT_ABOVE
- || lpString2[str2Index] == LATIN_CAPITAL_DOTLESS_I)
- {
- break;
- }
- }
-
- if (str2Index >= cchCount2)
- {
- return ::CompareStringW(lcid, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2);
- }
- }
-
- NewArrayHolder<WCHAR> pBuffer = new WCHAR[cchCount1 + cchCount2];
-
- if (str1Index>0)
- {
- memcpy_s(pBuffer, cchCount1 * sizeof(WCHAR), lpString1, str1Index * sizeof(WCHAR));
- }
-
- for (; str1Index<cchCount1; str1Index++)
- {
- pBuffer[str1Index] = (lpString1[str1Index] == LATIN_LOWERCASE_I_DOT_ABOVE)
- ? TURKISH_CAPITAL_I_DOT_ABOVE
- : ((lpString1[str1Index] == LATIN_CAPITAL_DOTLESS_I)
- ? TURKISH_LOWERCASE_DOTLESS_I
- : lpString1[str1Index]);
- }
-
- if (str2Index>0)
- {
- memcpy_s(&pBuffer[cchCount1], cchCount2 * sizeof(WCHAR), lpString2, str2Index * sizeof(WCHAR));
- }
-
- for (; str2Index<cchCount2; str2Index++)
- {
- pBuffer[cchCount1 + str2Index] = (lpString2[str2Index] == LATIN_LOWERCASE_I_DOT_ABOVE)
- ? TURKISH_CAPITAL_I_DOT_ABOVE
- : ((lpString2[str2Index] == LATIN_CAPITAL_DOTLESS_I)
- ? TURKISH_LOWERCASE_DOTLESS_I
- : lpString2[str2Index]);
- }
-
- return ::CompareStringW(lcid, dwCmpFlags, pBuffer, cchCount1, &pBuffer[cchCount1], cchCount2);
- }
-
- int CompareStringEx(__in LPCWSTR lpLocaleName, __in DWORD dwCmpFlags, __in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2,
- __in int cchCount2, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam )
- {
- CONTRACTL
- {
- THROWS;
- GC_NOTRIGGER;
- SO_TOLERANT;
- PRECONDITION(CheckPointer(lpLocaleName));
- PRECONDITION(CheckPointer(lpString1));
- PRECONDITION(CheckPointer(lpString2));
- } CONTRACTL_END;
-
- // Invariant is like en-US (default table) on downlevel (pre-vista) OS's
- if (lpLocaleName[0] == W('\0'))
- {
- // For now, use "en" instead.
- lpLocaleName = W("en-US");
- }
-
- // Get an LCID to call the downlevel function
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
- if (lcid == 0)
- return 0;
-
- // Need to remap flags to get rid of Vista flags and replace with downlevel flags
- // (not used at this moment)
- if ((dwCmpFlags & LINGUISTIC_IGNOREDIACRITIC)!=0)
- {
- dwCmpFlags -= LINGUISTIC_IGNOREDIACRITIC;
- dwCmpFlags |= NORM_IGNORENONSPACE;
- }
- if ((dwCmpFlags & LINGUISTIC_IGNORECASE)!=0)
- {
- dwCmpFlags -= LINGUISTIC_IGNORECASE;
- dwCmpFlags |= NORM_IGNORECASE;
- }
- dwCmpFlags &= (~NORM_LINGUISTIC_CASING);
-
- if (((dwCmpFlags & NORM_IGNORECASE)!=0) && IsTurkicILcid(lcid))
- {
- return TurkishCompareStringIgnoreCase(lcid, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2);
- }
-
- return ::CompareStringW(lcid,dwCmpFlags,lpString1,cchCount1,lpString2,cchCount2);
- }
-
- __inline WCHAR MapCase(const WORD * table, WCHAR wch)
- {
- WORD value = table[wch >> 8];
- value = table[value + ((wch >> 4) & 0xf)];
- value = table[value + (wch & 0xf)];
- return (wch + (int)((short)value));
- }
-
- // since this should only be run on XP, we just use the same table as XP
- __inline WCHAR ToUpperXP(WCHAR wch)
- {
- return MapCase(s_pUppercaseIndexTableXP, wch);
- }
-
- INT32 CompareOrdinalIgnoreCaseHelper(__in_ecount(count) DWORD* strAChars, __in_ecount(count) DWORD* strBChars, int count)
- {
- if( count == 0)
- return 0;
-
- int temp = 0;
-
- _ASSERTE( count >0);
-
- // Only go through fast code path if two strings have the same alignment
- if (((size_t)strAChars & 3) == ((size_t)strBChars & 3)) {
- int unalignedBytesA = (size_t)strAChars & 3;
-
- _ASSERTE(unalignedBytesA == 0 || unalignedBytesA == 2);
- // First try to make the strings aligned at DWORD boundary.
- if( unalignedBytesA != 0 ) {
- LPWSTR ptr1 = (LPWSTR)strAChars;
- LPWSTR ptr2 = (LPWSTR)strBChars;
-
- if (*ptr1 != *ptr2) {
- temp = ((int)ToUpperXP(*ptr1) - (int)ToUpperXP(*ptr2));
- if( temp != 0) {
- return temp;
- }
- }
-
- --count;
- strAChars = (DWORD *)(ptr1 + 1);
- strBChars = (DWORD *)(ptr2 + 1);
- }
-
- // Loop comparing a DWORD at a time.
- while (count >= 2) {
- _ASSERTE(IS_ALIGNED((size_t)strAChars, 4) && IS_ALIGNED((size_t)strBChars, 4));
- if ((*strAChars - *strBChars) != 0) {
- LPCWSTR ptr1 = (WCHAR*)strAChars;
- LPCWSTR ptr2 = (WCHAR*)strBChars;
-
- if (*ptr1 != *ptr2) {
- temp = ((int)ToUpperXP(*ptr1) - (int)ToUpperXP(*ptr2));
- }
- if (temp != 0) {
- return (temp);
- }
-
- temp = (int)ToUpperXP(*(ptr1+1)) - (int)ToUpperXP(*(ptr2+1));
- if (temp != 0) {
- return (temp);
- }
- }
- ++strBChars;
- ++strAChars;
- count -= 2;
- }
- }
-
- // We can exit the loop when we see two different DWORDs and one of them contains surrogate
- // or they are equal after case conversion.
- // We can also exit the loop when there is no or only one character left.
- if( count == 0) {
- return 0;
- }
-
- // we need to handle one special case here. Say we have two strings like:
- // A HS1 LS1 HS2 LS2 or A HS1 LS1
- // A HS1 LS2 HS2 LS2 or A HS1 NS
- // we need to go back a char to decide the order
- LPCWSTR pwStrB = (LPWSTR)strBChars;
- LPCWSTR pwStrA = (LPWSTR)strAChars;
-
- temp = 0;
- while ((count--) > 0)
- {
- WCHAR charA = *pwStrA++;
- WCHAR charB = *pwStrB++;
-
- if( charA != charB) {
- charA = ToUpperXP(charA);
- charB = ToUpperXP(charB);
-
- temp = (int)charA - (int)charB;
-
- if (temp != 0) {
- return (temp);
- }
- }
- }
-
- return 0;
- }
-
-
- int CompareStringOrdinal(__in_ecount(cchCount1) LPCWSTR string1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR string2, __in int cchCount2, __in BOOL bIgnoreCase)
- {
- // This should only happen for IgnoreCase == true. The rest are hard coded
- if (!bIgnoreCase)
- {
- return 0;
- }
-
- DWORD *strAChars, *strBChars;
- strAChars = (DWORD*)string1;
- strBChars = (DWORD*)string2;
-
- // If the strings are the same length, compare exactly the right # of chars.
- // If they are different, compare the shortest # + 1 (the '\0').
- int count = cchCount1;
- if( count > cchCount2)
- count = cchCount2;
-
- INT32 ret = CompareOrdinalIgnoreCaseHelper(strAChars, strBChars, count);
- if( ret == 0) {
- ret = cchCount1 - cchCount2;
- }
-
- if (ret > 0)
- {
- return CSTR_GREATER_THAN;
- }
- if (ret < 0)
- {
- return CSTR_LESS_THAN;
- }
-
- return CSTR_EQUAL;
- }
-
- inline bool HasOnlyUppercaseOrLowercaseFlag(__in DWORD flags)
- {
- if(((flags & (LCMAP_UPPERCASE | LCMAP_LOWERCASE))== 0)
- || MORE_THAN_ONE(flags, LCMAP_UPPERCASE)
- || MORE_THAN_ONE(flags, LCMAP_LOWERCASE))
- {
- return false;
- }
- return true;
- }
-
- int TurkicICasing( __in DWORD flags,
- __in_ecount(cchSrc) LPCWSTR source,
- __in int cchSrc,
- __out_ecount(cchDest) LPWSTR destination,
- __in int cchDest)
- {
- _ASSERTE(source != NULL);
- _ASSERTE(cchSrc > 0);
- _ASSERTE(destination != NULL);
- _ASSERTE(cchSrc == cchDest);
- _ASSERTE(HasOnlyUppercaseOrLowercaseFlag(flags));
-
- const WORD * table;
- WCHAR dottedI, mappedDottedI;
- WCHAR dotlessI, mappedDotlessI;
-
- if ((flags & LCMAP_UPPERCASE) != 0)
- {
- table = s_pUppercaseIndexTableLinguisticXP;
- dottedI = LATIN_LOWERCASE_I_DOT_ABOVE;
- mappedDottedI = TURKISH_CAPITAL_I_DOT_ABOVE;
- dotlessI = TURKISH_LOWERCASE_DOTLESS_I;
- mappedDotlessI = LATIN_CAPITAL_DOTLESS_I;
- }
- else
- {
- table = s_pLowercaseIndexTableLinguisticXP;
- dottedI = TURKISH_CAPITAL_I_DOT_ABOVE;
- mappedDottedI = LATIN_LOWERCASE_I_DOT_ABOVE;
- dotlessI = LATIN_CAPITAL_DOTLESS_I;
- mappedDotlessI = TURKISH_LOWERCASE_DOTLESS_I;
- }
-
- for (int i = 0; i < cchSrc && i < cchDest; ++i)
- {
- if (source[i] == dottedI)
- {
- destination[i] = mappedDottedI;
- }
- else if (source[i] == dotlessI)
- {
- destination[i] = mappedDotlessI;
- }
- else {
- destination[i] = MapCase(table, source[i]);
- }
- }
-
- return cchSrc;
- }
-
- int DefaultLinguisticCasing( __in DWORD flags,
- __in_ecount(cchSrc) LPCWSTR source,
- __in int cchSrc,
- __out_ecount(cchDest) LPWSTR destination,
- __in int cchDest)
- {
- _ASSERTE(source != NULL);
- _ASSERTE(cchSrc > 0);
- _ASSERTE(destination != NULL);
- _ASSERTE(cchSrc == cchDest);
- _ASSERTE(HasOnlyUppercaseOrLowercaseFlag(flags));
-
- const WORD * table;
-
- if ((flags & LCMAP_UPPERCASE) != 0)
- {
- table = s_pUppercaseIndexTableLinguisticXP;
- }
- else
- {
- table = s_pLowercaseIndexTableLinguisticXP;
- }
-
- for (int i = 0; i < cchSrc && i < cchDest; ++i)
- {
- destination[i] = MapCase(table, source[i]);
- }
-
- return cchSrc;
- }
-
- __success(return != 0)
- int LinguisticCaseString(__in LCID lcid,__in DWORD flags,
- __in_ecount(cchSrc) const WCHAR * source,
- __in int cchSrc,
- __out_ecount_opt(cchDest) WCHAR * destination,
- __in int cchDest)
- {
- _ASSERTE(lcid != 0);
-
- if ( (cchSrc == 0) || (cchDest < 0) || (source == NULL) ||
- ((cchDest != 0) && (destination == NULL)) )
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return (0);
- }
-
- if(!HasOnlyUppercaseOrLowercaseFlag(flags))
- {
- SetLastError(ERROR_INVALID_FLAGS);
- return (0);
- }
-
- if(cchSrc < 0)
- {
- cchSrc = (int)wcslen(source);
- }
-
- if(destination == NULL)
- {
- return cchSrc;
- }
-
- if(IsTurkicILcid(lcid))
- {
- return TurkicICasing(flags,
- source, cchSrc,
- destination, cchDest);
- }
- else
- {
- return DefaultLinguisticCasing(flags,
- source, cchSrc,
- destination, cchDest);
- }
-
- }
-
-#ifdef _MSC_VER
-// Get rid of size OACR requirement.
-#pragma warning(push)
-#pragma warning(disable:25057)
-#endif
- int LCMapStringEx(__in LPCWSTR lpLocaleName,
- __in DWORD dwMapFlags,
- __in_ecount(cchSrc) LPCWSTR lpSrcStr,
- __in int cchSrc,
- __out_xcount_opt(cchDest) LPWSTR lpDestStr,
- __in int cchDest,
- __in_opt LPNLSVERSIONINFO lpVersionInformation,
- __in_opt LPVOID lpReserved,
- __in_opt LPARAM lParam)
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
- {
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
- if (lcid == 0)
- return 0;
-
- // Need to remap flags to get rid of Vista flags and replace with downlevel flags
- // (not used at this moment)
- if ((dwMapFlags & LINGUISTIC_IGNOREDIACRITIC)!=0)
- {
- dwMapFlags -= LINGUISTIC_IGNOREDIACRITIC;
- dwMapFlags |= NORM_IGNORENONSPACE;
- }
- if ((dwMapFlags & LINGUISTIC_IGNORECASE)!=0)
- {
- dwMapFlags -= LINGUISTIC_IGNORECASE;
- dwMapFlags |= NORM_IGNORECASE;
- }
- dwMapFlags &= (~NORM_LINGUISTIC_CASING);
-
-// START WORK_AROUND_WIN2K3_LCMAPSTRING_BUG
- if((dwMapFlags & LCMAP_LINGUISTIC_CASING) != 0
- && (dwMapFlags & (LCMAP_UPPERCASE | LCMAP_LOWERCASE)) != 0)
- {
- dwMapFlags &= (~LCMAP_LINGUISTIC_CASING);
-
- return LinguisticCaseString(lcid, dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest);
- }
-// END WORK_AROUND_WIN2K3_LCMAPSTRING_BUG
- return ::LCMapStringW(lcid,dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest);
- }
-
- int FindNLSStringEx(__in LPCWSTR lpLocaleName,
- __in DWORD dwFindNLSStringFlags,
- __in_ecount(cchSource) LPCWSTR lpStringSource,
- __in int cchSource,
- __in_ecount(cchValue) LPCWSTR lpStringValue,
- __in int cchValue,
- __out_opt LPINT pcchFound,
- __in_opt LPNLSVERSIONINFO lpVersionInformation,
- __in_opt LPVOID lpReserved,
- __in_opt LPARAM lParam)
- {
- int retValue = -1;
-
- if (lpLocaleName == NULL || lpStringSource == NULL || lpStringValue == NULL)
- {
- return retValue;
- }
-
- if (dwFindNLSStringFlags & (FIND_ENDSWITH | FIND_FROMEND))
- {
- retValue = NewApis::LastIndexOfString(lpLocaleName, lpStringSource, cchSource, lpStringValue, cchValue, (int) dwFindNLSStringFlags & FIND_NLS_STRING_FLAGS_NEGATION, dwFindNLSStringFlags & FIND_ENDSWITH, pcchFound);
- }
- else
- {
- retValue = NewApis::IndexOfString(lpLocaleName, lpStringSource, cchSource, lpStringValue, cchValue, (int) dwFindNLSStringFlags & FIND_NLS_STRING_FLAGS_NEGATION, dwFindNLSStringFlags & FIND_STARTSWITH, pcchFound);
- }
- return retValue;
- }
-
-
- // Mac and Windows <= Windows XP
- // Note: "Function" is unused, always handles sorting for now
- // Note: "dwFlags" is unused, we don't have flags for now
- // Note: "lpVersionInfo" is unused, we always presume the current version
- BOOL IsNLSDefinedString(NLS_FUNCTION Function, DWORD dwFlags, LPNLSVERSIONINFOEX lpVersionInfo, LPCWSTR pString, int nStringLen )
- {
- // Ported downlevel code from comnlsinfo.cpp
-
- CQuickBytes buffer;
- buffer.AllocThrows(16);
- int ich = 0;
-
- while(ich < nStringLen)
- {
- WCHAR wch = pString[ich];
-
- int dwBufSize=NewApis::LCMapStringEx(W("en-US"),LCMAP_SORTKEY|SORT_STRINGSORT,pString+ich,1,(LPWSTR)buffer.Ptr(),
- (int)(buffer.Size()/sizeof(WCHAR)),NULL,NULL,0);
-
- if (dwBufSize == 0)
- {
- buffer.AllocThrows(buffer.Size()*2);
- continue; // try again
- }
-
- if (LPBYTE(buffer.Ptr())[0] == 0x1) // no weight
- {
- //
- // Check for the NULL case and formatting characters case. Not
- // defined but valid.
- //
- switch(wch)
- {
- case 0x0000: // NULL
- case 0x0640: // TATWEEL
- case 0x180b: // MONGOLIAN FVS 1
- case 0x180c: // MONGOLIAN FVS 2
- case 0x180d: // MONGOLIAN FVS 3
- case 0x180e: // MONGOLIAN VOWEL SEPERATOR
- case 0x200c: // ZWNJ
- case 0x200d: // ZWJ
- case 0x200e: // LRM
- case 0x200f: // RLM
- case 0x202a: // LRE
- case 0x202b: // RLE
- case 0x202c: // PDF
- case 0x202d: // LRO
- case 0x202e: // RLO
- case 0x206a: // ISS
- case 0x206b: // SSS
- case 0x206c: // IAFS
- case 0x206d: // AAFS
- case 0x206e: // NATIONAL DS
- case 0x206f: // NOMINAL DS
- case 0xfeff: // ZWNBSP
- case 0xfff9: // IAA
- case 0xfffa: // IAS
- case 0xfffb: // IAT
- case 0xfffc: // ORC
- case 0xfffd: // RC
- ich++;
- continue;
-
- default:
- return (FALSE);
- }
- }
-
- //
- // Eliminate Private Use characters. They are defined but cannot be considered
- // valid because AD-style apps should not use them in identifiers.
- //
- if ((wch >= PRIVATE_USE_BEGIN) && (wch <= PRIVATE_USE_END))
- {
- return (FALSE);
- }
-
- //
- // Eliminate invalid surogates pairs or single surrogates. Basically, all invalid
- // high surrogates have aleady been filtered (above) since they are unsortable.
- // All that is left is to check for standalone low surrogates and valid high
- // surrogates without corresponding low surrogates.
- //
-
- if ((wch >= LOW_SURROGATE_START) && (wch <= LOW_SURROGATE_END))
- {
- // Leading low surrogate
- return (FALSE);
- }
- else if ((wch >= HIGH_SURROGATE_START) && (wch <= HIGH_SURROGATE_END))
- {
- // Leading high surrogate
- if ( ((ich + 1) < nStringLen) && // Surrogates not the last character
- (pString[ich+1] >= LOW_SURROGATE_START) && (pString[ich+1] <= LOW_SURROGATE_END)) // Low surrogate
- {
- // Valid surrogates pair, High followed by a low surrogate. Skip the pair!
- ich++;
- }
- else
- {
- // High surrogate without low surrogate, so exit.
- return (FALSE);
- }
- }
-
- ich++;
-
- }
- return (TRUE);
- }
-
-
- int GetCalendarInfoEx(__in LPCWSTR lpLocaleName,
- __in CALID Calendar,
- __in_opt LPCWSTR pReserved,
- __in CALTYPE CalType,
- __out_ecount_opt(cchData) LPWSTR lpCalData,
- __in int cchData,
- __out_opt LPDWORD lpValue)
- {
-
- _ASSERTE((lpCalData == NULL && cchData == 0) || (lpCalData != NULL && cchData > 0));
- if ((CalType & CAL_RETURN_NUMBER))
- {
- // If CAL_RETURN_NUMBER, lpValue must be non-null and lpCalData must be null
- _ASSERTE((lpValue != NULL) && (lpCalData == NULL));
- }
-
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
-
- // zh-HK has English month/day names in older OS's, so we need to fix that (pre-Vista OS's)
- if (lcid == 0x0c04 && Calendar == CAL_GREGORIAN &&
- ((CalType >= CAL_SDAYNAME1 && CalType <= CAL_SABBREVMONTHNAME13) ||
- (CalType >= CAL_SSHORTESTDAYNAME1 && CalType <= CAL_SSHORTESTDAYNAME7)))
- {
- // zh-TW has the English names for those month/day name values
- lcid = 0x0404;
- }
-
- if (lcid == 0)
- return 0;
- return ::GetCalendarInfoW(lcid, Calendar, CalType, lpCalData, cchData, lpValue );
- }
-
-
- namespace LegacyCallbacks
- {
- LPARAM lDateFormatParam = NULL;
- DATEFMT_ENUMPROCEXEX realDateCallback = NULL;
-
- BOOL CALLBACK EnumDateFormatsProcWrapper(__in_z LPTSTR lpDateFormatString, __in CALID Calendar)
- {
- if (realDateCallback != NULL && lDateFormatParam != NULL)
- return realDateCallback(lpDateFormatString, Calendar, lDateFormatParam);
-
- // Didn't have the globals, fail
- return false;
- };
-
- BOOL EnumDateFormatsExEx(DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam)
- {
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
- if (lcid == 0)
- return 0;
-
- DelayCreateCriticalSection();
-
- BOOL ret = false;
- {
- CRITSEC_Holder sCrstHolder(g_pDownlevelNlsCrst);
-
- // Store our real callback and lParam
- lDateFormatParam = lParam;
- realDateCallback = lpDateFmtEnumProcExEx;
- ret = EnumDateFormatsExW(EnumDateFormatsProcWrapper, lcid, dwFlags);
- }
- return ret;
- };
-
- LPARAM lTimeFormatParam = NULL;
- TIMEFMT_ENUMPROCEX realTimeCallback = NULL;
-
- BOOL CALLBACK EnumTimeFormatsProcWrapper(__in_z LPTSTR lpTimeFormatString)
- {
- if (realTimeCallback != NULL && lTimeFormatParam != NULL)
- return realTimeCallback(lpTimeFormatString, lTimeFormatParam);
-
- // Didn't have the globals, fail
- return false;
- };
-
- BOOL EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam)
- {
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
- if (lcid == 0)
- return 0;
-
- DelayCreateCriticalSection();
-
- BOOL ret = false;
- {
- CRITSEC_Holder sCrstHolder(g_pDownlevelNlsCrst);
-
- // Store our real callback and lParam
- lTimeFormatParam = lParam;
- realTimeCallback = lpTimeFmtEnumProcEx;
- ret = EnumTimeFormatsW(EnumTimeFormatsProcWrapper, lcid, dwFlags);
- }
- return ret;
- };
-
- LPARAM lCalendarInfoParam = NULL;
- CALINFO_ENUMPROCEXEX realCalendarInfoCallback = NULL;
-
- BOOL CALLBACK EnumCalendarInfoProcWrapper(__in_z LPTSTR lpCalendarInfoString, __in CALID Calendar)
- {
- if (realCalendarInfoCallback != NULL && lCalendarInfoParam != NULL)
- return realCalendarInfoCallback(lpCalendarInfoString, Calendar, NULL, lCalendarInfoParam);
-
- // Didn't have the globals, fail
- return false;
- };
-
- BOOL EnumCalendarInfoExEx(CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, LPCWSTR lpLocaleName, CALID Calendar, LPCWSTR lpReserved, CALTYPE CalType, LPARAM lParam)
- {
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
- if (lcid == 0)
- return 0;
-
- DelayCreateCriticalSection();
-
- BOOL ret = false;
- {
- CRITSEC_Holder sCrstHolder(g_pDownlevelNlsCrst);
-
- // Store our real callback and lParam
- lCalendarInfoParam = lParam;
- realCalendarInfoCallback = pCalInfoEnumProcExEx;
- ret = EnumCalendarInfoExW(EnumCalendarInfoProcWrapper, lcid, Calendar, CalType);
- }
- return ret;
- };
- }
-
- // This is where we fudge data the OS doesn't know (even on Vista)
- namespace UplevelFallback
- {
- // Some properties are unknown to downlevel OS's (pre windows 7), so synthesize them
- // Pass in LCID if calling from the downlevel APIs.
- // Note that Vista gets here for neutrals as well as specifics
- // The only neutral Vista properties we support are SNAME, SPARENT & INEUTRAL (which assumes its a locale)
- // if lpLCData is NULL, caller wants required size to be returned. So we check before assigning and return
- // buffer size.
- int GetLocaleInfoEx(__in LPCWSTR lpLocaleName, __in LCID lcid, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData)
- {
- _ASSERTE((lpLCData == NULL && cchData == 0) || (lpLCData != NULL && cchData > 0));
-
- LPCWSTR useString = NULL;
- WCHAR buffer[80];
-
- // We don't differentiate user overrides for these types
- LCType &= ~LOCALE_NOUSEROVERRIDE;
-
- // TODO: NLS Arrowhead -Find better ways of handling these properties:
- // Right now we'll just fill them in with constant data
- switch (LCType)
- {
- case LOCALE_SPERCENT: // Percent symbol
- useString = W("%");
- break;
- case LOCALE_IPOSITIVEPERCENT | LOCALE_RETURN_NUMBER: // Positive percent format
- if (lpLCData)
- {
- *((DWORD*)lpLCData) = 0;
- }
- return 2;
- case LOCALE_INEGATIVEPERCENT | LOCALE_RETURN_NUMBER: // Negative percent format
- if (lpLCData)
- {
- *((DWORD*)lpLCData) = 0;
- }
- return 2;
- case LOCALE_SPERMILLE: // Per mille symbol
- useString = W("\x2030");
- break;
- case LOCALE_SSHORTTIME: // Short time format (default)
- // CultureData synthesizes short time from long time
-
- case LOCALE_SENGLISHDISPLAYNAME: // English display name (ie: Fijiian (Fiji))
- case LOCALE_SNATIVEDISPLAYNAME: // Native dispaly name (ie: Deutsch (Deutschland))
- // native & english names are built more easily in managed code
-
- //case LOCALE_SMONTHDAY: // month/day format
- //we get month/day patterns from the calendar data. This would be override, but that's not assigned
- // TODO: NLS Arrowhead - in windows 7 if we add overrides
- break;
- case LOCALE_IREADINGLAYOUT | LOCALE_RETURN_NUMBER: // Is Right To Left?
- // Use the RTL bit in the font signature
- LOCALESIGNATURE LocSig;
- if (NewApis::GetLocaleInfoEx( lpLocaleName, LOCALE_FONTSIGNATURE, (LPWSTR)&LocSig, sizeof(LocSig) / sizeof(WCHAR) ) ==
- sizeof(LocSig) / sizeof(WCHAR))
- {
- // Got the locale signature information, get the isrtl bit 123 to see if its RTL.
- if (lpLCData)
- {
- *((DWORD*)lpLCData) = ((LocSig.lsUsb[3] & 0x0800) != 0) ? 1 : 0;
- }
- return 2;
- }
- // Failed, just return 0
- return 0;
-
- case LOCALE_SNAME:
- // If we don't have an LCID, find one, this is < Vista or neutrals
- if (lcid == 0) lcid = NewApis::LocaleNameToLCID(lpLocaleName,0);
-
- // Make sure windows recognizes this LCID, or that its zh-Hant, sr, or bs
- if (GetLocaleInfoW(lcid, LOCALE_IDIGITS | LOCALE_RETURN_NUMBER, NULL, 0) == 0 &&
- lcid != 0x7c04 && lcid != 0x7c1a && lcid != 0x781a)
- {
- // Not a real locale, fail, don't fail for neutrals zh-Hant, sr, or bs.
- return 0;
- }
-
- // Convert name to LCID (so we get pretty name)
- if (lcid != 0)
- return NewApis::LCIDToLocaleName(lcid, lpLCData, cchData, 0);
- else
- return 0;
-
- case LOCALE_INEUTRAL | LOCALE_RETURN_NUMBER:
- // If its XP/Win2K3 or lower, then the lcid can tell us
-
- if (lcid != 0)
- {
- if (lpLCData)
- *((DWORD*)lpLCData) = ((lcid < 0x0400 || lcid > 0x7000) && (lcid < 0x10000)) ? 1 : 0;
- return 2;
- }
-
- // Vista or Win2K8 fail for neutrals
- // Note this assumes that neutral or not it is a valid locale.
- if (NewApis::GetLocaleInfoEx(lpLocaleName, LOCALE_IDIGITS | LOCALE_RETURN_NUMBER, NULL, 0) == 0)
- {
- // Failed, its a neutral
- // Note, we assumed it is a valid locale. (Caller lookind in our name/lcid tables undoubtedly)
- if (lpLCData)
- *((DWORD*)lpLCData) = 1;
- }
- else
- {
- // Succeeded, its not neutral
- if (lpLCData)
- *((DWORD*)lpLCData) = 0;
- }
-
- // Return "success"
- return 2;
-
- case LOCALE_SPARENT:
- // Should only get here for neutrals or downlevel
- // Downlevel only needs work if its not neutral
- if (lcid != 0)
- {
- // Downlevel
- // If its a neutral LCID then its "" Invariant
- if ((lcid < 0x0400 || lcid > 0x7000) && (lcid < 0x10000))
- {
- useString = W("");
- }
- else
- {
- // Parent is same as LCID & 0x3ff, except for a few cases
- switch (lcid)
- {
- case 0x0404: // zh-TW
- case 0x0c04: // zh-HK
- case 0x1404: // zh-MO
- lcid = 0x7c04; // zh-Hant
- break;
- case 0x081a: // sr-Latn-CS
- case 0x0c1a: // sr-Cryl-CS
- lcid = 0x7c1a; // sr
- break;
- case 0x201a: // bs-Cyrl-BA
- case 0x141a: // bs-Latn-BA
- lcid = 0x781a; // bs
- break;
- default:
- lcid &= 0x03ff;
- break;
- }
-
- // Get the name from LCIDToName
- if (NewApis::LCIDToLocaleName(lcid, buffer, NumItems(buffer), 0))
- {
- useString = buffer;
- }
- }
- }
- else
- {
- // Neutral on Vista / W2K8. Always "" Invariant
- // or neutral LCID
- useString = W("");
- }
- break;
-
- case LOCALE_SNAN:
- useString = W("NaN");
- break;
- case LOCALE_SPOSINFINITY:
- useString = W("Infinity");
- break;
- case LOCALE_SNEGINFINITY:
- useString = W("-Infinity");
- break;
- }
-
- // Return number already returned, so we should have a string, else its unknown
- if (useString == NULL) return 0;
-
- // Copy our string to the output & return
- int size = (int)(wcslen(useString) + 1);
- // if cchData is 0, then caller wants us to return size
- if (size > cchData && cchData != 0) return 0;
- if (lpLCData)
- {
- memcpy(lpLCData, useString, size * sizeof(WCHAR));
- }
-
- return size;
- }
-
- LPCWSTR const arabicSuperShortDayNames[] =
- {
- W("\x0646"), // Day name for Monday
- W("\x062b"),
- W("\x0631"),
- W("\x062e"),
- W("\x062c"),
- W("\x0633"),
- W("\x062d") // Day name for Sunday
- };
-
- LPCWSTR const chineseSuperShortDayNames[] =
- {
- W("\x4e00"), // Day name for Monday
- W("\x4e8c"),
- W("\x4e09"),
- W("\x56db"),
- W("\x4e94"),
- W("\x516d"),
- W("\x65e5") // Day name for Sunday
- };
-
- LPCWSTR const hebrewSuperShortDayNames[] =
- {
- W("\x05d1"), // Day name for Monday
- W("\x05d2"),
- W("\x05d3"),
- W("\x05d4"),
- W("\x05d5"),
- W("\x05e9"),
- W("\x05d0") // Day name for Sunday
- };
-
- LPCWSTR const mongolianSuperShortDayNames[] =
- {
- W("\x0414\x0430"), // Day name for Monday
- W("\x041c\x044f"),
- W("\x041b\x0445"),
- W("\x041f\x04af"),
- W("\x0411\x0430"),
- W("\x0411\x044f"),
- W("\x041d\x044f") // Day name for Sunday
- };
-
- int GetCalendarInfoEx(__in_opt LPCWSTR lpLocaleName,
- __in CALID Calendar,
- __in_opt LPCWSTR pReserved,
- __in CALTYPE CalType,
- __out_ecount_opt(cchData) LPWSTR lpCalData,
- __in int cchData,
- __out_opt LPDWORD lpValue)
- {
-
- _ASSERTE((lpCalData == NULL && cchData == 0) || (lpCalData != NULL && cchData > 0));
- if ((CalType & CAL_RETURN_NUMBER))
- {
- // If CAL_RETURN_NUMBER, lpValue must be non-null and lpCalData must be null
- _ASSERTE((lpValue != NULL) && (lpCalData == NULL));
- }
-
- // We don't differentiate user overrides for these types
- CalType &= ~CAL_NOUSEROVERRIDE;
-
- LCID lcid=NewApis::LocaleNameToLCID(lpLocaleName,0);
- int ret = 0;
- LPCWSTR pUseString = W("");
- LPCWSTR const *pDays = NULL;
-
- //
- // The requested info is a string.
- //
-
- // NOTE: Genitive names will skip this and just return empty strings
- // not much we can do for those.
- switch (CalType)
- {
- case CAL_SMONTHDAY:
- // Special cases for older locales with names that can't be truncated
- pUseString = W("MMMM dd");
-
- // Special case for CJK locales
- if ((lcid & 0x3ff) == 0x11 || // Japanese
- (lcid & 0x3ff) == 0x04) // Chinese
- {
- // Japanese & Chinese
- pUseString = W("M'\x6708'd'\x65e5'");
- }
- else if ((lcid & 0x3ff) == 0x012) // Korean
- {
- // Korean
- pUseString = W("M'\xc6d4' d'\xc77c'");
- }
- break;
-
- case CAL_SSHORTESTDAYNAME1:
- case CAL_SSHORTESTDAYNAME2:
- case CAL_SSHORTESTDAYNAME3:
- case CAL_SSHORTESTDAYNAME4:
- case CAL_SSHORTESTDAYNAME5:
- case CAL_SSHORTESTDAYNAME6:
- case CAL_SSHORTESTDAYNAME7:
- // Special cases for older locales with names that can't be truncated
-
- // Arabic
- if (((lcid & 0x3ff) == 0x01) && (Calendar == CAL_GREGORIAN || Calendar == CAL_HIJRI || Calendar == CAL_UMALQURA))
- pDays = arabicSuperShortDayNames;
-
- // Chinese
- if (((lcid & 0x3ff) == 0x04) && (Calendar == CAL_GREGORIAN || Calendar == CAL_TAIWAN))
- pDays = chineseSuperShortDayNames;
-
- // Hebrew
- if (((lcid & 0x3ff) == 0x0d) && (Calendar == CAL_GREGORIAN || Calendar == CAL_HEBREW))
- pDays = hebrewSuperShortDayNames;
-
- // Mongolian
- if ((lcid & 0x3ff) == 0x50) pDays = mongolianSuperShortDayNames;
-
- if (pDays)
- {
- // If we have a special case string then use that
- pUseString = pDays[CalType - CAL_SSHORTESTDAYNAME1];
- }
- else
- {
- // If lpCalData is null they just want the size
- // NOTE: We actually always know the size so we never ask.
- if (lpCalData == NULL)
- {
- ret = 5;
- }
- else
- {
- ret = NewApis::GetCalendarInfoEx(lpLocaleName, Calendar, pReserved, CAL_SABBREVDAYNAME1 + (CalType - CAL_SSHORTESTDAYNAME1), lpCalData, cchData, lpValue);
- if (ret > 0)
- {
- if (ret > 3)
- {
- // Just get the first two character, and NULL-terminate it.
- PREFIX_ASSUME(3 < cchData); // we can assume this; otherwise call would have failed
- lpCalData[3] = W('\0');
- ret = 3;
- }
- }
- }
-
- // Done
- return ret;
- }
- break;
- default:
- //
- // Not a CALTYPE that this function provides. Just returns 0.
- //
- return 0;
- break;
- }
-
- // If we have a special case string, copy to the output & return
- ret = (int)(wcslen(pUseString) + 1);
- if (lpCalData && cchData >= ret)
- {
- // If they wanted string (not just count), then return it
- memcpy(lpCalData, pUseString, ret * sizeof(WCHAR));
- }
-
- return ret;
- }
-
- // Handle the to titlecaseflag
- int LCMapStringEx(__in LPCWSTR lpLocaleName,
- __in DWORD dwMapFlags,
- __in_ecount(cchSrc) LPCWSTR lpSrcStr,
- __in int cchSrc,
- __out_ecount_opt(cchDest) LPWSTR lpDestStr,
- __in int cchDest,
- __in_opt LPNLSVERSIONINFO lpVersionInformation,
- __in_opt LPVOID lpReserved,
- __in_opt LPARAM lParam)
- {
- // We only know about the title case flag...
- if (dwMapFlags != LCMAP_TITLECASE)
- {
- return 0;
- }
-
- // Should be unused, we'll just workaround it to upper case in case there's a real problem
- // Just call NewAPIs with the upper case flag
- return NewApis::LCMapStringEx(lpLocaleName, LCMAP_UPPERCASE, lpSrcStr, cchSrc,
- lpDestStr, cchDest,
- lpVersionInformation, lpReserved, lParam);
- }
-
- }
-
- static int __cdecl compareLcidToLCIDEntry ( const void *key, const void *value)
- {
- LCID lcid=*((LCID*)key);
- LCIDEntry* entry=(LCIDEntry*)value;
- return lcid-entry->lcid;
- }
-
- int LCIDToLocaleName(__in LCID Locale, __out_ecount_opt(cchName) LPWSTR lpName, __in int cchName, __in DWORD dwFlags)
- {
- _ASSERTE((lpName == NULL && cchName == 0) || (lpName != NULL && cchName > 0));
- if (Locale==LOCALE_INVARIANT)
- {
- if (lpName != NULL)
- {
- *lpName=0;
- }
- return 1;
- }
-
- LCIDEntry* entry=(LCIDEntry*)bsearch(&Locale,s_lcids,NumItems(s_lcids),sizeof(*s_lcids),compareLcidToLCIDEntry);
-
- if (entry == NULL)
- {
- //_ASSERTE(entry);
- return 0;
- }
-
- int length = 0;
- if (cchName > 0)
- {
- PREFIX_ASSUME(lpName != NULL); // checked above, but prefix can't figure it out
- wcscpy_s(lpName,cchName,entry->wszName);
- length = (int)wcslen(entry->wszName) + 1;
- }
- return length;
- }
-
- LCID LocaleNameToLCID(__in LPCWSTR lpName, __in DWORD dwFlags)
- {
- if (lpName == NULL || *lpName==0)
- {
- return LOCALE_INVARIANT;
- }
-
- // Try the last one first, just in case
- static int cachedEntry = 0;
- PREFIX_ASSUME(cachedEntry < NumItems(s_names));
-
- int test = VolatileLoad(&cachedEntry);
- if (_wcsicmp(lpName, s_names[test].wszName) == 0)
- {
- _ASSERTE(s_names[test].lcid != 0);
- return s_names[test].lcid;
- }
-
- // Just do a binary lookup for the name
- int iBottom =0;
- int iTop = NumItems(s_names) - 1;
-
- while (iBottom <= iTop)
- {
- int iMiddle = (iBottom + iTop) / 2;
- int result = _wcsicmp(lpName, s_names[iMiddle].wszName);
- if (result == 0)
- {
- _ASSERTE(s_names[iMiddle].lcid != 0);
- cachedEntry = iMiddle;
- return s_names[iMiddle].lcid;
- }
- if (result < 0)
- {
- // pLocaleName was < s_names[iMiddle]
- iTop = iMiddle - 1;
- }
- else
- {
- // pLocaleName was > s_names[iMiddle]
- iBottom = iMiddle + 1;
- }
- }
-
- // Failed, return 0
- return 0;
- }
-
- // Fallback for pre windows 7 machines
- int ResolveLocaleName(__in LPCWSTR lpNameToResolve, __in_ecount_opt(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName)
- {
- PWSTR pSpecific = NULL;
- int retVal = 0;
-
- // Doesn't matter for mac, for windows map the name to LCID, then ask for LOCALE_ILANGUAGE to map the
- // LCID to a specific (legacy GetLocaleInfo behavior), then map the LCID to a name
- LCID lcid = LocaleNameToLCID(lpNameToResolve, 0);
- DWORD specific;
-
- // Some neutrals have specific values that downlevel OS's can't provide easily:
- retVal = 2;
- switch (lcid)
- {
- case 0x0004: specific = 0x0804; break; // zh-Hans::zh-CN::0804
- case 0x000a: specific = 0x0c0a; break; // es::es-ES::0c0a
- case 0x003c: specific = 0x083c; break; // ga::ga-IE::083c
- case 0x005d: specific = 0x085d; break; // iu::iu-Latn-CA:085d
- case 0x005f: specific = 0x085f; break; // tzm::tzm-Latn-DZ:085f
- case 0x703b: specific = 0x243b; break; // smn::smn-FI::243b
- case 0x743b: specific = 0x203b; break; // sms::sms-FI::203b
- case 0x7804: specific = 0x0804; break; // zh::zh-CN::0804
- case 0x7814: specific = 0x0814; break; // nn::nn-NO::0814
- case 0x781a: specific = 0x141a; break; // bs::bs-Latn-BA:141a
- case 0x783b: specific = 0x1c3b; break; // sma::sma-SE::1c3b
- case 0x7c04: specific = 0x0c04; break; // zh-Hant::zh-HK::0c04
- case 0x7c1a: specific = 0x081a; break; // sr::sr-Latn-CS:081a (this changes in win7)
- case 0x7c2e: specific = 0x082e; break; // dsb::dsb-DE::082e
- case 0x7c3b: specific = 0x143b; break; // smj::smj-SE::143b
- default:
- // Note this won't call our Downlevel API with the undesired LOCALE_ILANGUAGE
- retVal = GetLocaleInfoW(lcid, LOCALE_ILANGUAGE | LOCALE_RETURN_NUMBER, (LPWSTR)&specific, sizeof(specific)/sizeof(WCHAR));
- break;
- }
-
- if (retVal > 0)
- {
- retVal = LCIDToLocaleName(specific, lpLocaleName, cchLocaleName, 0);
- if (retVal > 0)
- return retVal;
- }
-
- // If we didn't have a specific, then use the locale name passed in
- if (!pSpecific)
- {
- pSpecific = (PWSTR)lpNameToResolve;
- }
-
- // Copy our string to the output & return
- int size = (int)(wcslen(pSpecific) + 1);
- if (size > cchLocaleName) return 0;
- memcpy(lpLocaleName, pSpecific, size * sizeof(WCHAR));
- return size;
- }
-
-
- BOOL GetThreadPreferredUILanguages(__in DWORD dwFlags,
- __out PULONG pulNumLanguages,
- __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer,
- __inout PULONG pcchLanguagesBuffer)
- {
- const WCHAR str[]=W("\0");
- ULONG nBufSize=*pcchLanguagesBuffer;
- *pcchLanguagesBuffer=NumItems(str);
-
- if (nBufSize == 0 && pwszLanguagesBuffer == NULL)
- {
- return TRUE;
- }
-
- if(nBufSize<NumItems(str))
- {
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- return FALSE;
- }
- *pulNumLanguages=0;
- memcpy(pwszLanguagesBuffer,str,sizeof(str));
- return TRUE;
-
- }
-
-}
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-
diff --git a/src/utilcode/newapis.cpp b/src/utilcode/newapis.cpp
deleted file mode 100644
index 9815b6d9d1..0000000000
--- a/src/utilcode/newapis.cpp
+++ /dev/null
@@ -1,1401 +0,0 @@
-// 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.
-////////////////////////////////////////////////////////////////////////////
-//
-// File: newapis.cpp
-//
-
-
-// Purpose: functions that need to be emulated on downlevel platforms.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#include "stdafx.h"
-#include "newapis.h"
-#ifdef ENABLE_DOWNLEVEL_FOR_NLS
-#include "downlevel.h"
-#endif
-
-#include "utilcode.h"
-
-namespace NewApis
-{
-
-
-#if defined(ENABLE_DOWNLEVEL_FOR_NLS)
-
- FARPROC GetProcAddressForLocaleApi(__in LPCSTR lpProcName, __in_opt FARPROC pFnDownlevelFallback)
- {
- _ASSERTE(lpProcName != NULL);
-
- FARPROC result = NULL;
-
-
- // next try the kernel
- if(result==NULL)
- {
- HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if(hMod!=NULL)
- {
- result=GetProcAddress(hMod,lpProcName);
- }
- }
-
- // failing all that, use the fallback provided
- if(result==NULL)
- {
- result = pFnDownlevelFallback;
- }
-
- return result;
- }
-
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
- __success(return > 0) int
- GetSystemDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName)
- {
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::GetSystemDefaultLocaleName(lpLocaleName, cchLocaleName);
-#else
- typedef int (WINAPI *PFNGetSystemDefaultLocaleName)(LPWSTR, int);
- static PFNGetSystemDefaultLocaleName pFNGetSystemDefaultLocaleName=NULL;
- if (pFNGetSystemDefaultLocaleName == NULL)
- {
- HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- // TODO: NLS Arrowhead - We should always fallback to the Downlevel APIs if the kernel APIs aren't found,
- // regardless of error reason
- if(hMod==NULL)
- return 0;
- pFNGetSystemDefaultLocaleName=(PFNGetSystemDefaultLocaleName)GetProcAddress(hMod,"GetSystemDefaultLocaleName");
- if(pFNGetSystemDefaultLocaleName==NULL)
- {
- if(GetLastError() == ERROR_PROC_NOT_FOUND)
- pFNGetSystemDefaultLocaleName=DownLevel::GetSystemDefaultLocaleName;
- else
- return 0;
- }
- }
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- return pFNGetSystemDefaultLocaleName(lpLocaleName,cchLocaleName);
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
-#endif
- };
-
- __success(return == TRUE) BOOL
- GetUserPreferredUILanguages (__in DWORD dwFlags, __out PULONG pulNumLanguages, __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer, __in PULONG pcchLanguagesBuffer)
- {
-#ifdef ENABLE_DOWNLEVEL_FOR_NLS
- typedef DWORD (WINAPI *PFNGetUserPreferredUILanguages)(ULONG, PULONG, LPWSTR, PULONG);
- static PFNGetUserPreferredUILanguages pFNGetUserPreferredUILanguages=NULL;
- if (pFNGetUserPreferredUILanguages == NULL)
- {
- HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if(hMod==NULL)
- return FALSE;
- pFNGetUserPreferredUILanguages=(PFNGetUserPreferredUILanguages)GetProcAddress(hMod,"GetUserPreferredUILanguages");
- if(pFNGetUserPreferredUILanguages==NULL)
- {
- if(GetLastError() == ERROR_PROC_NOT_FOUND)
- pFNGetUserPreferredUILanguages=DownLevel::GetUserPreferredUILanguages;
- else
- return FALSE;
- }
- }
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- BOOL res = pFNGetUserPreferredUILanguages(dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
- if(res == TRUE)
- return res;
-
- //fallback to thread preferred langs
- return GetThreadPreferredUILanguages(dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
-#else
- return ::GetUserPreferredUILanguages(dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
-#endif
- };
-
-
-
- __success(return != 0) int
- GetUserDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName)
- {
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::GetUserDefaultLocaleName(lpLocaleName, cchLocaleName);
-#else
- typedef int (WINAPI *PFNGetUserDefaultLocaleName)(LPWSTR, int);
- static PFNGetUserDefaultLocaleName pFNGetUserDefaultLocaleName=NULL;
- if (pFNGetUserDefaultLocaleName == NULL)
- {
- HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if(hMod==NULL)
- return 0;
- pFNGetUserDefaultLocaleName=(PFNGetUserDefaultLocaleName)GetProcAddress(hMod,"GetUserDefaultLocaleName");
- if(pFNGetUserDefaultLocaleName==NULL)
- {
- if(GetLastError() == ERROR_PROC_NOT_FOUND)
- pFNGetUserDefaultLocaleName=DownLevel::GetUserDefaultLocaleName;
- else
- return 0;
- }
- }
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- return pFNGetUserDefaultLocaleName(lpLocaleName,cchLocaleName);
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
-#endif
- }
-
- // Call GetLocaleInfoEx and see if the OS knows about it.
- // Note that GetLocaleInfoEx has variations:
- // * Pre-Vista it fails and has to go downlevel
- // * Vista succeeds, but not for neutrals
- // * Win7 succeeds for all locales.
- // * Mac does ???
- //
- // The caller is expected to call with a specific locale (non-neutral) on Windows < windows 7,
- // except for LOCALE_INEUTRAL and LOCALE_SPARENT, which downlevel.cpp handles
- //
- __success(return != 0) int
- GetLocaleInfoEx (__in LPCWSTR lpLocaleName, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData)
- {
- _ASSERTE((lpLCData == NULL && cchData == 0) || (lpLCData != NULL && cchData > 0));
- _ASSERTE(LCType == LOCALE_SNAME || NotLeakingFrameworkOnlyCultures(lpLocaleName));
- int retVal;
-
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- retVal = ::GetLocaleInfoEx(lpLocaleName, LCType, lpLCData, cchData);
-#else
- typedef int (WINAPI *PFNGetLocaleInfoEx)(LPCWSTR, LCTYPE, LPWSTR, int);
- static PFNGetLocaleInfoEx pFNGetLocaleInfoEx=NULL;
- if (pFNGetLocaleInfoEx== NULL)
- {
- pFNGetLocaleInfoEx=(PFNGetLocaleInfoEx)GetProcAddressForLocaleApi(
- "GetLocaleInfoEx",
- (FARPROC)DownLevel::GetLocaleInfoEx);
- }
- retVal = pFNGetLocaleInfoEx(lpLocaleName,LCType,lpLCData,cchData);
-
- // Do fallback if we didn't find anything yet
- if (retVal == 0)
- retVal = DownLevel::UplevelFallback::GetLocaleInfoEx(lpLocaleName,0,LCType,lpLCData,cchData);
-#endif
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- return retVal;
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
- }
-
- __success(return != 0) int
- GetDateFormatEx(__in LPCWSTR lpLocaleName, __in DWORD dwFlags, __in_opt CONST SYSTEMTIME* lpDate, __in_opt LPCWSTR lpFormat,
- __out_ecount(cchDate) LPWSTR lpDateStr, __in int cchDate, __in_opt LPCWSTR lpCalendar)
- {
- _ASSERTE(NotLeakingFrameworkOnlyCultures(lpLocaleName));
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::GetDateFormatEx(lpLocaleName, dwFlags, lpDate, lpFormat, lpDateStr, cchDate, lpCalendar);
-#else
- typedef int (WINAPI *PFNGetDateFormatEx)(LPCWSTR, DWORD, CONST SYSTEMTIME*, LPCWSTR, LPWSTR,int, LPCWSTR);
- static PFNGetDateFormatEx pFNGetDateFormatEx=NULL;
- if (pFNGetDateFormatEx== NULL)
- {
- HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if(hMod==NULL)
- return 0;
- pFNGetDateFormatEx=(PFNGetDateFormatEx)GetProcAddress(hMod,"GetDateFormatEx");
- if(pFNGetDateFormatEx==NULL)
- {
- if(GetLastError() == ERROR_PROC_NOT_FOUND)
- pFNGetDateFormatEx=DownLevel::GetDateFormatEx;
- else
- return 0;
- }
- }
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- return pFNGetDateFormatEx(lpLocaleName,dwFlags,lpDate,lpFormat,lpDateStr,cchDate,lpCalendar);
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
-#endif
- }
-
-#if defined(ENABLE_DOWNLEVEL_FOR_NLS)
- static BOOL AvoidVistaTurkishBug = FALSE;
-
- __success(return != NULL)
- inline
- FARPROC GetSystemProcAddressForSortingApi(
- __in LPCSTR lpProcName,
- __in_opt FARPROC pFnDownlevelFallback)
- {
- _ASSERTE(lpProcName != NULL);
-
- FARPROC result = NULL;
-
- // try the kernel
- HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if(hMod!=NULL)
- {
- result=GetProcAddress(hMod,lpProcName);
- }
-
- if (IsVistaPlatform()) AvoidVistaTurkishBug = TRUE;
-
- // failing all that, use the fallback provided
- if(result==NULL)
- {
- result = pFnDownlevelFallback;
- }
-
- return result;
- }
-
- __success(return != NULL)
- FARPROC GetProcAddressForSortingApi(
- __in LPCSTR lpProcName,
- __in FARPROC lpSortDllProcedure,
- __in_opt FARPROC pFnDownlevelFallback,
- __in_opt CONST NLSVERSIONINFO * lpVersionInformation)
- {
- _ASSERTE(lpProcName != NULL);
- _ASSERTE(lpSortDllProcedure != NULL);
-
- FARPROC result = NULL;
-
- // Below windows 8 we have to try the sorting dll
- if (!RunningOnWin8() && SortVersioning::IsAvailableVersion(lpVersionInformation))
- {
- result=lpSortDllProcedure;
- }
-
- if(result == NULL)
- {
- result = GetSystemProcAddressForSortingApi(lpProcName, pFnDownlevelFallback);
- }
- return result;
- }
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-
-#if defined(ENABLE_DOWNLEVEL_FOR_NLS)
- //
- // Vista handle tr-TR and az-Latn-AZ incorrectly with the sorting APIs that takes locale names
- // work around the problem by using the sorting name instead.
- //
-
- LPWSTR GetLingusticLocaleName(__in LPWSTR pLocaleName, __in DWORD dwFlags)
- {
- _ASSERTE(IsVistaPlatform());
-
- // If the localeName is NULL, then we are using an OS SortHandle and don't need to fix up
- // anything.
- if (pLocaleName == NULL)
- {
- return pLocaleName;
- }
-
- if ((dwFlags & CASING_BITS))
- {
- if (_wcsicmp(pLocaleName, TURKISH_LOCALE_NAME) == 0)
- return TURKISH_SORTING_LOCALE_NAME;
-
- if (_wcsicmp(pLocaleName, AZERBAIJAN_LOCALE_NAME) == 0)
- return AZERBAIJAN_SORTING_LOCALE_NAME;
- }
- return pLocaleName;
- }
-#endif
-
- //
- // NOTE: We assume that we're only being called from the BCL with an explicit locale name, so we don't
- // support the system/user default tokens used in the OS.
- //
- // Additionally this is only called for casing and sort keys, other functionality isn't supported.
- //
- int CompareStringEx(__in LPCWSTR lpLocaleName, __in DWORD dwCmpFlags, __in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2,
- __in int cchCount2, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam )
- {
- CONTRACTL
- {
- THROWS;
- GC_NOTRIGGER;
- SO_TOLERANT;
- PRECONDITION((lParam == 0 && CheckPointer(lpLocaleName)) || (lParam != 0 && lpLocaleName == NULL));
- PRECONDITION(CheckPointer(lpString1));
- PRECONDITION(CheckPointer(lpString2));
- } CONTRACTL_END;
-
- _ASSERTE(lpLocaleName == NULL || NotLeakingFrameworkOnlyCultures(lpLocaleName));
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return::CompareStringEx(lpLocaleName, dwCmpFlags, lpString1, cchCount1, lpString2,
- cchCount2, lpVersionInformation, lpReserved, lParam );
-#else
- typedef int (WINAPI *PFNCompareStringEx)(LPCWSTR, DWORD, LPCWSTR, int, LPCWSTR, int, LPNLSVERSIONINFO, LPVOID, LPARAM );
- static PFNCompareStringEx pFNCompareStringEx=NULL;
-
- // See if we loaded our pointer already
- if (pFNCompareStringEx == NULL)
- {
- pFNCompareStringEx = (PFNCompareStringEx) GetProcAddressForSortingApi(
- "CompareStringEx",
- (FARPROC)SortVersioning::SortCompareString,
- (FARPROC)DownLevel::CompareStringEx,
- lpVersionInformation);
- }
-
- // TODO: Remove this workaround after Vista SP2 &/or turkic CompareStringEx() gets fixed on Vista.
- // If its Vista and we want a turkik sort, then call CompareStringW not CompareStringEx
- LPCWSTR pLingLocaleName = AvoidVistaTurkishBug ? GetLingusticLocaleName((LPWSTR)lpLocaleName, dwCmpFlags) : lpLocaleName;
- // TODO: End of workaround for turkish CompareStringEx() on Vista/Win2K8
-
- return pFNCompareStringEx(pLingLocaleName, dwCmpFlags, lpString1, cchCount1, lpString2,
- cchCount2, lpVersionInformation, lpReserved, lParam );
-#endif
- }
-
- // Note that unlike the real version we always expect our callers to pass counted strings
- // I don't think we can assert because I think it'd call this code again
- int CompareStringOrdinal(__in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2, __in int cchCount2, __in BOOL bIgnoreCase)
- {
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::CompareStringOrdinal(lpString1, cchCount1, lpString2, cchCount2, bIgnoreCase);
-#else
- typedef int (WINAPI *PFNCompareStringOrdinal )(LPCWSTR, int, LPCWSTR, int, BOOL );
- static PFNCompareStringOrdinal pFNCompareStringOrdinal=NULL;
- if (pFNCompareStringOrdinal == NULL)
- {
- HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if(hMod != NULL)
- {
- // Grab the OS proc if its there
- pFNCompareStringOrdinal=(PFNCompareStringOrdinal)GetProcAddress(hMod, "CompareStringOrdinal");
- }
- if (pFNCompareStringOrdinal == NULL)
- {
- // Regardless of the reason why, if we can't find the API just use the downlevel version
- pFNCompareStringOrdinal=DownLevel::CompareStringOrdinal;
- }
- }
- return pFNCompareStringOrdinal(lpString1, cchCount1, lpString2, cchCount2, bIgnoreCase);
-#endif
- }
-
-// The invariant locale should always match the system for
-// upper and lower casing
-inline BOOL IsInvariantCasing(__in LPCWSTR lpLocaleName, __in DWORD dwMapFlags)
-{
- _ASSERTE(lpLocaleName);
-
- if(lpLocaleName[0] == NULL)
- {
- if(dwMapFlags & (LCMAP_UPPERCASE | LCMAP_LOWERCASE))
- {
- return TRUE;
- }
- }
- return FALSE;
-}
-
- //
- // NOTE: We assume that we're only being called from the BCL with an explicit locale name, so we don't
- // support the system/user default tokens used in the OS.
- //
- // Additionally this is only called for casing and sort keys, other functionality isn't supported.
- //
- __success(return != 0)
- int LCMapStringEx (__in LPCWSTR lpLocaleName, __in DWORD dwMapFlags, __in_ecount(cchSrc) LPCWSTR lpSrcStr, __in int cchSrc,
- __out_xcount_opt(cchDest) LPWSTR lpDestStr, __in int cchDest, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam )
- {
- int retVal = 0;
- // Note: We should only be calling this for casing or sort keys
- _ASSERTE((dwMapFlags & (LCMAP_UPPERCASE | LCMAP_LOWERCASE | LCMAP_TITLECASE | LCMAP_SORTKEY | (RunningOnWin8() ? (LCMAP_SORTHANDLE | LCMAP_HASH) : 0))) != 0);
-
- // Need to have a name or sort node
- _ASSERTE(lpLocaleName == NULL && lParam != 0 || lParam == 0 && lpLocaleName != NULL);
-
- _ASSERTE(lpLocaleName == NULL || NotLeakingFrameworkOnlyCultures(lpLocaleName));
-
- // Can't use the system token, which starts with an illegal !
- _ASSERTE(lpLocaleName == NULL || lpLocaleName[0] != W('!'));
-
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- retVal = ::LCMapStringEx (lpLocaleName, dwMapFlags, lpSrcStr, cchSrc,
- lpDestStr, cchDest, lpVersionInformation, lpReserved, lParam );
-#else
- typedef int (WINAPI *PFNLCMapStringEx )(LPCWSTR, DWORD, LPCWSTR, int, LPWSTR, int, LPNLSVERSIONINFO, LPVOID, LPARAM);
-
- PFNLCMapStringEx pLcMapStringEx;
- LPCWSTR pLingLocaleName;
- if(lpLocaleName == NULL || IsInvariantCasing(lpLocaleName, dwMapFlags)){
- static PFNLCMapStringEx pFNSystemLCMapStringEx=NULL;
- if (pFNSystemLCMapStringEx == NULL)
- {
- pFNSystemLCMapStringEx = (PFNLCMapStringEx) GetSystemProcAddressForSortingApi(
- "LCMapStringEx",
- (FARPROC)DownLevel::LCMapStringEx);
- }
- pLcMapStringEx = pFNSystemLCMapStringEx;
- pLingLocaleName = lpLocaleName;
- }
- else
- {
- static PFNLCMapStringEx pFNLCMapStringEx=NULL;
- // See if we still need to find which function to use
- if (pFNLCMapStringEx == NULL)
- {
- pFNLCMapStringEx = (PFNLCMapStringEx) GetProcAddressForSortingApi(
- "LCMapStringEx",
- (FARPROC)SortVersioning::LCMapStringEx,
- (FARPROC)DownLevel::LCMapStringEx,
- lpVersionInformation);
- }
- pLcMapStringEx = pFNLCMapStringEx;
-
- // TODO: Remove this workaround after Vista SP2 &/or turkic CompareStringEx() gets fixed on Vista.
- // If its Vista and we want a turkik sort, then call CompareStringW not CompareStringEx
- pLingLocaleName = AvoidVistaTurkishBug ? GetLingusticLocaleName((LPWSTR)lpLocaleName, dwMapFlags) : lpLocaleName;
- // TODO: End of workaround for turkish CompareStringEx() on Vista/Win2K8
- }
-
- retVal = pLcMapStringEx(pLingLocaleName, dwMapFlags, lpSrcStr, cchSrc,
- lpDestStr, cchDest, lpVersionInformation, lpReserved, lParam);
- if (retVal == 0)
- retVal = DownLevel::UplevelFallback::LCMapStringEx(lpLocaleName, dwMapFlags, lpSrcStr, cchSrc,
- lpDestStr, cchDest, lpVersionInformation, lpReserved, lParam);
-#endif
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- return retVal;
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
- }
-
- __inline BOOL IsLowerAsciiString(__in_ecount(cchCount) LPCWSTR lpString, __in int cchCount)
- {
- int count = cchCount;
- LPCWSTR pStr = lpString;
- __range(0,10) int cch;
- int value = 0;
-
- while (count > 0)
- {
- cch = min(count, 10);
- switch (cch)
- {
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26010) // Prefast - Potential read overflow of null terminated buffer using expression 'pStr[9]'
-#endif // _PREFAST_
- case 10: value |= (int) pStr[9]; __fallthrough; // fall through
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
- case 9: value |= (int) pStr[8]; __fallthrough; // fall through
- case 8: value |= (int) pStr[7]; __fallthrough; // fall through
- case 7: value |= (int) pStr[6]; __fallthrough; // fall through
- case 6: value |= (int) pStr[5]; __fallthrough; // fall through
- case 5: value |= (int) pStr[4]; __fallthrough; // fall through
- case 4: value |= (int) pStr[3]; __fallthrough; // fall through
- case 3: value |= (int) pStr[2]; __fallthrough; // fall through
- case 2: value |= (int) pStr[1]; __fallthrough; // fall through
- case 1: value |= (int) pStr[0]; __fallthrough; // fall through
- }
-
- if (value >= 0x80)
- {
- return FALSE;
- }
-
- count -= cch;
- pStr += cch;
- }
-
- return TRUE;
- }
-
- INT32 FastIndexOfString(__in_ecount(sourceLength) const WCHAR *source, __in INT32 sourceLength, __in_ecount(patternLength) const WCHAR *pattern, __in INT32 patternLength)
- {
- if (source == NULL || pattern == NULL || patternLength < 0 || sourceLength < 1)
- {
- return -1;
- }
-
- INT32 startIndex = 0;
- INT32 endIndex = sourceLength - 1;
-
- int endPattern = endIndex - patternLength + 1;
-
- if (endPattern<0) {
- return -1;
- }
-
- if (patternLength == 0) {
- return startIndex;
- }
-
- WCHAR patternChar0 = pattern[0];
- for (int ctrSrc = startIndex; ctrSrc<=endPattern; ctrSrc++) {
- if (source[ctrSrc] != patternChar0)
- continue;
- int ctrPat;
- for (ctrPat = 1; ctrPat < patternLength; ctrPat++) {
- if (source[ctrSrc + ctrPat] != pattern[ctrPat]) break;
- }
- if (ctrPat == patternLength) {
- return (ctrSrc);
- }
- }
-
- return (-1);
- }
-
- INT32 FastIndexOfStringInsensitive(__in_ecount(sourceLength) const WCHAR *source, __in INT32 sourceLength, __in_ecount(patternLength) const WCHAR *pattern, __in INT32 patternLength)
- {
- if (source == NULL || pattern == NULL || patternLength < 0 || sourceLength < 1)
- {
- return -1;
- }
-
- INT32 startIndex = 0;
- INT32 endIndex = sourceLength - 1;
-
- WCHAR srcChar;
- WCHAR patChar;
-
- int endPattern = endIndex - patternLength + 1;
-
- if (endPattern<0) {
- return -1;
- }
-
- if (patternLength == 0) {
- return startIndex;
- }
-
- WCHAR pattern0 = pattern[0];
- if (pattern0>='A' && pattern0<='Z') {
- pattern0|=0x20;
- }
-
- for (int ctrSrc = startIndex; ctrSrc<=endPattern; ctrSrc++) {
- srcChar = source[ctrSrc];
- if (srcChar>='A' && srcChar<='Z') {
- srcChar|=0x20;
- }
- if (srcChar != pattern0)
- continue;
-
- int ctrPat;
- for (ctrPat = 1; (ctrPat < patternLength); ctrPat++) {
- srcChar = source[ctrSrc + ctrPat];
- if (srcChar>='A' && srcChar<='Z') {
- srcChar|=0x20;
- }
- patChar = pattern[ctrPat];
- if (patChar>='A' && patChar<='Z') {
- patChar|=0x20;
- }
- if (srcChar!=patChar) {
- break;
- }
- }
-
- if (ctrPat == patternLength) {
- return (ctrSrc);
- }
- }
-
- return (-1);
- }
-
- // Works backwards, starting at startIndex and ending at endIndex
- INT32 FastLastIndexOfString(__in_ecount(sourceLength) const WCHAR *source, __in INT32 sourceLength, __in_ecount(patternLength) const WCHAR *pattern, __in INT32 patternLength)
- {
- if (source == NULL || pattern == NULL || patternLength < 0 || sourceLength < 1)
- {
- return -1;
- }
-
- INT32 startIndex = sourceLength - 1;
- INT32 endIndex = 0;
-
- //startIndex is the greatest index into the string.
- int startPattern = startIndex - patternLength + 1;
-
- if (startPattern < 0) {
- return (-1);
- }
-
- if (patternLength == 0) {
- return startIndex;
- }
-
- WCHAR patternChar0 = pattern[0];
- for (int ctrSrc = startPattern; ctrSrc >= endIndex; ctrSrc--) {
- if (source[ctrSrc] != patternChar0)
- continue;
- int ctrPat;
- for (ctrPat = 1; ctrPat<patternLength; ctrPat++) {
- if (source[ctrSrc+ctrPat] != pattern[ctrPat]) break;
- }
- if (ctrPat == patternLength) {
- return (ctrSrc);
- }
- }
-
- return (-1);
- }
-
- // Works backwards, starting at startIndex and ending at endIndex
- INT32 FastLastIndexOfStringInsensitive(__in_ecount(sourceLength) const WCHAR *source, __in INT32 sourceLength, __in_ecount(patternLength) const WCHAR *pattern, __in INT32 patternLength)
- {
- if (source == NULL || pattern == NULL || patternLength < 0 || sourceLength < 1)
- {
- return -1;
- }
-
- INT32 startIndex = sourceLength - 1;
- INT32 endIndex = 0;
-
- //startIndex is the greatest index into the string.
- int startPattern = startIndex - patternLength + 1;
-
- if (startPattern < 0) {
- return (-1);
- }
-
- if (patternLength == 0) {
- return startIndex;
- }
-
- WCHAR srcChar;
- WCHAR patChar;
- WCHAR pattern0 = pattern[0];
- if (pattern0>='A' && pattern0<='Z') {
- pattern0|=0x20;
- }
-
-
- for (int ctrSrc = startPattern; ctrSrc >= endIndex; ctrSrc--) {
- srcChar = source[ctrSrc];
- if (srcChar>='A' && srcChar<='Z') {
- srcChar|=0x20;
- }
- if (srcChar != pattern0)
- continue;
-
- int ctrPat;
- for (ctrPat = 1; ctrPat<patternLength; ctrPat++) {
- srcChar = source[ctrSrc+ctrPat];
- if (srcChar>='A' && srcChar<='Z') {
- srcChar|=0x20;
- }
- patChar = pattern[ctrPat];
- if (patChar>='A' && patChar<='Z') {
- patChar|=0x20;
- }
- if (srcChar!=patChar) {
- break;
- }
- }
- if (ctrPat == patternLength) {
- return (ctrSrc);
- }
- }
-
- return (-1);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // IndexOfString
- //
- ////////////////////////////////////////////////////////////////////////////
- int IndexOfString( __in LPCWSTR lpLocaleName,
- __in_ecount(cchCount1) LPCWSTR pString1, // String to search in
- __in int cchCount1, // length of pString1
- __in_ecount(cchCount2) LPCWSTR pString2, // String we're looking for
- __in int cchCount2, // length of pString2
- __in DWORD dwFlags, // search flags
- __in BOOL startWith, // true if we need to check for prefix case
- __out_opt LPINT pcchFound) // length of the string we found in source
- {
- int iRetVal = -1;
- int foundLengthInSource = 0;
-
- //
- // Check the ranges.
- //
- if (cchCount1 == 0)
- {
- if (cchCount2 == 0)
- iRetVal = 0;
- // else iRetVal = -1 (not found)
- goto lExit;
- }
-
- //
- // See if we have an empty string 2.
- //
- if (cchCount2 == 0)
- {
- iRetVal = 0;
- goto lExit;
- }
-
- //
- // Search for the character in the string.
- //
-
- if (dwFlags == COMPARE_OPTIONS_ORDINAL)
- {
- iRetVal = FastIndexOfString(pString1, cchCount1, pString2, cchCount2);
- foundLengthInSource = cchCount2;
- goto lExit;
- }
- //For dwFlags, 0 is the default, 1 is ignore case, we can handle both.
- // TODO: NLS Arrowhead -This isn't really right, custom locales could start with en- and have different sort behavior
-
- if (((dwFlags & ~CASING_BITS) == 0) && IS_FAST_COMPARE_LOCALE(lpLocaleName))
- {
- if (IsLowerAsciiString(pString1, cchCount1) && IsLowerAsciiString(pString2, cchCount2))
- {
- if ((dwFlags & (LINGUISTIC_IGNORECASE | NORM_IGNORECASE)) == 0)
- iRetVal = FastIndexOfString(pString1, cchCount1, pString2, cchCount2);
- else
- iRetVal = FastIndexOfStringInsensitive(pString1, cchCount1, pString2, cchCount2);
-
- // both are ascii strings,
- // the length should be the same as the length of the string we are searching for.
- foundLengthInSource = cchCount2;
-
- goto lExit;
- }
- }
-
- _ASSERTE(iRetVal==-1);
- int result;
-
- // Some things to think about, depending on the options passed in:
- //
- // LINGUISTIC_IGNORECASE - Can't cause length changes since casing is always changing to the same length
- // NORM_IGNORECASE - Can't cause length changes since casing is always changing to the same length
- // NORM_LINGUISTIC_CASING - Can't cause length changes since casing is always changing to the same length
- // NORM_IGNOREKANATYPE - A 1:1 mapping, so the lengths don't change
- // NORM_IGNOREWIDTH - A 1:1 mapping (full & half width), so lengths don't change
- // SORT_STRINGSORT - No impact on search size - special treatment for - and '
- // LINGUISTIC_IGNOREDIACRITIC - Terrible because both strings could be all diacritics, except for the last character.
- // NORM_IGNORENONSPACE -Terrible because both strings could all be non-spacing characters, except for 1 somewhere.
- // NORM_IGNORESYMBOLS - Terrible because both strings could be all symbols
- // Compressions/Expansions - Either string may have compressions or expansions impacting the size needing searched
- // for default table cultures (including invariant) there're only expansions, and those only expand 2X worst case.
-
- for (int iOffset=0; iRetVal == -1 && iOffset<cchCount1; iOffset++)
- {
- // Because of compressions/expansions/ignorable characters we can't just use the known length, but need to consider the entire remainder of the string.
- // TODO: NLS: the nested loop is extremely slow. oledbtest.exe can't finish even overnight. (Doing invariant ignore case)
- for (int iLength=1; iLength<=cchCount1 - iOffset; iLength++)
- {
- result = NewApis::CompareStringEx(lpLocaleName, dwFlags, pString2, cchCount2, &pString1[iOffset], iLength, NULL, NULL, 0);
- if (result == CSTR_EQUAL)
- {
- iRetVal = iOffset;
- foundLengthInSource = iLength;
- break;
- }
- else if (result == 0)
- {
- // return value of 0 indicates failure and error value is supposed to be set.
- // shouldn't ever really happen
- _ASSERTE(!"catastrophic failure calling NewApis::CompareStringEx! This could be a CultureInfo, RegionInfo, or Calendar bug (bad localeName string) or maybe a GCHole.");
- }
- }
- }
-
- lExit:
- if (startWith && iRetVal != 0)
- {
- iRetVal = -1;
- }
-
- if(iRetVal != -1 && pcchFound != NULL)
- *pcchFound = foundLengthInSource;
-
- return iRetVal;
- }
- ////////////////////////////////////////////////////////////////////////////
- //
- // LastIndexOfString
- //
- ////////////////////////////////////////////////////////////////////////////
- int LastIndexOfString( __in LPCWSTR lpLocaleName,
- __in_ecount(cchCount1) LPCWSTR pString1, // String to search in
- __in int cchCount1, // length of pString1
- __in_ecount(cchCount2) LPCWSTR pString2, // String we're looking for
- __in int cchCount2, // length of pString2
- __in DWORD dwFlags,
- __in BOOL endWith, // check suffix case
- __out_opt LPINT pcchFound) // length of the string we found in source
- {
- INT32 iRetVal = -1;
- BOOL comparedOrdinal = FALSE;
-
- int foundLengthInSource = 0;
-
- // Check for empty strings
- if (cchCount1 == 0)
- {
- if (cchCount2 == 0)
- iRetVal = 0;
- // else iRetVal = -1 (not found)
- goto lExit;
- }
-
- //
- // See if we have an empty string 2.
- //
- if (cchCount2 == 0)
- {
- iRetVal = 0;
- goto lExit;
- }
-
- //
- // Search for the character in the string.
- //<TODO>
- // @ToDo: Should read the nls data tables directly to make this
- // much faster and to handle composite characters.
- //</TODO>
-
- if (dwFlags == COMPARE_OPTIONS_ORDINAL)
- {
- iRetVal = FastLastIndexOfString(pString1, cchCount1, pString2, cchCount2);
- comparedOrdinal = TRUE;
- foundLengthInSource = cchCount2;
- goto lExit;
- }
-
- //For dwFlags, 0 is the default, 1 is ignore case, we can handle both.
- // TODO: NLS Arrowhead -This isn't really right, custom locales could start with en- and have different sort behavior
- if (((dwFlags & ~CASING_BITS) == 0) && IS_FAST_COMPARE_LOCALE(lpLocaleName))
- {
- if (IsLowerAsciiString(pString1, cchCount1) && IsLowerAsciiString(pString2, cchCount2))
- {
- if ((dwFlags & (LINGUISTIC_IGNORECASE | NORM_IGNORECASE)) == 0)
- iRetVal = FastLastIndexOfString(pString1, cchCount1, pString2, cchCount2);
- else
- iRetVal = FastLastIndexOfStringInsensitive(pString1, cchCount1, pString2, cchCount2);
- comparedOrdinal = TRUE;
-
- foundLengthInSource = cchCount2;
- goto lExit;
- }
- }
-
- _ASSERTE(iRetVal==-1);
- // TODO: Cleanup like IndexOfString
- for (int iOffset=0; iRetVal == -1 && iOffset>-cchCount1; iOffset--)
- {
- for (int iLength=1; iLength<=cchCount1 + iOffset; iLength++)
- {
- if (NewApis::CompareStringEx(lpLocaleName, dwFlags, pString2, cchCount2, &pString1[cchCount1 + iOffset - iLength], iLength, NULL, NULL, 0) == CSTR_EQUAL)
- {
- iRetVal= cchCount1 + iOffset - iLength;
- foundLengthInSource = iLength;
- break;
- }
- }
- }
- lExit:
-
- if (endWith && iRetVal>=0)
- {
- if (comparedOrdinal && (cchCount1 - iRetVal != cchCount2)) // optimize here to avoid calling CompareString
- {
- iRetVal = -1;
- }
- else if (NewApis::CompareStringEx(lpLocaleName, dwFlags, pString2, cchCount2, &pString1[iRetVal], cchCount1 - iRetVal, NULL, NULL, 0) != CSTR_EQUAL)
- {
- iRetVal = -1;
- }
- }
-
- if(iRetVal != -1 && pcchFound != NULL)
- *pcchFound = foundLengthInSource;
-
- return iRetVal;
- }
-
- //
- // NOTE: We assume that we're only being called from the BCL with an explicit locale name, so we don't
- // support the system/user default tokens used in the OS.
- //
- // Additionally this is only called for casing and sort keys, other functionality isn't supported.
- //
- int FindNLSStringEx(__in LPCWSTR lpLocaleName,
- __in DWORD dwFindNLSStringFlags,
- __in_ecount(cchSource) LPCWSTR lpStringSource,
- __in int cchSource,
- __in_ecount(cchValue) LPCWSTR lpStringValue,
- __in int cchValue,
- __out_opt LPINT pcchFound,
- __in_opt LPNLSVERSIONINFO lpVersionInformation,
- __in_opt LPVOID lpReserved,
- __in_opt LPARAM lParam)
- {
- _ASSERTE(lpLocaleName == NULL || NotLeakingFrameworkOnlyCultures(lpLocaleName));
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::FindNLSStringEx(lpLocaleName, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound,
- lpVersionInformation, lpReserved, lParam );
-#else
- typedef int (WINAPI *PFNFindNLSStringEx )(LPCWSTR, DWORD, LPCWSTR, int, LPCWSTR, int, LPINT, LPNLSVERSIONINFOEX, LPVOID, LPARAM );
- static PFNFindNLSStringEx pFNFindNLSStringEx=NULL;
-
- // See if we still need to figure out which function to call
- if (pFNFindNLSStringEx == NULL)
- {
- pFNFindNLSStringEx = (PFNFindNLSStringEx) GetProcAddressForSortingApi(
- "FindNLSStringEx",
- (FARPROC)SortVersioning::SortFindString,
- (FARPROC)DownLevel::FindNLSStringEx,
- lpVersionInformation);
- }
-
- // TODO: Remove this workaround after Vista SP2 &/or turkic CompareStringEx() gets fixed on Vista.
- // If its Vista and we want a turkik sort, then call CompareStringW not CompareStringEx
- LPCWSTR pLingLocaleName = AvoidVistaTurkishBug ? GetLingusticLocaleName((LPWSTR)lpLocaleName, dwFindNLSStringFlags) : lpLocaleName;
- // TODO: End of workaround for turkish CompareStringEx() on Vista/Win2K8
-
- int cchFound; // we need to get the length even if the caller doesn't care about it (see below)
- int result = pFNFindNLSStringEx(pLingLocaleName, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, &cchFound,
- lpVersionInformation, lpReserved, lParam );
- // When searching from end with an empty pattern (either empty string or all ignored characters)
- // a match is found (result != -1)
- // Currently we get a result == 0 but we are hoping this will change
- // with Win7 to be the length of the source string (thus pointing past-the-end)
- // and the length of the match (cchFound) will be 0
- // For compatibility, we need to return the index of the last character (or 0 if the source is empty)
- if((dwFindNLSStringFlags & FIND_FROMEND) &&
- result != -1 &&
- cchFound == 0 &&
- cchSource != 0)
- {
- result = cchSource - 1;
- }
-
- // if the caller cares about the length, give it to them
- if(pcchFound != NULL)
- {
- *pcchFound = cchFound;
- }
-
- return result;
-#endif
- }
-
- __success(return != 0) int
- GetCalendarInfoEx(__in LPCWSTR lpLocaleName, __in CALID Calendar, __in_opt LPCWSTR pReserved, __in CALTYPE CalType, __out_ecount_opt(cchData) LPWSTR lpCalData, __in int cchData, __out_opt LPDWORD lpValue )
- {
-
- _ASSERTE(NotLeakingFrameworkOnlyCultures(lpLocaleName));
- if ( (lpCalData != NULL && cchData == 0) || (lpCalData == NULL && cchData > 0) )
- {
- _ASSERTE(FALSE);
- SetLastError(ERROR_INVALID_PARAMETER);
- return 0;
- }
-
- if ((CalType & CAL_RETURN_NUMBER))
- {
- // If CAL_RETURN_NUMBER, lpValue must be non-null and lpCalData must be null
- if (lpValue == NULL || lpCalData != NULL)
- {
- _ASSERTE(FALSE);
- SetLastError(ERROR_INVALID_PARAMETER);
- return 0;
- }
- }
-
- int retVal = 0;
-
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- retVal = ::GetCalendarInfoEx(lpLocaleName, Calendar, pReserved, CalType, lpCalData, cchData, lpValue );
-#else
- typedef int (WINAPI *PFNGetCalendarInfoEx )(LPCWSTR, CALID, LPCWSTR, CALTYPE, LPWSTR, int, LPDWORD );
- static PFNGetCalendarInfoEx pFNGetCalendarInfoEx=NULL;
- if (pFNGetCalendarInfoEx== NULL)
- {
- pFNGetCalendarInfoEx=(PFNGetCalendarInfoEx)GetProcAddressForLocaleApi(
- "GetCalendarInfoEx",
- (FARPROC)DownLevel::GetCalendarInfoEx);
- }
- retVal = pFNGetCalendarInfoEx(lpLocaleName, Calendar, pReserved, CalType, lpCalData, cchData, lpValue );
-
- // Do fallback if we didn't find anything yet
- if (retVal == 0)
- retVal = DownLevel::UplevelFallback::GetCalendarInfoEx(lpLocaleName, Calendar, pReserved, CalType, lpCalData, cchData, lpValue );
-#endif
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- return retVal;
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
- }
-
- __success(return != 0)
- int LCIDToLocaleName(__in LCID Locale, __out_ecount_opt(cchName) LPWSTR lpName, __in int cchName, __in DWORD dwFlags)
- {
- int retVal = 0;
-
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- retVal = ::LCIDToLocaleName(Locale, lpName, cchName, dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
-#else
-
- retVal = DownLevel::LCIDToLocaleName(Locale, lpName,cchName,dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
-
- typedef int (WINAPI *PFNLCIDToLocaleName)(LCID, LPWSTR,int ,DWORD);
- static PFNLCIDToLocaleName pFNLCIDToLocaleName=NULL;
- if (retVal == 0)
- {
- if (pFNLCIDToLocaleName==NULL)
- {
- pFNLCIDToLocaleName=(PFNLCIDToLocaleName)GetProcAddressForLocaleApi(
- "LCIDToLocaleName",
- (FARPROC)DownLevel::LCIDToLocaleName);
-
- }
-
- // Try with the allow neutral flag (will fail in Vista, but
- // Downlevel::LCIDToLocaleName knows all vista locales)
- retVal = pFNLCIDToLocaleName(Locale, lpName, cchName, dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
- if(retVal == 0)
- {
- // in case we are using OS, it could have a problem with the above flag; retry without it
- retVal = pFNLCIDToLocaleName(Locale, lpName, cchName, dwFlags);
- }
- }
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- return retVal;
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
- }
-
- LCID LocaleNameToLCID(__in_opt LPCWSTR lpName , __in DWORD dwFlags)
- {
- LCID retVal = 0;
-
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::LocaleNameToLCID(lpName, dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
-#else
- retVal = DownLevel::LocaleNameToLCID(lpName, dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
-
- typedef int (WINAPI *PFNLocaleNameToLCID)(LPCWSTR,DWORD);
- static PFNLocaleNameToLCID pFNLocaleNameToLCID=NULL;
-
- if (retVal == 0)
- {
- if (pFNLocaleNameToLCID==NULL)
- {
- pFNLocaleNameToLCID=(PFNLocaleNameToLCID)GetProcAddressForLocaleApi(
- "LocaleNameToLCID",
- (FARPROC)DownLevel::LocaleNameToLCID);
-
- }
-
- // Try with the allow neutral flag (will fail in Vista, but
- // Downlevel::LocaleNametoLCID knows all vista locales)
- retVal = pFNLocaleNameToLCID(lpName, dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
- if(retVal == 0)
- {
- // in case we are using OS, it could have a problem with the above flag; retry without it
- retVal = pFNLocaleNameToLCID(lpName, dwFlags);
- }
- }
-#endif // ENABLE_DOWNLEVEL_FOR_NLS
-
- return retVal;
- }
-
- __success(return != 0) BOOL
- EnumDateFormatsExEx (DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam)
- {
- _ASSERTE(NotLeakingFrameworkOnlyCultures(lpLocaleName));
- int retVal = 0;
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- retVal = ::EnumDateFormatsExEx (lpDateFmtEnumProcExEx, lpLocaleName, dwFlags, lParam);
-#else
- typedef int (WINAPI *PFNEnumDateFormatsExEx)(DATEFMT_ENUMPROCEXEX, LPCWSTR, DWORD, LPARAM);
-
- static PFNEnumDateFormatsExEx pFNEnumDateFormatsExEx=NULL;
- if (pFNEnumDateFormatsExEx==NULL)
- {
- pFNEnumDateFormatsExEx=(PFNEnumDateFormatsExEx)GetProcAddressForLocaleApi(
- "EnumDateFormatsExEx",
- (FARPROC)DownLevel::LegacyCallbacks::EnumDateFormatsExEx);
- }
-
- retVal = pFNEnumDateFormatsExEx(lpDateFmtEnumProcExEx, lpLocaleName, dwFlags, lParam);
- if (retVal == 0)
- {
- retVal = DownLevel::LegacyCallbacks::EnumDateFormatsExEx(lpDateFmtEnumProcExEx, lpLocaleName, dwFlags, lParam);
- }
-#endif
- return retVal;
- }
-
- __success(return != 0)
- BOOL EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam)
- {
- _ASSERTE(NotLeakingFrameworkOnlyCultures(lpLocaleName));
- int retVal = 0;
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- retVal = ::EnumTimeFormatsEx(lpTimeFmtEnumProcEx, lpLocaleName, dwFlags, lParam);
-#else
- typedef int (WINAPI *PFNEnumTimeFormatsEx)(TIMEFMT_ENUMPROCEX, LPCWSTR, DWORD, LPARAM);
-
- static PFNEnumTimeFormatsEx pFNEnumTimeFormatsEx=NULL;
- if (pFNEnumTimeFormatsEx==NULL)
- {
- pFNEnumTimeFormatsEx=(PFNEnumTimeFormatsEx)GetProcAddressForLocaleApi(
- "EnumTimeFormatsEx",
- (FARPROC)DownLevel::LegacyCallbacks::EnumTimeFormatsEx);
- }
-
- retVal = pFNEnumTimeFormatsEx(lpTimeFmtEnumProcEx, lpLocaleName, dwFlags, lParam);
- if (retVal == 0)
- {
- retVal = DownLevel::LegacyCallbacks::EnumTimeFormatsEx(lpTimeFmtEnumProcEx, lpLocaleName, dwFlags, lParam);
- }
-#endif
- return retVal;
- }
-
- __success(return != 0)
- BOOL EnumCalendarInfoExEx(CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, LPCWSTR lpLocaleName, CALID Calendar, CALTYPE CalType, LPARAM lParam)
- {
- _ASSERTE(NotLeakingFrameworkOnlyCultures(lpLocaleName));
- int retVal = 0;
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- retVal = ::EnumCalendarInfoExEx (pCalInfoEnumProcExEx, lpLocaleName, Calendar, NULL, CalType, lParam);
-#else
- typedef int (WINAPI *PFNEnumCalendarInfoExEx)(CALINFO_ENUMPROCEXEX, LPCWSTR, CALID, LPCWSTR, CALTYPE, LPARAM);
-
- static PFNEnumCalendarInfoExEx pFNEnumCalendarInfoExEx=NULL;
- if (pFNEnumCalendarInfoExEx==NULL)
- {
- pFNEnumCalendarInfoExEx=(PFNEnumCalendarInfoExEx)GetProcAddressForLocaleApi(
- "EnumCalendarInfoExEx",
- (FARPROC)DownLevel::LegacyCallbacks::EnumCalendarInfoExEx);
- }
-
- retVal = pFNEnumCalendarInfoExEx(pCalInfoEnumProcExEx, lpLocaleName, Calendar, NULL, CalType, lParam);
- if (retVal == 0)
- {
- retVal = DownLevel::LegacyCallbacks::EnumCalendarInfoExEx(pCalInfoEnumProcExEx, lpLocaleName, Calendar, NULL, CalType, lParam);
- }
-#endif
-
- return retVal;
- }
-
- // This function exists is in server 2003 and above
- // Function should be COMPARE_STRING, dwFlags should be NULL, lpVersionInfo should be NULL for now
- BOOL IsNLSDefinedString(__in NLS_FUNCTION Function, __in DWORD dwFlags, __in_opt LPNLSVERSIONINFOEX lpVersionInfo, __in LPCWSTR lpString, __in int cchStr )
- {
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::IsNLSDefinedString(Function, dwFlags, lpVersionInfo, lpString, cchStr);
-#else
- typedef int (WINAPI *PFNIsNLSDefinedString)(NLS_FUNCTION, DWORD, LPNLSVERSIONINFO, LPCWSTR, int);
-
- static PFNIsNLSDefinedString pFNIsNLSDefinedString=NULL;
-
- // See if we still need to find our function
- if (pFNIsNLSDefinedString== NULL)
- {
- pFNIsNLSDefinedString = (PFNIsNLSDefinedString) GetProcAddressForSortingApi(
- "IsNLSDefinedString",
- (FARPROC)SortVersioning::SortIsDefinedString,
- (FARPROC)DownLevel::IsNLSDefinedString,
- lpVersionInfo);
- }
-
- // Call the appropriate function and return
- return pFNIsNLSDefinedString(Function, dwFlags, (LPNLSVERSIONINFO)lpVersionInfo, lpString, cchStr);
-#endif
- }
-
-
-
- // This is a Windows 7 and above function
- // This returns the "specific" locale from an input name, ie: "en" returns "en-US",
- // although note that it should always succeed!(returning "" neutral if nothing else)
- __success(return != 0)
- int ResolveLocaleName(__in LPCWSTR lpNameToResolve, __in_ecount_opt(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName)
- {
- _ASSERTE(NotLeakingFrameworkOnlyCultures(lpLocaleName));
- int retVal = 0;
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- retVal = ::ResolveLocaleName(lpNameToResolve, lpLocaleName, cchLocaleName);
-#else
- typedef int (WINAPI *PFNResolveLocaleName)(LPCWSTR, LPWSTR, int);
-
- static PFNResolveLocaleName pFNResolveLocaleName=NULL;
- if (pFNResolveLocaleName == NULL)
- {
- pFNResolveLocaleName =(PFNResolveLocaleName) GetProcAddressForLocaleApi(
- "ResolveLocaleName",
- (FARPROC)DownLevel::ResolveLocaleName);
- }
- retVal = pFNResolveLocaleName(lpNameToResolve, lpLocaleName, cchLocaleName);
- if (retVal == 0)
- {
- retVal = DownLevel::ResolveLocaleName(lpNameToResolve, lpLocaleName, cchLocaleName);
- }
-#endif
-
- return retVal;
- }
-
- __success(return == TRUE) BOOL
- GetThreadPreferredUILanguages(__in DWORD dwFlags,
- __out PULONG pulNumLanguages,
- __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer,
- __inout PULONG pcchLanguagesBuffer)
- {
-
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::GetThreadPreferredUILanguages(dwFlags, pulNumLanguages,pwszLanguagesBuffer,pcchLanguagesBuffer);
-#else
- typedef int (WINAPI *PFNGetThreadPreferredUILanguages)(DWORD, PULONG,PWSTR,PULONG);
- static PFNGetThreadPreferredUILanguages pFNGetThreadPreferredUILanguages=NULL;
- if (pFNGetThreadPreferredUILanguages == NULL)
- {
- HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if(hMod==NULL)
- return 0;
- pFNGetThreadPreferredUILanguages=(PFNGetThreadPreferredUILanguages)GetProcAddress(hMod,"GetThreadPreferredUILanguages");
- if(pFNGetThreadPreferredUILanguages==NULL)
- {
- if(GetLastError() == ERROR_PROC_NOT_FOUND)
- pFNGetThreadPreferredUILanguages=DownLevel::GetThreadPreferredUILanguages;
- else
- return 0;
- }
- }
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable: 26036) // Prefast - Possible postcondition violation due to failure to null terminate string
-#endif // _PREFAST_
- return pFNGetThreadPreferredUILanguages(dwFlags, pulNumLanguages,pwszLanguagesBuffer,pcchLanguagesBuffer);
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
-#endif
- }
-
- __success(return != 0)
- BOOL WINAPI EnumSystemLocalesEx(
- __in LOCALE_ENUMPROCEX lpLocaleEnumProc,
- __in DWORD dwFlags,
- __in LPARAM lParam,
- __in_opt LPVOID lpReserved)
- {
-#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
- return ::EnumSystemLocalesEx(lpLocaleEnumProc, dwFlags, lParam, lpReserved);
-#else
- typedef BOOL (WINAPI *PFNEnumSystemLocalesEx)(
- LOCALE_ENUMPROCEX lpLocaleEnumProc,
- DWORD dwFlags,
- LPARAM lParam,
- LPVOID lpReserved);
- static PFNEnumSystemLocalesEx pFNEnumSystemLocalesEx=NULL;
- if (pFNEnumSystemLocalesEx== NULL)
- {
- pFNEnumSystemLocalesEx=(PFNEnumSystemLocalesEx)GetProcAddressForLocaleApi(
- "EnumSystemLocalesEx",
- NULL);
- if (pFNEnumSystemLocalesEx == NULL)
- {
-
- return FALSE;
- }
- }
- BOOL result = pFNEnumSystemLocalesEx(lpLocaleEnumProc, dwFlags, lParam, lpReserved);
-
- {
- if(result == FALSE
- && GetLastError() == ERROR_BADDB
- && IsWindows7Platform())
- {
- HKEY hKey;
- if (::RegOpenKeyEx(
- HKEY_LOCAL_MACHINE,
- W("SYSTEM\\CurrentControlSet\\Control\\Nls\\ExtendedLocale"),
- 0,
- KEY_READ,
- &hKey) == ERROR_SUCCESS)
- {
- ::RegCloseKey(hKey);
- }
- else
- {
- result = TRUE;
- }
- }
- }
- return result;
-#endif
- }
-}
-
-
-
-
-
diff --git a/src/utilcode/sstring.cpp b/src/utilcode/sstring.cpp
index 7c332e08c3..74df619260 100644
--- a/src/utilcode/sstring.cpp
+++ b/src/utilcode/sstring.cpp
@@ -11,7 +11,6 @@
#include "sstring.h"
#include "ex.h"
#include "holder.h"
-#include "newapis.h"
#if defined(_MSC_VER)
@@ -91,7 +90,7 @@ static WCHAR MapChar(WCHAR wc, DWORD dwFlags, LocaleID lcid)
#else
// TODO: Uncertain if this is the best behavior. Caller should specify locale name
if (lcid == NULL || lcid[0]==W('!')) lcid = W("");
- int iRet = NewApis::LCMapStringEx(lcid, dwFlags, &wc, 1, &wTmp, 1, NULL, NULL, 0);
+ int iRet = ::LCMapStringEx(lcid, dwFlags, &wc, 1, &wTmp, 1, NULL, NULL, 0);
#endif
if (!iRet) {
// This can fail in non-exceptional cases becauseof unknown unicode characters.
diff --git a/src/utilcode/winfix.cpp b/src/utilcode/winfix.cpp
index c914fb6edd..bea212d9fa 100644
--- a/src/utilcode/winfix.cpp
+++ b/src/utilcode/winfix.cpp
@@ -466,96 +466,4 @@ HRESULT SetThreadName(HANDLE hThread, PCWSTR lpThreadDescription)
return g_pfnSetThreadDescription(hThread, lpThreadDescription);
}
-DWORD
-WszGetWorkingSet()
-{
- WINWRAPPER_NO_CONTRACT(SetLastError(ERROR_OUTOFMEMORY); return 0;);
-
- DWORD dwMemUsage = 0;
-
- // Consider also calling GetProcessWorkingSetSize to get the min & max working
- // set size. I don't know how to get the current working set though...
- PROCESS_MEMORY_COUNTERS pmc;
-
- HINSTANCE hPSapi;
- typedef BOOL (GET_PROCESS_MEMORY_INFO)(HANDLE, PROCESS_MEMORY_COUNTERS*, DWORD);
- GET_PROCESS_MEMORY_INFO* pGetProcessMemoryInfo;
-
- hPSapi = WszLoadLibrary(W("psapi.dll"));
- if (hPSapi == NULL) {
- _ASSERTE(0);
- return 0;
- }
-
- pGetProcessMemoryInfo =
- (GET_PROCESS_MEMORY_INFO*)GetProcAddress(hPSapi, "GetProcessMemoryInfo");
- // 403746: Prefix correctly complained about
- // pGetProcessMemoryInfo != NULL assertion.
- if (pGetProcessMemoryInfo == NULL) {
- _ASSERTE(0);
- FreeLibrary(hPSapi);
- return 0;
- }
- PREFIX_ASSUME(pGetProcessMemoryInfo != NULL);
-
- BOOL r = pGetProcessMemoryInfo(GetCurrentProcess(), &pmc, (DWORD) sizeof(PROCESS_MEMORY_COUNTERS));
- FreeLibrary(hPSapi);
- _ASSERTE(r);
-
- dwMemUsage = (DWORD)pmc.WorkingSetSize;
-
- return dwMemUsage;
-}
-
-
-SIZE_T
-WszGetPagefileUsage()
-{
- WINWRAPPER_NO_CONTRACT(SetLastError(ERROR_OUTOFMEMORY); return 0;);
-
- SIZE_T dwPagefileUsage = 0;
-
- typedef BOOL (WINAPI FnGetProcessMemoryInfo)(HANDLE, PROCESS_MEMORY_COUNTERS *, DWORD);
-
- HMODULE hPSApi = WszLoadLibrary(W("Psapi.dll"));
- if (hPSApi== NULL)
- {
- return 0;
- }
-
- FnGetProcessMemoryInfo *pfnGetProcessMemoryInfo = reinterpret_cast<FnGetProcessMemoryInfo *>(
- GetProcAddress(hPSApi, "GetProcessMemoryInfo"));
-
- if (pfnGetProcessMemoryInfo != NULL)
- {
- PROCESS_MEMORY_COUNTERS pmc;
- ZeroMemory(&pmc, sizeof(pmc));
-
- if (pfnGetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)))
- {
- dwPagefileUsage = pmc.PagefileUsage;
- }
- }
-
- FreeLibrary(hPSApi);
- hPSApi = NULL;
-
- return dwPagefileUsage;
-}
-
-DWORD
-WszGetProcessHandleCount()
-{
- WINWRAPPER_NO_CONTRACT(SetLastError(ERROR_OUTOFMEMORY); return 0;);
-
- DWORD dwHandleCount = 0;
-
- if (!GetProcessHandleCount(GetCurrentProcess(), &dwHandleCount))
- {
- dwHandleCount = 0;
- }
-
- return dwHandleCount;
-}
-
#endif //!FEATURE_PAL
diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt
index b7b9d2259f..cb75a09adb 100644
--- a/src/vm/CMakeLists.txt
+++ b/src/vm/CMakeLists.txt
@@ -184,9 +184,11 @@ set(VM_SOURCES_WKS
eventpipeconfiguration.cpp
eventpipeevent.cpp
eventpipeeventinstance.cpp
+ eventpipeeventsource.cpp
eventpipeblock.cpp
eventpipefile.cpp
eventpipejsonfile.cpp
+ eventpipemetadatagenerator.cpp
eventpipeprovider.cpp
eventpipebuffer.cpp
eventpipebuffermanager.cpp
@@ -213,7 +215,6 @@ set(VM_SOURCES_WKS
jithelpers.cpp
managedmdimport.cpp
marshalnative.cpp
- marvin32.cpp
mdaassistants.cpp
methodtablebuilder.cpp
mlinfo.cpp
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 8bb747b614..67b79ec19d 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -74,12 +74,6 @@
#include "clrprivtypecachewinrt.h"
-
-#pragma warning(push)
-#pragma warning(disable:4324)
-#include "marvin32.h"
-#pragma warning(pop)
-
// this file handles string conversion errors for itself
#undef MAKE_TRANSLATIONFAILED
diff --git a/src/vm/arm/asmhelpers.S b/src/vm/arm/asmhelpers.S
index b7fc652847..22ec7c1171 100644
--- a/src/vm/arm/asmhelpers.S
+++ b/src/vm/arm/asmhelpers.S
@@ -289,7 +289,7 @@ LOCAL_LABEL(LNullThis):
PROLOG_PUSH "{r0-r4,r7,r8,lr}" // add r8 to make stack aligned by 8B
PROLOG_STACK_SAVE_OFFSET r7, #20
- vpush {d0-d7}
+ PROLOG_VPUSH {d0-d7}
CHECK_STACK_ALIGNMENT
@@ -300,8 +300,8 @@ LOCAL_LABEL(LNullThis):
mov r12, r0
// Epilog
- vpop {d0-d7}
- pop {r0-r4,r7,r8,lr}
+ EPILOG_VPOP {d0-d7}
+ EPILOG_POP "{r0-r4,r7,r8,lr}"
bx r12
NESTED_END TheUMEntryPrestub,_TEXT
@@ -542,7 +542,7 @@ ThePreStubPatchLabel:
PROLOG_PUSH "{r0-r4,r7,r8,lr}" // Spill general argument registers, return address and
PROLOG_STACK_SAVE_OFFSET r7, #20
// arbitrary register to keep stack aligned
- vpush {d0-d7} // Spill floating point argument registers
+ PROLOG_VPUSH {d0-d7} // Spill floating point argument registers
CHECK_STACK_ALIGNMENT
@@ -550,8 +550,8 @@ ThePreStubPatchLabel:
bl C_FUNC(NDirectImportWorker)
mov r12, r0
- vpop {d0-d7}
- pop {r0-r4,r7,r8,lr}
+ EPILOG_VPOP {d0-d7}
+ EPILOG_POP "{r0-r4,r7,r8,lr}"
// If we got back from NDirectImportWorker, the MD has been successfully
// linked. Proceed to execute the original DLL call.
@@ -972,7 +972,7 @@ LOCAL_LABEL(stackProbe_loop):
// pop the stack and restore original register state
vldm sp, {d0-d7}
free_stack SIZEOF__FloatArgumentRegisters + 4
- pop {r0-r3, r7,r8, lr}
+ EPILOG_POP "{r0-r3, r7,r8, lr}"
PATCH_LABEL VirtualMethodFixupPatchLabel
@@ -1060,13 +1060,13 @@ LOCAL_LABEL(stackProbe_loop):
PROLOG_PUSH "{r0-r1, r7,r8, r11, lr}" // save integer return value
PROLOG_STACK_SAVE_OFFSET r7, #8
- vpush {d0-d3} // floating point return value
+ PROLOG_VPUSH {d0-d3} // floating point return value
CHECK_STACK_ALIGNMENT
bl C_FUNC(JIT_RareDisableHelperWorker)
- vpop {d0-d3}
+ EPILOG_VPOP {d0-d3}
EPILOG_POP "{r0-r1, r7,r8, r11, pc}"
NESTED_END JIT_RareDisableHelper, _TEXT
@@ -1193,8 +1193,8 @@ LOCAL_LABEL(ThrowIndexOutOfRangeException):
// r12 = array->GetArrayElementTypeHandle()
//
NESTED_ENTRY JIT_Stelem_Ref_NotExactMatch, _TEXT, NoHandler
- push {lr}
- push {r0-r2}
+ PROLOG_PUSH {lr}
+ PROLOG_PUSH {r0-r2}
CHECK_STACK_ALIGNMENT
@@ -1213,8 +1213,8 @@ LOCAL_LABEL(NeedFrame):
bl C_FUNC(ArrayStoreCheck) // ArrayStoreCheck(&val, &array)
LOCAL_LABEL(DoWrite):
- pop {r0-r2}
- pop {lr}
+ EPILOG_POP {r0-r2}
+ EPILOG_POP {lr}
b C_FUNC(JIT_Stelem_DoWrite)
NESTED_END JIT_Stelem_Ref_NotExactMatch, _TEXT
@@ -1410,20 +1410,20 @@ g_rgWriteBarrierDescriptors:
NESTED_ENTRY DelayLoad_MethodCall_FakeProlog, _TEXT, NoHandler
// Match what the lazy thunk has pushed. The actual method arguments will be spilled later.
- push {r1-r3}
+ PROLOG_PUSH {r1-r3}
// This is where execution really starts.
DelayLoad_MethodCall:
.global DelayLoad_MethodCall
- push {r0}
+ PROLOG_PUSH {r0}
PROLOG_WITH_TRANSITION_BLOCK 0x0, 1, DoNotPushArgRegs
// Load the helper arguments
ldr r5, [sp,#(__PWTB_TransitionBlock+10*4)] // pModule
ldr r6, [sp,#(__PWTB_TransitionBlock+11*4)] // sectionIndex
- ldr r7, [sp,#(__PWTB_TransitionBlock+12*4)] // indirection
+ ldr r8, [sp,#(__PWTB_TransitionBlock+12*4)] // indirection
// Spill the actual method arguments
str r1, [sp,#(__PWTB_TransitionBlock+10*4)]
@@ -1432,7 +1432,7 @@ DelayLoad_MethodCall:
add r0, sp, #__PWTB_TransitionBlock // pTransitionBlock
- mov r1, r7 // pIndirection
+ mov r1, r8 // pIndirection
mov r2, r6 // sectionIndex
mov r3, r5 // pModule
@@ -1454,20 +1454,20 @@ DelayLoad_MethodCall:
NESTED_ENTRY DelayLoad_Helper\suffix\()_FakeProlog, _TEXT, NoHandler
// Match what the lazy thunk has pushed. The actual method arguments will be spilled later.
- push {r1-r3}
+ PROLOG_PUSH {r1-r3}
// This is where execution really starts.
DelayLoad_Helper\suffix:
.global DelayLoad_Helper\suffix
- push {r0}
+ PROLOG_PUSH {r0}
PROLOG_WITH_TRANSITION_BLOCK 0x4, 0, DoNotPushArgRegs
// Load the helper arguments
ldr r5, [sp,#(__PWTB_TransitionBlock+10*4)] // pModule
ldr r6, [sp,#(__PWTB_TransitionBlock+11*4)] // sectionIndex
- ldr r7, [sp,#(__PWTB_TransitionBlock+12*4)] // indirection
+ ldr r8, [sp,#(__PWTB_TransitionBlock+12*4)] // indirection
// Spill the actual method arguments
str r1, [sp,#(__PWTB_TransitionBlock+10*4)]
@@ -1476,7 +1476,7 @@ DelayLoad_Helper\suffix:
add r0, sp, #__PWTB_TransitionBlock // pTransitionBlock
- mov r1, r7 // pIndirection
+ mov r1, r8 // pIndirection
mov r2, r6 // sectionIndex
mov r3, r5 // pModule
diff --git a/src/vm/arm/cgencpu.h b/src/vm/arm/cgencpu.h
index 3997dbf75b..53a964f288 100644
--- a/src/vm/arm/cgencpu.h
+++ b/src/vm/arm/cgencpu.h
@@ -12,7 +12,6 @@
#define __cgencpu_h__
#include "utilcode.h"
-#include "tls.h"
// preferred alignment for data
#define DATA_ALIGNMENT 4
diff --git a/src/vm/arm/stubs.cpp b/src/vm/arm/stubs.cpp
index 9668d7b4f0..916c949df1 100644
--- a/src/vm/arm/stubs.cpp
+++ b/src/vm/arm/stubs.cpp
@@ -23,7 +23,6 @@
#include "gcdump.h"
#include "rtlfunctions.h"
#include "codeman.h"
-#include "tls.h"
#include "ecall.h"
#include "threadsuspend.h"
diff --git a/src/vm/arm64/stubs.cpp b/src/vm/arm64/stubs.cpp
index c1e9a56cf6..a236e28f2e 100644
--- a/src/vm/arm64/stubs.cpp
+++ b/src/vm/arm64/stubs.cpp
@@ -10,7 +10,6 @@
#include "common.h"
#include "dllimportcallback.h"
#include "comdelegate.h"
-#include "tls.h"
#include "asmconstants.h"
#include "virtualcallstub.h"
#include "jitinterface.h"
@@ -1275,7 +1274,7 @@ void UMEntryThunkCode::Poison()
m_pTargetCode = (TADDR)UMEntryThunk::ReportViolation;
// ldp x16, x0, [x12]
- m_code[1] = 0xd42017c0;
+ m_code[1] = 0xa9400190;
ClrFlushInstructionCache(&m_code,sizeof(m_code));
}
diff --git a/src/vm/arm64/unixstubs.cpp b/src/vm/arm64/unixstubs.cpp
index 6cf97feb16..1d323bf571 100644
--- a/src/vm/arm64/unixstubs.cpp
+++ b/src/vm/arm64/unixstubs.cpp
@@ -10,19 +10,4 @@ extern "C"
{
PORTABILITY_ASSERT("Implement for PAL");
}
-
- void GenericPInvokeCalliHelper()
- {
- PORTABILITY_ASSERT("Implement for PAL");
- }
-
- void VarargPInvokeStub()
- {
- PORTABILITY_ASSERT("Implement for PAL");
- }
-
- void VarargPInvokeStub_RetBuffArg()
- {
- PORTABILITY_ASSERT("Implement for PAL");
- }
};
diff --git a/src/vm/assemblyname.cpp b/src/vm/assemblyname.cpp
index f0ed60bb6d..4fd6e20ee8 100644
--- a/src/vm/assemblyname.cpp
+++ b/src/vm/assemblyname.cpp
@@ -56,15 +56,18 @@ FCIMPL1(Object*, AssemblyNameNative::GetFileInformation, StringObject* filenameU
SString sFileName(gc.filename->GetBuffer());
PEImageHolder pImage = PEImage::OpenImage(sFileName, MDInternalImport_NoCache);
+ // Load the temporary image using a flat layout, instead of
+ // waiting for it to happen during HasNTHeaders. This allows us to
+ // get the assembly name for images that contain native code for a
+ // non-native platform.
+ PEImageLayoutHolder pLayout(pImage->GetLayout(PEImageLayout::LAYOUT_FLAT, PEImage::LAYOUT_CREATEIFNEEDED));
+
// Allow AssemblyLoadContext.GetAssemblyName for native images on CoreCLR
if (pImage->HasNTHeaders() && pImage->HasCorHeader() && pImage->HasNativeHeader())
pImage->VerifyIsNIAssembly();
else
pImage->VerifyIsAssembly();
- SString sUrl = sFileName;
- PEAssembly::PathToUrl(sUrl);
-
AssemblySpec spec;
spec.InitializeSpec(TokenFromRid(mdtAssembly,1),pImage->GetMDImport(),NULL,TRUE);
spec.AssemblyNameInit(&gc.result, pImage);
diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp
index 50724c0c35..f28dbcb545 100644
--- a/src/vm/ceeload.cpp
+++ b/src/vm/ceeload.cpp
@@ -39,7 +39,6 @@
#include <formattype.h>
#include "fieldmarshaler.h"
#include "sigbuilder.h"
-#include "tls.h"
#include "metadataexports.h"
#include "inlinetracking.h"
diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp
index 05384c3330..20b579af9a 100644
--- a/src/vm/ceemain.cpp
+++ b/src/vm/ceemain.cpp
@@ -208,8 +208,6 @@
#include "profilinghelper.h"
#endif // PROFILING_SUPPORTED
-#include "newapis.h"
-
#ifdef FEATURE_COMINTEROP
#include "synchronizationcontextnative.h" // For SynchronizationContextNative::Cleanup
#endif
@@ -448,7 +446,13 @@ static BOOL WINAPI DbgCtrlCHandler(DWORD dwCtrlType)
}
else
#endif // DEBUGGING_SUPPORTED
- {
+ {
+ if (dwCtrlType == CTRL_CLOSE_EVENT)
+ {
+ // Initiate shutdown so the ProcessExit handlers run
+ ForceEEShutdown(SCA_ReturnWhenShutdownComplete);
+ }
+
g_fInControlC = true; // only for weakening assertions in checked build.
return FALSE; // keep looking for a real handler.
}
@@ -2994,7 +2998,7 @@ static HRESULT GetThreadUICultureNames(__inout StringArrayList* pCultureNames)
SIZE_T cchParentCultureName=LOCALE_NAME_MAX_LENGTH;
#ifdef FEATURE_USE_LCID
SIZE_T cchCultureName=LOCALE_NAME_MAX_LENGTH;
- if (!NewApis::LCIDToLocaleName(id, sCulture.OpenUnicodeBuffer(static_cast<COUNT_T>(cchCultureName)), static_cast<int>(cchCultureName), 0))
+ if (!::LCIDToLocaleName(id, sCulture.OpenUnicodeBuffer(static_cast<COUNT_T>(cchCultureName)), static_cast<int>(cchCultureName), 0))
{
hr = HRESULT_FROM_GetLastError();
}
@@ -3004,7 +3008,7 @@ static HRESULT GetThreadUICultureNames(__inout StringArrayList* pCultureNames)
#endif
#ifndef FEATURE_PAL
- if (!NewApis::GetLocaleInfoEx((LPCWSTR)sCulture, LOCALE_SPARENT, sParentCulture.OpenUnicodeBuffer(static_cast<COUNT_T>(cchParentCultureName)),static_cast<int>(cchParentCultureName)))
+ if (!::GetLocaleInfoEx((LPCWSTR)sCulture, LOCALE_SPARENT, sParentCulture.OpenUnicodeBuffer(static_cast<COUNT_T>(cchParentCultureName)),static_cast<int>(cchParentCultureName)))
{
hr = HRESULT_FROM_GetLastError();
}
@@ -3094,7 +3098,7 @@ static int GetThreadUICultureId(__out LocaleIDValue* pLocale)
STRINGREF cultureName = pCurrentCulture->GetName();
_ASSERT(cultureName != NULL);
- if ((Result = NewApis::LocaleNameToLCID(cultureName->GetBuffer(), 0)) == 0)
+ if ((Result = ::LocaleNameToLCID(cultureName->GetBuffer(), 0)) == 0)
Result = (int)UICULTUREID_DONTCARE;
}
}
@@ -3172,7 +3176,7 @@ static int GetThreadUICultureId(__out LocaleIDValue* pLocale)
// This thread isn't set up to use a non-default culture. Let's grab the default
// one and return that.
- Result = NewApis::GetUserDefaultLocaleName(*pLocale, LOCALE_NAME_MAX_LENGTH);
+ Result = ::GetUserDefaultLocaleName(*pLocale, LOCALE_NAME_MAX_LENGTH);
_ASSERTE(Result != 0);
#else // !FEATURE_PAL
diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp
index d69329f44f..aa3c1fa1ed 100644
--- a/src/vm/codeman.cpp
+++ b/src/vm/codeman.cpp
@@ -2063,7 +2063,7 @@ static size_t GetDefaultReserveForJumpStubs(size_t codeHeapSize)
{
LIMITED_METHOD_CONTRACT;
-#ifdef _TARGET_AMD64_
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
//
// Keep a small default reserve at the end of the codeheap for jump stubs. It should reduce
// chance that we won't be able allocate jump stub because of lack of suitable address space.
diff --git a/src/vm/commodule.cpp b/src/vm/commodule.cpp
index 45b31bfe68..9512468a6d 100644
--- a/src/vm/commodule.cpp
+++ b/src/vm/commodule.cpp
@@ -8,7 +8,6 @@
#include "comdynamic.h"
#include "reflectclasswriter.h"
#include "class.h"
-#include "corpolicy.h"
#include "ceesectionstring.h"
#include <cor.h>
#include "typeparse.h"
diff --git a/src/vm/comsynchronizable.cpp b/src/vm/comsynchronizable.cpp
index a2cc4f0932..772163aff2 100644
--- a/src/vm/comsynchronizable.cpp
+++ b/src/vm/comsynchronizable.cpp
@@ -32,8 +32,6 @@
#include "utilcode.h"
#endif
-#include "newapis.h"
-
// To include definition of CAPTURE_BUCKETS_AT_TRANSITION
#include "exstate.h"
diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp
index 8fc326e814..48efc11904 100644
--- a/src/vm/comutilnative.cpp
+++ b/src/vm/comutilnative.cpp
@@ -2240,137 +2240,6 @@ FCIMPL1(INT32, ValueTypeHelper::GetHashCodeOfPtr, LPVOID ptr)
}
FCIMPLEND
-
-COMNlsHashProvider COMNlsHashProvider::s_NlsHashProvider;
-
-
-COMNlsHashProvider::COMNlsHashProvider()
-{
- LIMITED_METHOD_CONTRACT;
-
- pEntropy = NULL;
- pDefaultSeed = NULL;
-}
-
-INT32 COMNlsHashProvider::HashString(LPCWSTR szStr, SIZE_T strLen)
-{
- CONTRACTL {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- int marvinResult[SYMCRYPT_MARVIN32_RESULT_SIZE / sizeof(int)];
-
- SymCryptMarvin32(GetDefaultSeed(), (PCBYTE) szStr, strLen * sizeof(WCHAR), (PBYTE) &marvinResult);
-
- return marvinResult[0] ^ marvinResult[1];
-}
-
-
-INT32 COMNlsHashProvider::HashSortKey(PCBYTE pSrc, SIZE_T cbSrc)
-{
- CONTRACTL {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- int marvinResult[SYMCRYPT_MARVIN32_RESULT_SIZE / sizeof(int)];
-
- // Sort Keys are terminated with a null byte which we didn't hash using the old algorithm,
- // so we don't have it with Marvin32 either.
- SymCryptMarvin32(GetDefaultSeed(), pSrc, cbSrc - 1, (PBYTE) &marvinResult);
-
- return marvinResult[0] ^ marvinResult[1];
-}
-
-void COMNlsHashProvider::InitializeDefaultSeed()
-{
- CONTRACTL {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- PCBYTE pEntropy = GetEntropy();
- AllocMemHolder<SYMCRYPT_MARVIN32_EXPANDED_SEED> pSeed(GetAppDomain()->GetLowFrequencyHeap()->AllocMem(S_SIZE_T(sizeof(SYMCRYPT_MARVIN32_EXPANDED_SEED))));
- SymCryptMarvin32ExpandSeed(pSeed, pEntropy, SYMCRYPT_MARVIN32_SEED_SIZE);
-
- if(InterlockedCompareExchangeT(&pDefaultSeed, (PCSYMCRYPT_MARVIN32_EXPANDED_SEED) pSeed, NULL) == NULL)
- {
- pSeed.SuppressRelease();
- }
-}
-
-PCSYMCRYPT_MARVIN32_EXPANDED_SEED COMNlsHashProvider::GetDefaultSeed()
-{
- CONTRACTL {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- if(pDefaultSeed == NULL)
- {
- InitializeDefaultSeed();
- }
-
- return pDefaultSeed;
-}
-
-PCBYTE COMNlsHashProvider::GetEntropy()
-{
- CONTRACTL {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- if(pEntropy == NULL)
- {
- AllocMemHolder<BYTE> pNewEntropy(GetAppDomain()->GetLowFrequencyHeap()->AllocMem(S_SIZE_T(sizeof(SYMCRYPT_MARVIN32_SEED_SIZE))));
-
-#ifdef FEATURE_PAL
- PAL_Random(pNewEntropy, SYMCRYPT_MARVIN32_SEED_SIZE);
-#else
- HCRYPTPROV hCryptProv;
- WszCryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
- CryptGenRandom(hCryptProv, SYMCRYPT_MARVIN32_SEED_SIZE, pNewEntropy);
- CryptReleaseContext(hCryptProv, 0);
-#endif
-
- if(InterlockedCompareExchangeT(&pEntropy, (PBYTE) pNewEntropy, NULL) == NULL)
- {
- pNewEntropy.SuppressRelease();
- }
- }
-
- return (PCBYTE) pEntropy;
-}
-
-#ifdef FEATURE_COREFX_GLOBALIZATION
-INT32 QCALLTYPE CoreFxGlobalization::HashSortKey(PCBYTE pSortKey, INT32 cbSortKey)
-{
- QCALL_CONTRACT;
-
- INT32 retVal = 0;
-
- BEGIN_QCALL;
-
- retVal = COMNlsHashProvider::s_NlsHashProvider.HashSortKey(pSortKey, cbSortKey);
-
- END_QCALL;
-
- return retVal;
-}
-#endif //FEATURE_COREFX_GLOBALIZATION
-
static MethodTable * g_pStreamMT;
static WORD g_slotBeginRead, g_slotEndRead;
static WORD g_slotBeginWrite, g_slotEndWrite;
diff --git a/src/vm/comutilnative.h b/src/vm/comutilnative.h
index 617785de94..3e63a0479c 100644
--- a/src/vm/comutilnative.h
+++ b/src/vm/comutilnative.h
@@ -26,15 +26,6 @@
#include "windows.h"
#undef GetCurrentTime
-
-#pragma warning(push)
-#pragma warning(disable:4324)
-#if !defined(CROSS_COMPILE) && defined(_TARGET_ARM_) && !defined(PLATFORM_UNIX)
-#include "arm_neon.h"
-#endif
-#include "marvin32.h"
-#pragma warning(pop)
-
//
//
// EXCEPTION NATIVE
@@ -206,34 +197,6 @@ public:
static FCDECL1(INT32, GetHashCodeOfPtr, LPVOID ptr);
};
-
-typedef const BYTE * PCBYTE;
-
-class COMNlsHashProvider {
-public:
- COMNlsHashProvider();
-
- INT32 HashString(LPCWSTR szStr, SIZE_T strLen);
- INT32 HashSortKey(PCBYTE pSrc, SIZE_T cbSrc);
-
- static COMNlsHashProvider s_NlsHashProvider;
-
-private:
- PBYTE pEntropy;
- PCSYMCRYPT_MARVIN32_EXPANDED_SEED pDefaultSeed;
-
- PCBYTE GetEntropy();
- PCSYMCRYPT_MARVIN32_EXPANDED_SEED GetDefaultSeed();
- void InitializeDefaultSeed();
-};
-
-#ifdef FEATURE_COREFX_GLOBALIZATION
-class CoreFxGlobalization {
-public:
- static INT32 QCALLTYPE HashSortKey(PCBYTE pSortKey, INT32 cbSortKey);
-};
-#endif // FEATURE_COREFX_GLOBALIZATION
-
class StreamNative {
public:
static FCDECL1(FC_BOOL_RET, HasOverriddenBeginEndRead, Object *stream);
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index 5b31c8aad5..c93c2d8ff6 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -43,6 +43,9 @@
#endif // !FEATURE_PAL
#include "stringarraylist.h"
+#ifdef FEATURE_PERFTRACING
+#include "eventpipe.h"
+#endif // FEATURE_PERFTRACING
#ifdef FEATURE_COMINTEROP
#include "winrttypenameconverter.h"
@@ -368,6 +371,12 @@ void SetCommandLineArgs(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR* argv)
}
CONTRACTL_END;
+ // Send the command line to EventPipe.
+#ifdef FEATURE_PERFTRACING
+ EventPipe::SaveCommandLine(pwzAssemblyPath, argc, argv);
+#endif // FEATURE_PERFTRACING
+
+ // Send the command line to System.Environment.
struct _gc
{
PTRARRAYREF cmdLineArgs;
@@ -2943,14 +2952,6 @@ void GetProcessMemoryLoad(LPMEMORYSTATUSEX pMSEX)
pMSEX->dwLength = sizeof(MEMORYSTATUSEX);
BOOL fRet = GlobalMemoryStatusEx(pMSEX);
_ASSERTE (fRet);
-
-
- // If the machine has more RAM than virtual address limit, let us cap it.
- // Our GC can never use more than virtual address limit.
- if (pMSEX->ullAvailPhys > pMSEX->ullTotalVirtual)
- {
- pMSEX->ullAvailPhys = pMSEX->ullAvailVirtual;
- }
}
// This is the instance that exposes interfaces out to all the other DLLs of the CLR
diff --git a/src/vm/crossgencompile.cpp b/src/vm/crossgencompile.cpp
index cea93bff57..f608afcad4 100644
--- a/src/vm/crossgencompile.cpp
+++ b/src/vm/crossgencompile.cpp
@@ -384,7 +384,7 @@ extern "C" UINT_PTR STDCALL GetCurrentIP()
return 0;
}
-void EEPolicy::HandleFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, const WCHAR * argExceptionString)
+void EEPolicy::HandleFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, LPCWSTR argExceptionString)
{
fprintf(stderr, "Fatal error: %08x\n", exitCode);
ExitProcess(exitCode);
diff --git a/src/vm/customattribute.h b/src/vm/customattribute.h
index 1333373fca..d5aa4dd06f 100644
--- a/src/vm/customattribute.h
+++ b/src/vm/customattribute.h
@@ -166,23 +166,6 @@ private:
static CustomAttributeManagedValues GetManagedCaValue(CaValue* pCaVal);
};
-class CORSEC_ATTRSET_ARRAY: public StackSArray<CORSEC_ATTRSET>
-{
-public:
- CORSEC_ATTRSET_ARRAY()
- {
- }
- ~CORSEC_ATTRSET_ARRAY()
- {
- WRAPPER_NO_CONTRACT;
- for (COUNT_T i = 0; i < GetCount(); i++)
- {
- (*this)[i].CORSEC_ATTRSET::~CORSEC_ATTRSET();
- }
-
- }
-};
-
class COMCustomAttribute
{
public:
diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp
index 8d8557a76b..04620a6596 100644
--- a/src/vm/debugdebugger.cpp
+++ b/src/vm/debugdebugger.cpp
@@ -16,7 +16,6 @@
#include <object.h>
#include "ceeload.h"
-#include "corpermp.h"
#include "excep.h"
#include "frames.h"
diff --git a/src/vm/ecall.cpp b/src/vm/ecall.cpp
index dacec45787..3812ff1030 100644
--- a/src/vm/ecall.cpp
+++ b/src/vm/ecall.cpp
@@ -320,10 +320,14 @@ PCODE ECall::GetFCallImpl(MethodDesc * pMD, BOOL * pfSharedOrDynamicFCallImpl /*
return GetFCallImpl(MscorlibBinder::GetMethod(METHOD__DELEGATE__CONSTRUCT_DELEGATE));
}
-#ifdef FEATURE_COMINTEROP
// COM imported classes have special constructors
- if (pMT->IsComObjectType() && pMT != g_pBaseCOMObject && pMT != g_pBaseRuntimeClass)
+ if (pMT->IsComObjectType()
+#ifdef FEATURE_COMINTEROP
+ && pMT != g_pBaseCOMObject && pMT != g_pBaseRuntimeClass
+#endif // FEATURE_COMINTEROP
+ )
{
+#ifdef FEATURE_COMINTEROP
if (pfSharedOrDynamicFCallImpl)
*pfSharedOrDynamicFCallImpl = TRUE;
@@ -333,8 +337,10 @@ PCODE ECall::GetFCallImpl(MethodDesc * pMD, BOOL * pfSharedOrDynamicFCallImpl /*
// FCComCtor does not need to be in the fcall hashtable since it does not erect frame.
return GetEEFuncEntryPoint(FCComCtor);
- }
+#else
+ COMPlusThrow(kPlatformNotSupportedException, IDS_EE_ERROR_COM);
#endif // FEATURE_COMINTEROP
+ }
if (!pMD->GetModule()->IsSystem())
COMPlusThrow(kSecurityException, BFA_ECALLS_MUST_BE_IN_SYS_MOD);
diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h
index 5877f3183d..92d75e3f90 100644
--- a/src/vm/ecalllist.h
+++ b/src/vm/ecalllist.h
@@ -107,16 +107,13 @@ FCFuncStart(gStringFuncs)
FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_Int_Int_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorSBytePtrStartLengthManaged)
FCDynamicSig(COR_CTOR_METHOD_NAME, &gsig_IM_PtrSByt_Int_Int_Encoding_RetVoid, CORINFO_INTRINSIC_Illegal, ECall::CtorSBytePtrStartLengthEncodingManaged)
FCFuncElement("IsFastSort", COMString::IsFastSort)
- FCFuncElement("nativeCompareOrdinalIgnoreCaseWC", COMString::FCCompareOrdinalIgnoreCaseWC)
FCIntrinsic("get_Length", COMString::Length, CORINFO_INTRINSIC_StringLength)
FCIntrinsic("get_Chars", COMString::GetCharAt, CORINFO_INTRINSIC_StringGetChar)
FCFuncElement("IsAscii", COMString::IsAscii)
- FCFuncElement("CompareOrdinalHelper", COMString::CompareOrdinalEx)
#ifdef FEATURE_COMINTEROP
FCFuncElement("SetTrailByte", COMString::FCSetTrailByte)
FCFuncElement("TryGetTrailByte", COMString::FCTryGetTrailByte)
#endif // FEATURE_COMINTEROP
- FCFuncElement("InternalMarvin32HashString", COMString::Marvin32HashString)
FCFuncEnd()
FCFuncStart(gStringBufferFuncs)
@@ -795,23 +792,14 @@ FCFuncStart(gClrConfig)
FCFuncEnd()
#if !defined(FEATURE_COREFX_GLOBALIZATION)
-FCFuncStart(gCompareInfoFuncs)
- QCFuncElement("InternalGetGlobalizedHashCode", COMNlsInfo::InternalGetGlobalizedHashCode)
-FCFuncEnd()
-
FCFuncStart(gEncodingTableFuncs)
FCFuncElement("GetNumEncodingItems", COMNlsInfo::nativeGetNumEncodingItems)
FCFuncElement("GetEncodingData", COMNlsInfo::nativeGetEncodingTableDataPointer)
FCFuncElement("GetCodePageData", COMNlsInfo::nativeGetCodePageTableDataPointer)
+ FCFuncElement("nativeCompareOrdinalIgnoreCaseWC", COMString::FCCompareOrdinalIgnoreCaseWC)
FCFuncEnd()
#endif // !defined(FEATURE_COREFX_GLOBALIZATION)
-#ifdef FEATURE_COREFX_GLOBALIZATION
-FCFuncStart(gCompareInfoFuncs)
- QCFuncElement("InternalHashSortKey", CoreFxGlobalization::HashSortKey)
-FCFuncEnd()
-#endif
-
FCFuncStart(gArrayFuncs)
FCFuncElement("get_Rank", ArrayNative::GetRank)
FCFuncElement("GetLowerBound", ArrayNative::GetLowerBound)
@@ -1288,7 +1276,6 @@ FCClassElement("AssemblyLoadContext", "System.Runtime.Loader", gAssemblyLoadCont
FCClassElement("AssemblyName", "System.Reflection", gAssemblyNameFuncs)
FCClassElement("Buffer", "System", gBufferFuncs)
FCClassElement("CLRConfig", "System", gClrConfig)
-FCClassElement("CompareInfo", "System.Globalization", gCompareInfoFuncs)
FCClassElement("CompatibilitySwitch", "System.Runtime.Versioning", gCompatibilitySwitchFuncs)
FCClassElement("CriticalHandle", "System.Runtime.InteropServices", gCriticalHandleFuncs)
FCClassElement("Currency", "System", gCurrencyFuncs)
@@ -1302,7 +1289,7 @@ FCClassElement("DefaultBinder", "System", gCOMDefaultBinderFuncs)
FCClassElement("Delegate", "System", gDelegateFuncs)
FCClassElement("DependentHandle", "System.Runtime.CompilerServices", gDependentHandleFuncs)
#if !defined(FEATURE_COREFX_GLOBALIZATION)
-FCClassElement("EncodingTable", "System.Globalization", gEncodingTableFuncs)
+FCClassElement("EncodingTable", "System.Text", gEncodingTableFuncs)
#endif // !defined(FEATURE_COREFX_GLOBALIZATION)
FCClassElement("Enum", "System", gEnumFuncs)
FCClassElement("Environment", "System", gEnvironmentFuncs)
diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp
index ab83463256..1b44367e84 100644
--- a/src/vm/eeconfig.cpp
+++ b/src/vm/eeconfig.cpp
@@ -166,7 +166,6 @@ void *EEConfig::operator new(size_t size)
RETURN g_EEConfigMemory;
}
-
/**************************************************************/
HRESULT EEConfig::Init()
{
@@ -393,7 +392,6 @@ HRESULT EEConfig::Init()
// statically link to EEConfig.
CLRConfig::RegisterGetConfigValueCallback(&GetConfigValueCallback);
-
return S_OK;
}
@@ -1240,7 +1238,10 @@ HRESULT EEConfig::sync()
dwSleepOnExit = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_SleepOnExit);
#if defined(FEATURE_TIERED_COMPILATION)
- fTieredCompilation = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_TieredCompilation) != 0;
+ fTieredCompilation = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_TieredCompilation) != 0 ||
+ //this older name is deprecated, but still accepted for a time. Preserving it is a very small overhead not to needlessly break things.
+ CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_LEGACY_TieredCompilation) != 0;
+
tieredCompilation_tier1CallCountThreshold =
CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_TieredCompilation_Tier1CallCountThreshold);
if (tieredCompilation_tier1CallCountThreshold < 1)
diff --git a/src/vm/eepolicy.cpp b/src/vm/eepolicy.cpp
index bdfe0fbf67..e15af92bfc 100644
--- a/src/vm/eepolicy.cpp
+++ b/src/vm/eepolicy.cpp
@@ -1176,7 +1176,7 @@ inline void LogCallstackForLogWorker()
// Return Value:
// None
//
-inline void DoLogForFailFastException(LPCWSTR pszMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, const WCHAR * argExceptionString)
+inline void DoLogForFailFastException(LPCWSTR pszMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, LPCWSTR argExceptionString)
{
WRAPPER_NO_CONTRACT;
@@ -1205,7 +1205,7 @@ inline void DoLogForFailFastException(LPCWSTR pszMessage, PEXCEPTION_POINTERS pE
PrintToStdErrA("\n");
PrintToStdErrA("Exception details:");
PrintToStdErrA("\n");
- PrintToStdErrW(argExceptionString);
+ PrintToStdErrW((WCHAR*)argExceptionString);
PrintToStdErrA("\n");
}
}
@@ -1220,7 +1220,7 @@ inline void DoLogForFailFastException(LPCWSTR pszMessage, PEXCEPTION_POINTERS pE
// Log an error to the event log if possible, then throw up a dialog box.
//
-void EEPolicy::LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, const WCHAR * argExceptionString)
+void EEPolicy::LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, LPCWSTR argExceptionString)
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_TRIGGERS;
@@ -1262,7 +1262,7 @@ void EEPolicy::LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage
else if (exitCode == (UINT)COR_E_CODECONTRACTFAILED)
failureType = EventReporter::ERT_CodeContractFailed;
EventReporter reporter(failureType);
-
+ StackSString s(argExceptionString);
if ((exitCode == (UINT)COR_E_FAILFAST) || (exitCode == (UINT)COR_E_CODECONTRACTFAILED) || (exitCode == (UINT)CLR_E_GC_OOM))
{
@@ -1271,6 +1271,11 @@ void EEPolicy::LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage
reporter.AddDescription((WCHAR*)pszMessage);
}
+ if (argExceptionString)
+ {
+ reporter.AddFailFastStackTrace(s);
+ }
+
if (exitCode != (UINT)CLR_E_GC_OOM)
LogCallstackForEventReporter(reporter);
}
@@ -1486,7 +1491,7 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE
UNREACHABLE();
}
-void DECLSPEC_NORETURN EEPolicy::HandleFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage /* = NULL */, PEXCEPTION_POINTERS pExceptionInfo /* = NULL */, LPCWSTR errorSource /* = NULL */, const WCHAR * argExceptionString /* = NULL */)
+void DECLSPEC_NORETURN EEPolicy::HandleFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage /* = NULL */, PEXCEPTION_POINTERS pExceptionInfo /* = NULL */, LPCWSTR errorSource /* = NULL */, LPCWSTR argExceptionString /* = NULL */)
{
WRAPPER_NO_CONTRACT;
diff --git a/src/vm/eepolicy.h b/src/vm/eepolicy.h
index c41d16bc09..44e0073754 100644
--- a/src/vm/eepolicy.h
+++ b/src/vm/eepolicy.h
@@ -124,7 +124,7 @@ public:
static void HandleExitProcess(ShutdownCompleteAction sca = SCA_ExitProcessWhenShutdownComplete);
- static void DECLSPEC_NORETURN HandleFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pMessage=NULL, PEXCEPTION_POINTERS pExceptionInfo= NULL, LPCWSTR errorSource=NULL, const WCHAR * argExceptionString=NULL);
+ static void DECLSPEC_NORETURN HandleFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pMessage=NULL, PEXCEPTION_POINTERS pExceptionInfo= NULL, LPCWSTR errorSource=NULL, LPCWSTR argExceptionString=NULL);
static void DECLSPEC_NORETURN HandleFatalStackOverflow(EXCEPTION_POINTERS *pException, BOOL fSkipDebugger = FALSE);
@@ -147,7 +147,7 @@ private:
BOOL IsValidActionForFailure(EClrFailure failure, EPolicyAction action);
EPolicyAction GetFinalAction(EPolicyAction action, Thread *pThread);
- static void LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, const WCHAR * argExceptionString=NULL);
+ static void LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pMessage, PEXCEPTION_POINTERS pExceptionInfo, LPCWSTR errorSource, LPCWSTR argExceptionString=NULL);
// IMPORTANT NOTE: only the following two functions should be calling ExitProcessViaShim.
// - CorHost2::ExitProcess
diff --git a/src/vm/eetwain.cpp b/src/vm/eetwain.cpp
index ed76facde3..fcaa010895 100644
--- a/src/vm/eetwain.cpp
+++ b/src/vm/eetwain.cpp
@@ -3851,8 +3851,27 @@ bool UnwindEbpDoubleAlignFrame(
baseSP = curESP;
// Set baseSP as initial SP
baseSP += GetPushedArgSize(info, table, curOffs);
+
// 16-byte stack alignment padding (allocated in genFuncletProlog)
- baseSP += 12;
+ // Current funclet frame layout (see CodeGen::genFuncletProlog() and genFuncletEpilog()):
+ // prolog: sub esp, 12
+ // epilog: add esp, 12
+ // ret
+ // SP alignment padding should be added for all instructions except the first one and the last one.
+ TADDR funcletStart = pCodeInfo->GetJitManager()->GetFuncletStartAddress(pCodeInfo);
+
+ const ULONG32 funcletLastInstSize = 1; // 0xc3, ret
+ BOOL atFuncletLastInst = (pCodeInfo->GetRelOffset() + funcletLastInstSize) >= info->methodSize;
+ if (!atFuncletLastInst)
+ {
+ EECodeInfo nextCodeInfo;
+ nextCodeInfo.Init(pCodeInfo->GetCodeAddress() + funcletLastInstSize);
+ atFuncletLastInst = !nextCodeInfo.IsValid() || !nextCodeInfo.IsFunclet() ||
+ nextCodeInfo.GetJitManager()->GetFuncletStartAddress(&nextCodeInfo) != funcletStart;
+ }
+
+ if (!atFuncletLastInst && funcletStart != pCodeInfo->GetCodeAddress())
+ baseSP += 12;
pContext->PCTAddr = baseSP;
pContext->ControlPC = *PTR_PCODE(pContext->PCTAddr);
diff --git a/src/vm/eventpipe.cpp b/src/vm/eventpipe.cpp
index 910dee5b92..ade5dbcfb1 100644
--- a/src/vm/eventpipe.cpp
+++ b/src/vm/eventpipe.cpp
@@ -9,10 +9,12 @@
#include "eventpipebuffermanager.h"
#include "eventpipeconfiguration.h"
#include "eventpipeevent.h"
+#include "eventpipeeventsource.h"
#include "eventpipefile.h"
#include "eventpipeprovider.h"
#include "eventpipesession.h"
#include "eventpipejsonfile.h"
+#include "eventtracebase.h"
#include "sampleprofiler.h"
#ifdef FEATURE_PAL
@@ -27,6 +29,8 @@ EventPipeConfiguration* EventPipe::s_pConfig = NULL;
EventPipeSession* EventPipe::s_pSession = NULL;
EventPipeBufferManager* EventPipe::s_pBufferManager = NULL;
EventPipeFile* EventPipe::s_pFile = NULL;
+EventPipeEventSource* EventPipe::s_pEventSource = NULL;
+LPCWSTR EventPipe::s_pCommandLine = NULL;
#ifdef _DEBUG
EventPipeFile* EventPipe::s_pSyncFile = NULL;
EventPipeJsonFile* EventPipe::s_pJsonFile = NULL;
@@ -57,7 +61,7 @@ EventPipeEventPayload::EventPipeEventPayload(BYTE *pData, unsigned int length)
m_size = length;
}
-EventPipeEventPayload::EventPipeEventPayload(EventData **pEventData, unsigned int eventDataCount)
+EventPipeEventPayload::EventPipeEventPayload(EventData *pEventData, unsigned int eventDataCount)
{
CONTRACTL
{
@@ -75,7 +79,7 @@ EventPipeEventPayload::EventPipeEventPayload(EventData **pEventData, unsigned in
S_UINT32 tmp_size = S_UINT32(0);
for (unsigned int i=0; i<m_eventDataCount; i++)
{
- tmp_size += S_UINT32((*m_pEventData)[i].Size);
+ tmp_size += S_UINT32(m_pEventData[i].Size);
}
if (tmp_size.IsOverflow())
@@ -155,8 +159,8 @@ void EventPipeEventPayload::CopyData(BYTE *pDst)
unsigned int offset = 0;
for(unsigned int i=0; i<m_eventDataCount; i++)
{
- memcpy(pDst + offset, (BYTE*)(*m_pEventData)[i].Ptr, (*m_pEventData)[i].Size);
- offset += (*m_pEventData)[i].Size;
+ memcpy(pDst + offset, (BYTE*) m_pEventData[i].Ptr, m_pEventData[i].Size);
+ offset += m_pEventData[i].Size;
}
}
}
@@ -192,6 +196,8 @@ void EventPipe::Initialize()
s_pBufferManager = new EventPipeBufferManager();
+ s_pEventSource = new EventPipeEventSource();
+
// This calls into auto-generated code to initialize the runtime providers
// and events so that the EventPipe configuration lock isn't taken at runtime
InitProvidersAndEvents();
@@ -258,9 +264,18 @@ void EventPipe::Shutdown()
s_pBufferManager = NULL;
FlushProcessWriteBuffers();
- // Free the configuration and buffer manager.
+ // Free resources.
delete(pConfig);
delete(pBufferManager);
+ delete(s_pEventSource);
+ s_pEventSource = NULL;
+
+ // On Windows, this is just a pointer to the return value from
+ // GetCommandLineW(), so don't attempt to free it.
+#ifdef FEATURE_PAL
+ delete[](s_pCommandLine);
+ s_pCommandLine = NULL;
+#endif
}
void EventPipe::Enable(
@@ -307,6 +322,9 @@ void EventPipe::Enable(LPCWSTR strOutputPath, EventPipeSession *pSession)
return;
}
+ // Enable the EventPipe EventSource.
+ s_pEventSource->Enable(pSession);
+
// Take the lock before enabling tracing.
CrstHolder _crst(GetLock());
@@ -360,6 +378,12 @@ void EventPipe::Disable()
// Disable the profiler.
SampleProfiler::Disable();
+ // Log the process information event.
+ s_pEventSource->SendProcessInfo(s_pCommandLine);
+
+ // Log the runtime information event.
+ ETW::InfoLog::RuntimeInformation(ETW::InfoLog::InfoStructs::Normal);
+
// Disable tracing.
s_pConfig->Disable(s_pSession);
@@ -447,7 +471,7 @@ EventPipeProvider* EventPipe::CreateProvider(const SString &providerName, EventP
CONTRACTL
{
THROWS;
- GC_TRIGGERS;
+ GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
@@ -509,7 +533,7 @@ void EventPipe::WriteEvent(EventPipeEvent &event, BYTE *pData, unsigned int leng
EventPipe::WriteEventInternal(event, payload, pActivityId, pRelatedActivityId);
}
-void EventPipe::WriteEvent(EventPipeEvent &event, EventData **pEventData, unsigned int eventDataCount, LPCGUID pActivityId, LPCGUID pRelatedActivityId)
+void EventPipe::WriteEvent(EventPipeEvent &event, EventData *pEventData, unsigned int eventDataCount, LPCGUID pActivityId, LPCGUID pRelatedActivityId)
{
CONTRACTL
{
@@ -901,6 +925,47 @@ void EventPipe::GetConfigurationFromEnvironment(SString &outputPath, EventPipeSe
}
}
+void EventPipe::SaveCommandLine(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR *argv)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_TRIGGERS;
+ MODE_COOPERATIVE;
+ PRECONDITION(pwzAssemblyPath != NULL);
+ PRECONDITION(argc <= 0 || argv != NULL);
+ }
+ CONTRACTL_END;
+
+ // Get the command line.
+ LPCWSTR osCommandLine = GetCommandLineW();
+
+#ifndef FEATURE_PAL
+ // On Windows, osCommandLine contains the executable and all arguments.
+ s_pCommandLine = osCommandLine;
+#else
+ // On UNIX, the PAL doesn't have the command line arguments, so we must build the command line.
+ // osCommandLine contains the full path to the executable.
+ SString commandLine(osCommandLine);
+ commandLine.Append((WCHAR)' ');
+ commandLine.Append(pwzAssemblyPath);
+
+ for(int i=0; i<argc; i++)
+ {
+ commandLine.Append((WCHAR)' ');
+ commandLine.Append(argv[i]);
+ }
+
+ // Allocate a new string for the command line.
+ SIZE_T commandLineLen = commandLine.GetCount();
+ WCHAR *pCommandLine = new WCHAR[commandLineLen + 1];
+ wcsncpy(pCommandLine, commandLine.GetUnicode(), commandLineLen);
+ pCommandLine[commandLineLen] = '\0';
+
+ s_pCommandLine = pCommandLine;
+#endif
+}
+
void QCALLTYPE EventPipeInternal::Enable(
__in_z LPCWSTR outputFile,
UINT32 circularBufferSizeInMB,
@@ -1064,7 +1129,7 @@ void QCALLTYPE EventPipeInternal::WriteEvent(
void QCALLTYPE EventPipeInternal::WriteEventData(
INT_PTR eventHandle,
UINT32 eventID,
- EventData **pEventData,
+ EventData *pEventData,
UINT32 eventDataCount,
LPCGUID pActivityId,
LPCGUID pRelatedActivityId)
diff --git a/src/vm/eventpipe.h b/src/vm/eventpipe.h
index 907e0d7778..2becb5c0b8 100644
--- a/src/vm/eventpipe.h
+++ b/src/vm/eventpipe.h
@@ -16,6 +16,7 @@ class EventPipeFile;
class EventPipeJsonFile;
class EventPipeBuffer;
class EventPipeBufferManager;
+class EventPipeEventSource;
class EventPipeProvider;
class MethodDesc;
class SampleProfilerEventInstance;
@@ -35,7 +36,7 @@ typedef void (*EventPipeCallback)(
struct EventData
{
public:
- unsigned long Ptr;
+ UINT64 Ptr;
unsigned int Size;
unsigned int Reserved;
};
@@ -44,7 +45,7 @@ class EventPipeEventPayload
{
private:
BYTE *m_pData;
- EventData **m_pEventData;
+ EventData *m_pEventData;
unsigned int m_eventDataCount;
unsigned int m_size;
bool m_allocatedData;
@@ -57,7 +58,7 @@ public:
EventPipeEventPayload(BYTE *pData, unsigned int length);
// Build this payload to contain an array of EventData objects
- EventPipeEventPayload(EventData **pEventData, unsigned int eventDataCount);
+ EventPipeEventPayload(EventData *pEventData, unsigned int eventDataCount);
// If a buffer was allocated internally, delete it
~EventPipeEventPayload();
@@ -87,7 +88,7 @@ public:
return m_size;
}
- EventData** GetEventDataArray() const
+ EventData* GetEventDataArray() const
{
LIMITED_METHOD_CONTRACT;
@@ -258,7 +259,7 @@ class EventPipe
// Write out an event from an EventData array.
// Data is written as a serialized blob matching the ETW serialization conventions.
- static void WriteEvent(EventPipeEvent &event, EventData **pEventData, unsigned int eventDataCount, LPCGUID pActivityId = NULL, LPCGUID pRelatedActivityId = NULL);
+ static void WriteEvent(EventPipeEvent &event, EventData *pEventData, unsigned int eventDataCount, LPCGUID pActivityId = NULL, LPCGUID pRelatedActivityId = NULL);
// Write out a sample profile event.
static void WriteSampleProfileEvent(Thread *pSamplingThread, EventPipeEvent *pEvent, Thread *pTargetThread, StackContents &stackContents, BYTE *pData = NULL, unsigned int length = 0);
@@ -269,6 +270,9 @@ class EventPipe
// Get the managed call stack for the specified thread.
static bool WalkManagedStackForThread(Thread *pThread, StackContents &stackContents);
+ // Save the command line for the current process.
+ static void SaveCommandLine(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR *argv);
+
protected:
// The counterpart to WriteEvent which after the payload is constructed
@@ -299,6 +303,8 @@ class EventPipe
static EventPipeSession *s_pSession;
static EventPipeBufferManager *s_pBufferManager;
static EventPipeFile *s_pFile;
+ static EventPipeEventSource *s_pEventSource;
+ static LPCWSTR s_pCommandLine;
#ifdef _DEBUG
static EventPipeFile *s_pSyncFile;
static EventPipeJsonFile *s_pJsonFile;
@@ -408,7 +414,7 @@ public:
static void QCALLTYPE WriteEventData(
INT_PTR eventHandle,
UINT32 eventID,
- EventData **pEventData,
+ EventData *pEventData,
UINT32 eventDataCount,
LPCGUID pActivityId, LPCGUID pRelatedActivityId);
};
diff --git a/src/vm/eventpipeeventsource.cpp b/src/vm/eventpipeeventsource.cpp
new file mode 100644
index 0000000000..1a5cf2a3f3
--- /dev/null
+++ b/src/vm/eventpipeeventsource.cpp
@@ -0,0 +1,118 @@
+// 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.
+
+#include "common.h"
+#include "eventpipeeventsource.h"
+#include "eventpipe.h"
+#include "eventpipeevent.h"
+#include "eventpipemetadatagenerator.h"
+#include "eventpipeprovider.h"
+#include "eventpipesession.h"
+
+#ifdef FEATURE_PERFTRACING
+
+const WCHAR* EventPipeEventSource::s_pProviderName = W("Microsoft-DotNETCore-EventPipe");
+const WCHAR* EventPipeEventSource::s_pProcessInfoEventName = W("ProcessInfo");
+
+EventPipeEventSource::EventPipeEventSource()
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ m_pProvider = EventPipe::CreateProvider(SL(s_pProviderName), NULL, NULL);
+
+ // Generate metadata.
+ const unsigned int numParams = 1;
+ EventPipeParameterDesc params[numParams];
+ params[0].Type = EventPipeParameterType::String;
+ params[0].Name = W("CommandLine");
+
+ size_t metadataLength = 0;
+ BYTE *pMetadata = EventPipeMetadataGenerator::GenerateEventMetadata(
+ 1, /* eventID */
+ s_pProcessInfoEventName,
+ 0, /* keywords */
+ 0, /* version */
+ EventPipeEventLevel::LogAlways,
+ params,
+ numParams,
+ metadataLength);
+
+ // Add the event.
+ m_pProcessInfoEvent = m_pProvider->AddEvent(
+ 1, /* eventID */
+ 0, /* keywords */
+ 0, /* eventVersion */
+ EventPipeEventLevel::LogAlways,
+ pMetadata,
+ (unsigned int)metadataLength);
+
+ // Delete the metadata after the event is created.
+ // The metadata blob will be copied into EventPipe-owned memory.
+ delete(pMetadata);
+}
+
+EventPipeEventSource::~EventPipeEventSource()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_TRIGGERS;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ // Delete the provider and associated events.
+ // This is called in the shutdown path which can't throw.
+ // Catch exceptions and ignore failures.
+ EX_TRY
+ {
+ EventPipe::DeleteProvider(m_pProvider);
+ }
+ EX_CATCH { }
+ EX_END_CATCH(SwallowAllExceptions);
+}
+
+void EventPipeEventSource::Enable(EventPipeSession *pSession)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_TRIGGERS;
+ MODE_ANY;
+ PRECONDITION(pSession != NULL);
+ }
+ CONTRACTL_END;
+
+ EventPipeSessionProvider *pSessionProvider = new EventPipeSessionProvider(
+ s_pProviderName,
+ -1,
+ EventPipeEventLevel::LogAlways);
+ pSession->AddSessionProvider(pSessionProvider);
+}
+
+void EventPipeEventSource::SendProcessInfo(LPCWSTR pCommandLine)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ EventData data[1];
+ data[0].Ptr = (UINT64) pCommandLine;
+ data[0].Size = (unsigned int)(wcslen(pCommandLine) + 1) * 2;
+ data[0].Reserved = 0;
+
+ EventPipe::WriteEvent(*m_pProcessInfoEvent, data, 1);
+}
+
+#endif // FEATURE_PERFTRACING
diff --git a/src/vm/eventpipeeventsource.h b/src/vm/eventpipeeventsource.h
new file mode 100644
index 0000000000..67adb43e81
--- /dev/null
+++ b/src/vm/eventpipeeventsource.h
@@ -0,0 +1,33 @@
+// 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.
+
+#ifndef __EVENTPIPE_EVENTSOURCE_H__
+#define __EVENTPIPE_EVENTSOURCE_H__
+
+#ifdef FEATURE_PERFTRACING
+
+class EventPipeProvider;
+class EventPipeEvent;
+class EventPipeSession;
+
+class EventPipeEventSource
+{
+private:
+ const static WCHAR* s_pProviderName;
+ EventPipeProvider *m_pProvider;
+
+ const static WCHAR* s_pProcessInfoEventName;
+ EventPipeEvent *m_pProcessInfoEvent;
+
+public:
+ EventPipeEventSource();
+ ~EventPipeEventSource();
+
+ void Enable(EventPipeSession *pSession);
+ void SendProcessInfo(LPCWSTR pCommandLine);
+};
+
+#endif // FEATURE_PERFTRACING
+
+#endif // __EVENTPIPE_EVENTSOURCE_H__
diff --git a/src/vm/eventpipefile.cpp b/src/vm/eventpipefile.cpp
index 3346ee54a5..907a5dc7bd 100644
--- a/src/vm/eventpipefile.cpp
+++ b/src/vm/eventpipefile.cpp
@@ -51,13 +51,17 @@ EventPipeFile::EventPipeFile(
m_samplingRateInNs = SampleProfiler::GetSamplingRate();
- m_pSerializer = new FastSerializer(outputFilePath); // it creates the file stream and writes the header
+ // Create the file stream and write the header.
+ m_pSerializer = new FastSerializer(outputFilePath);
+
m_serializationLock.Init(LOCK_TYPE_DEFAULT);
m_pMetadataIds = new MapSHashWithRemove<EventPipeEvent*, unsigned int>();
- m_metadataIdCounter = 0; // we start with 0, it's always gets incremented by generator so the first id will be 1, as specified in the docs
+ // Start and 0 - The value is always incremented prior to use, so the first ID will be 1.
+ m_metadataIdCounter = 0;
- m_pSerializer->WriteObject(this); // this is the first object in the file
+ // Write the first object to the file.
+ m_pSerializer->WriteObject(this);
}
EventPipeFile::~EventPipeFile()
diff --git a/src/vm/eventpipemetadatagenerator.cpp b/src/vm/eventpipemetadatagenerator.cpp
new file mode 100644
index 0000000000..3b17e41868
--- /dev/null
+++ b/src/vm/eventpipemetadatagenerator.cpp
@@ -0,0 +1,97 @@
+// 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.
+
+#include "common.h"
+#include "eventpipemetadatagenerator.h"
+#include "eventpipe.h"
+
+#ifdef FEATURE_PERFTRACING
+
+BYTE* EventPipeMetadataGenerator::GenerateEventMetadata(
+ unsigned int eventID,
+ LPCWSTR pEventName,
+ INT64 keywords,
+ unsigned int version,
+ EventPipeEventLevel level,
+ EventPipeParameterDesc *pParams,
+ unsigned int paramCount,
+ size_t &metadataLength)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ PRECONDITION(pEventName != NULL);
+ PRECONDITION(paramCount == 0 || pParams != NULL);
+ }
+ CONTRACTL_END;
+
+ // eventID : 4 bytes
+ // eventName : (eventName.Length + 1) * 2 bytes
+ // keywords : 8 bytes
+ // eventVersion : 4 bytes
+ // level : 4 bytes
+ // parameterCount : 4 bytes
+ size_t eventNameLength = wcslen(pEventName);
+ metadataLength = 24 + ((eventNameLength + 1) * sizeof(WCHAR));
+
+ // Each parameter has a 4 byte TypeCode + (parameterName.Length + 1) * 2 bytes.
+ for(unsigned int i=0; i<paramCount; i++)
+ {
+ _ASSERTE(pParams[i].Name != NULL);
+
+ metadataLength += (4 + ((wcslen(pParams[i].Name) + 1) * sizeof(WCHAR)));
+ }
+
+ // Allocate a metadata blob.
+ BYTE *pMetadata = new BYTE[metadataLength];
+ BYTE *pCurrent = pMetadata;
+
+ // Write the event ID.
+ *((unsigned int *)pCurrent) = eventID;
+ pCurrent += sizeof(unsigned int);
+
+ // Write the event name.
+ wcsncpy((WCHAR *)pCurrent, pEventName, eventNameLength);
+ pCurrent += eventNameLength * sizeof(WCHAR);
+ *((WCHAR *)pCurrent) = W('\0');
+ pCurrent += sizeof(WCHAR);
+
+ // Write the keywords.
+ *((INT64 *)pCurrent) = keywords;
+ pCurrent += sizeof(INT64);
+
+ // Write the version.
+ *((unsigned int *)pCurrent) = version;
+ pCurrent += sizeof(unsigned int);
+
+ // Write the level.
+ *((unsigned int *)pCurrent) = (unsigned int)level;
+ pCurrent += sizeof(unsigned int);
+
+ // Write the parameter count.
+ *((unsigned int *)pCurrent) = paramCount;
+ pCurrent += sizeof(unsigned int);
+
+ // Write the parameter descriptions.
+ for(unsigned int i=0; i<paramCount; i++)
+ {
+ EventPipeParameterDesc *pParam = &pParams[i];
+ *((unsigned int *)pCurrent) = (unsigned int)pParam->Type;
+ pCurrent += sizeof(unsigned int);
+
+ size_t parameterNameLength = wcslen(pParam->Name);
+ wcsncpy((WCHAR *)pCurrent, pParam->Name, parameterNameLength);
+ pCurrent += parameterNameLength * sizeof(WCHAR);
+ *((WCHAR *)pCurrent) = W('\0');
+ pCurrent += sizeof(WCHAR);
+ }
+
+ _ASSERTE(metadataLength == (pCurrent - pMetadata));
+
+ return pMetadata;
+}
+
+#endif // FEATURE_PERFTRACING
diff --git a/src/vm/eventpipemetadatagenerator.h b/src/vm/eventpipemetadatagenerator.h
new file mode 100644
index 0000000000..2886fcefd3
--- /dev/null
+++ b/src/vm/eventpipemetadatagenerator.h
@@ -0,0 +1,63 @@
+// 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.
+
+#ifndef __EVENTPIPE_METADATAGENERATOR_H__
+#define __EVENTPIPE_METADATAGENERATOR_H__
+
+#ifdef FEATURE_PERFTRACING
+
+enum class EventPipeEventLevel;
+
+// Represents the type of an event parameter.
+// This enum is derived from the managed TypeCode type, though
+// not all of these values are available in TypeCode.
+// For example, Guid does not exist in TypeCode.
+enum class EventPipeParameterType
+{
+ Empty = 0, // Null reference
+ Object = 1, // Instance that isn't a value
+ DBNull = 2, // Database null value
+ Boolean = 3, // Boolean
+ Char = 4, // Unicode character
+ SByte = 5, // Signed 8-bit integer
+ Byte = 6, // Unsigned 8-bit integer
+ Int16 = 7, // Signed 16-bit integer
+ UInt16 = 8, // Unsigned 16-bit integer
+ Int32 = 9, // Signed 32-bit integer
+ UInt32 = 10, // Unsigned 32-bit integer
+ Int64 = 11, // Signed 64-bit integer
+ UInt64 = 12, // Unsigned 64-bit integer
+ Single = 13, // IEEE 32-bit float
+ Double = 14, // IEEE 64-bit double
+ Decimal = 15, // Decimal
+ DateTime = 16, // DateTime
+ Guid = 17, // Guid
+ String = 18, // Unicode character string
+};
+
+// Contains the metadata associated with an EventPipe event parameter.
+struct EventPipeParameterDesc
+{
+ EventPipeParameterType Type;
+ LPCWSTR Name;
+};
+
+// Generates metadata for an event emitted by the EventPipe.
+class EventPipeMetadataGenerator
+{
+public:
+ static BYTE* GenerateEventMetadata(
+ unsigned int eventID,
+ LPCWSTR pEventName,
+ INT64 keywords,
+ unsigned int version,
+ EventPipeEventLevel level,
+ EventPipeParameterDesc *pParams,
+ unsigned int paramCount,
+ size_t &metadataLength);
+};
+
+#endif // FEATURE_PERFTRACING
+
+#endif // __EVENTPIPE_METADATAGENERATOR_H__
diff --git a/src/vm/eventreporter.cpp b/src/vm/eventreporter.cpp
index c73af36b55..74362802dc 100644
--- a/src/vm/eventreporter.cpp
+++ b/src/vm/eventreporter.cpp
@@ -345,6 +345,41 @@ void EventReporter::AddStackTrace(SString& s)
//---------------------------------------------------------------------------------------
//
+// Add the stack trace of exception passed to managed FailFast call (Environment.FailFast()) to Event Log
+//
+// Arguments:
+// s - String representation of the stack trace of argument exception
+//
+// Return Value:
+// None.
+//
+void EventReporter::AddFailFastStackTrace(SString& s)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ SO_INTOLERANT;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ _ASSERTE(m_eventType == ERT_ManagedFailFast);
+ InlineSString<80> ssMessage;
+ if (!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_UNHANDLEDEXCEPTION))
+ {
+ m_Description.Append(W("Exception stack:\n"));
+ }
+ else
+ {
+ m_Description.Append(ssMessage);
+ }
+ m_Description.Append(s);
+ m_Description.Append(W("\n"));
+}
+
+//---------------------------------------------------------------------------------------
+//
// Generate an entry in EventLog.
//
// Arguments:
@@ -448,7 +483,6 @@ BOOL ShouldLogInEventLog()
}
CONTRACTL_END;
-#ifndef FEATURE_CORESYSTEM
// If the process is being debugged, don't log
if ((CORDebuggerAttached() || IsDebuggerPresent())
#ifdef _DEBUG
@@ -471,10 +505,6 @@ BOOL ShouldLogInEventLog()
return FALSE;
else
return TRUE;
-#else
- // no event log on Apollo
- return FALSE;
-#endif //!FEATURE_CORESYSTEM
}
//---------------------------------------------------------------------------------------
@@ -645,7 +675,7 @@ void ReportExceptionStackHelper(OBJECTREF exObj, EventReporter& reporter, SmallS
//---------------------------------------------------------------------------------------
//
-// Generate an EventLog entry for unhandled exception.
+// Generate an EventLog entry for unhandled exceptions that are not sent to DefaultCatchHandler.
//
// Arguments:
// pExceptionInfo - Exception information
@@ -653,10 +683,10 @@ void ReportExceptionStackHelper(OBJECTREF exObj, EventReporter& reporter, SmallS
// Return Value:
// None
//
-void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
+void DoReportForUnhandledNativeException(PEXCEPTION_POINTERS pExceptionInfo)
{
WRAPPER_NO_CONTRACT;
-
+
if (ShouldLogInEventLog())
{
Thread *pThread = GetThread();
@@ -664,107 +694,21 @@ void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
EX_TRY
{
StackSString s;
- if (pThread && pThread->HasException() != NULL)
- {
- GCX_COOP();
- struct
- {
- OBJECTREF throwable;
- STRINGREF originalExceptionMessage;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
-
- gc.throwable = pThread->GetThrowable();
- _ASSERTE(gc.throwable != NULL);
-
- // On CoreCLR, managed code execution happens in non-default AppDomains and all threads have an AD transition
- // at their base from DefaultDomain to the target Domain before they start executing managed code. Thus, when
- // an exception goes unhandled in a non-default AppDomain on a reverse pinvoke thread, the original exception details are copied
- // to the Message property of System.CrossAppDomainMarshaledException instance at the AD transition boundary,
- // and the exception is then thrown in the calling AppDomain. This is done since CoreCLR does not support marshaling of
- // objects across AppDomains.
- //
- // On SL, exceptions dont go unhandled to the OS. But in WLC, they can. Thus, when the scenario above happens for WLC,
- // the OS will invoke CoreCLR's registered UEF and reach here to write the stacktrace from the
- // exception object (which will be a CrossAppDomainMarshaledException instance) to the event log. At this point,
- // we shall be in DefaultDomain.
- //
- // However, the original exception details are in the Message property of CrossAppDomainMarshaledException. So, we should
- // look that up and if it is not empty, add those details to the EventReporter so that they get written to the
- // event log as well.
- //
- // We can also be here when in non-DefaultDomain an exception goes unhandled on a pure managed thread. In such a case,
- // we wont have CrossAppDomainMarshaledException instance but the original exception object that will be used to extract
- // the stack trace from.
- if (pThread->GetDomain()->IsDefaultDomain())
- {
- if (IsExceptionOfType(kCrossAppDomainMarshaledException, &(gc.throwable)))
- {
- // This is a CrossAppDomainMarshaledException instance - check if it has
- // something for us in the Message property.
- gc.originalExceptionMessage = ((EXCEPTIONREF)gc.throwable)->GetMessage();
- if (gc.originalExceptionMessage != NULL)
- {
- // Ok - so, we have details about the original exception. Add them to the
- // EventReporter object so that they get written to the event log.
- reporter.AddDescription(gc.originalExceptionMessage->GetBuffer());
-
- LOG((LF_EH, LL_INFO100, "DoReportForUnhandledException - Added original exception details to EventReporter from CrossAppDomainMarshaledException object.\n"));
- }
- else
- {
- LOG((LF_EH, LL_INFO100, "DoReportForUnhandledException - Original exception details not present in CrossAppDomainMarshaledException object.\n"));
- }
- }
- }
- else
- {
- if (IsException(gc.throwable->GetMethodTable()))
- {
- SmallStackSString wordAt;
- if (!wordAt.LoadResource(CCompRC::Optional, IDS_ER_WORDAT))
- {
- wordAt.Set(W(" at"));
- }
- else
- {
- wordAt.Insert(wordAt.Begin(), W(" "));
- }
- wordAt += W(" ");
-
- ReportExceptionStackHelper(gc.throwable, reporter, wordAt, /* recursionLimit = */10);
- }
- else
- {
- TypeString::AppendType(s, TypeHandle(gc.throwable->GetMethodTable()), TypeString::FormatNamespace | TypeString::FormatFullInst);
- reporter.AddDescription(s);
- reporter.BeginStackTrace();
- LogCallstackForEventReporterWorker(reporter);
- }
- }
-
- GCPROTECT_END();
- }
- else
- {
- InlineSString<80> ssErrorFormat;
- if(!ssErrorFormat.LoadResource(CCompRC::Optional, IDS_ER_UNHANDLEDEXCEPTIONINFO))
- ssErrorFormat.Set(W("exception code %1, exception address %2"));
- SmallStackSString exceptionCodeString;
- exceptionCodeString.Printf(W("%x"), pExceptionInfo->ExceptionRecord->ExceptionCode);
- SmallStackSString addressString;
- addressString.Printf(W("%p"), (UINT_PTR)pExceptionInfo->ExceptionRecord->ExceptionAddress);
- s.FormatMessage(FORMAT_MESSAGE_FROM_STRING, (LPCWSTR)ssErrorFormat, 0, 0, exceptionCodeString, addressString);
- reporter.AddDescription(s);
- if (pThread)
- {
- LogCallstackForEventReporter(reporter);
- }
- }
+ InlineSString<80> ssErrorFormat;
+ if (!ssErrorFormat.LoadResource(CCompRC::Optional, IDS_ER_UNHANDLEDEXCEPTIONINFO))
+ ssErrorFormat.Set(W("exception code %1, exception address %2"));
+ SmallStackSString exceptionCodeString;
+ exceptionCodeString.Printf(W("%x"), pExceptionInfo->ExceptionRecord->ExceptionCode);
+ SmallStackSString addressString;
+ addressString.Printf(W("%p"), (UINT_PTR)pExceptionInfo->ExceptionRecord->ExceptionAddress);
+ s.FormatMessage(FORMAT_MESSAGE_FROM_STRING, (LPCWSTR)ssErrorFormat, 0, 0, exceptionCodeString, addressString);
+ reporter.AddDescription(s);
+ if (pThread)
+ {
+ LogCallstackForEventReporter(reporter);
+ }
}
- EX_CATCH
+ EX_CATCH
{
// We are reporting an exception. If we throw while working on this, it is not fatal.
}
diff --git a/src/vm/eventreporter.h b/src/vm/eventreporter.h
index 54317133dd..abd35befc4 100644
--- a/src/vm/eventreporter.h
+++ b/src/vm/eventreporter.h
@@ -61,6 +61,8 @@ public:
void BeginStackTrace();
// Add one frame to the callstack part
void AddStackTrace(SString& s);
+ // Add failfast stack trace
+ void AddFailFastStackTrace(SString& s);
// Report to the EventLog
void Report();
};
@@ -69,7 +71,8 @@ public:
BOOL ShouldLogInEventLog();
// Record managed callstack in EventReporter.
void LogCallstackForEventReporter(EventReporter& reporter);
-// Generate a report in EventLog for unhandled exception for both managed and unmanaged.
-void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo);
-
+// Record unhandled native exceptions.
+void DoReportForUnhandledNativeException(PEXCEPTION_POINTERS pExceptionInfo);
+// Helper method for logging stack trace in EventReporter
+void ReportExceptionStackHelper(OBJECTREF exObj, EventReporter& reporter, SmallStackSString& wordAt, int recursionLimit);
#endif // _eventreporter_h_
diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp
index 09283f7839..3ba3d05a82 100644
--- a/src/vm/excep.cpp
+++ b/src/vm/excep.cpp
@@ -28,6 +28,7 @@
#include "shimload.h"
#include "eeconfig.h"
#include "virtualcallstub.h"
+#include "typestring.h"
#ifndef FEATURE_PAL
#include "dwreport.h"
@@ -5234,10 +5235,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
#endif // DEBUGGING_SUPPORTED
-#if defined(FEATURE_EVENT_TRACE) && !defined(FEATURE_PAL)
- DoReportForUnhandledException(pParam->pExceptionInfo);
-#endif // FEATURE_EVENT_TRACE
-
//
// Except for notifying debugger, ignore exception if unmanaged, or
// if it's a debugger-generated exception or user breakpoint exception.
@@ -5245,6 +5242,9 @@ LONG InternalUnhandledExceptionFilter_Worker(
if (tore.GetType() == TypeOfReportedError::NativeThreadUnhandledException)
{
pParam->retval = EXCEPTION_CONTINUE_SEARCH;
+#if defined(FEATURE_EVENT_TRACE) && !defined(FEATURE_PAL)
+ DoReportForUnhandledNativeException(pParam->pExceptionInfo);
+#endif
goto lDone;
}
@@ -5252,15 +5252,17 @@ LONG InternalUnhandledExceptionFilter_Worker(
{
LOG((LF_EH, LL_INFO100, "InternalUnhandledExceptionFilter_Worker, ignoring the exception\n"));
pParam->retval = EXCEPTION_CONTINUE_SEARCH;
+#if defined(FEATURE_EVENT_TRACE) && !defined(FEATURE_PAL)
+ DoReportForUnhandledNativeException(pParam->pExceptionInfo);
+#endif
goto lDone;
}
LOG((LF_EH, LL_INFO100, "InternalUnhandledExceptionFilter_Worker: Calling DefaultCatchHandler\n"));
-
// Call our default catch handler to do the managed unhandled exception work.
DefaultCatchHandler(pParam->pExceptionInfo, NULL, useLastThrownObject,
- TRUE /*isTerminating*/, FALSE /*isThreadBaseFIlter*/, FALSE /*sendAppDomainEvents*/);
+ TRUE /*isTerminating*/, FALSE /*isThreadBaseFIlter*/, FALSE /*sendAppDomainEvents*/, TRUE /* sendWindowsEventLog */);
lDone: ;
}
@@ -5510,8 +5512,10 @@ void STDMETHODCALLTYPE
DefaultCatchHandlerExceptionMessageWorker(Thread* pThread,
OBJECTREF throwable,
__inout_ecount(buf_size) WCHAR *buf,
- const int buf_size)
+ const int buf_size,
+ BOOL sendWindowsEventLog)
{
+ GCPROTECT_BEGIN(throwable);
if (throwable != NULL)
{
PrintToStdErrA("\n");
@@ -5532,7 +5536,39 @@ DefaultCatchHandlerExceptionMessageWorker(Thread* pThread,
}
PrintToStdErrA("\n");
+
+#if defined(FEATURE_EVENT_TRACE) && !defined(FEATURE_PAL)
+ // Send the log to Windows Event Log
+ if (sendWindowsEventLog && ShouldLogInEventLog())
+ {
+ EX_TRY
+ {
+ EventReporter reporter(EventReporter::ERT_UnhandledException);
+
+ if (IsException(throwable->GetMethodTable()))
+ {
+ if (!message.IsEmpty())
+ {
+ reporter.AddDescription(message);
+ }
+ reporter.Report();
+ }
+ else
+ {
+ StackSString s;
+ TypeString::AppendType(s, TypeHandle(throwable->GetMethodTable()), TypeString::FormatNamespace | TypeString::FormatFullInst);
+ reporter.AddDescription(s);
+ LogCallstackForEventReporter(reporter);
+ }
+ }
+ EX_CATCH
+ {
+ }
+ EX_END_CATCH(SwallowAllExceptions);
+ }
+#endif
}
+ GCPROTECT_END();
}
//******************************************************************************
@@ -5544,7 +5580,8 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
BOOL useLastThrownObject,
BOOL isTerminating,
BOOL isThreadBaseFilter,
- BOOL sendAppDomainEvents)
+ BOOL sendAppDomainEvents,
+ BOOL sendWindowsEventLog)
{
CONTRACTL
{
@@ -5724,7 +5761,7 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
{
// this is stack heavy because of the CQuickWSTRBase, so we break it out
// and don't have to carry the weight through our other code paths.
- DefaultCatchHandlerExceptionMessageWorker(pThread, throwable, buf, buf_size);
+ DefaultCatchHandlerExceptionMessageWorker(pThread, throwable, buf, buf_size, sendWindowsEventLog);
}
}
EX_CATCH
diff --git a/src/vm/excep.h b/src/vm/excep.h
index 4261c3cff3..6df9a98452 100644
--- a/src/vm/excep.h
+++ b/src/vm/excep.h
@@ -241,7 +241,8 @@ void STDMETHODCALLTYPE DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionInfo,
BOOL useLastThrownObject = FALSE,
BOOL isTerminating = FALSE,
BOOL isThreadBaseFilter = FALSE,
- BOOL sendAppDomainEvents = TRUE);
+ BOOL sendAppDomainEvents = TRUE,
+ BOOL sendWindowsEventLog = FALSE);
void ReplaceExceptionContextRecord(T_CONTEXT *pTarget, T_CONTEXT *pSource);
diff --git a/src/vm/gcenv.os.cpp b/src/vm/gcenv.os.cpp
index 8d8630ec62..70dc2619dd 100644
--- a/src/vm/gcenv.os.cpp
+++ b/src/vm/gcenv.os.cpp
@@ -409,11 +409,14 @@ size_t GCToOSInterface::GetVirtualMemoryLimit()
return (size_t)memStatus.ullTotalVirtual;
}
-
static size_t g_RestrictedPhysicalMemoryLimit = (size_t)MAX_PTR;
#ifndef FEATURE_PAL
+// For 32-bit processes the virtual address range could be smaller than the amount of physical
+// memory on the machine/in the container, we need to restrict by the VM.
+static bool g_UseRestrictedVirtualMemory = false;
+
typedef BOOL (WINAPI *PGET_PROCESS_MEMORY_INFO)(HANDLE handle, PROCESS_MEMORY_COUNTERS* memCounters, uint32_t cb);
static PGET_PROCESS_MEMORY_INFO GCGetProcessMemoryInfo = 0;
@@ -429,6 +432,8 @@ static size_t GetRestrictedPhysicalMemoryLimit()
return g_RestrictedPhysicalMemoryLimit;
size_t job_physical_memory_limit = (size_t)MAX_PTR;
+ uint64_t total_virtual = 0;
+ uint64_t total_physical = 0;
BOOL in_job_p = FALSE;
HINSTANCE hinstKernel32 = 0;
@@ -487,6 +492,8 @@ static size_t GetRestrictedPhysicalMemoryLimit()
MEMORYSTATUSEX ms;
::GetProcessMemoryLoad(&ms);
+ total_virtual = ms.ullTotalVirtual;
+ total_physical = ms.ullAvailPhys;
// A sanity check in case someone set a larger limit than there is actual physical memory.
job_physical_memory_limit = (size_t) min (job_physical_memory_limit, ms.ullTotalPhys);
@@ -498,7 +505,40 @@ exit:
{
job_physical_memory_limit = 0;
- FreeLibrary(hinstKernel32);
+ if (hinstKernel32 != 0)
+ {
+ FreeLibrary(hinstKernel32);
+ hinstKernel32 = 0;
+ GCGetProcessMemoryInfo = 0;
+ }
+ }
+
+ // Check to see if we are limited by VM.
+ if (total_virtual == 0)
+ {
+ MEMORYSTATUSEX ms;
+ ::GetProcessMemoryLoad(&ms);
+
+ total_virtual = ms.ullTotalVirtual;
+ total_physical = ms.ullTotalPhys;
+ }
+
+ if (job_physical_memory_limit != 0)
+ {
+ total_physical = job_physical_memory_limit;
+ }
+
+ if (total_virtual < total_physical)
+ {
+ if (hinstKernel32 != 0)
+ {
+ // We can also free the lib here - if we are limited by VM we will not be calling
+ // GetProcessMemoryInfo.
+ FreeLibrary(hinstKernel32);
+ GCGetProcessMemoryInfo = 0;
+ }
+ g_UseRestrictedVirtualMemory = true;
+ job_physical_memory_limit = (size_t)total_virtual;
}
VolatileStore(&g_RestrictedPhysicalMemoryLimit, job_physical_memory_limit);
@@ -558,9 +598,12 @@ void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available
size_t workingSetSize;
BOOL status = FALSE;
#ifndef FEATURE_PAL
- PROCESS_MEMORY_COUNTERS pmc;
- status = GCGetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
- workingSetSize = pmc.WorkingSetSize;
+ if (!g_UseRestrictedVirtualMemory)
+ {
+ PROCESS_MEMORY_COUNTERS pmc;
+ status = GCGetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
+ workingSetSize = pmc.WorkingSetSize;
+ }
#else
status = PAL_GetWorkingSetSize(&workingSetSize);
#endif
@@ -587,13 +630,32 @@ void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available
MEMORYSTATUSEX ms;
::GetProcessMemoryLoad(&ms);
-
- if (memory_load != NULL)
- *memory_load = ms.dwMemoryLoad;
- if (available_physical != NULL)
- *available_physical = ms.ullAvailPhys;
- if (available_page_file != NULL)
- *available_page_file = ms.ullAvailPageFile;
+
+#ifndef FEATURE_PAL
+ if (g_UseRestrictedVirtualMemory)
+ {
+ _ASSERTE (ms.ullTotalVirtual == restricted_limit);
+ if (memory_load != NULL)
+ *memory_load = (uint32_t)((float)(ms.ullTotalVirtual - ms.ullAvailVirtual) * 100.0 / (float)ms.ullTotalVirtual);
+ if (available_physical != NULL)
+ *available_physical = ms.ullTotalVirtual;
+
+ // Available page file isn't helpful when we are restricted by virtual memory
+ // since the amount of memory we can reserve is less than the amount of
+ // memory we can commit.
+ if (available_page_file != NULL)
+ *available_page_file = 0;
+ }
+ else
+#endif //!FEATURE_PAL
+ {
+ if (memory_load != NULL)
+ *memory_load = ms.dwMemoryLoad;
+ if (available_physical != NULL)
+ *available_physical = ms.ullAvailPhys;
+ if (available_page_file != NULL)
+ *available_page_file = ms.ullAvailPageFile;
+ }
}
// Get a high precision performance counter
diff --git a/src/vm/i386/stublinkerx86.cpp b/src/vm/i386/stublinkerx86.cpp
index 0b63e68942..d5461a7568 100644
--- a/src/vm/i386/stublinkerx86.cpp
+++ b/src/vm/i386/stublinkerx86.cpp
@@ -16,7 +16,6 @@
#include "field.h"
#include "stublink.h"
-#include "tls.h"
#include "frames.h"
#include "excep.h"
#include "dllimport.h"
diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp
index d48163c075..630706bfc7 100644
--- a/src/vm/interoputil.cpp
+++ b/src/vm/interoputil.cpp
@@ -999,6 +999,7 @@ void GetCultureInfoForLCID(LCID lcid, OBJECTREF *pCultureObj)
COMPlusThrow(kNotSupportedException);
#endif
}
+
#endif // CROSSGEN_COMPILE
//---------------------------------------------------------------------------
@@ -1618,6 +1619,55 @@ BOOL CanCastComObject(OBJECTREF obj, MethodTable * pTargetMT)
}
}
+// Returns TRUE iff the argument represents the "__ComObject" type or
+// any type derived from it (i.e. typelib-imported RCWs).
+BOOL IsComWrapperClass(TypeHandle type)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ MethodTable* pMT = type.GetMethodTable();
+ if (pMT == NULL)
+ return FALSE;
+
+ return pMT->IsComObjectType();
+}
+
+// Returns TRUE iff the argument represents the "__ComObject" type.
+BOOL IsComObjectClass(TypeHandle type)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+#ifdef FEATURE_COMINTEROP
+ if (!type.IsTypeDesc())
+ {
+ MethodTable *pMT = type.AsMethodTable();
+
+ if (pMT->IsComObjectType())
+ {
+ // May be __ComObject or typed RCW. __ComObject must have already been loaded
+ // if we see an MT marked like this so calling the *NoInit method is sufficient.
+
+ return pMT == g_pBaseCOMObject;
+ }
+ }
+#endif
+
+ return FALSE;
+}
+
VOID
ReadBestFitCustomAttribute(MethodDesc* pMD, BOOL* BestFit, BOOL* ThrowOnUnmappableChar)
{
@@ -6204,53 +6254,6 @@ MethodTable *WinRTDelegateRedirector::GetWinRTTypeForRedirectedDelegateIndex(Win
}
}
-// Returns TRUE iff the argument represents the "__ComObject" type or
-// any type derived from it (i.e. typelib-imported RCWs).
-BOOL IsComWrapperClass(TypeHandle type)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- MethodTable* pMT = type.GetMethodTable();
- if (pMT == NULL)
- return FALSE;
-
- return pMT->IsComObjectType();
-}
-
-// Returns TRUE iff the argument represents the "__ComObject" type.
-BOOL IsComObjectClass(TypeHandle type)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- if (!type.IsTypeDesc())
- {
- MethodTable *pMT = type.AsMethodTable();
-
- if (pMT->IsComObjectType())
- {
- // May be __ComObject or typed RCW. __ComObject must have already been loaded
- // if we see an MT marked like this so calling the *NoInit method is sufficient.
- return (pMT == g_pBaseCOMObject);
- }
- }
-
- return FALSE;
-}
-
-
#ifndef CROSSGEN_COMPILE
#ifdef _DEBUG
diff --git a/src/vm/interoputil.h b/src/vm/interoputil.h
index 6762c80f92..a6896248c6 100644
--- a/src/vm/interoputil.h
+++ b/src/vm/interoputil.h
@@ -106,6 +106,13 @@ ULONG SafeReleasePreemp(IUnknown* pUnk, RCW* pRCW = NULL);
// Determines if a COM object can be cast to the specified type.
BOOL CanCastComObject(OBJECTREF obj, MethodTable * pTargetMT);
+// includes Types which hold a "ComObject" class
+// and types which are imported through typelib
+BOOL IsComWrapperClass(TypeHandle type);
+
+// includes Type which hold a "__ComObject" class
+BOOL IsComObjectClass(TypeHandle type);
+
//---------------------------------------------------------
// Read the BestFit custom attribute info from
// both assembly level and interface level
@@ -491,14 +498,6 @@ public:
static void ComputeGuidForGenericType(MethodTable *pMT, GUID *pGuid);
}; // class WinRTGuidGenerator
-
-// includes Types which hold a "ComObject" class
-// and types which are imported through typelib
-BOOL IsComWrapperClass(TypeHandle type);
-
-// includes Type which hold a "__ComObject" class
-BOOL IsComObjectClass(TypeHandle type);
-
IUnknown* MarshalObjectToInterface(OBJECTREF* ppObject, MethodTable* pItfMT, MethodTable* pClassMT, DWORD dwFlags);
void UnmarshalObjectFromInterface(OBJECTREF *ppObjectDest, IUnknown **ppUnkSrc, MethodTable *pItfMT, MethodTable *pClassMT, DWORD dwFlags);
@@ -508,7 +507,6 @@ class ICOMInterfaceMarshalerCallback;
void GetNativeWinRTFactoryObject(MethodTable *pMT, Thread *pThread, MethodTable *pFactoryIntfMT, BOOL bNeedUniqueRCW, ICOMInterfaceMarshalerCallback *pCallback, OBJECTREF *prefFactory);
#else // FEATURE_COMINTEROP
-
inline HRESULT EnsureComStartedNoThrow()
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index 90c96580e3..d4db61c357 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -36,7 +36,6 @@
#ifdef PROFILING_SUPPORTED
#include "proftoeeinterfaceimpl.h"
#endif
-#include "tls.h"
#include "ecall.h"
#include "generics.h"
#include "typestring.h"
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index 706caf0e57..502b5ada13 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -37,7 +37,6 @@
#include "eetoprofinterfaceimpl.inl"
#include "profilepriv.h"
#endif
-#include "tls.h"
#include "ecall.h"
#include "generics.h"
#include "typestring.h"
@@ -11372,7 +11371,7 @@ void CEEJitInfo::recordRelocation(void * location,
// When m_fAllowRel32 == TRUE, the JIT will use REL32s for both data addresses and direct code targets.
// Since we cannot tell what the relocation is for, we have to defensively retry.
//
- m_fRel32Overflow = TRUE;
+ m_fJumpStubOverflow = TRUE;
delta = 0;
}
else
@@ -11386,7 +11385,7 @@ void CEEJitInfo::recordRelocation(void * location,
{
// This forces the JIT to retry the method, which allows us to reserve more space for jump stubs and have a higher chance that
// we will find space for them.
- m_fRel32Overflow = TRUE;
+ m_fJumpStubOverflow = TRUE;
}
// Keep track of conservative estimate of how much memory may be needed by jump stubs. We will use it to reserve extra memory
@@ -11430,12 +11429,12 @@ void CEEJitInfo::recordRelocation(void * location,
if (!FitsInRel28(delta))
{
// Use jump stub.
- //
+ //
TADDR baseAddr = (TADDR)fixupLocation;
TADDR loAddr = baseAddr - 0x08000000; // -2^27
TADDR hiAddr = baseAddr + 0x07FFFFFF; // +2^27-1
- // Check for the wrap around cases
+ // Check for the wrap around cases
if (loAddr > baseAddr)
loAddr = UINT64_MIN; // overflow
if (hiAddr < baseAddr)
@@ -11444,7 +11443,21 @@ void CEEJitInfo::recordRelocation(void * location,
PCODE jumpStubAddr = ExecutionManager::jumpStub(m_pMethodBeingCompiled,
(PCODE) target,
(BYTE *) loAddr,
- (BYTE *) hiAddr);
+ (BYTE *) hiAddr,
+ NULL,
+ false);
+
+ // Keep track of conservative estimate of how much memory may be needed by jump stubs. We will use it to reserve extra memory
+ // on retry to increase chances that the retry succeeds.
+ m_reserveForJumpStubs = max(0x400, m_reserveForJumpStubs + 2*BACK_TO_BACK_JUMP_ALLOCATE_SIZE);
+
+ if (jumpStubAddr == 0)
+ {
+ // This forces the JIT to retry the method, which allows us to reserve more space for jump stubs and have a higher chance that
+ // we will find space for them.
+ m_fJumpStubOverflow = TRUE;
+ break;
+ }
delta = (INT64)(jumpStubAddr - fixupLocation);
@@ -12675,25 +12688,22 @@ PCODE UnsafeJitFunction(MethodDesc* ftn, COR_ILMETHOD_DECODER* ILHeader, CORJIT_
}
#endif //_DEBUG
-#ifdef _TARGET_AMD64_
- BOOL fForceRel32Overflow = FALSE;
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+ BOOL fForceJumpStubOverflow = FALSE;
#ifdef _DEBUG
// Always exercise the overflow codepath with force relocs
if (PEDecoder::GetForceRelocs())
- fForceRel32Overflow = TRUE;
+ fForceJumpStubOverflow = TRUE;
+#endif
+
+#if defined(_TARGET_AMD64_)
+ BOOL fAllowRel32 = (g_fAllowRel32 | fForceJumpStubOverflow);
#endif
- BOOL fAllowRel32 = g_fAllowRel32 | fForceRel32Overflow;
size_t reserveForJumpStubs = 0;
- // For determinism, never try to use the REL32 in compilation process
- if (IsCompilationProcess())
- {
- fForceRel32Overflow = FALSE;
- fAllowRel32 = FALSE;
- }
-#endif // _TARGET_AMD64_
+#endif // defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
for (;;)
{
@@ -12707,10 +12717,15 @@ PCODE UnsafeJitFunction(MethodDesc* ftn, COR_ILMETHOD_DECODER* ILHeader, CORJIT_
EEJitManager *jitMgr = NULL;
#endif
-#if defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE)
- if (fForceRel32Overflow)
- jitInfo.SetRel32Overflow(fAllowRel32);
+#if (defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)) && !defined(CROSSGEN_COMPILE)
+#ifdef _TARGET_AMD64_
+ if (fForceJumpStubOverflow)
+ jitInfo.SetJumpStubOverflow(fAllowRel32);
jitInfo.SetAllowRel32(fAllowRel32);
+#else
+ if (fForceJumpStubOverflow)
+ jitInfo.SetJumpStubOverflow(fForceJumpStubOverflow);
+#endif
jitInfo.SetReserveForJumpStubs(reserveForJumpStubs);
#endif
@@ -12859,21 +12874,26 @@ PCODE UnsafeJitFunction(MethodDesc* ftn, COR_ILMETHOD_DECODER* ILHeader, CORJIT_
if (!nativeEntry)
COMPlusThrow(kInvalidProgramException);
-#if defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE)
- if (jitInfo.IsRel32Overflow())
+#if (defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)) && !defined(CROSSGEN_COMPILE)
+ if (jitInfo.IsJumpStubOverflow())
{
// Backout and try again with fAllowRel32 == FALSE.
jitInfo.BackoutJitData(jitMgr);
+#ifdef _TARGET_AMD64_
// Disallow rel32 relocs in future.
g_fAllowRel32 = FALSE;
fAllowRel32 = FALSE;
+#endif // _TARGET_AMD64_
+#ifdef _TARGET_ARM64_
+ fForceJumpStubOverflow = FALSE;
+#endif // _TARGET_ARM64_
reserveForJumpStubs = jitInfo.GetReserveForJumpStubs();
continue;
}
-#endif // _TARGET_AMD64_ && !CROSSGEN_COMPILE
+#endif // (_TARGET_AMD64_ || _TARGET_ARM64_) && !CROSSGEN_COMPILE
LOG((LF_JIT, LL_INFO10000,
"Jitted Entry at" FMT_ADDR "method %s::%s %s\n", DBG_ADDR(nativeEntry),
diff --git a/src/vm/jitinterface.h b/src/vm/jitinterface.h
index e04274cb69..1e4c847204 100644
--- a/src/vm/jitinterface.h
+++ b/src/vm/jitinterface.h
@@ -1351,23 +1351,25 @@ public:
LIMITED_METHOD_CONTRACT;
m_fAllowRel32 = fAllowRel32;
}
+#endif
- void SetRel32Overflow(BOOL fRel32Overflow)
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+ void SetJumpStubOverflow(BOOL fJumpStubOverflow)
{
LIMITED_METHOD_CONTRACT;
- m_fRel32Overflow = fRel32Overflow;
+ m_fJumpStubOverflow = fJumpStubOverflow;
}
- BOOL IsRel32Overflow()
+ BOOL IsJumpStubOverflow()
{
LIMITED_METHOD_CONTRACT;
- return m_fRel32Overflow;
+ return m_fJumpStubOverflow;
}
BOOL JitAgain()
{
LIMITED_METHOD_CONTRACT;
- return m_fRel32Overflow;
+ return m_fJumpStubOverflow;
}
size_t GetReserveForJumpStubs()
@@ -1411,7 +1413,9 @@ public:
#endif
#ifdef _TARGET_AMD64_
m_fAllowRel32(FALSE),
- m_fRel32Overflow(FALSE),
+#endif
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+ m_fJumpStubOverflow(FALSE),
m_reserveForJumpStubs(0),
#endif
m_GCinfo_len(0),
@@ -1495,8 +1499,10 @@ protected :
#ifdef _TARGET_AMD64_
BOOL m_fAllowRel32; // Use 32-bit PC relative address modes
- BOOL m_fRel32Overflow; // Overflow while trying to use encode 32-bit PC relative address.
- // The code will need to be regenerated with m_fRel32Allowed == FALSE.
+#endif
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+ BOOL m_fJumpStubOverflow; // Overflow while trying to alocate jump stub slot within PC relative branch region
+ // The code will need to be regenerated (with m_fRel32Allowed == FALSE for AMD64).
size_t m_reserveForJumpStubs; // Space to reserve for jump stubs when allocating code
#endif
diff --git a/src/vm/marvin32.cpp b/src/vm/marvin32.cpp
deleted file mode 100644
index 4fadee4580..0000000000
--- a/src/vm/marvin32.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-// 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.
-
-//
-// This module contains the routines to implement the Marvin32 checksum function
-//
-//
-
-#include "common.h"
-#include "marvin32.h"
-
-//
-// See the symcrypt.h file for documentation on what the various functions do.
-//
-
-//
-// Round rotation amounts. This array is optimized away by the compiler
-// as we inline all our rotations.
-//
-static const int rotate[4] = {
- 20, 9, 27, 19,
-};
-
-
-#define ROL32( x, n ) _rotl( (x), (n) )
-#define ROR32( x, n ) _rotr( (x), (n) )
-
-#define BLOCK( a, b ) \
-{\
- b ^= a; a = ROL32( a, rotate[0] );\
- a += b; b = ROL32( b, rotate[1] );\
- b ^= a; a = ROL32( a, rotate[2] );\
- a += b; b = ROL32( b, rotate[3] );\
-}
-
-
-
-HRESULT
-SymCryptMarvin32ExpandSeed(
- __out PSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed,
- __in_ecount(cbSeed) PCBYTE pbSeed,
- SIZE_T cbSeed )
-{
- HRESULT retVal = S_OK;
-
- if( cbSeed != SYMCRYPT_MARVIN32_SEED_SIZE )
- {
- retVal =E_INVALIDARG;
- goto cleanup;
- }
- pExpandedSeed->s[0] = LOAD_LSBFIRST32( pbSeed );
- pExpandedSeed->s[1] = LOAD_LSBFIRST32( pbSeed + 4 );
-
-cleanup:
- return retVal;
-}
-
-
-VOID
-SymCryptMarvin32Init( _Out_ PSYMCRYPT_MARVIN32_STATE pState,
- _In_ PCSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed)
-{
- pState->chain = *pExpandedSeed;
- pState->dataLength = 0;
- pState->pSeed = pExpandedSeed;
-
- *(ULONG *) &pState->buffer[4] = 0; // wipe the last 4 bytes of the buffer.
-}
-
-VOID
-SymCryptMarvin32AppendBlocks(
- _Inout_ PSYMCRYPT_MARVIN32_CHAINING_STATE pChain,
- _In_reads_( cbData ) PCBYTE pbData,
- SIZE_T cbData )
-{
- ULONG s0 = pChain->s[0];
- ULONG s1 = pChain->s[1];
-
- SIZE_T bytesInFirstBlock = cbData & 0xc; // 0, 4, 8, or 12
-
- pbData += bytesInFirstBlock;
- cbData -= bytesInFirstBlock;
-
- switch( bytesInFirstBlock )
- {
- case 0: // This handles the cbData == 0 case too
- while( cbData > 0 )
- {
- pbData += 16;
- cbData -= 16;
-
- s0 += LOAD_LSBFIRST32( pbData - 16 );
- BLOCK( s0, s1 );
- case 12:
- s0 += LOAD_LSBFIRST32( pbData - 12 );
- BLOCK( s0, s1 );
- case 8:
- s0 += LOAD_LSBFIRST32( pbData - 8 );
- BLOCK( s0, s1 );
- case 4:
- s0 += LOAD_LSBFIRST32( pbData - 4 );
- BLOCK( s0, s1 );
- }
- }
-
- pChain->s[0] = s0;
- pChain->s[1] = s1;
-}
-
-VOID
-SymCryptMarvin32Append(_Inout_ SYMCRYPT_MARVIN32_STATE * state,
-_In_reads_bytes_(cbData) PCBYTE pbData,
-SIZE_T cbData)
-{
- ULONG bytesInBuffer = state->dataLength;
-
- state->dataLength += (ULONG)cbData; // We only keep track of the last 2 bits...
-
- //
- // Truncate bytesInBuffer so that we never have an integer overflow.
- //
- bytesInBuffer &= SYMCRYPT_MARVIN32_INPUT_BLOCK_SIZE - 1;
-
- //
- // If previous data in buffer, buffer new input and transform if possible.
- //
- if (bytesInBuffer > 0)
- {
- SIZE_T freeInBuffer = SYMCRYPT_MARVIN32_INPUT_BLOCK_SIZE - bytesInBuffer;
- if (cbData < freeInBuffer)
- {
- //
- // All the data will fit in the buffer.
- // We don't do anything here.
- // As cbData < INPUT_BLOCK_SIZE the bulk data processing is skipped,
- // and the data will be copied to the buffer at the end
- // of this code.
- }
- else {
- //
- // Enough data to fill the whole buffer & process it
- //
- memcpy(&state->buffer[bytesInBuffer], pbData, freeInBuffer);
- pbData += freeInBuffer;
- cbData -= freeInBuffer;
- SymCryptMarvin32AppendBlocks(&state->chain, state->buffer, SYMCRYPT_MARVIN32_INPUT_BLOCK_SIZE);
-
- //
- // Set bytesInBuffer to zero to ensure that the trailing data in the
- // buffer will be copied to the right location of the buffer below.
- //
- bytesInBuffer = 0;
- }
- }
-
- //
- // Internal buffer is empty; process all remaining whole blocks in the input
- //
- if (cbData >= SYMCRYPT_MARVIN32_INPUT_BLOCK_SIZE)
- {
- SIZE_T cbDataRoundedDown = cbData & ~(SIZE_T)(SYMCRYPT_MARVIN32_INPUT_BLOCK_SIZE - 1);
- SymCryptMarvin32AppendBlocks(&state->chain, pbData, cbDataRoundedDown);
- pbData += cbDataRoundedDown;
- cbData -= cbDataRoundedDown;
- }
-
- //
- // buffer remaining input if necessary.
- //
- if (cbData > 0)
- {
- memcpy(&state->buffer[bytesInBuffer], pbData, cbData);
- }
-
-}
-
-VOID
-SymCryptMarvin32Result(
- _Inout_ PSYMCRYPT_MARVIN32_STATE pState,
- _Out_writes_( SYMCRYPT_MARVIN32_RESULT_SIZE ) PBYTE pbResult )
-{
- SIZE_T bytesInBuffer = ( pState->dataLength) & 0x3;
-
- //
- // Wipe four bytes in the buffer.
- // Doing this first ensures that this write is aligned when the input was of
- // length 0 mod 4.
- // The buffer is 8 bytes long, so we never overwrite anything else.
- //
- *(ULONG *) &pState->buffer[bytesInBuffer] = 0;
-
- //
- // The buffer is never completely full, so we can always put the first
- // padding byte in.
- //
- pState->buffer[bytesInBuffer++] = 0x80;
-
- //
- // Process the final block
- //
- SymCryptMarvin32AppendBlocks( &pState->chain, pState->buffer, 8 );
-
- STORE_LSBFIRST32( pbResult , pState->chain.s[0] );
- STORE_LSBFIRST32( pbResult + 4, pState->chain.s[1] );
-
- //
- // Wipe only those things that we need to wipe.
- //
-
- *(ULONG *) &pState->buffer[0] = 0;
- pState->dataLength = 0;
-
- pState->chain = *pState->pSeed;
-}
-
-
-VOID
-SymCryptMarvin32(
- __in PCSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed,
- __in_ecount(cbData) PCBYTE pbData,
- SIZE_T cbData,
- __out_ecount(SYMCRYPT_MARVIN32_RESULT_SIZE) PBYTE pbResult)
-//
-// To reduce the per-computation overhead, we have a dedicated code here instead of the whole Init/Append/Result stuff.
-//
-{
- ULONG tmp;
-
- ULONG s0 = pExpandedSeed->s[0];
- ULONG s1 = pExpandedSeed->s[1];
-
- while( cbData > 7 )
- {
- s0 += LOAD_LSBFIRST32( pbData );
- BLOCK( s0, s1 );
- s0 += LOAD_LSBFIRST32( pbData + 4 );
- BLOCK( s0, s1 );
- pbData += 8;
- cbData -= 8;
- }
-
- switch( cbData )
- {
- default:
- case 4: s0 += LOAD_LSBFIRST32( pbData ); BLOCK( s0, s1 ); pbData += 4;
- case 0: tmp = 0x80; break;
-
- case 5: s0 += LOAD_LSBFIRST32( pbData ); BLOCK( s0, s1 ); pbData += 4;
- case 1: tmp = 0x8000 | pbData[0]; break;
-
- case 6: s0 += LOAD_LSBFIRST32( pbData ); BLOCK( s0, s1 ); pbData += 4;
- case 2: tmp = 0x800000 | LOAD_LSBFIRST16( pbData ); break;
-
- case 7: s0 += LOAD_LSBFIRST32( pbData ); BLOCK( s0, s1 ); pbData += 4;
- case 3: tmp = LOAD_LSBFIRST16( pbData ) | (pbData[2] << 16) | 0x80000000; break;
- }
- s0 += tmp;
-
-
- BLOCK( s0, s1 );
- BLOCK( s0, s1 );
-
- STORE_LSBFIRST32( pbResult , s0 );
- STORE_LSBFIRST32( pbResult + 4, s1 );
-}
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index 9b3080ec6c..d323ef0f40 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -4409,7 +4409,10 @@ BOOL MethodDescChunk::IsCompactEntryPointAtAddress(PCODE addr)
if (fSpeculative INDEBUG(|| TRUE))
{
#ifdef _TARGET_ARM_
- if (!IsCompactEntryPointAtAddress(addr))
+ TADDR instrCodeAddr = PCODEToPINSTR(addr);
+ if (!IsCompactEntryPointAtAddress(addr) ||
+ *PTR_BYTE(instrCodeAddr) != TEP_ENTRY_INSTR1_BYTE1 ||
+ *PTR_BYTE(instrCodeAddr+1) != TEP_ENTRY_INSTR1_BYTE2)
#else // _TARGET_ARM_
if ((addr & 3) != 1 ||
*PTR_BYTE(addr) != X86_INSTR_MOV_AL ||
diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp
index 710a81abf4..67656235ef 100644
--- a/src/vm/methodtable.cpp
+++ b/src/vm/methodtable.cpp
@@ -602,8 +602,6 @@ void MethodTable::SetIsRestored()
#endif
}
-#ifdef FEATURE_COMINTEROP
-
//==========================================================================================
// mark as COM object type (System.__ComObject and types deriving from it)
void MethodTable::SetComObjectType()
@@ -612,8 +610,6 @@ void MethodTable::SetComObjectType()
SetFlag(enum_flag_ComObject);
}
-#endif // FEATURE_COMINTEROP
-
#if defined(FEATURE_TYPEEQUIVALENCE)
void MethodTable::SetHasTypeEquivalence()
{
diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h
index 7bc2a83c54..e88fe16644 100644
--- a/src/vm/methodtable.h
+++ b/src/vm/methodtable.h
@@ -882,9 +882,6 @@ public:
BOOL IsExtensibleRCW();
- // mark the class type as COM object class
- void SetComObjectType();
-
#if defined(FEATURE_TYPEEQUIVALENCE)
// mark the type as opted into type equivalence
void SetHasTypeEquivalence();
@@ -894,12 +891,6 @@ public:
// the hierarchy
MethodTable* GetComPlusParentMethodTable();
- // class is a com object class
- BOOL IsComObjectType()
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return GetFlag(enum_flag_ComObject);
- }
// class is a WinRT object class (is itself or derives from a ProjectedFromWinRT class)
BOOL IsWinRTObjectType();
@@ -943,11 +934,6 @@ public:
InteropMethodTableData *GetComInteropData();
#else // !FEATURE_COMINTEROP
- BOOL IsComObjectType()
- {
- SUPPORTS_DAC;
- return FALSE;
- }
BOOL IsWinRTObjectType()
{
LIMITED_METHOD_CONTRACT;
@@ -955,6 +941,16 @@ public:
}
#endif // !FEATURE_COMINTEROP
+ // class is a com object class
+ BOOL IsComObjectType()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return GetFlag(enum_flag_ComObject);
+ }
+
+ // mark the class type as COM object class
+ void SetComObjectType();
+
#ifdef FEATURE_ICASTABLE
void SetICastable();
#endif
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index 6464e5849e..c57677b316 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -1536,12 +1536,11 @@ MethodTableBuilder::BuildMethodTableThrowing(
}
}
-#ifdef FEATURE_COMINTEROP
-
// Com Import classes are special. These types must derive from System.Object,
// and we then substitute the parent with System._ComObject.
if (IsComImport() && !IsEnum() && !IsInterface() && !IsValueClass() && !IsDelegate())
{
+#ifdef FEATURE_COMINTEROP
// ComImport classes must either extend from Object or be a WinRT class
// that extends from another WinRT class (and so form a chain of WinRT classes
// that ultimately extend from object).
@@ -1579,11 +1578,12 @@ MethodTableBuilder::BuildMethodTableThrowing(
bmtInternal->pType->SetParentType(CreateTypeChain(pCOMMT, Substitution()));
bmtInternal->pParentMT = pCOMMT;
}
-
+#endif
// if the current class is imported
bmtProp->fIsComObjectType = true;
}
+#ifdef FEATURE_COMINTEROP
if (GetHalfBakedClass()->IsProjectedFromWinRT() && IsValueClass() && !IsEnum())
{
// WinRT structures must have sequential layout
@@ -2865,12 +2865,10 @@ MethodTableBuilder::EnumerateClassMethods()
// RVA : 0
if (dwMethodRVA != 0)
{
-#ifdef FEATURE_COMINTEROP
if(fIsClassComImport)
{
BuildMethodTableThrowException(BFA_METHOD_WITH_NONZERO_RVA);
}
-#endif // FEATURE_COMINTEROP
if(IsMdAbstract(dwMemberAttrs))
{
BuildMethodTableThrowException(BFA_ABSTRACT_METHOD_WITH_RVA);
@@ -3066,14 +3064,12 @@ MethodTableBuilder::EnumerateClassMethods()
// The attribute is not present
if (hr == S_FALSE)
{
+#ifdef FEATURE_COMINTEROP
if (fIsClassComImport
-#ifdef FEATURE_COMINTEROP
|| GetHalfBakedClass()->IsProjectedFromWinRT()
|| bmtProp->fComEventItfType
-#endif //FEATURE_COMINTEROP
)
{
-#ifdef FEATURE_COMINTEROP
// ComImport classes have methods which are just used
// for implementing all interfaces the class supports
type = METHOD_TYPE_COMINTEROP;
@@ -3090,13 +3086,10 @@ MethodTableBuilder::EnumerateClassMethods()
type = METHOD_TYPE_FCALL;
}
}
-#else
- //If we don't support com interop, refuse to load interop methods. Otherwise we fail to
- //jit calls to them since the constuctor has no intrinsic ID.
- BuildMethodTableThrowException(hr, IDS_CLASSLOAD_GENERAL, tok);
-#endif // FEATURE_COMINTEROP
}
- else if (dwMethodRVA == 0)
+ else
+#endif //FEATURE_COMINTEROP
+ if (dwMethodRVA == 0)
{
type = METHOD_TYPE_FCALL;
}
@@ -10322,16 +10315,17 @@ MethodTableBuilder::SetupMethodTable2(
GetHalfBakedClass()->SetBaseSizePadding(baseSize - bmtFP->NumInstanceFieldBytes);
-#ifdef FEATURE_COMINTEROP
if (bmtProp->fIsComObjectType)
{ // Propagate the com specific info
pMT->SetComObjectType();
-
+#ifdef FEATURE_COMINTEROP
// COM objects need an optional field on the EEClass, so ensure this class instance has allocated
// the optional field descriptor.
EnsureOptionalFieldsAreAllocated(pClass, m_pAllocMemTracker, GetLoaderAllocator()->GetLowFrequencyHeap());
+#endif // FEATURE_COMINTEROP
}
+#ifdef FEATURE_COMINTEROP
if (pMT->GetAssembly()->IsManagedWinMD())
{
// We need to mark classes that are implementations of managed WinRT runtime classes with
diff --git a/src/vm/methodtablebuilder.h b/src/vm/methodtablebuilder.h
index e64b72bb9d..3e267a2b23 100644
--- a/src/vm/methodtablebuilder.h
+++ b/src/vm/methodtablebuilder.h
@@ -1316,10 +1316,9 @@ private:
bool fNoSanityChecks;
bool fSparse; // Set to true if a sparse interface is being used.
-#ifdef FEATURE_COMINTEROP
// Com Interop, ComWrapper classes extend from ComObject
bool fIsComObjectType; // whether this class is an instance of ComObject class
-
+#ifdef FEATURE_COMINTEROP
bool fIsMngStandardItf; // Set to true if the interface is a manages standard interface.
bool fComEventItfType; // Set to true if the class is a special COM event interface.
bool fIsRedirectedInterface; // Set to true if the class is an interface redirected for WinRT
diff --git a/src/vm/object.cpp b/src/vm/object.cpp
index 0282b6a6a4..83afcd2fe5 100644
--- a/src/vm/object.cpp
+++ b/src/vm/object.cpp
@@ -1148,168 +1148,6 @@ BOOL StringObject::CaseInsensitiveCompHelper(__in_ecount(aLength) WCHAR *strACha
}
-INT32 StringObject::FastCompareStringHelper(DWORD* strAChars, INT32 countA, DWORD* strBChars, INT32 countB)
-{
- STATIC_CONTRACT_SO_TOLERANT;
-
- INT32 count = (countA < countB) ? countA : countB;
-
- PREFIX_ASSUME(count >= 0);
-
- ptrdiff_t diff = (char *)strAChars - (char *)strBChars;
-
-#if defined(_WIN64) || defined(ALIGN_ACCESS)
- int alignmentA = ((SIZE_T)strAChars) & (sizeof(SIZE_T) - 1);
- int alignmentB = ((SIZE_T)strBChars) & (sizeof(SIZE_T) - 1);
-#endif // _WIN64 || ALIGN_ACCESS
-
-#if defined(_WIN64)
- if (alignmentA == alignmentB)
- {
- if ((alignmentA == 2 || alignmentA == 6) && (count >= 1))
- {
- LPWSTR ptr2 = (WCHAR *)strBChars;
-
- if (( *((WCHAR*)((char *)ptr2 + diff)) - *ptr2) != 0)
- {
- return ((int)*((WCHAR*)((char *)ptr2 + diff)) - (int)*ptr2);
- }
- strBChars = (DWORD*)(++ptr2);
- count -= 1;
- alignmentA = (alignmentA == 2 ? 4 : 0);
- }
-
- if ((alignmentA == 4) && (count >= 2))
- {
- DWORD* ptr2 = (DWORD*)strBChars;
-
- if (( *((DWORD*)((char *)ptr2 + diff)) - *ptr2) != 0)
- {
- LPWSTR chkptr1 = (WCHAR*)((char *)strBChars + diff);
- LPWSTR chkptr2 = (WCHAR*)strBChars;
-
- if (*chkptr1 != *chkptr2)
- {
- return ((int)*chkptr1 - (int)*chkptr2);
- }
- return ((int)*(chkptr1+1) - (int)*(chkptr2+1));
- }
- strBChars = ++ptr2;
- count -= 2;
- alignmentA = 0;
- }
-
- if (alignmentA == 0)
- {
- while (count >= 4)
- {
- SIZE_T* ptr2 = (SIZE_T*)strBChars;
-
- if (( *((SIZE_T*)((char *)ptr2 + diff)) - *ptr2) != 0)
- {
- if (( *((DWORD*)((char *)ptr2 + diff)) - *(DWORD*)ptr2) != 0)
- {
- LPWSTR chkptr1 = (WCHAR*)((char *)strBChars + diff);
- LPWSTR chkptr2 = (WCHAR*)strBChars;
-
- if (*chkptr1 != *chkptr2)
- {
- return ((int)*chkptr1 - (int)*chkptr2);
- }
- return ((int)*(chkptr1+1) - (int)*(chkptr2+1));
- }
- else
- {
- LPWSTR chkptr1 = (WCHAR*)((DWORD*)((char *)strBChars + diff) + 1);
- LPWSTR chkptr2 = (WCHAR*)((DWORD*)strBChars + 1);
-
- if (*chkptr1 != *chkptr2)
- {
- return ((int)*chkptr1 - (int)*chkptr2);
- }
- return ((int)*(chkptr1+1) - (int)*(chkptr2+1));
- }
- }
- strBChars = (DWORD*)(++ptr2);
- count -= 4;
- }
- }
-
- LPWSTR ptr2 = (WCHAR*)strBChars;
- while ((count -= 1) >= 0)
- {
- if (( *((WCHAR*)((char *)ptr2 + diff)) - *ptr2) != 0)
- {
- return ((int)*((WCHAR*)((char *)ptr2 + diff)) - (int)*ptr2);
- }
- ++ptr2;
- }
- }
- else
-#endif // _WIN64
-#if defined(ALIGN_ACCESS)
- if ( ( !IS_ALIGNED((size_t)strAChars, sizeof(DWORD)) ||
- !IS_ALIGNED((size_t)strBChars, sizeof(DWORD)) ) &&
- (abs(alignmentA - alignmentB) != 4) )
- {
- _ASSERTE(IS_ALIGNED((size_t)strAChars, sizeof(WCHAR)));
- _ASSERTE(IS_ALIGNED((size_t)strBChars, sizeof(WCHAR)));
- LPWSTR ptr2 = (WCHAR *)strBChars;
-
- while ((count -= 1) >= 0)
- {
- if (( *((WCHAR*)((char *)ptr2 + diff)) - *ptr2) != 0)
- {
- return ((int)*((WCHAR*)((char *)ptr2 + diff)) - (int)*ptr2);
- }
- ++ptr2;
- }
- }
- else
-#endif // ALIGN_ACCESS
- {
-#if defined(_WIN64) || defined(ALIGN_ACCESS)
- if (abs(alignmentA - alignmentB) == 4)
- {
- if ((alignmentA == 2) || (alignmentB == 2))
- {
- LPWSTR ptr2 = (WCHAR *)strBChars;
-
- if (( *((WCHAR*)((char *)ptr2 + diff)) - *ptr2) != 0)
- {
- return ((int)*((WCHAR*)((char *)ptr2 + diff)) - (int)*ptr2);
- }
- strBChars = (DWORD*)(++ptr2);
- count -= 1;
- }
- }
-#endif // WIN64 || ALIGN_ACCESS
-
- // Loop comparing a DWORD at a time.
- while ((count -= 2) >= 0)
- {
- if ((*((DWORD* )((char *)strBChars + diff)) - *strBChars) != 0)
- {
- LPWSTR ptr1 = (WCHAR*)((char *)strBChars + diff);
- LPWSTR ptr2 = (WCHAR*)strBChars;
- if (*ptr1 != *ptr2) {
- return ((int)*ptr1 - (int)*ptr2);
- }
- return ((int)*(ptr1+1) - (int)*(ptr2+1));
- }
- ++strBChars;
- }
-
- int c;
- if (count == -1)
- if ((c = *((WCHAR *) ((char *)strBChars + diff)) - *((WCHAR *) strBChars)) != 0)
- return c;
- }
-
- return countA - countB;
-}
-
-
/*=============================InternalHasHighChars=============================
**Action: Checks if the string can be sorted quickly. The requirements are that
** the string contain no character greater than 0x80 and that the string not
diff --git a/src/vm/object.h b/src/vm/object.h
index b0125fa50e..4324fcac2e 100644
--- a/src/vm/object.h
+++ b/src/vm/object.h
@@ -1060,8 +1060,6 @@ class StringObject : public Object
private:
- static INT32 FastCompareStringHelper(DWORD* strAChars, INT32 countA, DWORD* strBChars, INT32 countB);
-
static STRINGREF* EmptyStringRefPtr;
};
diff --git a/src/vm/olevariant.cpp b/src/vm/olevariant.cpp
index 95c0b9b0cc..35936bbc5a 100644
--- a/src/vm/olevariant.cpp
+++ b/src/vm/olevariant.cpp
@@ -2310,8 +2310,9 @@ void OleVariant::MarshalLPSTRRArrayComToOle(BASEARRAYREF *pComArray, void *oleAr
ThrowOutOfMemory();
// Convert the unicode string to an ansi string.
- InternalWideToAnsi(stringRef->GetBuffer(), Length, lpstr, allocLength, fBestFitMapping, fThrowOnUnmappableChar);
- lpstr[Length] = 0;
+ int bytesWritten = InternalWideToAnsi(stringRef->GetBuffer(), Length, lpstr, allocLength, fBestFitMapping, fThrowOnUnmappableChar);
+ _ASSERTE(bytesWritten >= 0 && bytesWritten < allocLength);
+ lpstr[bytesWritten] = 0;
}
*pOle++ = lpstr;
diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp
index 88ecf44148..58540fe605 100644
--- a/src/vm/pefile.cpp
+++ b/src/vm/pefile.cpp
@@ -11,13 +11,11 @@
#include "common.h"
#include "pefile.h"
#include "strongname.h"
-#include "corperm.h"
#include "eecontract.h"
#include "apithreadstress.h"
#include "eeconfig.h"
#include "product_version.h"
#include "eventtrace.h"
-#include "corperm.h"
#include "dbginterface.h"
#include "peimagelayout.inl"
#include "dlwrap.h"
diff --git a/src/vm/pefile.h b/src/vm/pefile.h
index dcdb80a1ad..787474745d 100644
--- a/src/vm/pefile.h
+++ b/src/vm/pefile.h
@@ -17,7 +17,6 @@
#include <windef.h>
-#include <corpolicy.h>
#include "sstring.h"
#include "peimage.h"
#include "metadata.h"
@@ -32,7 +31,6 @@
#include "stackwalktypes.h"
#include <specstrings.h>
#include "slist.h"
-#include "corperm.h"
#include "eventtrace.h"
#include "clrprivbinderutil.h"
diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp
index ea3d888ebe..0a84892421 100644
--- a/src/vm/peimagelayout.cpp
+++ b/src/vm/peimagelayout.cpp
@@ -469,9 +469,9 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner)
#else //!FEATURE_PAL
#ifndef CROSSGEN_COMPILE
- m_FileView = PAL_LOADLoadPEFile(hFile);
+ m_LoadedFile = PAL_LOADLoadPEFile(hFile);
- if (m_FileView == NULL)
+ if (m_LoadedFile == NULL)
{
// For CoreCLR, try to load all files via LoadLibrary first. If LoadLibrary did not work, retry using
// regular mapping - but not for native images.
@@ -481,10 +481,10 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner)
}
LOG((LF_LOADER, LL_INFO1000, "PEImage: image %S (hFile %p) mapped @ %p\n",
- (LPCWSTR) GetPath(), hFile, (void*)m_FileView));
+ (LPCWSTR) GetPath(), hFile, (void*)m_LoadedFile));
- TESTHOOKCALL(ImageMapped(GetPath(),m_FileView,IM_IMAGEMAP));
- IfFailThrow(Init((void *) m_FileView));
+ TESTHOOKCALL(ImageMapped(GetPath(),m_LoadedFile,IM_IMAGEMAP));
+ IfFailThrow(Init((void *) m_LoadedFile));
if (!HasCorHeader())
ThrowHR(COR_E_BADIMAGEFORMAT);
@@ -500,7 +500,7 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner)
}
#else // !CROSSGEN_COMPILE
- m_FileView = NULL;
+ m_LoadedFile = NULL;
#endif // !CROSSGEN_COMPILE
#endif // !FEATURE_PAL
diff --git a/src/vm/peimagelayout.h b/src/vm/peimagelayout.h
index 557a2a5ffc..8ddb577a85 100644
--- a/src/vm/peimagelayout.h
+++ b/src/vm/peimagelayout.h
@@ -120,8 +120,12 @@ class MappedImageLayout: public PEImageLayout
VPTR_VTABLE_CLASS(MappedImageLayout,PEImageLayout)
VPTR_UNIQUE(0x15)
protected:
+#ifndef FEATURE_PAL
HandleHolder m_FileMap;
CLRMapViewHolder m_FileView;
+#else
+ PALPEFileHolder m_LoadedFile;
+#endif
public:
#ifndef DACCESS_COMPILE
MappedImageLayout(HANDLE hFile, PEImage* pOwner);
diff --git a/src/vm/rcwrefcache.cpp b/src/vm/rcwrefcache.cpp
index a4cdf80ece..d7dbbfc5e2 100644
--- a/src/vm/rcwrefcache.cpp
+++ b/src/vm/rcwrefcache.cpp
@@ -17,9 +17,9 @@
#include "common.h"
-#include "rcwrefcache.h"
#include "comcallablewrapper.h"
#include "runtimecallablewrapper.h"
+#include "rcwrefcache.h"
// SHRINK_TOTAL_THRESHOLD - only shrink when the total number of handles exceed this number
#ifdef _DEBUG
diff --git a/src/vm/runtimehandles.cpp b/src/vm/runtimehandles.cpp
index 723222e55b..de9505ae91 100644
--- a/src/vm/runtimehandles.cpp
+++ b/src/vm/runtimehandles.cpp
@@ -1012,7 +1012,6 @@ RuntimeTypeHandle::IsVisible(
} // RuntimeTypeHandle::IsVisible
FCIMPL2(FC_BOOL_RET, RuntimeTypeHandle::IsComObject, ReflectClassBaseObject *pTypeUNSAFE, CLR_BOOL isGenericCOM) {
-#ifdef FEATURE_COMINTEROP
CONTRACTL {
FCALL_CHECK;
}
@@ -1037,17 +1036,6 @@ FCIMPL2(FC_BOOL_RET, RuntimeTypeHandle::IsComObject, ReflectClassBaseObject *pTy
HELPER_METHOD_FRAME_END();
FC_RETURN_BOOL(ret);
-#else
- CONTRACTL {
- DISABLED(NOTHROW);
- GC_NOTRIGGER;
- MODE_COOPERATIVE;
- PRECONDITION(CheckPointer(pTypeUNSAFE));
- }
- CONTRACTL_END;
- FCUnique(0x37);
- FC_RETURN_BOOL(FALSE);
-#endif
}
FCIMPLEND
diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp
index f66495ce83..928f20a095 100644
--- a/src/vm/threads.cpp
+++ b/src/vm/threads.cpp
@@ -11,7 +11,6 @@
#include "common.h"
-#include "tls.h"
#include "frames.h"
#include "threads.h"
#include "stackwalk.h"
diff --git a/src/vm/tieredcompilation.cpp b/src/vm/tieredcompilation.cpp
index cd571a6b47..f139ddea5c 100644
--- a/src/vm/tieredcompilation.cpp
+++ b/src/vm/tieredcompilation.cpp
@@ -22,19 +22,11 @@
//
// # Current feature state
//
-// This feature is incomplete and currently experimental. To enable it
-// you need to set COMPLUS_EXPERIMENTAL_TieredCompilation = 1. When the environment
-// variable is unset the runtime should work as normal, but when it is there are a few
-// known issues
-// ETW - Native to IL maps aren't correctly emitted (probably tier1 wrong, tier0 right)
-// Profiler - Still missing APIs that allow profilers to correctly get native to IL
-// maps for all code bodies.
-//
-// Diagnostic tools have minimal testing that we are aware of and its possible they
-// made additional assumptions about runtime implementation that have been invalidated
-// by this feature. VS debugging does appear to work at a basic level at least.
-//
-// I aim to keep this comment updated as things change.
+// This feature is a work in progress. It should be functionally correct for a
+// good range of scenarios, but performance varies by scenario. To enable it
+// you need to set COMPLUS_TieredCompilation = 1. This feature has been
+// tested with all of our runtime and CoreFX functional tests, as well as
+// diagnostics tests and various partner testing in Visual Studio.
//
//
// # Important entrypoints in this code:
diff --git a/src/vm/util.cpp b/src/vm/util.cpp
index b9448dadbe..b4b725e525 100644
--- a/src/vm/util.cpp
+++ b/src/vm/util.cpp
@@ -14,7 +14,6 @@
#include "eventtrace.h"
#include "posterror.h"
#include "eemessagebox.h"
-#include "newapis.h"
#include <shlobj.h>
@@ -2047,11 +2046,7 @@ size_t GetCacheSizePerLogicalCpu(BOOL bTrueSize)
#ifndef FEATURE_PAL
ThreadLocaleHolder::~ThreadLocaleHolder()
{
-#ifdef FEATURE_USE_LCID
-#endif // FEATURE_USE_LCID
- {
- SetThreadLocale(m_locale);
- }
+ SetThreadLocale(m_locale);
}
HMODULE CLRGetModuleHandle(LPCWSTR lpModuleFileName)
@@ -3463,7 +3458,7 @@ INT32 InternalCasingHelper::InvariantToLowerHelper(__out_bcount_opt(cMaxBytes) L
}
//Do the casing operation
- NewApis::LCMapStringEx(W(""), LCMAP_LOWERCASE, szInWide, wideCopyLen, szWideOut, wideCopyLen, NULL, NULL, 0);
+ ::LCMapStringEx(W(""), LCMAP_LOWERCASE, szInWide, wideCopyLen, szWideOut, wideCopyLen, NULL, NULL, 0);
//Convert the Unicode back to UTF8
result = WszWideCharToMultiByte(CP_UTF8, 0, szWideOut, wideCopyLen, szOut, cMaxBytes, NULL, NULL);
diff --git a/src/vm/util.hpp b/src/vm/util.hpp
index ad1261845f..82e87e4a11 100644
--- a/src/vm/util.hpp
+++ b/src/vm/util.hpp
@@ -728,6 +728,15 @@ typedef Wrapper<void *, DoNothing, VoidCLRUnmapViewOfFile> CLRMapViewHolder;
typedef Wrapper<void *, DoNothing, DoNothing> CLRMapViewHolder;
#endif
+#ifdef FEATURE_PAL
+#ifndef DACCESS_COMPILE
+FORCEINLINE void VoidPALUnloadPEFile(void *ptr) { PAL_LOADUnloadPEFile(ptr); }
+typedef Wrapper<void *, DoNothing, VoidPALUnloadPEFile> PALPEFileHolder;
+#else
+typedef Wrapper<void *, DoNothing, DoNothing> PALPEFileHolder;
+#endif
+#endif // FEATURE_PAL
+
void GetProcessMemoryLoad(LPMEMORYSTATUSEX pMSEX);
void ProcessEventForHost(EClrEvent event, void *data);
diff --git a/tests/arm/Tests.lst b/tests/arm/Tests.lst
index dffcd70dea..34cc977a06 100644
--- a/tests/arm/Tests.lst
+++ b/tests/arm/Tests.lst
@@ -10041,7 +10041,7 @@ RelativePath=JIT\jit64\opt\cse\hugeexpr1\hugeexpr1.cmd
WorkingDir=JIT\jit64\opt\cse\hugeexpr1
Expected=0
MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS;Pri1
+Categories=EXPECTED_PASS;Pri1;JITSTRESS_FAIL;16587
HostStyle=0
[GCSimulator_101.cmd_1262]
diff --git a/tests/build.proj b/tests/build.proj
index 43c4997763..aede1317a1 100644
--- a/tests/build.proj
+++ b/tests/build.proj
@@ -9,9 +9,9 @@
</ItemGroup>
<Import Project="dir.targets" />
-
+
<Import Project="dir.traversal.targets" />
-
+
<PropertyGroup>
<TraversalBuildDependsOn>
BatchRestorePackages;
@@ -34,15 +34,15 @@
<RestoreProjects Include="$(MSBuildThisFileDirectory)src\TestWrappersConfig\TestWrappersConfig.csproj" />
</ItemGroup>
- <Target Name="BuildTargetingPack" AfterTargets="BatchRestorePackages">
+ <Target Name="BuildTargetingPack" AfterTargets="BatchRestorePackages" Condition="$(__SkipTargetingPackBuild) != 'true'">
<Message Text="Building Targeting Pack" Importance="High" />
<Error Text="BuildOS has not been specified. Please do that then run build again." Condition="'$(BuildOS)' == 'AnyOS'" />
<MSBuild Projects="$(MSBuildThisFileDirectory)\src\Common\external\external.depproj" />
</Target>
- <Target Name="BatchRestorePackages">
+ <Target Name="BatchRestorePackages" Condition="$(__SkipPackageRestore) != 'true'">
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Restoring all packages..." />
-
+
<!-- restore all csproj's with PackageReferences in one pass -->
<MSBuild Projects="build.proj"
Properties="RestoreProj=%(RestoreProjects.Identity)"
diff --git a/tests/helixpublish.proj b/tests/helixpublish.proj
index 5d1b7d1d81..cd1d3bf29b 100644
--- a/tests/helixpublish.proj
+++ b/tests/helixpublish.proj
@@ -47,6 +47,7 @@
<BuildMoniker Condition="'$(IsOfficial)'=='true' And '$(ProductBuildId)'!=''">$(ProductBuildId)</BuildMoniker>
<HelixArchLabel>$(Platform)</HelixArchLabel>
<HelixConfigLabel>$(BuildType)</HelixConfigLabel>
+ <TestListFilename>$(Rid)-$(BuildType)-TestList.json</TestListFilename>
</PropertyGroup>
<!-- Set Helix environment vars based on target platform -->
@@ -102,4 +103,4 @@
<CallTarget Condition="'$(EnableCloudTest)' != 'false'" Targets="CoreClrPreCloudBuild;HelixCloudBuild" />
</Target>
-</Project> \ No newline at end of file
+</Project>
diff --git a/tests/runtest.cmd b/tests/runtest.cmd
index 1533402104..072c2737f9 100644
--- a/tests/runtest.cmd
+++ b/tests/runtest.cmd
@@ -80,7 +80,7 @@ if /i "%1" == "GenerateLayoutOnly" (set __GenerateLayoutOnly=1&shift&goto Arg
if /i "%1" == "PerfTests" (set __PerfTests=true&shift&goto Arg_Loop)
if /i "%1" == "runcrossgentests" (set RunCrossGen=true&shift&goto Arg_Loop)
if /i "%1" == "link" (set DoLink=true&set ILLINK=%2&shift&shift&goto Arg_Loop)
-if /i "%1" == "tieredcompilation" (set COMPLUS_EXPERIMENTAL_TieredCompilation=1&shift&goto Arg_Loop)
+if /i "%1" == "tieredcompilation" (set COMPLUS_TieredCompilation=1&shift&goto Arg_Loop)
if /i "%1" == "gcname" (set COMPlus_GCName=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "timeout" (set __TestTimeout=%2&shift&shift&goto Arg_Loop)
@@ -515,7 +515,7 @@ echo 2: GC on transitions to preemptive GC
echo 4: GC on every allowable JITed instruction
echo 8: GC on every allowable NGEN instruction
echo 16: GC only on a unique stack trace
-echo tieredcompilation - Run the tests with COMPlus_EXPERIMENTAL_TieredCompilation=1
+echo tieredcompilation - Run the tests with COMPlus_TieredCompilation=1
echo gcname ^<name^> - Runs the tests with COMPlus_GCName=name
echo timeout ^<n^> - Sets the per-test timeout in milliseconds ^(default is 10 minutes = 10 * 60 * 1000 = 600000^).
echo Note: some options override this ^(gcstresslevel, longgc, gcsimulator^).
diff --git a/tests/runtest.sh b/tests/runtest.sh
index 64d12e7d80..8ded8c33bf 100755
--- a/tests/runtest.sh
+++ b/tests/runtest.sh
@@ -59,7 +59,7 @@ function print_usage {
echo ' 8: GC on every allowable NGEN instr 16: GC only on a unique stack trace'
echo ' --long-gc : Runs the long GC tests'
echo ' --gcsimulator : Runs the GCSimulator tests'
- echo ' --tieredcompilation : Runs the tests with COMPlus_EXPERIMENTAL_TieredCompilation=1'
+ echo ' --tieredcompilation : Runs the tests with COMPlus_TieredCompilation=1'
echo ' --link <ILlink> : Runs the tests after linking via ILlink'
echo ' --show-time : Print execution sequence and running time for each test'
echo ' --no-lf-conversion : Do not execute LF conversion before running test script'
@@ -100,6 +100,12 @@ countSkippedTests=0
xunitOutputPath=
xunitTestOutputPath=
+# Variables for text file output. These can be passed back to runtest.sh using the "--playlist" argument
+# to rerun specific tests.
+testsPassOutputPath=
+testsFailOutputPath=
+testsSkipOutputPath=
+
# libExtension determines extension for dynamic library files
# runtimeName determines where CoreFX Runtime files will be located
OSName=$(uname -s)
@@ -301,6 +307,49 @@ function xunit_output_end {
echo '</assemblies>' >>"$xunitOutputPath"
}
+function text_file_output_begin {
+ if [ -z "$testsPassOutputPath" ]; then
+ testsPassOutputPath=$testRootDir/coreclrtests.pass.txt
+ fi
+ if ! [ -e $(basename "$testsPassOutputPath") ]; then
+ testsPassOutputPath=$testRootDir/coreclrtests.pass.txt
+ fi
+ if [ -e "$testsPassOutputPath" ]; then
+ rm -f "$testsPassOutputPath"
+ fi
+ if [ -z "$testsFailOutputPath" ]; then
+ testsFailOutputPath=$testRootDir/coreclrtests.fail.txt
+ fi
+ if ! [ -e $(basename "$testsFailOutputPath") ]; then
+ testsFailOutputPath=$testRootDir/coreclrtests.fail.txt
+ fi
+ if [ -e "$testsFailOutputPath" ]; then
+ rm -f "$testsFailOutputPath"
+ fi
+ if [ -z "$testsSkipOutputPath" ]; then
+ testsSkipOutputPath=$testRootDir/coreclrtests.skip.txt
+ fi
+ if ! [ -e $(basename "$testsSkipOutputPath") ]; then
+ testsSkipOutputPath=$testRootDir/coreclrtests.skip.txt
+ fi
+ if [ -e "$testsSkipOutputPath" ]; then
+ rm -f "$testsSkipOutputPath"
+ fi
+}
+
+function text_file_output_add_test {
+ local scriptFilePath=$1
+ local testResult=$2 # Pass, Fail, or Skip
+
+ if [ "$testResult" == "Pass" ]; then
+ echo "$scriptFilePath" >>"$testsPassOutputPath"
+ elif [ "$testResult" == "Skip" ]; then
+ echo "$scriptFilePath" >>"$testsSkipOutputPath"
+ else
+ echo "$scriptFilePath" >>"$testsFailOutputPath"
+ fi
+}
+
function exit_with_error {
local errorSource=$1
local errorMessage=$2
@@ -820,11 +869,11 @@ function finish_test {
header=$header$(printf "[%4ds]" $testRunningTime)
fi
- local xunitTestResult
+ local testResult
case $testScriptExitCode in
0)
let countPassedTests++
- xunitTestResult='Pass'
+ testResult='Pass'
if ((verbose == 1 || runFailingTestsOnly == 1)); then
echo "PASSED - ${header}${scriptFilePath}"
else
@@ -833,12 +882,12 @@ function finish_test {
;;
2)
let countSkippedTests++
- xunitTestResult='Skip'
+ testResult='Skip'
echo "SKIPPED - ${header}${scriptFilePath}"
;;
*)
let countFailedTests++
- xunitTestResult='Fail'
+ testResult='Fail'
echo "FAILED - ${header}${scriptFilePath}"
;;
esac
@@ -850,7 +899,8 @@ function finish_test {
done <"$outputFilePath"
fi
- xunit_output_add_test "$scriptFilePath" "$outputFilePath" "$xunitTestResult" "$testScriptExitCode" "$testRunningTime"
+ xunit_output_add_test "$scriptFilePath" "$outputFilePath" "$testResult" "$testScriptExitCode" "$testRunningTime"
+ text_file_output_add_test "$scriptFilePath" "$testResult"
}
function finish_remaining_tests {
@@ -1077,7 +1127,7 @@ do
export DoLink=true
;;
--tieredcompilation)
- export COMPlus_EXPERIMENTAL_TieredCompilation=1
+ export COMPlus_TieredCompilation=1
;;
--jitdisasm)
jitdisasm=1
@@ -1258,6 +1308,7 @@ then
fi
xunit_output_begin
+text_file_output_begin
create_core_overlay
precompile_overlay_assemblies
@@ -1282,11 +1333,8 @@ if [ "$ARCH" == "x64" ]
then
scriptPath=$(dirname $0)
${scriptPath}/setup-stress-dependencies.sh --outputDir=$coreOverlayDir
-else
- if [ "$ARCH" != "arm64" ]
- then
- echo "Skip preparing for GC stress test. Dependent package is not supported on this architecture."
- fi
+elif [ "$ARCH" != "arm64" ] && [ "$ARCH" != "arm" ]; then
+ echo "Skip preparing for GC stress test. Dependent package is not supported on this architecture."
fi
export __TestEnv=$testEnv
diff --git a/tests/runtesttilstable.sh b/tests/runtesttilstable.sh
new file mode 100755
index 0000000000..a34774d45c
--- /dev/null
+++ b/tests/runtesttilstable.sh
@@ -0,0 +1,158 @@
+#!/usr/bin/env bash
+
+function print_usage {
+ echo ''
+ echo 'CoreCLR test runner wrapper script.'
+ echo ''
+ echo 'Run tests using runtest.sh, then rerun the failures, if any,'
+ echo 'until the number of failures stabilizes. Thus, when running'
+ echo 'flaky tests, or running tests on a flaky platform, only the'
+ echo 'repeatable, "real", failures are reported.'
+ echo ''
+ echo 'Tests are rerun in sequential mode (passing --sequential to runtest.sh).'
+ echo 'This hopefully avoids resource exhaustion and other parallel run problems.'
+ echo ''
+ echo 'A maximum number of iterations can be specified.'
+ echo ''
+ echo 'Command line:'
+ echo ''
+ echo 'runtesttilstable.sh [options] [arguments for runtest.sh]'
+ echo ''
+ echo 'Any unknown argument is passed directly to runtest.sh.'
+ echo ''
+ echo 'Optional arguments:'
+ echo ' -h|--help : Show usage information.'
+ echo ' --max-iterations=<count> : Specify the maximum number of iterations. Default: 4.'
+ echo ''
+}
+
+function exit_with_error {
+ local errorMessage=$1
+ local printUsage=$2
+
+ if [ -z "$printUsage" ]; then
+ ((printUsage = 0))
+ fi
+
+ echo "$errorMessage"
+ if ((printUsage != 0)); then
+ print_usage
+ fi
+ exit $EXIT_CODE_EXCEPTION
+}
+
+# Handle Ctrl-C. We will stop execution and print the results that
+# we gathered so far.
+function handle_ctrl_c {
+ echo ""
+ echo "*** Stopping... ***"
+ print_results
+ exit_with_error "Test run aborted by Ctrl+C."
+}
+
+# Register the Ctrl-C handler
+trap handle_ctrl_c INT
+
+# Where are we?
+scriptPath=$(dirname $0)
+
+# Exit code constants
+readonly EXIT_CODE_SUCCESS=0 # Script ran normally.
+readonly EXIT_CODE_EXCEPTION=1 # Script exited because something exceptional happened (e.g. bad arguments, Ctrl-C interrupt).
+readonly EXIT_CODE_TEST_FAILURE=2 # Script completed successfully, but one or more tests failed.
+
+# Argument variables
+((maxIterations = 20))
+
+# Handle arguments
+__UnprocessedBuildArgs=
+
+# We need to capture the --testRootDir argument so we know where the test pass/fail/skip files will be placed.
+testRootDir=
+
+# We need to handle the --playlist argument specially. The first run, we pass it through (if passed).
+# After that, we use the --playlist argument ourselves, so we don't pass through the original one.
+playlistArgument=
+
+for i in "$@"
+do
+ case $i in
+ -h|--help)
+ print_usage
+ exit $EXIT_CODE_SUCCESS
+ ;;
+ --max-iterations=*)
+ maxIterations=${i#*=}
+ ;;
+ --playlist=*)
+ playlistArgument=$i
+ ;;
+ --testRootDir=*)
+ testRootDir=${i#*=}
+ # Also pass it on to runtest.sh
+ __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
+ ;;
+ *)
+ __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
+ ;;
+ esac
+done
+
+# Check testRootDir; this check is also done by runtest.sh.
+
+if [ -z "$testRootDir" ]; then
+ echo "--testRootDir is required."
+ print_usage
+ exit $EXIT_CODE_EXCEPTION
+fi
+if [ ! -d "$testRootDir" ]; then
+ echo "Directory specified by --testRootDir does not exist: $testRootDir"
+ exit $EXIT_CODE_EXCEPTION
+fi
+
+# Now start running the tests.
+
+nextcmd="${scriptPath}/runtest.sh ${playlistArgument} ${__UnprocessedBuildArgs}"
+echo "Running: $nextcmd"
+$nextcmd
+exitCode=$?
+if [ $exitCode -eq $EXIT_CODE_TEST_FAILURE ]; then
+ # Now, we loop, rerunning the failed tests up to maxIterations times minus one
+ # (the initial run counts as an iteration).
+ ((totalRerunCount = $maxIterations - 1))
+ for (( i=1; i<=$totalRerunCount; i++ )); do
+ if [ ! -e "$testRootDir/coreclrtests.fail.txt" ]; then
+ exit_with_error "Error: couldn't find $testRootDir/coreclrtests.fail.txt"
+ fi
+
+ num_errors=$(grep -c '' "$testRootDir/coreclrtests.fail.txt")
+ echo "Test run failed with $num_errors errors:"
+ cat "$testRootDir/coreclrtests.fail.txt"
+ echo ''
+
+ echo "Rerunning failures ($i of $totalRerunCount reruns)..."
+
+ # Move the fail file to a different location, so it can be used without getting trashed by the
+ # next run's error file.
+ retryFile="$testRootDir/coreclrtests.retry.txt"
+ if [ -e "$retryFile" ]; then
+ rm -f "$retryFile"
+ if [ -e "$retryFile" ]; then
+ exit_with_error "Error: couldn't delete $retryFile"
+ fi
+ fi
+ mv "$testRootDir/coreclrtests.fail.txt" "$retryFile"
+
+ nextcmd="${scriptPath}/runtest.sh --sequential --playlist=${retryFile} ${__UnprocessedBuildArgs}"
+ echo "Running: $nextcmd"
+ $nextcmd
+ exitCode=$?
+ if [ $exitCode -ne $EXIT_CODE_TEST_FAILURE ]; then
+ # Either success or exceptional failure; we're done. For test failure, we loop,
+ # if we haven't hit the maximum number of allowed iterations.
+ break
+ fi
+ done
+fi
+
+exit $exitCode
diff --git a/tests/scripts/arm32_ci_script.sh b/tests/scripts/arm32_ci_script.sh
index aecb3e890a..3ffff2c9ab 100755
--- a/tests/scripts/arm32_ci_script.sh
+++ b/tests/scripts/arm32_ci_script.sh
@@ -183,21 +183,21 @@ function mount_emulator {
fi
if [ ! -d "$__ARMEmulRootfs" ]; then
- sudo mkdir "$__ARMEmulRootfs"
- fi
+ sudo mkdir "$__ARMEmulRootfs"
+ fi
- if [ ! -f "$__ARMEmulRootfs/arm-emulator-rootfs.tar" ]; then
- if mountpoint -q -- "$__ARMRootfsMountPath"; then
- sudo umount -l $__ARMRootfsMountPath
+ if [ ! -f "$__ARMEmulRootfs/arm-emulator-rootfs.tar" ]; then
+ if mountpoint -q -- "$__ARMRootfsMountPath"; then
+ sudo umount -l $__ARMRootfsMountPath
fi
- mount_with_checking "" "$__ARMEmulPath/platform/rootfs-t30.ext4" "$__ARMRootfsMountPath"
-
- cd $__ARMRootfsMountPath
- sudo tar -cf "$__ARMEmulRootfs/arm-emulator-rootfs.tar" *
- cd -
- fi
+ mount_with_checking "" "$__ARMEmulPath/platform/rootfs-t30.ext4" "$__ARMRootfsMountPath"
+
+ cd $__ARMRootfsMountPath
+ sudo tar -cf "$__ARMEmulRootfs/arm-emulator-rootfs.tar" *
+ cd -
+ fi
- sudo tar -xf "$__ARMEmulRootfs/arm-emulator-rootfs.tar" -C "$__ARMEmulRootfs"
+ sudo tar -xf "$__ARMEmulRootfs/arm-emulator-rootfs.tar" -C "$__ARMEmulRootfs"
mount_with_checking "-t proc" "/proc" "$__ARMEmulRootfs/proc"
mount_with_checking "-o bind" "/dev/" "$__ARMEmulRootfs/dev"
@@ -209,9 +209,9 @@ function mount_emulator {
fi
mount_with_checking "-o bind" "/mnt" "$__ARMEmulRootfs/bindings/tmp"
- if [ ! -d "$__ARMEmulRootfs/$__TempFolder" ]; then
+ if [ ! -d "$__ARMEmulRootfs/$__TempFolder" ]; then
sudo mkdir "$__ARMEmulRootfs/$__TempFolder"
- fi
+ fi
}
#Cross builds coreclr
@@ -354,7 +354,7 @@ function run_tests {
sudo chroot $__ARMEmulRootfs /bin/bash -x <<EOF
cd "$__ARMEmulCoreclr"
./tests/runtest.sh --sequential\
- --testRootDir=$__testRootDirBase \
+ --testRootDir=$__testRootDirBase \
--mscorlibDir=$__mscorlibDirBase \
--coreFxNativeBinDir=$__coreFxNativeBinDirBase \
--coreFxBinDir="$__coreFxBinDirBase" \
@@ -509,7 +509,7 @@ if [ "$__ciMode" == "emulator" ]; then
__skipTests=1
fi
-__coreFxBinDir="./bin/CoreFxBinDir" # TODO-clenup: Just for testing....
+__coreFxBinDir="./bin/CoreFxBinDir" # TODO-cleanup: Just for testing....
#Check if the optional arguments are present in the case that testing is to be done
if [ $__skipTests == 0 ]; then
exit_if_empty "$__testRootDir" "Testing requested, but --testRootDir not provided" true
diff --git a/tests/scripts/run-corefx-tests.py b/tests/scripts/run-corefx-tests.py
index 7f261af713..84f5abfde1 100644
--- a/tests/scripts/run-corefx-tests.py
+++ b/tests/scripts/run-corefx-tests.py
@@ -296,13 +296,35 @@ def main(args):
# runtime with the runtime built in the coreclr build. The result will be that perhaps
# some, hopefully few, corefx tests will fail, but the builds will never fail.
- command = ' '.join(('build.cmd' if Is_windows else './build.sh',
- config_args))
+ if not Is_windows and arch == 'arm64' :
+ # Cross build corefx for arm64 on x64
+ command = ' '.join(('./build-native.sh', config_args))
+ log(command)
+ returncode = 0 if testing else os.system(command)
+ if returncode != 0:
+ sys.exit(1)
+
+ command = ' '.join(('./build-managed.sh', '-release'))
+ log(command)
+ returncode = 0 if testing else os.system(command)
+ if returncode != 0:
+ sys.exit(1)
+
+ # Rename runtime to arm64
+ os.rename(os.path.join(fx_root,'bin','runtime', 'netcoreapp-%s-%s-%s' % (clr_os, 'Release', 'x64')),
+ os.path.join(fx_root,'bin','runtime', 'netcoreapp-%s-%s-%s' % (clr_os, 'Release', 'arm64')))
+
+ os.rename(os.path.join(fx_root,'bin','testhost', 'netcoreapp-%s-%s-%s' % (clr_os, 'Release', 'x64')),
+ os.path.join(fx_root,'bin','testhost', 'netcoreapp-%s-%s-%s' % (clr_os, 'Release', 'arm64')))
+
+ else:
+ command = ' '.join(('build.cmd' if Is_windows else './build.sh',
+ config_args))
+ log(command)
+ returncode = 0 if testing else os.system(command)
+ if returncode != 0:
+ sys.exit(1)
- log(command)
- returncode = 0 if testing else os.system(command)
- if returncode != 0:
- sys.exit(1)
# Override the built corefx runtime (which it picked up by copying from packages determined
# by its dependencies.props file). Note that we always build Release corefx.
@@ -322,6 +344,22 @@ def main(args):
log('Updating CoreCLR: %s => %s' % (core_root, fx_runtime))
copy_files(core_root, fx_runtime)
+ if not Is_windows and arch == 'arm64' :
+ fx_arm64_native = os.path.join(fx_root,
+ 'bin',
+ '%s.%s.%s' % (clr_os, 'arm64', 'Release'),
+ 'native')
+ log('Copying CoreFx Arm64 Native libraries: %s => %s' % (fx_arm64_native, fx_runtime))
+ copy_files(fx_arm64_native, fx_runtime)
+
+ # Replace dotnet binary with corerun softlink, to make run-test.sh work as is on ARM64 platform
+ # with the built runtime.
+ dotnet_base= os.path.join(fx_root,'bin','testhost', 'netcoreapp-%s-%s-%s' % (clr_os, 'Release', arch))
+ os.remove(os.path.join(dotnet_base,'dotnet'))
+ os.chdir(dotnet_base)
+ os.symlink(os.path.join('shared','Microsoft.NETCore.App','9.9.9','corerun'), 'dotnet')
+ os.chdir(fx_root)
+
# Build the build-tests command line.
if Is_windows:
diff --git a/tests/scripts/run-xunit-perf.py b/tests/scripts/run-xunit-perf.py
index 6e0a0bade3..3c1cb89dca 100755
--- a/tests/scripts/run-xunit-perf.py
+++ b/tests/scripts/run-xunit-perf.py
@@ -458,7 +458,7 @@ def main(args):
if optLevel == 'min_opts':
myEnv['COMPlus_JITMinOpts'] = '1'
elif optLevel == 'tiered':
- myEnv['COMPLUS_EXPERIMENTAL_TieredCompilation'] = '1'
+ myEnv['COMPLUS_TieredCompilation'] = '1'
if not 'XUNIT_PERFORMANCE_MAX_ITERATION' in myEnv:
myEnv['XUNIT_PERFORMANCE_MAX_ITERATION'] = '21'
diff --git a/tests/src/CLRTest.Execute.Bash.targets b/tests/src/CLRTest.Execute.Bash.targets
index 73f70313b0..53b632b12e 100644
--- a/tests/src/CLRTest.Execute.Bash.targets
+++ b/tests/src/CLRTest.Execute.Bash.targets
@@ -83,9 +83,9 @@ fi
]]></BashCLRTestEnvironmentCompatibilityCheck>
<BashCLRTestEnvironmentCompatibilityCheck Condition="'$(JitOptimizationSensitive)' == 'true'"><![CDATA[
$(BashCLRTestEnvironmentCompatibilityCheck)
-if [[ ( ! -z "$COMPlus_JitStress" ) || ( ! -z "$COMPlus_JitStressRegs" ) || ( ! -z "$COMPlus_JITMinOpts" ) || ( ! -z "$COMPlus_TailcallStress" ) || ( ! -z "$COMPlus_EXPERIMENTAL_TieredCompilation" ) ]]
+if [[ ( ! -z "$COMPlus_JitStress" ) || ( ! -z "$COMPlus_JitStressRegs" ) || ( ! -z "$COMPlus_JITMinOpts" ) || ( ! -z "$COMPlus_TailcallStress" ) || ( ! -z "$COMPlus_EXPERIMENTAL_TieredCompilation" ) || ( ! -z "$COMPlus_TieredCompilation" ) ]]
then
- echo "SKIPPING EXECUTION BECAUSE ONE OR MORE OF (COMPlus_JitStress, COMPlus_JitStressRegs, COMPlus_JITMinOpts, COMPlus_TailcallStress, COMPlus_EXPERIMENTAL_TieredCompilation) IS SET"
+ echo "SKIPPING EXECUTION BECAUSE ONE OR MORE OF (COMPlus_JitStress, COMPlus_JitStressRegs, COMPlus_JITMinOpts, COMPlus_TailcallStress, COMPlus_EXPERIMENTAL_TieredCompilation, COMPlus_TieredCompilation) IS SET"
exit $(GCBashScriptExitCode)
fi
]]></BashCLRTestEnvironmentCompatibilityCheck>
diff --git a/tests/src/CLRTest.Execute.Batch.targets b/tests/src/CLRTest.Execute.Batch.targets
index 7abf16a731..b02c396cd4 100644
--- a/tests/src/CLRTest.Execute.Batch.targets
+++ b/tests/src/CLRTest.Execute.Batch.targets
@@ -78,8 +78,8 @@ IF NOT "%COMPlus_GCStress%"=="" (
]]></BatchCLRTestEnvironmentCompatibilityCheck>
<BatchCLRTestEnvironmentCompatibilityCheck Condition="'$(JitOptimizationSensitive)' == 'true'"><![CDATA[
$(BatchCLRTestEnvironmentCompatibilityCheck)
-IF "%COMPlus_JitStress%"=="" IF "%COMPlus_JitStressRegs%"=="" IF "%COMPlus_JITMinOpts%"=="" IF "%COMPlus_TailcallStress%"=="" IF "%COMPlus_EXPERIMENTAL_TieredCompilation%"=="" goto :Compatible1
- ECHO SKIPPING EXECUTION BECAUSE ONE OR MORE OF (COMPlus_JitStress, COMPlus_JitStressRegs, COMPlus_JITMinOpts, COMPlus_TailcallStress, COMPlus_EXPERIMENTAL_TieredCompilation) IS SET
+IF "%COMPlus_JitStress%"=="" IF "%COMPlus_JitStressRegs%"=="" IF "%COMPlus_JITMinOpts%"=="" IF "%COMPlus_TailcallStress%"=="" IF "%COMPlus_EXPERIMENTAL_TieredCompilation%"=="" IF "%COMPlus_TieredCompilation%"=="" goto :Compatible1
+ ECHO SKIPPING EXECUTION BECAUSE ONE OR MORE OF (COMPlus_JitStress, COMPlus_JitStressRegs, COMPlus_JITMinOpts, COMPlus_TailcallStress, COMPlus_EXPERIMENTAL_TieredCompilation, COMPlus_TieredCompilation) IS SET
popd
Exit /b 0
:Compatible1
diff --git a/tests/src/Interop/CMakeLists.txt b/tests/src/Interop/CMakeLists.txt
index fc6ee5d2e6..9c217063f2 100644
--- a/tests/src/Interop/CMakeLists.txt
+++ b/tests/src/Interop/CMakeLists.txt
@@ -26,3 +26,4 @@ add_subdirectory(StringMarshalling/UTF8)
add_subdirectory(MarshalAPI/FunctionPointer)
add_subdirectory(MarshalAPI/IUnknown)
add_subdirectory(SizeConst)
+add_subdirectory(ClassicCOM) \ No newline at end of file
diff --git a/tests/src/Interop/ClassicCOM/CMakeLists.txt b/tests/src/Interop/ClassicCOM/CMakeLists.txt
new file mode 100644
index 0000000000..d3416dd584
--- /dev/null
+++ b/tests/src/Interop/ClassicCOM/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required (VERSION 2.6)
+project (ClassicCOMNative)
+include_directories(${INC_PLATFORM_DIR})
+set(SOURCES ClassicCOMNative.cpp)
+
+# add the executable
+add_library (ClassicCOMNative SHARED ${SOURCES})
+target_link_libraries(ClassicCOMNative ${LINK_LIBRARIES_ADDITIONAL})
+
+# add the install targets
+install (TARGETS ClassicCOMNative DESTINATION bin)
+
+
diff --git a/tests/src/Interop/ClassicCOM/COMLib.cs b/tests/src/Interop/ClassicCOM/COMLib.cs
new file mode 100644
index 0000000000..fba866c567
--- /dev/null
+++ b/tests/src/Interop/ClassicCOM/COMLib.cs
@@ -0,0 +1,34 @@
+// 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;
+using System.Text;
+using System.Security;
+using System.Runtime.InteropServices;
+
+public class COMLib
+{
+ [Guid("00020404-0000-0000-C000-000000000046")]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ [ComImport]
+ public interface IEnumVARIANT
+ {
+ [PreserveSig]
+ int Next(int celt, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] object[] rgVar, IntPtr pceltFetched);
+
+ [PreserveSig]
+ int Skip(int celt);
+
+ [PreserveSig]
+ int Reset();
+
+ IEnumVARIANT Clone();
+ }
+
+ [ComImport]
+ [Guid("78A51822-51F4-11D0-8F20-00805F2CD064")]
+ public class ProcessDebugManager
+ {
+ }
+}
diff --git a/tests/src/Interop/ClassicCOM/COMLib.csproj b/tests/src/Interop/ClassicCOM/COMLib.csproj
new file mode 100644
index 0000000000..1f289d6729
--- /dev/null
+++ b/tests/src/Interop/ClassicCOM/COMLib.csproj
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>COMLib</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{5FEE5C46-8DD9-49FA-BDC1-AF22867A0704}</ProjectGuid>
+ <OutputType>library</OutputType>
+ <ProjectTypeGuids>{CDC3DF7E-04B4-4464-9A02-7E2B0FAB586A};{68EC03EE-C9EE-47FD-AA08-A954EB2D9816}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="COMLib.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Interop/ClassicCOM/COMLib2.cs b/tests/src/Interop/ClassicCOM/COMLib2.cs
new file mode 100644
index 0000000000..8f0ec78c4d
--- /dev/null
+++ b/tests/src/Interop/ClassicCOM/COMLib2.cs
@@ -0,0 +1,34 @@
+// 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;
+using System.Text;
+using System.Security;
+using System.Runtime.InteropServices;
+
+namespace COMLib2
+{
+ [Guid("00020404-0000-0000-C000-000000000046")]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ [ComImport]
+ public interface IEnumVARIANT
+ {
+ [PreserveSig]
+ int Next(int celt, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] object[] rgVar, IntPtr pceltFetched);
+
+ [PreserveSig]
+ int Skip(int celt);
+
+ [PreserveSig]
+ int Reset();
+
+ IEnumVARIANT Clone();
+ }
+
+ [ComImport]
+ [Guid("09799AFB-AD67-11d1-ABCD-00C04FC30936")]
+ public class ContextMenu
+ {
+ }
+}
diff --git a/tests/src/Interop/ClassicCOM/COMLib2.csproj b/tests/src/Interop/ClassicCOM/COMLib2.csproj
new file mode 100644
index 0000000000..601b94ecf9
--- /dev/null
+++ b/tests/src/Interop/ClassicCOM/COMLib2.csproj
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>COMLib2</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C04AB564-CC61-499D-9F4C-AA1A9FDE42C9}</ProjectGuid>
+ <OutputType>library</OutputType>
+ <ProjectTypeGuids>{4948E98A-ECFC-4988-851E-68E1ADD2DD5A};{B850CC46-E8FB-4569-A28D-423F81E8A861}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="COMLib2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Interop/ClassicCOM/ClassicCOMNative.cpp b/tests/src/Interop/ClassicCOM/ClassicCOMNative.cpp
new file mode 100644
index 0000000000..962313c229
--- /dev/null
+++ b/tests/src/Interop/ClassicCOM/ClassicCOMNative.cpp
@@ -0,0 +1,28 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+#include <xplatform.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+extern "C" DLL_EXPORT void PassObjectToNative(void * ptr)
+{
+ // TODO: Add check
+}
+
+extern "C" DLL_EXPORT void PassObjectArrayToNative(void ** pptr)
+{
+ // TODO: Add check
+}
+
+extern "C" DLL_EXPORT void GetObjectFromNative(void ** pptr)
+{
+ *pptr = NULL;
+ // TODO: Add check
+}
+
+extern "C" DLL_EXPORT void GetObjectFromNativeAsRef(void ** pptr)
+{
+ // TODO: Add check
+} \ No newline at end of file
diff --git a/tests/src/Interop/ClassicCOM/ClassicCOMUnitTest.cs b/tests/src/Interop/ClassicCOM/ClassicCOMUnitTest.cs
new file mode 100644
index 0000000000..23bac89fbb
--- /dev/null
+++ b/tests/src/Interop/ClassicCOM/ClassicCOMUnitTest.cs
@@ -0,0 +1,245 @@
+// 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.
+//
+
+//
+// Adding tests for Classic COM code coverage
+//
+
+using System;
+using System.Text;
+using System.Security;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using TestLibrary;
+
+public class ClassicCOMUnitTest
+{
+ /// <summary>
+ /// Try to reflect load ComImport Types by enumerate
+ /// </summary>
+ /// <returns></returns>
+ static bool RelectionLoad()
+ {
+ try
+ {
+ Console.WriteLine("Scenario: RelectionLoad");
+ var asm = Assembly.LoadFrom("COMLib.dll");
+ foreach (Type t in asm.GetTypes())
+ {
+ Console.WriteLine(t.Name);
+ }
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " + e);
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Try to test Type.IsCOMObject
+ /// </summary>
+ /// <returns></returns>
+ static bool TypeIsComObject()
+ {
+ try
+ {
+ Console.WriteLine("Scenario: TypeIsComObject");
+ Type classType = typeof(COMLib2.ContextMenu);
+ if (!classType.IsCOMObject)
+ {
+ Console.WriteLine("ComImport Class's IsCOMObject should return true");
+ return false;
+ }
+
+ Type interfaceType = typeof(COMLib2.IEnumVARIANT);
+ if (interfaceType.IsCOMObject)
+ {
+ Console.WriteLine("ComImport interface's IsCOMObject should return false");
+ return false;
+ }
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " + e);
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Try to create COM instance
+ /// </summary>
+ /// <returns></returns>
+ static bool AcivateCOMType()
+ {
+ try
+ {
+ Console.WriteLine("Scenario: AcivateCOMType");
+ COMLib2.ContextMenu contextMenu = (COMLib2.ContextMenu)Activator.CreateInstance(typeof(COMLib2.ContextMenu));
+
+ // Linux should throw PlatformNotSupportedException
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ return false;
+ }
+
+ if (contextMenu == null)
+ {
+ Console.WriteLine("AcivateCOMType failed");
+ return false;
+ }
+
+ return true;
+ }
+ catch (System.Reflection.TargetInvocationException e)
+ {
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && e.InnerException is PlatformNotSupportedException)
+ {
+ return true;
+ }
+
+ Console.WriteLine("Caught unexpected PlatformNotSupportedException: " + e);
+ return false;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " + e);
+ return false;
+ }
+ }
+
+ [DllImport("ClassicCOMNative.dll")]
+ extern static void PassObjectToNative([In, MarshalAs( UnmanagedType.Interface)] object o);
+
+ [DllImport("ClassicCOMNative.dll")]
+ extern static void PassObjectArrayToNative([In,Out] object[] o);
+
+ [DllImport("ClassicCOMNative.dll")]
+ extern static void GetObjectFromNative(out object o);
+
+ [DllImport("ClassicCOMNative.dll")]
+ extern static void GetObjectFromNativeAsRef(ref object o);
+
+ /// <summary>
+ /// Try to Marshal COM Type across managed-native boundary
+ /// </summary>
+ /// <returns></returns>
+ static bool MarshalCOMType()
+ {
+ Console.WriteLine("Scenario: MarshalCOMType");
+ try
+ {
+ object o = new object();
+ PassObjectToNative(o);
+ }
+ catch (System.Runtime.InteropServices.MarshalDirectiveException e)
+ {
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ return true;
+ }
+ Console.WriteLine("Caught unexpected MarshalDirectiveException: " + e);
+ return false;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception in PassObjectToNative: " + e);
+ return false;
+ }
+
+ try
+ {
+ object [] oa = new object[2];
+ PassObjectArrayToNative(oa);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception in GetObjectFromNative: " + e);
+ return false;
+ }
+
+
+ try
+ {
+ object o;
+ GetObjectFromNative(out o);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception in GetObjectFromNative: " + e);
+ return false;
+ }
+
+ try
+ {
+ object o = new object();
+ GetObjectFromNativeAsRef(ref o);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception in GetObjectFromNativeAsRef: " + e);
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Try to call Marshal API for COM Types
+ /// </summary>
+ /// <returns></returns>
+ static bool MarshalAPI()
+ {
+ Console.WriteLine("Scenario: MarshalAPI");
+ // MarshalAPI
+ if (Marshal.AreComObjectsAvailableForCleanup())
+ {
+ Console.WriteLine("AreComObjectsAvailableForCleanup should return false");
+ return false;
+ }
+ return true;
+ }
+
+ [System.Security.SecuritySafeCritical]
+ static int Main()
+ {
+ int failures = 0;
+ if (!RelectionLoad())
+ {
+ Console.WriteLine("RelectionLoad Failed");
+ failures++;
+ }
+
+ if (!TypeIsComObject())
+ {
+ Console.WriteLine("TypeIsComObject Failed");
+ failures++;
+ }
+
+ if (!AcivateCOMType())
+ {
+ Console.WriteLine("AcivateCOMType Failed");
+ failures++;
+ }
+
+ if (!MarshalCOMType())
+ {
+ Console.WriteLine("MarshalCOMType Failed");
+ failures++;
+ }
+
+ if (!MarshalAPI())
+ {
+ Console.WriteLine("MarshalAPI Failed");
+ failures++;
+ }
+
+ return failures > 0 ? 101 : 100;
+ }
+}
diff --git a/tests/src/Interop/ClassicCOM/ClassicCOMUnitTest.csproj b/tests/src/Interop/ClassicCOM/ClassicCOMUnitTest.csproj
new file mode 100644
index 0000000000..673e216fe9
--- /dev/null
+++ b/tests/src/Interop/ClassicCOM/ClassicCOMUnitTest.csproj
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>ClassicCOMUnitTest</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{85C57688-DA98-4DE3-AC9B-526E4747434C}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{209912F9-0DA1-4184-9CC1-8D583BAF4A28};{87799F5D-CEBD-499D-BDBA-B2C6105CD766}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ClassicCOMUnitTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
+ <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
+ <Name>CoreCLRTestLibrary</Name>
+ </ProjectReference>
+ <ProjectReference Include="COMLib.csproj">
+ <Project>{5FEE5C46-8DD9-49FA-BDC1-AF22867A0704}</Project>
+ <Name>COMLib</Name>
+ </ProjectReference>
+ <ProjectReference Include="COMLib2.csproj">
+ <Project>{C04AB564-CC61-499D-9F4C-AA1A9FDE42C9}</Project>
+ <Name>COMLib</Name>
+ </ProjectReference>
+ <ProjectReference Include="CMakeLists.txt" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs b/tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs
index 7bfe19fdac..2e9e6858f8 100644
--- a/tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs
+++ b/tests/src/Interop/StringMarshalling/UTF8/UTF8Test.cs
@@ -126,8 +126,21 @@ class UTF8StructMarshalling
public int index;
}
+ unsafe struct UnmanagedStruct
+ {
+ public fixed byte psz[8];
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ struct ManagedStruct
+ {
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
+ public string str;
+ }
+
[DllImport("UTF8TestNative", CallingConvention = CallingConvention.Cdecl)]
public static extern void TestStructWithUtf8Field(Utf8Struct utfStruct);
+
public static void TestUTF8StructMarshalling(string[] utf8Strings)
{
Utf8Struct utf8Struct = new Utf8Struct();
@@ -137,7 +150,40 @@ class UTF8StructMarshalling
utf8Struct.index = i;
TestStructWithUtf8Field(utf8Struct);
}
- }
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ CompareWithUTF8Encoding();
+ }
+
+ unsafe static void CompareWithUTF8Encoding()
+ {
+ // Compare results with UTF8Encoding
+ UnmanagedStruct ums;
+ ums.psz[0] = 0xFF;
+ ums.psz[1] = (byte)'a';
+ ums.psz[2] = (byte)'b';
+ ums.psz[3] = (byte)'c';
+ ums.psz[4] = (byte)'d';
+ ums.psz[5] = 0;
+
+ IntPtr ptr = (IntPtr)(&ums);
+ ManagedStruct ms = Marshal.PtrToStructure<ManagedStruct>(ptr);
+ string actual = ms.str;
+
+ UTF8Encoding uTF8Encoding = new UTF8Encoding();
+ byte [] b = new byte[5];
+ b[0] = 0xFF;
+ b[1] = (byte)'a';
+ b[2] = (byte)'b';
+ b[3] = (byte)'c';
+ b[4] = (byte)'d';
+ string expected = uTF8Encoding.GetString(b);
+ if (actual != expected)
+ {
+ Console.WriteLine("Actual:" + actual + " Length:" + actual.Length);
+ Console.WriteLine("Expected:" + expected + " Length:" + expected.Length);
+ throw new Exception("UTF8Encoding.GetString doesn't match with Utf8 String Marshaller result");
+ }
+ }
}
// UTF8 string as delegate parameter
@@ -165,6 +211,7 @@ class UTF8DelegateMarshalling
}
}
+
class Test
{
//test strings
@@ -216,6 +263,7 @@ class Test
// String.Empty tests
UTF8StringTests.EmptyStringTest();
+
return 100;
}
-} \ No newline at end of file
+}
diff --git a/tests/src/JIT/Directed/RVAInit/oddsize.ilproj b/tests/src/JIT/Directed/RVAInit/oddsize.ilproj
index 39d8bfaf0d..7e22d9ffb4 100644
--- a/tests/src/JIT/Directed/RVAInit/oddsize.ilproj
+++ b/tests/src/JIT/Directed/RVAInit/oddsize.ilproj
@@ -10,7 +10,6 @@
<OutputType>Exe</OutputType>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Double.cs
index 797828aa5e..ab282494fd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__AddDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Single.cs
index 12a068fbdb..ebb2751a02 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Add.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__AddSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Double.cs
index 19b16438ef..e1ae4afdb0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSubtractDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__AddSubtractDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Single.cs
index dcea453e43..15822235ab 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/AddSubtract.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSubtractSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__AddSubtractSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Double.cs
index 6869532508..b71ad1ae2f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__AndDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Single.cs
index 1172954115..b6e5e62a7f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/And.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__AndSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Double.cs
index d41872c0a2..aa62937bcd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__AndNotDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Single.cs
index afa57f1981..41aa383a45 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/AndNot.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__AndNotSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj
index 98abca2e19..7f89b89440 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj
@@ -60,6 +60,14 @@
<Compile Include="Extract.UInt64.1.cs" />
<Compile Include="Extract.Int64.3.cs" />
<Compile Include="Extract.UInt64.3.cs" />
+ <Compile Include="Extract.Byte.52.cs" />
+ <Compile Include="Extract.SByte.52.cs" />
+ <Compile Include="Extract.Int16.27.cs" />
+ <Compile Include="Extract.UInt16.27.cs" />
+ <Compile Include="Extract.Int32.22.cs" />
+ <Compile Include="Extract.UInt32.22.cs" />
+ <Compile Include="Extract.Int64.19.cs" />
+ <Compile Include="Extract.UInt64.19.cs" />
<Compile Include="ExtendToVector256.Byte.cs" />
<Compile Include="ExtendToVector256.Double.cs" />
<Compile Include="ExtendToVector256.Int16.cs" />
@@ -96,6 +104,14 @@
<Compile Include="Insert.UInt64.1.cs" />
<Compile Include="Insert.Int64.3.cs" />
<Compile Include="Insert.UInt64.3.cs" />
+ <Compile Include="Insert.Byte.52.cs" />
+ <Compile Include="Insert.SByte.52.cs" />
+ <Compile Include="Insert.Int16.27.cs" />
+ <Compile Include="Insert.UInt16.27.cs" />
+ <Compile Include="Insert.Int32.22.cs" />
+ <Compile Include="Insert.UInt32.22.cs" />
+ <Compile Include="Insert.Int64.19.cs" />
+ <Compile Include="Insert.UInt64.19.cs" />
<Compile Include="InsertVector128.Byte.1.Load.cs" />
<Compile Include="InsertVector128.SByte.1.Load.cs" />
<Compile Include="InsertVector128.Int16.1.Load.cs" />
@@ -130,6 +146,8 @@
<Compile Include="Permute.Double.1.cs" />
<Compile Include="Permute.Single.2.cs" />
<Compile Include="Permute.Double.2.cs" />
+ <Compile Include="PermuteVar.Single.cs" />
+ <Compile Include="PermuteVar.Double.cs" />
<Compile Include="RoundCurrentDirection.Double.cs" />
<Compile Include="RoundCurrentDirection.Single.cs" />
<Compile Include="RoundToNearestInteger.Double.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj
index 7b45811695..66eb86a7e1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj
@@ -60,6 +60,14 @@
<Compile Include="Extract.UInt64.1.cs" />
<Compile Include="Extract.Int64.3.cs" />
<Compile Include="Extract.UInt64.3.cs" />
+ <Compile Include="Extract.Byte.52.cs" />
+ <Compile Include="Extract.SByte.52.cs" />
+ <Compile Include="Extract.Int16.27.cs" />
+ <Compile Include="Extract.UInt16.27.cs" />
+ <Compile Include="Extract.Int32.22.cs" />
+ <Compile Include="Extract.UInt32.22.cs" />
+ <Compile Include="Extract.Int64.19.cs" />
+ <Compile Include="Extract.UInt64.19.cs" />
<Compile Include="ExtendToVector256.Byte.cs" />
<Compile Include="ExtendToVector256.Double.cs" />
<Compile Include="ExtendToVector256.Int16.cs" />
@@ -96,6 +104,14 @@
<Compile Include="Insert.UInt64.1.cs" />
<Compile Include="Insert.Int64.3.cs" />
<Compile Include="Insert.UInt64.3.cs" />
+ <Compile Include="Insert.Byte.52.cs" />
+ <Compile Include="Insert.SByte.52.cs" />
+ <Compile Include="Insert.Int16.27.cs" />
+ <Compile Include="Insert.UInt16.27.cs" />
+ <Compile Include="Insert.Int32.22.cs" />
+ <Compile Include="Insert.UInt32.22.cs" />
+ <Compile Include="Insert.Int64.19.cs" />
+ <Compile Include="Insert.UInt64.19.cs" />
<Compile Include="InsertVector128.Byte.1.Load.cs" />
<Compile Include="InsertVector128.SByte.1.Load.cs" />
<Compile Include="InsertVector128.Int16.1.Load.cs" />
@@ -130,6 +146,8 @@
<Compile Include="Permute.Double.1.cs" />
<Compile Include="Permute.Single.2.cs" />
<Compile Include="Permute.Double.2.cs" />
+ <Compile Include="PermuteVar.Single.cs" />
+ <Compile Include="PermuteVar.Double.cs" />
<Compile Include="RoundCurrentDirection.Double.cs" />
<Compile Include="RoundCurrentDirection.Single.cs" />
<Compile Include="RoundToNearestInteger.Double.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Double.cs
index 5e5270e42a..7a576dfe2a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Double.cs
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__BlendVariableDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int Op3ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(((i % 2) == 0) ? -0.0 : 1.0); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar3), ref Unsafe.As<Double, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleTernaryOpTest__BlendVariableDouble()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(((i % 2) == 0) ? -0.0 : 1.0); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld3), ref Unsafe.As<Double, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(((i % 2) == 0) ? -0.0 : 1.0); }
- _dataTable = new SimpleTernaryOpTest__DataTable<Double, Double, Double, Double>(_data1, _data2, _data3, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<Double, Double, Double, Double>(_data1, _data2, _data3, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray3 = new Double[Op3ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray3 = new Double[Op3ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Single.cs
index e3540d85ca..6af68ac357 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BlendVariable.Single.cs
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__BlendVariableSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int Op3ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(((i % 2) == 0) ? -0.0 : 1.0); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar3), ref Unsafe.As<Single, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleTernaryOpTest__BlendVariableSingle()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(((i % 2) == 0) ? -0.0 : 1.0); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld3), ref Unsafe.As<Single, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(((i % 2) == 0) ? -0.0 : 1.0); }
- _dataTable = new SimpleTernaryOpTest__DataTable<Single, Single, Single, Single>(_data1, _data2, _data3, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<Single, Single, Single, Single>(_data1, _data2, _data3, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray3 = new Single[Op3ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray3 = new Single[Op3ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256.cs
new file mode 100644
index 0000000000..95e6a9e73f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256.cs
@@ -0,0 +1,107 @@
+// 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;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.Intrinsics;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static unsafe int Main(string[] args)
+ {
+ int testResult = Pass;
+
+ if (Avx.IsSupported)
+ {
+ using (TestTable<float> floatTable = new TestTable<float>(new float[8] { 1, -5, 100, 0, 1, 2, 3, 4 }, new float[8]))
+ {
+ var vf = Avx.BroadcastVector128ToVector256((float*)(floatTable.inArrayPtr));
+ Unsafe.Write(floatTable.outArrayPtr, vf);
+
+ if (!floatTable.CheckResult((x, y) => BitConverter.SingleToInt32Bits(x) == BitConverter.SingleToInt32Bits(y)))
+ {
+ Console.WriteLine("AVX BroadcastVector128ToVector256 failed on float:");
+ foreach (var item in floatTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<double> doubleTable = new TestTable<double>(new double[4] { 1, -5, 100, 0}, new double[4]))
+ {
+ var vf = Avx.BroadcastVector128ToVector256((double*)(doubleTable.inArrayPtr));
+ Unsafe.Write(doubleTable.outArrayPtr, vf);
+
+ if (!doubleTable.CheckResult((x, y) => BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y)))
+ {
+ Console.WriteLine("AVX BroadcastVector128ToVector256 failed on double:");
+ foreach (var item in doubleTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+ }
+ return testResult;
+ }
+
+ public unsafe struct TestTable<T> : IDisposable where T : struct
+ {
+ public T[] inArray;
+ public T[] outArray;
+
+ public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
+ public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
+
+ GCHandle inHandle;
+ GCHandle outHandle;
+ public TestTable(T[] a, T[] b)
+ {
+ this.inArray = a;
+ this.outArray = b;
+
+ inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned);
+ outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
+ }
+ public bool CheckResult(Func<T, T, bool> check)
+ {
+ for (int i = 0; i < outArray.Length/2; i++)
+ {
+ if (!check(inArray[i], outArray[i]))
+ {
+ return false;
+ }
+ }
+ for (int i = outArray.Length/2; i < outArray.Length; i++)
+ {
+ if (!check(inArray[i - outArray.Length/2], outArray[i]))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void Dispose()
+ {
+ inHandle.Free();
+ outHandle.Free();
+ }
+ }
+
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256_r.csproj
new file mode 100644
index 0000000000..1f4bcd4e36
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256_r.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BroadcastVector128ToVector256.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256_ro.csproj
new file mode 100644
index 0000000000..feecc1c334
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/BroadcastVector128ToVector256_ro.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BroadcastVector128ToVector256.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Double.cs
index 202f4e246d..f34542f437 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__CeilingDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__CeilingDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Single.cs
index c2df15d21b..d6a27d52c6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Ceiling.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__CeilingSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__CeilingSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32.Double.cs
index 680415f20c..874015205d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int32Double
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = 16 / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int32Double()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Double>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Double>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32WithTruncation.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32WithTruncation.Double.cs
index db0392674b..7261fa08df 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32WithTruncation.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Int32WithTruncation.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int32WithTruncationDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = 16 / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int32WithTruncationDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Double>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Double>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Single.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Single.Double.cs
index 912ea707cd..d485250eca 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Single.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector128Single.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128SingleDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = 16 / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__ConvertToVector128SingleDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Double>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Double>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Int32.cs
index 4da4429568..fb267c0177 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Int32.cs
@@ -85,11 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256DoubleInt32
{
- private const int Op1VectorSize = 16;
- private const int RetVectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = Op1VectorSize / sizeof(Int32);
- private const int RetElementCount = RetVectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -104,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), Op1VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ConvertToVector256DoubleInt32()
@@ -114,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), Op1VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Int32>(_data, new Double[RetElementCount], RetVectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Int32>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -260,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), RetVectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -271,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), Op1VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), RetVectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Single.cs
index bc22e79bfa..8cee60b6e0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Double.Single.cs
@@ -85,11 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256DoubleSingle
{
- private const int Op1VectorSize = 16;
- private const int RetVectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = Op1VectorSize / sizeof(Single);
- private const int RetElementCount = RetVectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Single[] _data = new Single[Op1ElementCount];
@@ -104,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), Op1VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__ConvertToVector256DoubleSingle()
@@ -114,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), Op1VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Single>(_data, new Double[RetElementCount], RetVectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Single>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -260,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), RetVectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -271,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), Op1VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), RetVectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32.Single.cs
index edcad5fa43..42b88dc928 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256Int32Single
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__ConvertToVector256Int32Single()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Single>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Single>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32WithTruncation.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32WithTruncation.Single.cs
index 53b81c7761..a9507d2e62 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32WithTruncation.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Int32WithTruncation.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256Int32WithTruncationSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__ConvertToVector256Int32WithTruncationSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Single>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Single>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Single.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Single.Int32.cs
index a0b8ba86b8..abbdb9c355 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Single.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToVector256Single.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256SingleInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ConvertToVector256SingleInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Int32>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Int32>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Double.cs
index 93fbf1e844..52588d9e2c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__DivideDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__DivideDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Single.cs
index cd77bf07e0..aa28dc18a4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Divide.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__DivideSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__DivideSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Double.cs
index 282e821626..ae42b1a0af 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__DuplicateEvenIndexedDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__DuplicateEvenIndexedDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Single.cs
index e27647475d..45728ded03 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateEvenIndexed.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__DuplicateEvenIndexedSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__DuplicateEvenIndexedSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateOddIndexed.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateOddIndexed.Single.cs
index bcfb0bae67..94180518c9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateOddIndexed.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/DuplicateOddIndexed.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__DuplicateOddIndexedSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__DuplicateOddIndexedSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Byte.cs
index 6db20e8cc1..a84bd435ca 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256Byte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__ExtendToVector256Byte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Double.cs
index baee554be1..75f635d53f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256Double
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__ExtendToVector256Double()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int16.cs
index 28844add8a..99d8a75804 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256Int16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ExtendToVector256Int16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int32.cs
index 5c56a78726..97da6a6fb0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256Int32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ExtendToVector256Int32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int64.cs
index 36a8d71106..dd181a0db9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256Int64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ExtendToVector256Int64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.SByte.cs
index 3e47c881ea..a8a83d7b28 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256SByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__ExtendToVector256SByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Single.cs
index 05cdafa3cd..44be3a25a3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256Single
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__ExtendToVector256Single()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt16.cs
index 7f0ff236f4..f2f1d3747d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256UInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ExtendToVector256UInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt32.cs
index 154b3cb864..6a9d7908a9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256UInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ExtendToVector256UInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt64.cs
index 85295c05ef..3e504b119e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtendToVector256.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtendToVector256UInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ExtendToVector256UInt64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs
index 4f64c65045..2c59dfdf73 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__ExtractByte1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs
index bbe912f98d..068e812b00 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractByte20
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__ExtractByte20()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.52.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.52.cs
new file mode 100644
index 0000000000..4f39a52795
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.52.cs
@@ -0,0 +1,309 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ExtractByte52()
+ {
+ var test = new SimpleUnaryOpTest__ExtractByte52();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ExtractByte52
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ private static Byte[] _data = new Byte[Op1ElementCount];
+
+ private static Vector256<Byte> _clsVar;
+
+ private Vector256<Byte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
+
+ static SimpleUnaryOpTest__ExtractByte52()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ }
+
+ public SimpleUnaryOpTest__ExtractByte52()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Extract(
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Extract(
+ Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Extract(
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Extract(
+ _clsVar,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
+ var result = Avx.Extract(firstOp, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ExtractByte52();
+ var result = Avx.Extract(test._fld, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Extract(_fld, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
+ {
+ if ((result[0] != firstOp[20]))
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Extract)}<Byte>(Vector256<Byte><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.1.cs
index 183888c5fc..157ae1696f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ExtractInt161()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.11.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.11.cs
index e240fe4e62..ba511b8200 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.11.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.11.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt1611
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ExtractInt1611()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.27.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.27.cs
new file mode 100644
index 0000000000..83d73dacf6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int16.27.cs
@@ -0,0 +1,309 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ExtractInt1627()
+ {
+ var test = new SimpleUnaryOpTest__ExtractInt1627();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ExtractInt1627
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ private static Int16[] _data = new Int16[Op1ElementCount];
+
+ private static Vector256<Int16> _clsVar;
+
+ private Vector256<Int16> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int16, Int16> _dataTable;
+
+ static SimpleUnaryOpTest__ExtractInt1627()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ }
+
+ public SimpleUnaryOpTest__ExtractInt1627()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Extract(
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Extract(
+ Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Extract(
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int16>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int16)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int16>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int16)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int16>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int16)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Extract(
+ _clsVar,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr);
+ var result = Avx.Extract(firstOp, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ExtractInt1627();
+ var result = Avx.Extract(test._fld, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Extract(_fld, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int16> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray = new Int16[Op1ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray = new Int16[Op1ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "")
+ {
+ if ((result[0] != firstOp[11]))
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int16>(Vector256<Int16><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs
index ef7ee434c1..133d65a06e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ExtractInt321()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.22.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.22.cs
new file mode 100644
index 0000000000..bd79d925cf
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.22.cs
@@ -0,0 +1,309 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ExtractInt3222()
+ {
+ var test = new SimpleUnaryOpTest__ExtractInt3222();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ExtractInt3222
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ private static Int32[] _data = new Int32[Op1ElementCount];
+
+ private static Vector256<Int32> _clsVar;
+
+ private Vector256<Int32> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
+
+ static SimpleUnaryOpTest__ExtractInt3222()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ }
+
+ public SimpleUnaryOpTest__ExtractInt3222()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Extract(
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Extract(
+ Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Extract(
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Extract(
+ _clsVar,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
+ var result = Avx.Extract(firstOp, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ExtractInt3222();
+ var result = Avx.Extract(test._fld, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Extract(_fld, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray = new Int32[Op1ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray = new Int32[Op1ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
+ {
+ if ((result[0] != firstOp[6]))
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int32>(Vector256<Int32><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs
index c7d935cba1..0e42ec785d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt326
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ExtractInt326()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs
index 269128a314..2213721e52 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ExtractInt641()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.19.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.19.cs
new file mode 100644
index 0000000000..24e7207803
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.19.cs
@@ -0,0 +1,309 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ExtractInt6419()
+ {
+ var test = new SimpleUnaryOpTest__ExtractInt6419();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ExtractInt6419
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ private static Int64[] _data = new Int64[Op1ElementCount];
+
+ private static Vector256<Int64> _clsVar;
+
+ private Vector256<Int64> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
+
+ static SimpleUnaryOpTest__ExtractInt6419()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ }
+
+ public SimpleUnaryOpTest__ExtractInt6419()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Extract(
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Extract(
+ Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Extract(
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Extract(
+ _clsVar,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
+ var result = Avx.Extract(firstOp, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ExtractInt6419();
+ var result = Avx.Extract(test._fld, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Extract(_fld, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int64[] inArray = new Int64[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int64[] inArray = new Int64[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
+ {
+ if ((result[0] != firstOp[3]))
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int64>(Vector256<Int64><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs
index 70835b59b4..fb89cd06a8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt643
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ExtractInt643()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.1.cs
index e50c608442..387e00b548 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractSByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__ExtractSByte1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.20.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.20.cs
index 5cdc42c2ea..4fb463acd8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.20.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.20.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractSByte20
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__ExtractSByte20()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.52.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.52.cs
new file mode 100644
index 0000000000..391703f2d9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.SByte.52.cs
@@ -0,0 +1,309 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ExtractSByte52()
+ {
+ var test = new SimpleUnaryOpTest__ExtractSByte52();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ExtractSByte52
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ private static SByte[] _data = new SByte[Op1ElementCount];
+
+ private static Vector256<SByte> _clsVar;
+
+ private Vector256<SByte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<SByte, SByte> _dataTable;
+
+ static SimpleUnaryOpTest__ExtractSByte52()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ }
+
+ public SimpleUnaryOpTest__ExtractSByte52()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Extract(
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Extract(
+ Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Extract(
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<SByte>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (SByte)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<SByte>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (SByte)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<SByte>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (SByte)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Extract(
+ _clsVar,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr);
+ var result = Avx.Extract(firstOp, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ExtractSByte52();
+ var result = Avx.Extract(test._fld, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Extract(_fld, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<SByte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ SByte[] outArray = new SByte[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ SByte[] outArray = new SByte[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
+ {
+ if ((result[0] != firstOp[20]))
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Extract)}<SByte>(Vector256<SByte><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs
index 67a8d3ed48..717749c9ba 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ExtractUInt161()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs
index 4cfdc671e9..b68ab35ded 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt1611
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ExtractUInt1611()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.27.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.27.cs
new file mode 100644
index 0000000000..9ece246b54
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.27.cs
@@ -0,0 +1,309 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ExtractUInt1627()
+ {
+ var test = new SimpleUnaryOpTest__ExtractUInt1627();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ExtractUInt1627
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ private static UInt16[] _data = new UInt16[Op1ElementCount];
+
+ private static Vector256<UInt16> _clsVar;
+
+ private Vector256<UInt16> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
+
+ static SimpleUnaryOpTest__ExtractUInt1627()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ }
+
+ public SimpleUnaryOpTest__ExtractUInt1627()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Extract(
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Extract(
+ Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Extract(
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Extract(
+ _clsVar,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
+ var result = Avx.Extract(firstOp, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ExtractUInt1627();
+ var result = Avx.Extract(test._fld, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Extract(_fld, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray = new UInt16[Op1ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray = new UInt16[Op1ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
+ {
+ if ((result[0] != firstOp[11]))
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt16>(Vector256<UInt16><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs
index 1d43daa75d..846efb1b2c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ExtractUInt321()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.22.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.22.cs
new file mode 100644
index 0000000000..7251ef7803
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.22.cs
@@ -0,0 +1,309 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ExtractUInt3222()
+ {
+ var test = new SimpleUnaryOpTest__ExtractUInt3222();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ExtractUInt3222
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ private static UInt32[] _data = new UInt32[Op1ElementCount];
+
+ private static Vector256<UInt32> _clsVar;
+
+ private Vector256<UInt32> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
+
+ static SimpleUnaryOpTest__ExtractUInt3222()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ }
+
+ public SimpleUnaryOpTest__ExtractUInt3222()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Extract(
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Extract(
+ Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Extract(
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Extract(
+ _clsVar,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
+ var result = Avx.Extract(firstOp, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ExtractUInt3222();
+ var result = Avx.Extract(test._fld, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Extract(_fld, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray = new UInt32[Op1ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray = new UInt32[Op1ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
+ {
+ if ((result[0] != firstOp[6]))
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt32>(Vector256<UInt32><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs
index de8837caf1..6546a7e097 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt326
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ExtractUInt326()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs
index a7ed898a86..9f6315a58e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ExtractUInt641()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.19.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.19.cs
new file mode 100644
index 0000000000..d3d90d8bd6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.19.cs
@@ -0,0 +1,309 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ExtractUInt6419()
+ {
+ var test = new SimpleUnaryOpTest__ExtractUInt6419();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ExtractUInt6419
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ private static UInt64[] _data = new UInt64[Op1ElementCount];
+
+ private static Vector256<UInt64> _clsVar;
+
+ private Vector256<UInt64> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
+
+ static SimpleUnaryOpTest__ExtractUInt6419()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ }
+
+ public SimpleUnaryOpTest__ExtractUInt6419()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Extract(
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Extract(
+ Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Extract(
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Extract(
+ _clsVar,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
+ var result = Avx.Extract(firstOp, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
+ var result = Avx.Extract(firstOp, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ExtractUInt6419();
+ var result = Avx.Extract(test._fld, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Extract(_fld, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray = new UInt64[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray = new UInt64[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
+ {
+ if ((result[0] != firstOp[3]))
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt64>(Vector256<UInt64><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs
index 67154d41af..8b3f3cfba6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt643
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ExtractUInt643()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.Store.cs
index b43bb977bc..844edcc9d2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Byte1Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = 16 / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__ExtractVector128Byte1Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.cs
index 4a8d646024..0b314a6b3b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Byte.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Byte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = 16 / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__ExtractVector128Byte1()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.Store.cs
index 4c80be7fe8..d55515d2a7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Double1Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = 16 / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__ExtractVector128Double1Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.cs
index a048510694..53aafd6827 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Double.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Double1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = 16 / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__ExtractVector128Double1()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.Store.cs
index 8732da30ea..8b073bd270 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int161Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = 16 / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ExtractVector128Int161Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.cs
index 8ef99ca072..6b7a2ed634 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int16.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = 16 / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ExtractVector128Int161()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.Store.cs
index 886c0bddca..7b55d154d6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int321Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = 16 / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ExtractVector128Int321Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.cs
index 11b97be6eb..f66dd67090 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int32.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = 16 / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ExtractVector128Int321()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.Store.cs
index 005fc82b49..c683405c3b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int641Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = 16 / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ExtractVector128Int641Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.cs
index f6f8c1b63f..11b52eaa83 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Int64.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = 16 / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ExtractVector128Int641()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.Store.cs
index fa745d2716..25d4cfc623 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128SByte1Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = 16 / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__ExtractVector128SByte1Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.cs
index 2dddbe5259..bd10710acc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.SByte.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128SByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = 16 / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__ExtractVector128SByte1()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.Store.cs
index 3fe06f5bd0..03c29d2a0e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Single1Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = 16 / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__ExtractVector128Single1Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.cs
index 7b72949740..a8097235ae 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.Single.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Single1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = 16 / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__ExtractVector128Single1()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.Store.cs
index 4f3d5a18fe..2deda23f9a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt161Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = 16 / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt161Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.cs
index 855580c58c..8054be42d3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt16.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = 16 / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt161()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.Store.cs
index 14202204fd..53769a5194 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt321Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = 16 / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt321Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.cs
index 25fd0644c0..8deb1b0d74 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt32.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = 16 / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt321()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.Store.cs
index fc22be9aef..949d618a03 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt641Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = 16 / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt641Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.cs
index d43f65136a..d277ff55fc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ExtractVector128.UInt64.1.cs
@@ -87,10 +87,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = 16 / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -105,7 +105,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt641()
@@ -115,10 +115,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -274,8 +274,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -285,8 +285,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Double.cs
index 2698d03e13..d616cf19d4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__FloorDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__FloorDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Single.cs
index 3342423976..f85a614951 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Floor.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__FloorSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__FloorSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs
index eef3e690ac..b8bb560f14 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__GetLowerHalfByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs
index cf746dd0e5..604d537e86 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__GetLowerHalfDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs
index fead370421..30d48a1176 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__GetLowerHalfInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs
index 53db66ab8a..ade78b5907 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__GetLowerHalfInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs
index ec796bf499..9c17b248de 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__GetLowerHalfInt64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs
index 5358b4ebe5..51e1f79165 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__GetLowerHalfSByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs
index 109ff68847..cb29e95568 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__GetLowerHalfSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs
index 5373f8b505..1ce642c1c8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__GetLowerHalfUInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs
index e7c675db77..2ef048d190 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__GetLowerHalfUInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs
index 089d6b86c6..06727e54df 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__GetLowerHalfUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__GetLowerHalfUInt64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs
index cd89f1fec6..d596cfc7f1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__InsertByte1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs
index 6ae3d08357..73ccb9dfd8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertByte20
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__InsertByte20()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.52.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.52.cs
new file mode 100644
index 0000000000..218f984165
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.52.cs
@@ -0,0 +1,321 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void InsertByte52()
+ {
+ var test = new SimpleUnaryOpTest__InsertByte52();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__InsertByte52
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ private static Byte[] _data = new Byte[Op1ElementCount];
+
+ private static Vector256<Byte> _clsVar;
+
+ private Vector256<Byte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
+
+ static SimpleUnaryOpTest__InsertByte52()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ }
+
+ public SimpleUnaryOpTest__InsertByte52()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Insert(
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
+ (byte)2,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Insert(
+ Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
+ (byte)2,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Insert(
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
+ (byte)2,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
+ (byte)2,
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
+ (byte)2,
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
+ (byte)2,
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Insert(
+ _clsVar,
+ (byte)2,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
+ var result = Avx.Insert(firstOp, (byte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (byte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (byte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__InsertByte52();
+ var result = Avx.Insert(test._fld, (byte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Insert(_fld, (byte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
+ {
+
+ for (var i = 0; i < RetElementCount; i++)
+ {
+ if ((i == 20 ? result[i] != 2 : result[i] != 0))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Insert)}<Byte>(Vector256<Byte><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs
index b2039f4a2e..1899ec728c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__InsertInt161()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs
index 311762cd92..7e3049b428 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt1611
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__InsertInt1611()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.27.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.27.cs
new file mode 100644
index 0000000000..373db0f023
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.27.cs
@@ -0,0 +1,321 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void InsertInt1627()
+ {
+ var test = new SimpleUnaryOpTest__InsertInt1627();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__InsertInt1627
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ private static Int16[] _data = new Int16[Op1ElementCount];
+
+ private static Vector256<Int16> _clsVar;
+
+ private Vector256<Int16> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int16, Int16> _dataTable;
+
+ static SimpleUnaryOpTest__InsertInt1627()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ }
+
+ public SimpleUnaryOpTest__InsertInt1627()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Insert(
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
+ (short)2,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Insert(
+ Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
+ (short)2,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Insert(
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
+ (short)2,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
+ (short)2,
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
+ (short)2,
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
+ (short)2,
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Insert(
+ _clsVar,
+ (short)2,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr);
+ var result = Avx.Insert(firstOp, (short)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (short)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (short)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__InsertInt1627();
+ var result = Avx.Insert(test._fld, (short)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Insert(_fld, (short)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int16> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray = new Int16[Op1ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray = new Int16[Op1ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "")
+ {
+
+ for (var i = 0; i < RetElementCount; i++)
+ {
+ if ((i == 11 ? result[i] != 2 : result[i] != 0))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int16>(Vector256<Int16><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs
index 84fa978194..0e2d1eb8bb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__InsertInt321()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.22.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.22.cs
new file mode 100644
index 0000000000..9740754b80
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.22.cs
@@ -0,0 +1,321 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void InsertInt3222()
+ {
+ var test = new SimpleUnaryOpTest__InsertInt3222();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__InsertInt3222
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ private static Int32[] _data = new Int32[Op1ElementCount];
+
+ private static Vector256<Int32> _clsVar;
+
+ private Vector256<Int32> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
+
+ static SimpleUnaryOpTest__InsertInt3222()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ }
+
+ public SimpleUnaryOpTest__InsertInt3222()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Insert(
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
+ (int)2,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Insert(
+ Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
+ (int)2,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Insert(
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
+ (int)2,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
+ (int)2,
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
+ (int)2,
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
+ (int)2,
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Insert(
+ _clsVar,
+ (int)2,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
+ var result = Avx.Insert(firstOp, (int)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (int)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (int)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__InsertInt3222();
+ var result = Avx.Insert(test._fld, (int)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Insert(_fld, (int)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray = new Int32[Op1ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray = new Int32[Op1ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
+ {
+
+ for (var i = 0; i < RetElementCount; i++)
+ {
+ if ((i == 6 ? result[i] != 2 : result[i] != 0))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int32>(Vector256<Int32><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs
index a9a7a6ce9d..2b1da87840 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt326
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__InsertInt326()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs
index ea68e0a1d9..f17ff1ff20 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__InsertInt641()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.19.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.19.cs
new file mode 100644
index 0000000000..012f96493d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.19.cs
@@ -0,0 +1,321 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void InsertInt6419()
+ {
+ var test = new SimpleUnaryOpTest__InsertInt6419();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__InsertInt6419
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ private static Int64[] _data = new Int64[Op1ElementCount];
+
+ private static Vector256<Int64> _clsVar;
+
+ private Vector256<Int64> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
+
+ static SimpleUnaryOpTest__InsertInt6419()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ }
+
+ public SimpleUnaryOpTest__InsertInt6419()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Insert(
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
+ (long)2,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Insert(
+ Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
+ (long)2,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Insert(
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
+ (long)2,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
+ (long)2,
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
+ (long)2,
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
+ (long)2,
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Insert(
+ _clsVar,
+ (long)2,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
+ var result = Avx.Insert(firstOp, (long)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (long)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (long)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__InsertInt6419();
+ var result = Avx.Insert(test._fld, (long)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Insert(_fld, (long)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int64[] inArray = new Int64[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int64[] inArray = new Int64[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
+ {
+
+ for (var i = 0; i < RetElementCount; i++)
+ {
+ if ((i == 3 ? result[i] != 2 : result[i] != 0))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int64>(Vector256<Int64><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs
index 618532fe99..24471323d2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt643
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__InsertInt643()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs
index 69557b48e9..ca6d9f5e39 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertSByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__InsertSByte1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs
index 91b233d31f..917aba5300 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertSByte20
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__InsertSByte20()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.52.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.52.cs
new file mode 100644
index 0000000000..cbbaa73d1c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.52.cs
@@ -0,0 +1,321 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void InsertSByte52()
+ {
+ var test = new SimpleUnaryOpTest__InsertSByte52();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__InsertSByte52
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ private static SByte[] _data = new SByte[Op1ElementCount];
+
+ private static Vector256<SByte> _clsVar;
+
+ private Vector256<SByte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<SByte, SByte> _dataTable;
+
+ static SimpleUnaryOpTest__InsertSByte52()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ }
+
+ public SimpleUnaryOpTest__InsertSByte52()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Insert(
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
+ (sbyte)2,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Insert(
+ Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
+ (sbyte)2,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Insert(
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
+ (sbyte)2,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
+ (sbyte)2,
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
+ (sbyte)2,
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
+ (sbyte)2,
+ (byte)52
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Insert(
+ _clsVar,
+ (sbyte)2,
+ 52
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr);
+ var result = Avx.Insert(firstOp, (sbyte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (sbyte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (sbyte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__InsertSByte52();
+ var result = Avx.Insert(test._fld, (sbyte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Insert(_fld, (sbyte)2, 52);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<SByte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ SByte[] outArray = new SByte[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ SByte[] outArray = new SByte[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
+ {
+
+ for (var i = 0; i < RetElementCount; i++)
+ {
+ if ((i == 20 ? result[i] != 2 : result[i] != 0))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Insert)}<SByte>(Vector256<SByte><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs
index c67ca950e3..b17dbdcc34 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__InsertUInt161()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs
index 327b65bfea..43f4a5a2e9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt1611
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__InsertUInt1611()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.27.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.27.cs
new file mode 100644
index 0000000000..cff1f45bc4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.27.cs
@@ -0,0 +1,321 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void InsertUInt1627()
+ {
+ var test = new SimpleUnaryOpTest__InsertUInt1627();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__InsertUInt1627
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ private static UInt16[] _data = new UInt16[Op1ElementCount];
+
+ private static Vector256<UInt16> _clsVar;
+
+ private Vector256<UInt16> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
+
+ static SimpleUnaryOpTest__InsertUInt1627()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ }
+
+ public SimpleUnaryOpTest__InsertUInt1627()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Insert(
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
+ (ushort)2,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Insert(
+ Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
+ (ushort)2,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Insert(
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
+ (ushort)2,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
+ (ushort)2,
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
+ (ushort)2,
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
+ (ushort)2,
+ (byte)27
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Insert(
+ _clsVar,
+ (ushort)2,
+ 27
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
+ var result = Avx.Insert(firstOp, (ushort)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (ushort)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (ushort)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__InsertUInt1627();
+ var result = Avx.Insert(test._fld, (ushort)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Insert(_fld, (ushort)2, 27);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray = new UInt16[Op1ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray = new UInt16[Op1ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
+ {
+
+ for (var i = 0; i < RetElementCount; i++)
+ {
+ if ((i == 11 ? result[i] != 2 : result[i] != 0))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt16>(Vector256<UInt16><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs
index 7a742fbf37..608bedef57 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__InsertUInt321()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.22.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.22.cs
new file mode 100644
index 0000000000..e3609e8962
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.22.cs
@@ -0,0 +1,321 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void InsertUInt3222()
+ {
+ var test = new SimpleUnaryOpTest__InsertUInt3222();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__InsertUInt3222
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ private static UInt32[] _data = new UInt32[Op1ElementCount];
+
+ private static Vector256<UInt32> _clsVar;
+
+ private Vector256<UInt32> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
+
+ static SimpleUnaryOpTest__InsertUInt3222()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ }
+
+ public SimpleUnaryOpTest__InsertUInt3222()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Insert(
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
+ (uint)2,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Insert(
+ Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
+ (uint)2,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Insert(
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
+ (uint)2,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
+ (uint)2,
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
+ (uint)2,
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
+ (uint)2,
+ (byte)22
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Insert(
+ _clsVar,
+ (uint)2,
+ 22
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
+ var result = Avx.Insert(firstOp, (uint)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (uint)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (uint)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__InsertUInt3222();
+ var result = Avx.Insert(test._fld, (uint)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Insert(_fld, (uint)2, 22);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray = new UInt32[Op1ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray = new UInt32[Op1ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
+ {
+
+ for (var i = 0; i < RetElementCount; i++)
+ {
+ if ((i == 6 ? result[i] != 2 : result[i] != 0))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt32>(Vector256<UInt32><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs
index 0800058258..ffd003572a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt326
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__InsertUInt326()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs
index 9b6b4e3a20..8ec1dd80f4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__InsertUInt641()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.19.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.19.cs
new file mode 100644
index 0000000000..f60e347cad
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.19.cs
@@ -0,0 +1,321 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void InsertUInt6419()
+ {
+ var test = new SimpleUnaryOpTest__InsertUInt6419();
+
+ try
+ {
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+ }
+ catch (PlatformNotSupportedException)
+ {
+ test.Succeeded = true;
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__InsertUInt6419
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ private static UInt64[] _data = new UInt64[Op1ElementCount];
+
+ private static Vector256<UInt64> _clsVar;
+
+ private Vector256<UInt64> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
+
+ static SimpleUnaryOpTest__InsertUInt6419()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ }
+
+ public SimpleUnaryOpTest__InsertUInt6419()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Insert(
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
+ (ulong)2,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Insert(
+ Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
+ (ulong)2,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Insert(
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
+ (ulong)2,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
+ (ulong)2,
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
+ (ulong)2,
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
+ (ulong)2,
+ (byte)19
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Insert(
+ _clsVar,
+ (ulong)2,
+ 19
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
+ var result = Avx.Insert(firstOp, (ulong)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (ulong)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
+ var result = Avx.Insert(firstOp, (ulong)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__InsertUInt6419();
+ var result = Avx.Insert(test._fld, (ulong)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Insert(_fld, (ulong)2, 19);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray = new UInt64[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray = new UInt64[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
+ {
+
+ for (var i = 0; i < RetElementCount; i++)
+ {
+ if ((i == 3 ? result[i] != 2 : result[i] != 0))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt64>(Vector256<UInt64><9>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs
index 9839d7ab0e..fd815ca985 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt643
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__InsertUInt643()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.Load.cs
index 0d7c5786de..58d3894af5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Byte1Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = 16 / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__InsertVector128Byte1Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.cs
index ffcce7b13d..69546c70a4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Byte.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Byte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = 16 / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__InsertVector128Byte1()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.Load.cs
index db00d65ecd..74ca07cd1e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Double1Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = 16 / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__InsertVector128Double1Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.cs
index 188c9ef831..a435cc14c7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Double.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Double1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = 16 / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__InsertVector128Double1()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.Load.cs
index 0f032f8d2a..03247d9ff8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int161Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = 16 / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0,short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__InsertVector128Int161Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0,short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0,short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.cs
index 592d79556f..6132cadd08 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int16.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = 16 / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__InsertVector128Int161()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.Load.cs
index 50e36a3971..23fa978466 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int321Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = 16 / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__InsertVector128Int321Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0,int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.cs
index fcc13d2bcb..ac69626179 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int32.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = 16 / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__InsertVector128Int321()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.Load.cs
index 1aaa274971..3fbc087422 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int641Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = 16 / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__InsertVector128Int641Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0,int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.cs
index 0d353aea1d..c998558b52 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Int64.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = 16 / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__InsertVector128Int641()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.Load.cs
index 4b584fbaef..881f529965 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128SByte1Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = 16 / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0,sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__InsertVector128SByte1Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0,sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0,sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.cs
index 7dcd2f0ac1..11bbf03f1e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.SByte.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128SByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = 16 / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__InsertVector128SByte1()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.Load.cs
index a41d40d3af..715484eb31 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Single1Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = 16 / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__InsertVector128Single1Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.cs
index 6b12b571e1..e485ed4d77 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.Single.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Single1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = 16 / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__InsertVector128Single1()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.Load.cs
index 47fc2ca379..745aa55c53 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt161Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = 16 / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__InsertVector128UInt161Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0,ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.cs
index 6eff087993..fd6677b2c5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt16.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = 16 / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__InsertVector128UInt161()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.Load.cs
index da9e5bfd1b..ecc6655e57 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt321Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = 16 / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__InsertVector128UInt321Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0,int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.cs
index 4a11f6f989..912fd6cb70 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt32.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = 16 / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__InsertVector128UInt321()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.Load.cs
index 8fb7b27950..8ed7dfdaaa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt641Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = 16 / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__InsertVector128UInt641Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0,int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.cs
index 50742653ed..50b7c6d722 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/InsertVector128.UInt64.1.cs
@@ -88,11 +88,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = 16 / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -110,9 +110,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__InsertVector128UInt641()
@@ -122,13 +122,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -295,9 +295,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -308,9 +308,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad.cs
new file mode 100644
index 0000000000..2a493e095e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad.cs
@@ -0,0 +1,140 @@
+// 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;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.Intrinsics;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static unsafe int Main(string[] args)
+ {
+ int testResult = Pass;
+
+ if (Avx.IsSupported)
+ {
+ using (TestTable<float, uint> floatTable = new TestTable<float, uint>(new float[8] { 1, -5, 100, 0, 1, 2, 3, 4 }, new uint[8] { uint.MaxValue, uint.MaxValue, 0, 0, uint.MaxValue, uint.MaxValue, 0, 0 }, new float[8]))
+ {
+ Vector256<float> vf = Avx.MaskLoad((float*)(floatTable.inArrayPtr), Avx.LoadVector256((uint*)(floatTable.maskArrayPtr)));
+ Unsafe.Write(floatTable.outArrayPtr, vf);
+
+ if (!floatTable.CheckResult((x, m, y) => m == uint.MaxValue ? BitConverter.SingleToInt32Bits(x) == BitConverter.SingleToInt32Bits(y) : BitConverter.SingleToInt32Bits(y) == 0))
+ {
+ Console.WriteLine("AVX MaskLoad failed on float:");
+ foreach (var item in floatTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<double, ulong> doubleTable = new TestTable<double, ulong>(new double[4] { 1, -5, 100, 0}, new ulong[4] { 0, ulong.MaxValue, ulong.MaxValue, 0}, new double[4]))
+ {
+ Vector256<double> vf = Avx.MaskLoad((double*)(doubleTable.inArrayPtr), Avx.LoadVector256((ulong*)(doubleTable.maskArrayPtr)));
+ Unsafe.Write(doubleTable.outArrayPtr, vf);
+
+ if (!doubleTable.CheckResult((x, m, y) => m == ulong.MaxValue ? BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y) : BitConverter.DoubleToInt64Bits(y) == 0))
+ {
+ Console.WriteLine("AVX MaskLoad failed on double:");
+ foreach (var item in doubleTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<float, uint> floatTable = new TestTable<float, uint>(new float[4] { 1, -5, 100, 0 }, new uint[4] { uint.MaxValue, 0, 0, uint.MaxValue }, new float[4]))
+ {
+ Vector128<float> vf = Avx.MaskLoad((float*)(floatTable.inArrayPtr), Sse2.LoadVector128((uint*)(floatTable.maskArrayPtr)));
+ Unsafe.Write(floatTable.outArrayPtr, vf);
+
+ if (!floatTable.CheckResult((x, m, y) => m == uint.MaxValue ? BitConverter.SingleToInt32Bits(x) == BitConverter.SingleToInt32Bits(y) : BitConverter.SingleToInt32Bits(y) == 0))
+ {
+ Console.WriteLine("AVX MaskLoad failed on Vector128 float:");
+ foreach (var item in floatTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<double, ulong> doubleTable = new TestTable<double, ulong>(new double[2] { 1, -5}, new ulong[2] { 0, ulong.MaxValue}, new double[2]))
+ {
+ Vector128<double> vf = Avx.MaskLoad((double*)(doubleTable.inArrayPtr), Sse2.LoadVector128((ulong*)(doubleTable.maskArrayPtr)));
+ Unsafe.Write(doubleTable.outArrayPtr, vf);
+
+ if (!doubleTable.CheckResult((x, m, y) => m == ulong.MaxValue ? BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y) : BitConverter.DoubleToInt64Bits(y) == 0))
+ {
+ Console.WriteLine("AVX MaskLoad failed on double:");
+ foreach (var item in doubleTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+ }
+
+ return testResult;
+ }
+
+ public unsafe struct TestTable<T, U> : IDisposable where T : struct
+ {
+ public T[] inArray;
+ public U[] maskArray;
+ public T[] outArray;
+
+ public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
+ public void* maskArrayPtr => maskHandle.AddrOfPinnedObject().ToPointer();
+ public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
+
+ GCHandle inHandle;
+ GCHandle maskHandle;
+ GCHandle outHandle;
+ public TestTable(T[] a, U[] mask, T[] b)
+ {
+ this.inArray = a;
+ this.maskArray = mask;
+ this.outArray = b;
+
+ inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned);
+ maskHandle = GCHandle.Alloc(maskArray, GCHandleType.Pinned);
+ outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
+ }
+ public bool CheckResult(Func<T, U, T, bool> check)
+ {
+ for (int i = 0; i < inArray.Length; i++)
+ {
+ if (!check(inArray[i], maskArray[i], outArray[i]))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void Dispose()
+ {
+ inHandle.Free();
+ outHandle.Free();
+ }
+ }
+
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_r.csproj
new file mode 100644
index 0000000000..a35fbf8f8a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_r.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MaskLoad.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_ro.csproj
new file mode 100644
index 0000000000..d0a0a9c518
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MaskLoad_ro.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MaskLoad.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Double.cs
index 93ab3211a8..c8b2815519 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__MaxDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Single.cs
index 7f123d213f..3939057bef 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Max.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__MaxSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Double.cs
index 0bcaf5e6d3..d9c08b0373 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__MinDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Single.cs
index 077cb78764..4c80d5f146 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Min.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__MinSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask.cs
new file mode 100644
index 0000000000..98ad32760b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask.cs
@@ -0,0 +1,77 @@
+// 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;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.Intrinsics;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static unsafe int Main(string[] args)
+ {
+ int testResult = Pass;
+
+ if (Avx.IsSupported)
+ {
+ using (TestTable<float> floatTable = new TestTable<float>(new float[8] { 1, -5, 100, 0, 1, -5, 100, 0 }))
+ {
+
+ var vf1 = Unsafe.Read<Vector256<float>>(floatTable.inArray1Ptr);
+ var res = Avx.MoveMask(vf1);
+
+ if (res != 0b00100010)
+ {
+ Console.WriteLine("Avx MoveMask failed on float:");
+ Console.WriteLine(res);
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<double> doubleTable = new TestTable<double>(new double[4] { 1, -5, 1, -5 }))
+ {
+
+ var vf1 = Unsafe.Read<Vector256<double>>(doubleTable.inArray1Ptr);
+ var res = Avx.MoveMask(vf1);
+
+ if (res != 0b1010)
+ {
+ Console.WriteLine("Avx MoveMask failed on double:");
+ Console.WriteLine(res);
+ testResult = Fail;
+ }
+ }
+ }
+
+
+ return testResult;
+ }
+
+ public unsafe struct TestTable<T> : IDisposable where T : struct
+ {
+ public T[] inArray1;
+ public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
+ GCHandle inHandle1;
+
+ public TestTable(T[] a)
+ {
+ this.inArray1 = a;
+ inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
+ }
+
+ public void Dispose()
+ {
+ inHandle1.Free();
+ }
+ }
+
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask_r.csproj
new file mode 100644
index 0000000000..868b0ce2e8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask_r.csproj
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{EC7AD883-41EA-4BDC-BFBE-77A78B727D76}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MoveMask.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask_ro.csproj
new file mode 100644
index 0000000000..06ad5dc47f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/MoveMask_ro.csproj
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{4D4CC0B8-3894-4F6F-868B-C93A7B722B5C}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MoveMask.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Double.cs
index 9a54d57587..278e320b55 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplyDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__MultiplyDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Single.cs
index 026186b4de..c6f0b5338c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Multiply.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplySingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__MultiplySingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Double.cs
index dd39908c17..c28d3c9ac6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__OrDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Single.cs
index 682db8f5aa..3336030aa1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Or.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__OrSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.1.cs
index 1abf18d52c..a7d3bf9e1e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__PermuteDouble1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__PermuteDouble1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.2.cs
index 37722b50c3..4ccecc5ddc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.2.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Double.2.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__PermuteDouble2
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__PermuteDouble2()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.1.cs
index 69a7466967..30b5838d98 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__PermuteSingle1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__PermuteSingle1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.2.cs
index f30023e5e3..d50cddc384 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.2.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute.Single.2.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__PermuteSingle2
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__PermuteSingle2()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx.cs
new file mode 100644
index 0000000000..598b34d343
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx.cs
@@ -0,0 +1,24 @@
+// 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;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Permute2x128.Double.2"] = Permute2x128Double2,
+ ["Permute2x128.Single.2"] = Permute2x128Single2,
+ ["Permute2x128.Int32.2"] = Permute2x128Int322,
+ ["Permute2x128.UInt32.2"] = Permute2x128Int322,
+ ["Permute2x128.Int64.2"] = Permute2x128Int642,
+ ["Permute2x128.UInt64.2"] = Permute2x128UInt642,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx_r.csproj
new file mode 100644
index 0000000000..8f4ae0493e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx_r.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Permute2x128.Single.2.cs" />
+ <Compile Include="Permute2x128.Double.2.cs" />
+ <Compile Include="Permute2x128.Int32.2.cs" />
+ <Compile Include="Permute2x128.UInt32.2.cs" />
+ <Compile Include="Permute2x128.Int64.2.cs" />
+ <Compile Include="Permute2x128.UInt64.2.cs" />
+ <Compile Include="Permute2x128.Avx.cs" />
+ <Compile Include="..\Shared\BooleanBinOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\BooleanTwoCmpOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleTernOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx_ro.csproj
new file mode 100644
index 0000000000..f8bb6bdba9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Avx_ro.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Permute2x128.Single.2.cs" />
+ <Compile Include="Permute2x128.Double.2.cs" />
+ <Compile Include="Permute2x128.Int32.2.cs" />
+ <Compile Include="Permute2x128.UInt32.2.cs" />
+ <Compile Include="Permute2x128.Int64.2.cs" />
+ <Compile Include="Permute2x128.UInt64.2.cs" />
+ <Compile Include="Permute2x128.Avx.cs" />
+ <Compile Include="..\Shared\BooleanBinOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\BooleanTwoCmpOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleTernOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Double.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Double.2.cs
new file mode 100644
index 0000000000..3df7e70ea9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Double.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128Double2()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Double2();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128Double2
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = VectorSize / sizeof(Double);
+ private const int Op2ElementCount = VectorSize / sizeof(Double);
+ private const int RetElementCount = VectorSize / sizeof(Double);
+
+ private static Double[] _data1 = new Double[Op1ElementCount];
+ private static Double[] _data2 = new Double[Op2ElementCount];
+
+ private static Vector256<Double> _clsVar1;
+ private static Vector256<Double> _clsVar2;
+
+ private Vector256<Double> _fld1;
+ private Vector256<Double> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Double, Double, Double> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128Double2()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ }
+
+ public SimpleBinaryOpTest__Permute2x128Double2()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Permute2x128(
+ Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Double) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Double) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Double) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr);
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Double2();
+ var result = Avx.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Double> left, Vector256<Double> right, void* result, [CallerMemberName] string method = "")
+ {
+ Double[] inArray1 = new Double[Op1ElementCount];
+ Double[] inArray2 = new Double[Op2ElementCount];
+ Double[] outArray = new Double[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Double[] inArray1 = new Double[Op1ElementCount];
+ Double[] inArray2 = new Double[Op2ElementCount];
+ Double[] outArray = new Double[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Double[] left, Double[] right, Double[] result, [CallerMemberName] string method = "")
+ {
+ if (BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 1 ? (BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i - 2])) : (BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(right[i])))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Permute2x128)}<Double>(Vector256<Double>.2, Vector256<Double>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Int32.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Int32.2.cs
new file mode 100644
index 0000000000..cb0a2ddb12
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Int32.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128Int322()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Int322();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128Int322
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = VectorSize / sizeof(Int32);
+ private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private const int RetElementCount = VectorSize / sizeof(Int32);
+
+ private static Int32[] _data1 = new Int32[Op1ElementCount];
+ private static Int32[] _data2 = new Int32[Op2ElementCount];
+
+ private static Vector256<Int32> _clsVar1;
+ private static Vector256<Int32> _clsVar2;
+
+ private Vector256<Int32> _fld1;
+ private Vector256<Int32> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Int32, Int32, Int32> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128Int322()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ }
+
+ public SimpleBinaryOpTest__Permute2x128Int322()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Permute2x128(
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr);
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Int322();
+ var result = Avx.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int32> left, Vector256<Int32> right, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray1 = new Int32[Op1ElementCount];
+ Int32[] inArray2 = new Int32[Op2ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray1 = new Int32[Op1ElementCount];
+ Int32[] inArray2 = new Int32[Op2ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Int32[] left, Int32[] right, Int32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != right[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 3 ? (result[i] != left[i - 4]) : (result[i] != right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Permute2x128)}<Int32>(Vector256<Int32>.2, Vector256<Int32>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Int64.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Int64.2.cs
new file mode 100644
index 0000000000..ddbcaa8c6c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Int64.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128Int642()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Int642();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128Int642
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = VectorSize / sizeof(Int64);
+ private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private const int RetElementCount = VectorSize / sizeof(Int64);
+
+ private static Int64[] _data1 = new Int64[Op1ElementCount];
+ private static Int64[] _data2 = new Int64[Op2ElementCount];
+
+ private static Vector256<Int64> _clsVar1;
+ private static Vector256<Int64> _clsVar2;
+
+ private Vector256<Int64> _fld1;
+ private Vector256<Int64> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Int64, Int64, Int64> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128Int642()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ }
+
+ public SimpleBinaryOpTest__Permute2x128Int642()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Permute2x128(
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int64*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int64*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Int64>>(_dataTable.inArray2Ptr);
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Int64*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Int642();
+ var result = Avx.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int64> left, Vector256<Int64> right, void* result, [CallerMemberName] string method = "")
+ {
+ Int64[] inArray1 = new Int64[Op1ElementCount];
+ Int64[] inArray2 = new Int64[Op2ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Int64[] inArray1 = new Int64[Op1ElementCount];
+ Int64[] inArray2 = new Int64[Op2ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Int64[] left, Int64[] right, Int64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != right[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 1 ? (result[i] != left[i - 2]) : (result[i] != right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Permute2x128)}<Int64>(Vector256<Int64>.2, Vector256<Int64>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Single.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Single.2.cs
new file mode 100644
index 0000000000..bcec95d79c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.Single.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128Single2()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Single2();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128Single2
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = VectorSize / sizeof(Single);
+ private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private const int RetElementCount = VectorSize / sizeof(Single);
+
+ private static Single[] _data1 = new Single[Op1ElementCount];
+ private static Single[] _data2 = new Single[Op2ElementCount];
+
+ private static Vector256<Single> _clsVar1;
+ private static Vector256<Single> _clsVar2;
+
+ private Vector256<Single> _fld1;
+ private Vector256<Single> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Single, Single, Single> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128Single2()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ }
+
+ public SimpleBinaryOpTest__Permute2x128Single2()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Permute2x128(
+ Unsafe.Read<Vector256<Single>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Single>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadVector256((Single*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Single*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadAlignedVector256((Single*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Single*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Single) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Single>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Single>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Single) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Single*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Single*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(Single) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Single*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Single*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Single>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Single>>(_dataTable.inArray2Ptr);
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Single*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Single*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Single*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Single*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Single2();
+ var result = Avx.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Single> left, Vector256<Single> right, void* result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray1 = new Single[Op1ElementCount];
+ Single[] inArray2 = new Single[Op2ElementCount];
+ Single[] outArray = new Single[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray1 = new Single[Op1ElementCount];
+ Single[] inArray2 = new Single[Op2ElementCount];
+ Single[] outArray = new Single[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Single[] left, Single[] right, Single[] result, [CallerMemberName] string method = "")
+ {
+ if (BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 3 ? (BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i - 4])) : (BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(right[i])))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Permute2x128)}<Single>(Vector256<Single>.2, Vector256<Single>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.UInt32.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.UInt32.2.cs
new file mode 100644
index 0000000000..751d0a4fe7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.UInt32.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128UInt322()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128UInt322();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128UInt322
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = VectorSize / sizeof(UInt32);
+ private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private const int RetElementCount = VectorSize / sizeof(UInt32);
+
+ private static UInt32[] _data1 = new UInt32[Op1ElementCount];
+ private static UInt32[] _data2 = new UInt32[Op2ElementCount];
+
+ private static Vector256<UInt32> _clsVar1;
+ private static Vector256<UInt32> _clsVar2;
+
+ private Vector256<UInt32> _fld1;
+ private Vector256<UInt32> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128UInt322()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ }
+
+ public SimpleBinaryOpTest__Permute2x128UInt322()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Permute2x128(
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr);
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128UInt322();
+ var result = Avx.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt32> left, Vector256<UInt32> right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray1 = new UInt32[Op1ElementCount];
+ UInt32[] inArray2 = new UInt32[Op2ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray1 = new UInt32[Op1ElementCount];
+ UInt32[] inArray2 = new UInt32[Op2ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(UInt32[] left, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != right[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 3 ? (result[i] != left[i - 4]) : (result[i] != right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Permute2x128)}<UInt32>(Vector256<UInt32>.2, Vector256<UInt32>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.UInt64.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.UInt64.2.cs
new file mode 100644
index 0000000000..305b3a8c20
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Permute2x128.UInt64.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128UInt642()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128UInt642();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128UInt642
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = VectorSize / sizeof(UInt64);
+ private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private const int RetElementCount = VectorSize / sizeof(UInt64);
+
+ private static UInt64[] _data1 = new UInt64[Op1ElementCount];
+ private static UInt64[] _data2 = new UInt64[Op2ElementCount];
+
+ private static Vector256<UInt64> _clsVar1;
+ private static Vector256<UInt64> _clsVar2;
+
+ private Vector256<UInt64> _fld1;
+ private Vector256<UInt64> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128UInt642()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ }
+
+ public SimpleBinaryOpTest__Permute2x128UInt642()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.Permute2x128(
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadVector256((UInt64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt64*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.Permute2x128(
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt64*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.Permute2x128)).MakeGenericMethod( new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray2Ptr);
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((UInt64*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((UInt64*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray2Ptr));
+ var result = Avx.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128UInt642();
+ var result = Avx.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt64> left, Vector256<UInt64> right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray1 = new UInt64[Op1ElementCount];
+ UInt64[] inArray2 = new UInt64[Op2ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray1 = new UInt64[Op1ElementCount];
+ UInt64[] inArray2 = new UInt64[Op2ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(UInt64[] left, UInt64[] right, UInt64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != right[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 1 ? (result[i] != left[i - 2]) : (result[i] != right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.Permute2x128)}<UInt64>(Vector256<UInt64>.2, Vector256<UInt64>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/PermuteVar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/PermuteVar.Double.cs
new file mode 100644
index 0000000000..f9171d8e02
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/PermuteVar.Double.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void PermuteVarDouble()
+ {
+ var test = new SimpleBinaryOpTest__PermuteVarDouble();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__PermuteVarDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ private static Double[] _data1 = new Double[Op1ElementCount];
+ private static Double[] _data2 = new Double[Op2ElementCount];
+
+ private static Vector256<Double> _clsVar1;
+ private static Vector256<Double> _clsVar2;
+
+ private Vector256<Double> _fld1;
+ private Vector256<Double> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Double, Double, Double> _dataTable;
+
+ static SimpleBinaryOpTest__PermuteVarDouble()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = BitConverter.Int64BitsToDouble(1); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ }
+
+ public SimpleBinaryOpTest__PermuteVarDouble()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = BitConverter.Int64BitsToDouble(1); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = BitConverter.Int64BitsToDouble(1); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.PermuteVar(
+ Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.PermuteVar(
+ Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.PermuteVar(
+ Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.PermuteVar), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.PermuteVar), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.PermuteVar), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.PermuteVar(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr);
+ var result = Avx.PermuteVar(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr));
+ var result = Avx.PermuteVar(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr));
+ var result = Avx.PermuteVar(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__PermuteVarDouble();
+ var result = Avx.PermuteVar(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.PermuteVar(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Double> left, Vector256<Double> right, void* result, [CallerMemberName] string method = "")
+ {
+ Double[] inArray1 = new Double[Op1ElementCount];
+ Double[] inArray2 = new Double[Op2ElementCount];
+ Double[] outArray = new Double[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Double[] inArray1 = new Double[Op1ElementCount];
+ Double[] inArray2 = new Double[Op2ElementCount];
+ Double[] outArray = new Double[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Double[] left, Double[] right, Double[] result, [CallerMemberName] string method = "")
+ {
+ if (BitConverter.DoubleToInt64Bits(left[0]) != BitConverter.DoubleToInt64Bits(result[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 1 ? (BitConverter.DoubleToInt64Bits(left[2]) != BitConverter.DoubleToInt64Bits(result[i])) : (BitConverter.DoubleToInt64Bits(left[0]) != BitConverter.DoubleToInt64Bits(result[i])))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.PermuteVar)}<Double>(Vector256<Double>, Vector256<Double>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/PermuteVar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/PermuteVar.Single.cs
new file mode 100644
index 0000000000..24e5bb021d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/PermuteVar.Single.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void PermuteVarSingle()
+ {
+ var test = new SimpleBinaryOpTest__PermuteVarSingle();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__PermuteVarSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ private static Single[] _data1 = new Single[Op1ElementCount];
+ private static Single[] _data2 = new Single[Op2ElementCount];
+
+ private static Vector256<Single> _clsVar1;
+ private static Vector256<Single> _clsVar2;
+
+ private Vector256<Single> _fld1;
+ private Vector256<Single> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Single, Single, Single> _dataTable;
+
+ static SimpleBinaryOpTest__PermuteVarSingle()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = BitConverter.Int32BitsToSingle(1); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ }
+
+ public SimpleBinaryOpTest__PermuteVarSingle()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = BitConverter.Int32BitsToSingle(1); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = BitConverter.Int32BitsToSingle(1); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx.PermuteVar(
+ Unsafe.Read<Vector256<Single>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Single>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx.PermuteVar(
+ Avx.LoadVector256((Single*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Single*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx.PermuteVar(
+ Avx.LoadAlignedVector256((Single*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Single*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.PermuteVar), new Type[] { typeof(Vector256<Single>), typeof(Vector256<Single>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Single>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Single>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.PermuteVar), new Type[] { typeof(Vector256<Single>), typeof(Vector256<Single>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Single*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Single*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx).GetMethod(nameof(Avx.PermuteVar), new Type[] { typeof(Vector256<Single>), typeof(Vector256<Single>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Single*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Single*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx.PermuteVar(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Single>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Single>>(_dataTable.inArray2Ptr);
+ var result = Avx.PermuteVar(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Single*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Single*)(_dataTable.inArray2Ptr));
+ var result = Avx.PermuteVar(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Single*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Single*)(_dataTable.inArray2Ptr));
+ var result = Avx.PermuteVar(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__PermuteVarSingle();
+ var result = Avx.PermuteVar(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx.PermuteVar(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Single> left, Vector256<Single> right, void* result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray1 = new Single[Op1ElementCount];
+ Single[] inArray2 = new Single[Op2ElementCount];
+ Single[] outArray = new Single[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray1 = new Single[Op1ElementCount];
+ Single[] inArray2 = new Single[Op2ElementCount];
+ Single[] outArray = new Single[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Single[] left, Single[] right, Single[] result, [CallerMemberName] string method = "")
+ {
+ if (BitConverter.SingleToInt32Bits(left[1]) != BitConverter.SingleToInt32Bits(result[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 3 ? (BitConverter.SingleToInt32Bits(left[5]) != BitConverter.SingleToInt32Bits(result[i])) : (BitConverter.SingleToInt32Bits(left[1]) != BitConverter.SingleToInt32Bits(result[i])))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx)}.{nameof(Avx.PermuteVar)}<Single>(Vector256<Single>, Vector256<Single>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs
index 1bf4389d94..9c52458bfa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs
@@ -33,18 +33,26 @@ namespace JIT.HardwareIntrinsics.X86
["Extract.SByte.1"] = ExtractSByte1,
["Extract.Byte.20"] = ExtractByte20,
["Extract.SByte.20"] = ExtractSByte20,
+ ["Extract.Byte.52"] = ExtractByte52,
+ ["Extract.SByte.52"] = ExtractSByte52,
["Extract.Int16.1"] = ExtractInt161,
["Extract.UInt16.1"] = ExtractUInt161,
["Extract.Int16.11"] = ExtractInt1611,
["Extract.UInt16.11"] = ExtractUInt1611,
+ ["Extract.Int16.27"] = ExtractInt1627,
+ ["Extract.UInt16.27"] = ExtractUInt1627,
["Extract.Int32.1"] = ExtractInt321,
["Extract.UInt32.1"] = ExtractUInt321,
["Extract.Int32.6"] = ExtractInt326,
["Extract.UInt32.6"] = ExtractUInt326,
+ ["Extract.Int32.22"] = ExtractInt3222,
+ ["Extract.UInt32.22"] = ExtractUInt3222,
["Extract.Int64.1"] = ExtractInt641,
["Extract.UInt64.1"] = ExtractUInt641,
["Extract.Int64.3"] = ExtractInt643,
["Extract.UInt64.3"] = ExtractUInt643,
+ ["Extract.Int64.19"] = ExtractInt6419,
+ ["Extract.UInt64.19"] = ExtractUInt6419,
["ExtendToVector256.Byte"] = ExtendToVector256Byte,
["ExtendToVector256.Double"] = ExtendToVector256Double,
["ExtendToVector256.Int16"] = ExtendToVector256Int16,
@@ -69,18 +77,26 @@ namespace JIT.HardwareIntrinsics.X86
["Insert.Byte.20"] = InsertByte20,
["Insert.SByte.1"] = InsertSByte1,
["Insert.SByte.20"] = InsertSByte20,
+ ["Insert.Byte.52"] = InsertByte52,
+ ["Insert.SByte.52"] = InsertSByte52,
["Insert.Int16.1"] = InsertInt161,
["Insert.Int16.11"] = InsertInt1611,
["Insert.UInt16.1"] = InsertUInt161,
["Insert.UInt16.11"] = InsertUInt1611,
+ ["Insert.Int16.27"] = InsertInt1627,
+ ["Insert.UInt16.27"] = InsertUInt1627,
["Insert.Int32.1"] = InsertInt321,
["Insert.Int32.6"] = InsertInt326,
["Insert.UInt32.1"] = InsertUInt321,
["Insert.UInt32.6"] = InsertUInt326,
+ ["Insert.Int32.22"] = InsertInt3222,
+ ["Insert.UInt32.22"] = InsertUInt3222,
["Insert.Int64.1"] = InsertInt641,
["Insert.Int64.3"] = InsertInt643,
["Insert.UInt64.1"] = InsertUInt641,
["Insert.UInt64.3"] = InsertUInt643,
+ ["Insert.Int64.19"] = InsertInt6419,
+ ["Insert.UInt64.19"] = InsertUInt6419,
["InsertVector128.Byte.1.Load"] = InsertVector128Byte1Load,
["InsertVector128.SByte.1.Load"] = InsertVector128SByte1Load,
["InsertVector128.Int16.1.Load"] = InsertVector128Int161Load,
@@ -115,6 +131,8 @@ namespace JIT.HardwareIntrinsics.X86
["Permute.Double.1"] = PermuteDouble1,
["Permute.Single.2"] = PermuteSingle2,
["Permute.Double.2"] = PermuteDouble2,
+ ["PermuteVar.Single"] = PermuteVarSingle,
+ ["PermuteVar.Double"] = PermuteVarDouble,
["RoundCurrentDirection.Double"] = RoundCurrentDirectionDouble,
["RoundCurrentDirection.Single"] = RoundCurrentDirectionSingle,
["RoundToNearestInteger.Double"] = RoundToNearestIntegerDouble,
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Double.cs
index 0501d3a0d5..89728933ea 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundCurrentDirectionDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__RoundCurrentDirectionDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Single.cs
index b444c94d40..1ff78899b6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundCurrentDirection.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundCurrentDirectionSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__RoundCurrentDirectionSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Double.cs
index 51d87fa295..70aa331044 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToNearestIntegerDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__RoundToNearestIntegerDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Single.cs
index 7fc26cb632..4ca041cbf3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNearestInteger.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToNearestIntegerSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__RoundToNearestIntegerSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Double.cs
index 2c11ab688d..90ce9cbb7f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToNegativeInfinityDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__RoundToNegativeInfinityDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Single.cs
index 10fa04d785..8ac2fade68 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToNegativeInfinity.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToNegativeInfinitySingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__RoundToNegativeInfinitySingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Double.cs
index d53b365b33..f37472f523 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToPositiveInfinityDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__RoundToPositiveInfinityDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Single.cs
index d3d57cc54e..fb216f4f23 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToPositiveInfinity.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToPositiveInfinitySingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__RoundToPositiveInfinitySingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Double.cs
index f23c8e720a..3c20297c4e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToZeroDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleUnaryOpTest__RoundToZeroDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Single.cs
index 756980922e..d8ecdb2138 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/RoundToZero.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToZeroSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleUnaryOpTest__RoundToZeroSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256.cs
new file mode 100644
index 0000000000..cfe3b841d5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256.cs
@@ -0,0 +1,241 @@
+// 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;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.Intrinsics;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static unsafe int Main(string[] args)
+ {
+ int testResult = Pass;
+
+ if (Avx.IsSupported)
+ {
+ using (TestTable<float> floatTable = new TestTable<float>(new float[8] { float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN }))
+ {
+ var vf1 = Avx.SetAllVector256<float>(-5);
+ Unsafe.Write(floatTable.outArrayPtr, vf1);
+
+ if (!floatTable.CheckResult((x) => (x == -5)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on float:");
+ foreach (var item in floatTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<double> doubleTable = new TestTable<double>(new double[4] { double.NaN, double.NaN, double.NaN, double.NaN }))
+ {
+ var vf1 = Avx.SetAllVector256<double>(3);
+ Unsafe.Write(doubleTable.outArrayPtr, vf1);
+
+ if (!doubleTable.CheckResult((x) => (x == 3)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on double:");
+ foreach (var item in doubleTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<sbyte> sbyteTable = new TestTable<sbyte>(new sbyte[32] { sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
+ sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
+ sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
+ sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue }))
+ {
+ var vf1 = Avx.SetAllVector256<sbyte>(100);
+ Unsafe.Write(sbyteTable.outArrayPtr, vf1);
+
+ if (!sbyteTable.CheckResult((x) => (x == 100)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on sbyte:");
+ foreach (var item in sbyteTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<byte> byteTable = new TestTable<byte>(new byte[32] { byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
+ byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
+ byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
+ byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue }))
+ {
+ Vector256<byte> vf1 = Avx.SetAllVector256<byte>(4);
+ Unsafe.Write(byteTable.outArrayPtr, vf1);
+
+ if (!byteTable.CheckResult((x) => (x == 4)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on byte:");
+ foreach (var item in byteTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<short> shortTable = new TestTable<short>(new short[16] { short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue,
+ short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue }))
+ {
+ var vf1 = Avx.SetAllVector256<short>(-5);
+ Unsafe.Write(shortTable.outArrayPtr, vf1);
+
+ if (!shortTable.CheckResult((x) => (x == -5)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on short:");
+ foreach (var item in shortTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<ushort> ushortTable = new TestTable<ushort>(new ushort[16] { ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue,
+ ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue }))
+ {
+ Vector256<ushort> vf1 = Avx.SetAllVector256<ushort>(2);
+ Unsafe.Write(ushortTable.outArrayPtr, vf1);
+
+ if (!ushortTable.CheckResult((x) => (x == 2)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on ushort:");
+ foreach (var item in ushortTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<int> intTable = new TestTable<int>(new int[8] { int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue }))
+ {
+ var vf1 = Avx.SetAllVector256<int>(-5);
+ Unsafe.Write(intTable.outArrayPtr, vf1);
+
+ if (!intTable.CheckResult((x) => (x == -5)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on int:");
+ foreach (var item in intTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<uint> uintTable = new TestTable<uint>(new uint[8] { uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue }))
+ {
+ Vector256<uint> vf1 = Avx.SetAllVector256<uint>(3);
+ Unsafe.Write(uintTable.outArrayPtr, vf1);
+
+ if (!uintTable.CheckResult((x) => (x == 3)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on uint:");
+ foreach (var item in uintTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ if (Environment.Is64BitProcess)
+ {
+ using (TestTable<long> longTable = new TestTable<long>(new long[4] { long.MaxValue, long.MaxValue, long.MaxValue, long.MaxValue }))
+ {
+ var vf1 = Avx.SetAllVector256<long>(-199);
+ Unsafe.Write(longTable.outArrayPtr, vf1);
+
+ if (!longTable.CheckResult((x) => (x == -199)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on long:");
+ foreach (var item in longTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<ulong> ulongTable = new TestTable<ulong>(new ulong[4] { ulong.MaxValue, ulong.MaxValue, ulong.MaxValue, ulong.MaxValue }))
+ {
+ Vector256<ulong> vf1 = Avx.SetAllVector256<ulong>(34);
+ Unsafe.Write(ulongTable.outArrayPtr, vf1);
+
+ if (!ulongTable.CheckResult((x) => (x == 34)))
+ {
+ Console.WriteLine("AVX SetAllVector256 failed on ulong:");
+ foreach (var item in ulongTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+ }
+ }
+
+ return testResult;
+ }
+
+ public unsafe struct TestTable<T> : IDisposable where T : struct
+ {
+ public T[] outArray;
+
+ public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
+
+ GCHandle outHandle;
+ public TestTable(T[] a)
+ {
+ this.outArray = a;
+
+ outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
+ }
+ public bool CheckResult(Func<T, bool> check)
+ {
+ foreach (var item in outArray)
+ {
+ if (!check(item))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void Dispose()
+ {
+ outHandle.Free();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_r.csproj
new file mode 100644
index 0000000000..7864a8f759
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_r.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SetAllVector256.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_ro.csproj
new file mode 100644
index 0000000000..da79454a83
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_ro.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SetAllVector256.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256.cs
new file mode 100644
index 0000000000..90e89c6f67
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256.cs
@@ -0,0 +1,258 @@
+// 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;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.Intrinsics;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static unsafe int Main(string[] args)
+ {
+ int testResult = Pass;
+
+ if (Avx.IsSupported)
+ {
+ using (TestTable<float> floatTable = new TestTable<float>(new float[8] { float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN }))
+ {
+ var vf1 = Avx.SetVector256((float)1, -5, 100, 0, 1, 2, 3, 4);
+ Unsafe.Write(floatTable.outArrayPtr, vf1);
+
+ if (!floatTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
+ (x[4] == 0) && (x[5] == 100) && (x[6] == -5) && (x[7] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on float:");
+ foreach (var item in floatTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<double> doubleTable = new TestTable<double>(new double[4] { double.NaN, double.NaN, double.NaN, double.NaN }))
+ {
+ var vf1 = Avx.SetVector256((double)1, 2, 3, 4);
+ Unsafe.Write(doubleTable.outArrayPtr, vf1);
+
+ if (!doubleTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on double:");
+ foreach (var item in doubleTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<sbyte> sbyteTable = new TestTable<sbyte>(new sbyte[32] { sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
+ sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
+ sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
+ sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue }))
+ {
+ var vf1 = Avx.SetVector256(1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4);
+ Unsafe.Write(sbyteTable.outArrayPtr, vf1);
+
+ if (!sbyteTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
+ (x[4] == 0) && (x[5] == 100) && (x[6] == -5) && (x[7] == 1) &&
+ (x[8] == 4) && (x[9] == 3) && (x[10] == 2) && (x[11] == 1) &&
+ (x[12] == 0) && (x[13] == 100) && (x[14] == -5) && (x[15] == 1) &&
+ (x[16] == 4) && (x[17] == 3) && (x[18] == 2) && (x[19] == 1) &&
+ (x[20] == 0) && (x[21] == 100) && (x[22] == -5) && (x[23] == 1) &&
+ (x[24] == 4) && (x[25] == 3) && (x[26] == 2) && (x[27] == 1) &&
+ (x[28] == 0) && (x[29] == 100) && (x[30] == -5) && (x[31] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on sbyte:");
+ foreach (var item in sbyteTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<byte> byteTable = new TestTable<byte>(new byte[32] { byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
+ byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
+ byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
+ byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue }))
+ {
+ Vector256<byte> vf1 = Avx.SetVector256((byte)1, 5, 100, 0, 1, 2, 3, 4, 1, 5, 100, 0, 1, 2, 3, 4, 1, 5, 100, 0, 1, 2, 3, 4, 1, 5, 100, 0, 1, 2, 3, 4);
+ Unsafe.Write(byteTable.outArrayPtr, vf1);
+
+ if (!byteTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
+ (x[4] == 0) && (x[5] == 100) && (x[6] == 5) && (x[7] == 1) &&
+ (x[8] == 4) && (x[9] == 3) && (x[10] == 2) && (x[11] == 1) &&
+ (x[12] == 0) && (x[13] == 100) && (x[14] == 5) && (x[15] == 1) &&
+ (x[16] == 4) && (x[17] == 3) && (x[18] == 2) && (x[19] == 1) &&
+ (x[20] == 0) && (x[21] == 100) && (x[22] == 5) && (x[23] == 1) &&
+ (x[24] == 4) && (x[25] == 3) && (x[26] == 2) && (x[27] == 1) &&
+ (x[28] == 0) && (x[29] == 100) && (x[30] == 5) && (x[31] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on byte:");
+ foreach (var item in byteTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<short> shortTable = new TestTable<short>(new short[16] { short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue,
+ short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue }))
+ {
+ var vf1 = Avx.SetVector256(1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4);
+ Unsafe.Write(shortTable.outArrayPtr, vf1);
+
+ if (!shortTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
+ (x[4] == 0) && (x[5] == 100) && (x[6] == -5) && (x[7] == 1) &&
+ (x[8] == 4) && (x[9] == 3) && (x[10] == 2) && (x[11] == 1) &&
+ (x[12] == 0) && (x[13] == 100) && (x[14] == -5) && (x[15] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on short:");
+ foreach (var item in shortTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<ushort> ushortTable = new TestTable<ushort>(new ushort[16] { ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue,
+ ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue }))
+ {
+ Vector256<ushort> vf1 = Avx.SetVector256((ushort)1, 5, 100, 0, 1, 2, 3, 4, 1, 5, 100, 0, 1, 2, 3, 4);
+ Unsafe.Write(ushortTable.outArrayPtr, vf1);
+
+ if (!ushortTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
+ (x[4] == 0) && (x[5] == 100) && (x[6] == 5) && (x[7] == 1) &&
+ (x[8] == 4) && (x[9] == 3) && (x[10] == 2) && (x[11] == 1) &&
+ (x[12] == 0) && (x[13] == 100) && (x[14] == 5) && (x[15] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on ushort:");
+ foreach (var item in ushortTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<int> intTable = new TestTable<int>(new int[8] { int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue }))
+ {
+ var vf1 = Avx.SetVector256(1, -5, 100, 0, 1, 2, 3, 4);
+ Unsafe.Write(intTable.outArrayPtr, vf1);
+
+ if (!intTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
+ (x[4] == 0) && (x[5] == 100) && (x[6] == -5) && (x[7] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on int:");
+ foreach (var item in intTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<uint> uintTable = new TestTable<uint>(new uint[8] { uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue }))
+ {
+ Vector256<uint> vf1 = Avx.SetVector256((uint)1, 5, 100, 0, 1, 2, 3, 4);
+ Unsafe.Write(uintTable.outArrayPtr, vf1);
+
+ if (!uintTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
+ (x[4] == 0) && (x[5] == 100) && (x[6] == 5) && (x[7] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on uint:");
+ foreach (var item in uintTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ if (Environment.Is64BitProcess)
+ {
+ using (TestTable<long> longTable = new TestTable<long>(new long[4] { long.MaxValue, long.MaxValue, long.MaxValue, long.MaxValue }))
+ {
+ var vf1 = Avx.SetVector256(1, 2, 3, 4);
+ Unsafe.Write(longTable.outArrayPtr, vf1);
+
+ if (!longTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on long:");
+ foreach (var item in longTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<ulong> ulongTable = new TestTable<ulong>(new ulong[4] { ulong.MaxValue, ulong.MaxValue, ulong.MaxValue, ulong.MaxValue }))
+ {
+ Vector256<ulong> vf1 = Avx.SetVector256((ulong)1, 2, 3, 4);
+ Unsafe.Write(ulongTable.outArrayPtr, vf1);
+
+ if (!ulongTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1)))
+ {
+ Console.WriteLine("AVX SetVector256 failed on ulong:");
+ foreach (var item in ulongTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+ }
+ }
+
+ return testResult;
+ }
+
+ public unsafe struct TestTable<T> : IDisposable where T : struct
+ {
+ public T[] outArray;
+
+ public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
+
+ GCHandle outHandle;
+ public TestTable(T[] a)
+ {
+ this.outArray = a;
+
+ outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
+ }
+ public bool CheckResult(Func<T[], bool> check)
+ {
+ return check(outArray);
+ }
+
+ public void Dispose()
+ {
+ outHandle.Free();
+ }
+ }
+
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_r.csproj
new file mode 100644
index 0000000000..5bcc47e3f3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_r.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SetVector256.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_ro.csproj
new file mode 100644
index 0000000000..be90a4846d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_ro.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SetVector256.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Double.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Double.1.cs
index 7577826ec8..97ea26a72a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Double.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Double.1.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__ShuffleDouble1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__ShuffleDouble1()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -286,9 +286,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -299,9 +299,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Single.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Single.1.cs
index b3fa1cd1a4..3192185336 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Single.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Shuffle.Single.1.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__ShuffleSingle1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__ShuffleSingle1()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -286,9 +286,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -299,9 +299,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Double.cs
index 6354cd2338..51f355ab2b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__SubtractDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Single.cs
index e99ae8c63f..9ad31d60ef 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Subtract.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__SubtractSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Byte.cs
index 8ea205c1d6..b98a09bdd4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public BooleanBinaryOpTest__TestCByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int16.cs
index 47e1f2f26d..b9d579135a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public BooleanBinaryOpTest__TestCInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int32.cs
index 1cbe4f5109..0808a5ba6b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public BooleanBinaryOpTest__TestCInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int64.cs
index 50e881c793..6d59986f46 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public BooleanBinaryOpTest__TestCInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.SByte.cs
index ebb96bc34c..230bb03864 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public BooleanBinaryOpTest__TestCSByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt16.cs
index b52c32353a..f203b62218 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public BooleanBinaryOpTest__TestCUInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt32.cs
index 22d8c3e402..430b97b82a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public BooleanBinaryOpTest__TestCUInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt64.cs
index e09bcc9110..573fd505cb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestC.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public BooleanBinaryOpTest__TestCUInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Byte.cs
index 58232bc7a3..5c40fd04aa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Byte, Byte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Byte, Byte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int16.cs
index ee4efaff44..e4be74f539 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int16, Int16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int16, Int16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int32.cs
index ffc8fe595a..494b36b7e5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int32, Int32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int32, Int32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int64.cs
index abebb0865f..047a1d23d9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int64, Int64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int64, Int64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.SByte.cs
index 3d967a4c83..5f4b056ba2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCSByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<SByte, SByte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<SByte, SByte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt16.cs
index d82ff7fc86..8325d5e7bf 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCUInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt16, UInt16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt16, UInt16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt32.cs
index da6bebaa95..74ffd2d301 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCUInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt32, UInt32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt32, UInt32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt64.cs
index aeeb8482ac..3e09f105e6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestNotZAndNotC.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCUInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt64, UInt64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt64, UInt64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Byte.cs
index bdf04e5e2f..2a7afbea96 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public BooleanBinaryOpTest__TestZByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int16.cs
index f347e27105..04ae3058b4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public BooleanBinaryOpTest__TestZInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int32.cs
index 13983af5ff..8cd3156a16 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public BooleanBinaryOpTest__TestZInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int64.cs
index 746ae11cc1..2b2be9432f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public BooleanBinaryOpTest__TestZInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.SByte.cs
index 408ff477c8..a7b11ef09c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public BooleanBinaryOpTest__TestZSByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt16.cs
index d62277c2f6..660c3733d2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public BooleanBinaryOpTest__TestZUInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt32.cs
index 04d571c559..10fd92a941 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public BooleanBinaryOpTest__TestZUInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt64.cs
index ddd3a96e7d..e5d330de03 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/TestZ.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public BooleanBinaryOpTest__TestZUInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Double.cs
index 7cecba5d15..053026e490 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorDouble
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleBinaryOpTest__XorDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Single.cs
index 6e7ee76d14..9e91f6f6f9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Xor.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorSingle
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
}
public SimpleBinaryOpTest__XorSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Byte.cs
index ebc9e612e0..bba9fe7e8d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleBinaryOpTest__AddByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int16.cs
index b0669b58e3..d1df1b650f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleBinaryOpTest__AddInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int32.cs
index 2d09a5e2cb..e758f3be09 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleBinaryOpTest__AddInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int64.cs
index f15961c5c2..bfe96038ec 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleBinaryOpTest__AddInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.SByte.cs
index 828f12bd3e..ad8dc3f878 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleBinaryOpTest__AddSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt16.cs
index bc2576bfe8..750621a15c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleBinaryOpTest__AddUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt32.cs
index 4a31709b16..0a1001ef11 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleBinaryOpTest__AddUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt64.cs
index ee588fc61b..a47f3d1022 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Add.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleBinaryOpTest__AddUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Byte.cs
index 4978ea8751..582513def6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleBinaryOpTest__AndByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int16.cs
index 5ae85bda6a..86f0808076 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleBinaryOpTest__AndInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int32.cs
index f33c3b1caa..40a021c0d6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleBinaryOpTest__AndInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int64.cs
index b197174e88..e0acc87cd5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleBinaryOpTest__AndInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.SByte.cs
index 19661540ab..4c40e4e313 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleBinaryOpTest__AndSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt16.cs
index 80e9d0fa17..7943d3fcbd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleBinaryOpTest__AndUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt32.cs
index b8d9296094..26c74e3ea6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleBinaryOpTest__AndUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt64.cs
index e3051aa2d9..ddbeef057b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/And.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleBinaryOpTest__AndUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Byte.cs
index f2016ae596..af8dc71ff5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleBinaryOpTest__AndNotByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int16.cs
index 0f9aa8da60..db5f3232fe 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleBinaryOpTest__AndNotInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int32.cs
index a6ad3c04b9..6f85e81932 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleBinaryOpTest__AndNotInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int64.cs
index d6fd1d2e02..2af6e9a92f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleBinaryOpTest__AndNotInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.SByte.cs
index 2a6a14d245..6af9e2eb79 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleBinaryOpTest__AndNotSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt16.cs
index 28950d63b3..a4fbb70cc5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleBinaryOpTest__AndNotUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt32.cs
index 279b8d2ed9..3a5304a8fc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleBinaryOpTest__AndNotUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt64.cs
index 6a28bcbfba..b940c7f4c8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/AndNot.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleBinaryOpTest__AndNotUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.Byte.cs
index f919d19e7e..d5d9e8226b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AverageByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleBinaryOpTest__AverageByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.UInt16.cs
index d8895402a7..00907cd611 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Average.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AverageUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleBinaryOpTest__AverageUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj
index 027236a269..bc465abb83 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj
@@ -119,6 +119,18 @@
<Compile Include="InsertVector128.UInt32.1.Load.cs" />
<Compile Include="InsertVector128.Int64.1.Load.cs" />
<Compile Include="InsertVector128.UInt64.1.Load.cs" />
+ <Compile Include="Max.Byte.cs" />
+ <Compile Include="Max.Int16.cs" />
+ <Compile Include="Max.Int32.cs" />
+ <Compile Include="Max.SByte.cs" />
+ <Compile Include="Max.UInt16.cs" />
+ <Compile Include="Max.UInt32.cs" />
+ <Compile Include="Min.Byte.cs" />
+ <Compile Include="Min.Int16.cs" />
+ <Compile Include="Min.Int32.cs" />
+ <Compile Include="Min.SByte.cs" />
+ <Compile Include="Min.UInt16.cs" />
+ <Compile Include="Min.UInt32.cs" />
<Compile Include="Or.Byte.cs" />
<Compile Include="Or.Int16.cs" />
<Compile Include="Or.Int32.cs" />
@@ -127,6 +139,10 @@
<Compile Include="Or.UInt16.cs" />
<Compile Include="Or.UInt32.cs" />
<Compile Include="Or.UInt64.cs" />
+ <Compile Include="Permute2x128.Int32.2.cs" />
+ <Compile Include="Permute2x128.UInt32.2.cs" />
+ <Compile Include="Permute2x128.Int64.2.cs" />
+ <Compile Include="Permute2x128.UInt64.2.cs" />
<Compile Include="ShiftLeftLogical.Int16.1.cs" />
<Compile Include="ShiftLeftLogical.UInt16.1.cs" />
<Compile Include="ShiftLeftLogical.Int32.1.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj
index 7eb8667ead..55ddee102a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj
@@ -119,6 +119,18 @@
<Compile Include="InsertVector128.UInt32.1.Load.cs" />
<Compile Include="InsertVector128.Int64.1.Load.cs" />
<Compile Include="InsertVector128.UInt64.1.Load.cs" />
+ <Compile Include="Max.Byte.cs" />
+ <Compile Include="Max.Int16.cs" />
+ <Compile Include="Max.Int32.cs" />
+ <Compile Include="Max.SByte.cs" />
+ <Compile Include="Max.UInt16.cs" />
+ <Compile Include="Max.UInt32.cs" />
+ <Compile Include="Min.Byte.cs" />
+ <Compile Include="Min.Int16.cs" />
+ <Compile Include="Min.Int32.cs" />
+ <Compile Include="Min.SByte.cs" />
+ <Compile Include="Min.UInt16.cs" />
+ <Compile Include="Min.UInt32.cs" />
<Compile Include="Or.Byte.cs" />
<Compile Include="Or.Int16.cs" />
<Compile Include="Or.Int32.cs" />
@@ -127,6 +139,10 @@
<Compile Include="Or.UInt16.cs" />
<Compile Include="Or.UInt32.cs" />
<Compile Include="Or.UInt64.cs" />
+ <Compile Include="Permute2x128.Int32.2.cs" />
+ <Compile Include="Permute2x128.UInt32.2.cs" />
+ <Compile Include="Permute2x128.Int64.2.cs" />
+ <Compile Include="Permute2x128.UInt64.2.cs" />
<Compile Include="ShiftLeftLogical.Int16.1.cs" />
<Compile Include="ShiftLeftLogical.UInt16.1.cs" />
<Compile Include="ShiftLeftLogical.Int32.1.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.Byte.cs
index 0ae9c7a97a..ca4738e493 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.Byte.cs
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__BlendVariableByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int Op3ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (byte)(((i % 2) == 0) ? 128 : 1); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar3), ref Unsafe.As<Byte, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar3), ref Unsafe.As<Byte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleTernaryOpTest__BlendVariableByte()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (byte)(((i % 2) == 0) ? 128 : 1); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld3), ref Unsafe.As<Byte, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld3), ref Unsafe.As<Byte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (byte)(((i % 2) == 0) ? 128 : 1); }
- _dataTable = new SimpleTernaryOpTest__DataTable<Byte, Byte, Byte, Byte>(_data1, _data2, _data3, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<Byte, Byte, Byte, Byte>(_data1, _data2, _data3, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray3 = new Byte[Op3ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray3 = new Byte[Op3ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.SByte.cs
index 4beb856bb5..f15a531a40 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BlendVariable.SByte.cs
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__BlendVariableSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int Op3ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar3), ref Unsafe.As<SByte, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar3), ref Unsafe.As<SByte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleTernaryOpTest__BlendVariableSByte()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld3), ref Unsafe.As<SByte, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld3), ref Unsafe.As<SByte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); }
- _dataTable = new SimpleTernaryOpTest__DataTable<SByte, SByte, SByte, SByte>(_data1, _data2, _data3, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<SByte, SByte, SByte, SByte>(_data1, _data2, _data3, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray3 = new SByte[Op3ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray3 = new SByte[Op3ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Byte.cs
index 6d62c44d1b..e02e1f3c53 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128Byte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128Byte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Double.cs
index b1b5169835..e2165e0877 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128Double
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128Double()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int16.cs
index ac47ab40e1..cca08b34d7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128Int16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128Int16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int32.cs
index 68fa2d97fd..0c27915839 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128Int32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128Int32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int64.cs
index ee9b10a77c..98a9fa2672 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128Int64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128Int64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.SByte.cs
index 057189618e..8c8ea54db7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128SByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128SByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Single.cs
index 32550faa74..0e7535fcf8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128Single
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128Single()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt16.cs
index dc7c04409e..ec5efa9444 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128UInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128UInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt32.cs
index 5f5815d6ae..6cf303e86d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128UInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128UInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt64.cs
index 59e8914738..3a2acad9c0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector128.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector128UInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector128UInt64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Byte.cs
index 18ae07f47a..6710791d14 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256Byte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256Byte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Double.cs
index 64bedc42af..df0ddd82bd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256Double
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256Double()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int16.cs
index 89e15181e3..2fb3132015 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256Int16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256Int16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int32.cs
index e33cb6cd6b..4d1792a46c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256Int32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256Int32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int64.cs
index bd812ce42d..feef4b9643 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256Int64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256Int64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.SByte.cs
index 67438a34a1..33a9ac1bda 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256SByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256SByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Single.cs
index 3520940d03..4fc18d7bc5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256Single
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256Single()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt16.cs
index 9612f9b945..64c4e8109d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256UInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256UInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt32.cs
index 32a6bff3b7..0136d9949c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256UInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256UInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt64.cs
index 0bcac6ea98..2f9aaf8e57 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastScalarToVector256.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__BroadcastScalarToVector256UInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__BroadcastScalarToVector256UInt64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256.cs
new file mode 100644
index 0000000000..6a0e45ec7a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256.cs
@@ -0,0 +1,141 @@
+// 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;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.Intrinsics;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static unsafe int Main(string[] args)
+ {
+ int testResult = Pass;
+
+ if (Avx2.IsSupported)
+ {
+ using (TestTable<int> intTable = new TestTable<int>(new int[8] { 1, -5, 100, 0, 1, 2, 3, 4 }, new int[8]))
+ {
+ var vf = Avx2.BroadcastVector128ToVector256((int*)(intTable.inArrayPtr));
+ Unsafe.Write(intTable.outArrayPtr, vf);
+
+ if (!intTable.CheckResult((x, y) => x == y))
+ {
+ Console.WriteLine("Avx2 BroadcastVector128ToVector256 failed on int:");
+ foreach (var item in intTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<uint> uintTable = new TestTable<uint>(new uint[8] { 1, 5, 100, 0, 1, 2, 3, 4 }, new uint[8]))
+ {
+ var vf = Avx2.BroadcastVector128ToVector256((uint*)(uintTable.inArrayPtr));
+ Unsafe.Write(uintTable.outArrayPtr, vf);
+
+ if (!uintTable.CheckResult((x, y) => x == y))
+ {
+ Console.WriteLine("Avx2 BroadcastVector128ToVector256 failed on uint:");
+ foreach (var item in uintTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<long> longTable = new TestTable<long>(new long[4] { 1, -5, 100, 0}, new long[4]))
+ {
+ var vf = Avx2.BroadcastVector128ToVector256((long*)(longTable.inArrayPtr));
+ Unsafe.Write(longTable.outArrayPtr, vf);
+
+ if (!longTable.CheckResult((x, y) => x == y))
+ {
+ Console.WriteLine("Avx2 BroadcastVector128ToVector256 failed on long:");
+ foreach (var item in longTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<ulong> ulongTable = new TestTable<ulong>(new ulong[4] { 1, 5, 100, 0}, new ulong[4]))
+ {
+ var vf = Avx2.BroadcastVector128ToVector256((ulong*)(ulongTable.inArrayPtr));
+ Unsafe.Write(ulongTable.outArrayPtr, vf);
+
+ if (!ulongTable.CheckResult((x, y) => x == y))
+ {
+ Console.WriteLine("Avx2 BroadcastVector128ToVector256 failed on ulong:");
+ foreach (var item in ulongTable.outArray)
+ {
+ Console.Write(item + ", ");
+ }
+ Console.WriteLine();
+ testResult = Fail;
+ }
+ }
+ }
+ return testResult;
+ }
+
+ public unsafe struct TestTable<T> : IDisposable where T : struct
+ {
+ public T[] inArray;
+ public T[] outArray;
+
+ public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
+ public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
+
+ GCHandle inHandle;
+ GCHandle outHandle;
+ public TestTable(T[] a, T[] b)
+ {
+ this.inArray = a;
+ this.outArray = b;
+
+ inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned);
+ outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
+ }
+ public bool CheckResult(Func<T, T, bool> check)
+ {
+ for (int i = 0; i < outArray.Length/2; i++)
+ {
+ if (!check(inArray[i], outArray[i]))
+ {
+ return false;
+ }
+ }
+ for (int i = outArray.Length/2; i < outArray.Length; i++)
+ {
+ if (!check(inArray[i - outArray.Length/2], outArray[i]))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void Dispose()
+ {
+ inHandle.Free();
+ outHandle.Free();
+ }
+ }
+
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_r.csproj
new file mode 100644
index 0000000000..1f4bcd4e36
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_r.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BroadcastVector128ToVector256.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_ro.csproj
new file mode 100644
index 0000000000..feecc1c334
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_ro.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BroadcastVector128ToVector256.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Byte.cs
index dd20210f2a..7c0154216b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleBinaryOpTest__CompareEqualByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int16.cs
index 945535b401..7e3304fa8e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleBinaryOpTest__CompareEqualInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int32.cs
index cf82a0fd9e..a3c8d5b95b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleBinaryOpTest__CompareEqualInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int64.cs
index 14d7d7d01b..4764dd4f3f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleBinaryOpTest__CompareEqualInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.SByte.cs
index dd8d09c421..2616f1f7c3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleBinaryOpTest__CompareEqualSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt16.cs
index dbb3e8e6e2..34835ba549 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleBinaryOpTest__CompareEqualUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt32.cs
index 14d6fdee69..6dcaca2435 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleBinaryOpTest__CompareEqualUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt64.cs
index e419d9d50d..8df791cb9d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareEqual.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleBinaryOpTest__CompareEqualUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int16.cs
index 0023989b3b..804d24e87b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleBinaryOpTest__CompareGreaterThanInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int32.cs
index e921b601e1..e5cb25e464 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleBinaryOpTest__CompareGreaterThanInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int64.cs
index 5ac1316ad1..0227f9d640 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleBinaryOpTest__CompareGreaterThanInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.SByte.cs
index 3b3eed6914..b3d8c4dd0f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/CompareGreaterThan.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleBinaryOpTest__CompareGreaterThanSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int16.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int16.SByte.cs
new file mode 100644
index 0000000000..92b47e7eba
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int16.SByte.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256Int16SByte()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int16SByte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256Int16SByte
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(SByte);
+ private const int RetElementCount = VectorSize / sizeof(Int16);
+
+ private static SByte[] _data = new SByte[Op1ElementCount];
+
+ private static Vector128<SByte> _clsVar;
+
+ private Vector128<SByte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int16, SByte> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256Int16SByte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256Int16SByte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, SByte>(_data, new Int16[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256Int16(
+ Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256Int16(
+ Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256Int16(
+ Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int16), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int16), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int16), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256Int16(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256Int16(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int16(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int16(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int16SByte();
+ var result = Avx2.ConvertToVector256Int16(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256Int16(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<SByte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(SByte[] firstOp, Int16[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256Int16)}<Int16>(Vector128<SByte>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int32.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int32.Int16.cs
new file mode 100644
index 0000000000..a197da2439
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int32.Int16.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256Int32Int16()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int32Int16();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256Int32Int16
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(Int16);
+ private const int RetElementCount = VectorSize / sizeof(Int32);
+
+ private static Int16[] _data = new Int16[Op1ElementCount];
+
+ private static Vector128<Int16> _clsVar;
+
+ private Vector128<Int16> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int32, Int16> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256Int32Int16()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256Int32Int16()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int16>(_data, new Int32[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256Int32(
+ Unsafe.Read<Vector128<Int16>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256Int32(
+ Sse2.LoadVector128((Int16*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256Int32(
+ Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int32), new Type[] { typeof(Vector128<Int16>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Int16>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int32), new Type[] { typeof(Vector128<Int16>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((Int16*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int32), new Type[] { typeof(Vector128<Int16>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256Int32(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<Int16>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256Int32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((Int16*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int32Int16();
+ var result = Avx2.ConvertToVector256Int32(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256Int32(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Int16> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray = new Int16[Op1ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray = new Int16[Op1ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int16[] firstOp, Int32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256Int32)}<Int32>(Vector128<Int16>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int32.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int32.SByte.cs
new file mode 100644
index 0000000000..47af229606
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int32.SByte.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256Int32SByte()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int32SByte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256Int32SByte
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(SByte);
+ private const int RetElementCount = VectorSize / sizeof(Int32);
+
+ private static SByte[] _data = new SByte[Op1ElementCount];
+
+ private static Vector128<SByte> _clsVar;
+
+ private Vector128<SByte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int32, SByte> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256Int32SByte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256Int32SByte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, SByte>(_data, new Int32[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256Int32(
+ Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256Int32(
+ Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256Int32(
+ Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int32), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int32), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int32), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256Int32(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256Int32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int32SByte();
+ var result = Avx2.ConvertToVector256Int32(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256Int32(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<SByte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(SByte[] firstOp, Int32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256Int32)}<Int32>(Vector128<SByte>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.Int16.cs
new file mode 100644
index 0000000000..092610d61d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.Int16.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256Int64Int16()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int64Int16();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256Int64Int16
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(Int16);
+ private const int RetElementCount = VectorSize / sizeof(Int64);
+
+ private static Int16[] _data = new Int16[Op1ElementCount];
+
+ private static Vector128<Int16> _clsVar;
+
+ private Vector128<Int16> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int64, Int16> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256Int64Int16()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256Int64Int16()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int16>(_data, new Int64[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Unsafe.Read<Vector128<Int16>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Sse2.LoadVector128((Int16*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<Int16>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Int16>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<Int16>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((Int16*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<Int16>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<Int16>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((Int16*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((Int16*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int64Int16();
+ var result = Avx2.ConvertToVector256Int64(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256Int64(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Int16> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray = new Int16[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray = new Int16[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int16[] firstOp, Int64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256Int64)}<Int64>(Vector128<Int16>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.Int32.cs
new file mode 100644
index 0000000000..f1c16ee090
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.Int32.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256Int64Int32()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int64Int32();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256Int64Int32
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(Int32);
+ private const int RetElementCount = VectorSize / sizeof(Int64);
+
+ private static Int32[] _data = new Int32[Op1ElementCount];
+
+ private static Vector128<Int32> _clsVar;
+
+ private Vector128<Int32> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int64, Int32> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256Int64Int32()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256Int64Int32()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int32>(_data, new Int64[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<Int32>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<Int32>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<Int32>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int64Int32();
+ var result = Avx2.ConvertToVector256Int64(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256Int64(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Int32> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray = new Int32[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray = new Int32[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Int32[] firstOp, Int64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256Int64)}<Int64>(Vector128<Int32>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.SByte.cs
new file mode 100644
index 0000000000..f3848d55e6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256Int64.SByte.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256Int64SByte()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int64SByte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256Int64SByte
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(SByte);
+ private const int RetElementCount = VectorSize / sizeof(Int64);
+
+ private static SByte[] _data = new SByte[Op1ElementCount];
+
+ private static Vector128<SByte> _clsVar;
+
+ private Vector128<SByte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<Int64, SByte> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256Int64SByte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256Int64SByte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, SByte>(_data, new Int64[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256Int64), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256Int64(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<SByte>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((SByte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256Int64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256Int64SByte();
+ var result = Avx2.ConvertToVector256Int64(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256Int64(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<SByte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray = new SByte[Op1ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(SByte[] firstOp, Int64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256Int64)}<Int64>(Vector128<SByte>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt16.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt16.Byte.cs
new file mode 100644
index 0000000000..682b76a894
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt16.Byte.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256UInt16Byte()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt16Byte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256UInt16Byte
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(Byte);
+ private const int RetElementCount = VectorSize / sizeof(Int16);
+
+ private static Byte[] _data = new Byte[Op1ElementCount];
+
+ private static Vector128<Byte> _clsVar;
+
+ private Vector128<Byte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt16, Byte> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256UInt16Byte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256UInt16Byte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, Byte>(_data, new UInt16[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256UInt16(
+ Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256UInt16(
+ Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256UInt16(
+ Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt16), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt16), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt16), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt16(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256UInt16(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt16(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt16(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt16Byte();
+ var result = Avx2.ConvertToVector256UInt16(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt16(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Byte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Byte[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256UInt16)}<UInt16>(Vector128<Byte>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt32.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt32.Byte.cs
new file mode 100644
index 0000000000..89202c2f1e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt32.Byte.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256UInt32Byte()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt32Byte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256UInt32Byte
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(Byte);
+ private const int RetElementCount = VectorSize / sizeof(Int32);
+
+ private static Byte[] _data = new Byte[Op1ElementCount];
+
+ private static Vector128<Byte> _clsVar;
+
+ private Vector128<Byte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt32, Byte> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256UInt32Byte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256UInt32Byte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, Byte>(_data, new UInt32[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256UInt32(
+ Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256UInt32(
+ Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256UInt32(
+ Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt32), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt32), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt32), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt32(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256UInt32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt32Byte();
+ var result = Avx2.ConvertToVector256UInt32(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt32(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Byte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Byte[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256UInt32)}<UInt32>(Vector128<Byte>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt32.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt32.UInt16.cs
new file mode 100644
index 0000000000..afb35c6404
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt32.UInt16.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256UInt32UInt16()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt32UInt16();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256UInt32UInt16
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(UInt16);
+ private const int RetElementCount = VectorSize / sizeof(Int32);
+
+ private static UInt16[] _data = new UInt16[Op1ElementCount];
+
+ private static Vector128<UInt16> _clsVar;
+
+ private Vector128<UInt16> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt32, UInt16> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256UInt32UInt16()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256UInt32UInt16()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt16>(_data, new UInt32[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256UInt32(
+ Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256UInt32(
+ Sse2.LoadVector128((UInt16*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256UInt32(
+ Sse2.LoadAlignedVector128((UInt16*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt32), new Type[] { typeof(Vector128<UInt16>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt32), new Type[] { typeof(Vector128<UInt16>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((UInt16*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt32), new Type[] { typeof(Vector128<UInt16>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((UInt16*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt32(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256UInt32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((UInt16*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((UInt16*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt32(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt32UInt16();
+ var result = Avx2.ConvertToVector256UInt32(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt32(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray = new UInt16[Op1ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray = new UInt16[Op1ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt16[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256UInt32)}<UInt32>(Vector128<UInt16>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.Byte.cs
new file mode 100644
index 0000000000..4d95740aaa
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.Byte.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256UInt64Byte()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt64Byte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256UInt64Byte
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(Byte);
+ private const int RetElementCount = VectorSize / sizeof(Int64);
+
+ private static Byte[] _data = new Byte[Op1ElementCount];
+
+ private static Vector128<Byte> _clsVar;
+
+ private Vector128<Byte> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt64, Byte> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256UInt64Byte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256UInt64Byte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, Byte>(_data, new UInt64[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<Byte>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((Byte*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt64Byte();
+ var result = Avx2.ConvertToVector256UInt64(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt64(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Byte> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray = new Byte[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(Byte[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256UInt64)}<UInt64>(Vector128<Byte>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.UInt16.cs
new file mode 100644
index 0000000000..48d5d7f954
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.UInt16.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256UInt64UInt16()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt64UInt16();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256UInt64UInt16
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(UInt16);
+ private const int RetElementCount = VectorSize / sizeof(Int64);
+
+ private static UInt16[] _data = new UInt16[Op1ElementCount];
+
+ private static Vector128<UInt16> _clsVar;
+
+ private Vector128<UInt16> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt64, UInt16> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256UInt64UInt16()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256UInt64UInt16()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt16>(_data, new UInt64[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Sse2.LoadVector128((UInt16*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Sse2.LoadAlignedVector128((UInt16*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<UInt16>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<UInt16>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((UInt16*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<UInt16>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((UInt16*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((UInt16*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((UInt16*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt64UInt16();
+ var result = Avx2.ConvertToVector256UInt64(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt64(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray = new UInt16[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray = new UInt16[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt16[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256UInt64)}<UInt64>(Vector128<UInt16>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.UInt32.cs
new file mode 100644
index 0000000000..67f361b4f1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256UInt64.UInt32.cs
@@ -0,0 +1,306 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void ConvertToVector256UInt64UInt32()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt64UInt32();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleUnaryOpTest__ConvertToVector256UInt64UInt32
+ {
+ private const int VectorSize = 32;
+
+ private const int Op1ElementCount = 16 / sizeof(UInt32);
+ private const int RetElementCount = VectorSize / sizeof(Int64);
+
+ private static UInt32[] _data = new UInt32[Op1ElementCount];
+
+ private static Vector128<UInt32> _clsVar;
+
+ private Vector128<UInt32> _fld;
+
+ private SimpleUnaryOpTest__DataTable<UInt64, UInt32> _dataTable;
+
+ static SimpleUnaryOpTest__ConvertToVector256UInt64UInt32()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), 16);
+ }
+
+ public SimpleUnaryOpTest__ConvertToVector256UInt64UInt32()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), 16);
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt32>(_data, new UInt64[RetElementCount], VectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Unsafe.Read<Vector128<UInt32>>(_dataTable.inArrayPtr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Sse2.LoadVector128((UInt32*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArrayPtr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<UInt32>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<UInt32>>(_dataTable.inArrayPtr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<UInt32>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((UInt32*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToVector256UInt64), new Type[] { typeof(Vector128<UInt32>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArrayPtr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt64(
+ _clsVar
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var firstOp = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArrayPtr);
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var firstOp = Sse2.LoadVector128((UInt32*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var firstOp = Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArrayPtr));
+ var result = Avx2.ConvertToVector256UInt64(firstOp);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleUnaryOpTest__ConvertToVector256UInt64UInt32();
+ var result = Avx2.ConvertToVector256UInt64(test._fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.ConvertToVector256UInt64(_fld);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray = new UInt32[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray = new UInt32[Op1ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), 16);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+
+ ValidateResult(inArray, outArray, method);
+ }
+
+ private void ValidateResult(UInt32[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != firstOp[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != firstOp[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.ConvertToVector256UInt64)}<UInt64>(Vector128<UInt32>): {method} failed:");
+ Console.WriteLine($" firstOp: ({string.Join(", ", firstOp)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256_r.csproj
new file mode 100644
index 0000000000..c240eab6b3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256_r.csproj
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ConvertToVector256UInt16.Byte.cs" />
+ <Compile Include="ConvertToVector256Int16.SByte.cs" />
+ <Compile Include="ConvertToVector256UInt32.Byte.cs" />
+ <Compile Include="ConvertToVector256Int32.Int16.cs" />
+ <Compile Include="ConvertToVector256Int32.SByte.cs" />
+ <Compile Include="ConvertToVector256UInt32.UInt16.cs" />
+ <Compile Include="ConvertToVector256UInt64.Byte.cs" />
+ <Compile Include="ConvertToVector256Int64.Int16.cs" />
+ <Compile Include="ConvertToVector256Int64.Int32.cs" />
+ <Compile Include="ConvertToVector256Int64.SByte.cs" />
+ <Compile Include="ConvertToVector256UInt64.UInt16.cs" />
+ <Compile Include="ConvertToVector256UInt64.UInt32.cs" />
+ <Compile Include="Program.ConvertToVector256.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256_ro.csproj
new file mode 100644
index 0000000000..15b943a683
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToVector256_ro.csproj
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ConvertToVector256UInt16.Byte.cs" />
+ <Compile Include="ConvertToVector256Int16.SByte.cs" />
+ <Compile Include="ConvertToVector256UInt32.Byte.cs" />
+ <Compile Include="ConvertToVector256Int32.Int16.cs" />
+ <Compile Include="ConvertToVector256Int32.SByte.cs" />
+ <Compile Include="ConvertToVector256UInt32.UInt16.cs" />
+ <Compile Include="ConvertToVector256UInt64.Byte.cs" />
+ <Compile Include="ConvertToVector256Int64.Int16.cs" />
+ <Compile Include="ConvertToVector256Int64.Int32.cs" />
+ <Compile Include="ConvertToVector256Int64.SByte.cs" />
+ <Compile Include="ConvertToVector256UInt64.UInt16.cs" />
+ <Compile Include="ConvertToVector256UInt64.UInt32.cs" />
+ <Compile Include="Program.ConvertToVector256.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.Store.cs
index 0ec5ded3b9..01e37463cb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Byte1Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = 16 / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__ExtractVector128Byte1Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.cs
index 2cc202e806..90ff66ba4a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Byte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Byte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = 16 / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__ExtractVector128Byte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.Store.cs
index 2554632bee..3f1b9644b4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int161Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = 16 / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ExtractVector128Int161Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.cs
index 38e04fac97..b92fc89c54 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = 16 / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ExtractVector128Int161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.Store.cs
index d6ff51f478..35446e6e50 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int321Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = 16 / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ExtractVector128Int321Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.cs
index fc93d547e8..8d6c800e8a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = 16 / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ExtractVector128Int321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.Store.cs
index ad8d67478c..9d74435270 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int641Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = 16 / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ExtractVector128Int641Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.cs
index c9d36d21b7..82eb318b4c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128Int641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = 16 / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ExtractVector128Int641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.Store.cs
index 4a3b8ccf5d..7af171776a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128SByte1Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = 16 / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__ExtractVector128SByte1Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.cs
index d581fe0e56..a24c5deab7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.SByte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128SByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = 16 / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__ExtractVector128SByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.Store.cs
index 56e756ca6c..f2da250625 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt161Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = 16 / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt161Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.cs
index 72a583e4c7..93a99dfec2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = 16 / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.Store.cs
index 353e23a7b9..5383285413 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt321Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = 16 / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt321Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.cs
index 374751b4f2..88b415c50c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = 16 / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.Store.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.Store.cs
index 60b9e27e34..02ce1e7ded 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.Store.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.Store.cs
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt641Store
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = 16 / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt641Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.cs
index f1fcefa48c..227c62b056 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ExtractVector128.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractVector128UInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = 16 / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ExtractVector128UInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.Load.cs
index 6c2de2f66b..4585907c87 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Byte1Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = 16 / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__InsertVector128Byte1Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.cs
index 5c7c198199..71ff744478 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Byte.1.cs
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Byte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = 16 / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__InsertVector128Byte1()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.Load.cs
index 56fc66cb53..073b5a1996 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int161Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = 16 / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0,short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__InsertVector128Int161Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0,short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0,short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.cs
index dce21e86d4..226d8471da 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int16.1.cs
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = 16 / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__InsertVector128Int161()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(0, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.Load.cs
index f0c27ff6d1..7401013cf6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int321Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = 16 / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__InsertVector128Int321Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0,int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.cs
index 3850505248..ddf47a5838 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int32.1.cs
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = 16 / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__InsertVector128Int321()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.Load.cs
index da0f4f13f7..40deb8cd89 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int641Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = 16 / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__InsertVector128Int641Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0,int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.cs
index 1ceadc38f2..e8cdf0f40a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.1.cs
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128Int641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = 16 / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__InsertVector128Int641()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.Load.cs
index d3abe77188..9ccc2c547f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128SByte1Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = 16 / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0,sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__InsertVector128SByte1Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0,sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0,sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.cs
index 388796251f..94c92ee0d6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.SByte.1.cs
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128SByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = 16 / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__InsertVector128SByte1()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.Load.cs
index 6d0c365fb4..0f561f65b6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt161Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = 16 / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__InsertVector128UInt161Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0,ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.cs
index 67decefd50..57f1d2da54 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt16.1.cs
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = 16 / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__InsertVector128UInt161()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.Load.cs
index 0ab344b409..1384636552 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt321Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = 16 / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__InsertVector128UInt321Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0,int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.cs
index c6b4daf6ee..244d788ca8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt32.1.cs
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = 16 / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__InsertVector128UInt321()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.Load.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.Load.cs
index 69db416db5..5cb7d0c2e3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.Load.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.Load.cs
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt641Load
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = 16 / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__InsertVector128UInt641Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0,int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0,int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.cs
index 9fee258ffa..76ac558da5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.UInt64.1.cs
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__InsertVector128UInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = 16 / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__InsertVector128UInt641()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Byte.cs
new file mode 100644
index 0000000000..00af5a5699
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Byte.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MaxByte()
+ {
+ var test = new SimpleBinaryOpTest__MaxByte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MaxByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ private static Byte[] _data1 = new Byte[Op1ElementCount];
+ private static Byte[] _data2 = new Byte[Op2ElementCount];
+
+ private static Vector256<Byte> _clsVar1;
+ private static Vector256<Byte> _clsVar2;
+
+ private Vector256<Byte> _fld1;
+ private Vector256<Byte> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Byte, Byte, Byte> _dataTable;
+
+ static SimpleBinaryOpTest__MaxByte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ }
+
+ public SimpleBinaryOpTest__MaxByte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Max(
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Max(
+ Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Max(
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Max(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MaxByte();
+ var result = Avx2.Max(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Max(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Byte> left, Vector256<Byte> right, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray1 = new Byte[Op1ElementCount];
+ Byte[] inArray2 = new Byte[Op2ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray1 = new Byte[Op1ElementCount];
+ Byte[] inArray2 = new Byte[Op2ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Byte[] left, Byte[] right, Byte[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Max(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Max(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Max)}<Byte>(Vector256<Byte>, Vector256<Byte>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Int16.cs
new file mode 100644
index 0000000000..bd8f391a29
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Int16.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MaxInt16()
+ {
+ var test = new SimpleBinaryOpTest__MaxInt16();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MaxInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ private static Int16[] _data1 = new Int16[Op1ElementCount];
+ private static Int16[] _data2 = new Int16[Op2ElementCount];
+
+ private static Vector256<Int16> _clsVar1;
+ private static Vector256<Int16> _clsVar2;
+
+ private Vector256<Int16> _fld1;
+ private Vector256<Int16> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Int16, Int16, Int16> _dataTable;
+
+ static SimpleBinaryOpTest__MaxInt16()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ }
+
+ public SimpleBinaryOpTest__MaxInt16()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Max(
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Max(
+ Avx.LoadVector256((Int16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int16*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Max(
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Int16>), typeof(Vector256<Int16>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Int16>), typeof(Vector256<Int16>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int16*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Int16>), typeof(Vector256<Int16>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Max(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Int16>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Int16>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Int16*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Int16*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MaxInt16();
+ var result = Avx2.Max(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Max(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int16> left, Vector256<Int16> right, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray1 = new Int16[Op1ElementCount];
+ Int16[] inArray2 = new Int16[Op2ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray1 = new Int16[Op1ElementCount];
+ Int16[] inArray2 = new Int16[Op2ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Int16[] left, Int16[] right, Int16[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Max(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Max(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Max)}<Int16>(Vector256<Int16>, Vector256<Int16>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Int32.cs
new file mode 100644
index 0000000000..e9c45952b0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.Int32.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MaxInt32()
+ {
+ var test = new SimpleBinaryOpTest__MaxInt32();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MaxInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ private static Int32[] _data1 = new Int32[Op1ElementCount];
+ private static Int32[] _data2 = new Int32[Op2ElementCount];
+
+ private static Vector256<Int32> _clsVar1;
+ private static Vector256<Int32> _clsVar2;
+
+ private Vector256<Int32> _fld1;
+ private Vector256<Int32> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Int32, Int32, Int32> _dataTable;
+
+ static SimpleBinaryOpTest__MaxInt32()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ }
+
+ public SimpleBinaryOpTest__MaxInt32()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Max(
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Max(
+ Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Max(
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Max(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MaxInt32();
+ var result = Avx2.Max(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Max(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int32> left, Vector256<Int32> right, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray1 = new Int32[Op1ElementCount];
+ Int32[] inArray2 = new Int32[Op2ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray1 = new Int32[Op1ElementCount];
+ Int32[] inArray2 = new Int32[Op2ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Int32[] left, Int32[] right, Int32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Max(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Max(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Max)}<Int32>(Vector256<Int32>, Vector256<Int32>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.SByte.cs
new file mode 100644
index 0000000000..cf8f8095af
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.SByte.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MaxSByte()
+ {
+ var test = new SimpleBinaryOpTest__MaxSByte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MaxSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ private static SByte[] _data1 = new SByte[Op1ElementCount];
+ private static SByte[] _data2 = new SByte[Op2ElementCount];
+
+ private static Vector256<SByte> _clsVar1;
+ private static Vector256<SByte> _clsVar2;
+
+ private Vector256<SByte> _fld1;
+ private Vector256<SByte> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<SByte, SByte, SByte> _dataTable;
+
+ static SimpleBinaryOpTest__MaxSByte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ }
+
+ public SimpleBinaryOpTest__MaxSByte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Max(
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Max(
+ Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Max(
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Max(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MaxSByte();
+ var result = Avx2.Max(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Max(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<SByte> left, Vector256<SByte> right, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray1 = new SByte[Op1ElementCount];
+ SByte[] inArray2 = new SByte[Op2ElementCount];
+ SByte[] outArray = new SByte[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray1 = new SByte[Op1ElementCount];
+ SByte[] inArray2 = new SByte[Op2ElementCount];
+ SByte[] outArray = new SByte[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(SByte[] left, SByte[] right, SByte[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Max(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Max(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Max)}<SByte>(Vector256<SByte>, Vector256<SByte>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.UInt16.cs
new file mode 100644
index 0000000000..147cddaf5b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.UInt16.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MaxUInt16()
+ {
+ var test = new SimpleBinaryOpTest__MaxUInt16();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MaxUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ private static UInt16[] _data1 = new UInt16[Op1ElementCount];
+ private static UInt16[] _data2 = new UInt16[Op2ElementCount];
+
+ private static Vector256<UInt16> _clsVar1;
+ private static Vector256<UInt16> _clsVar2;
+
+ private Vector256<UInt16> _fld1;
+ private Vector256<UInt16> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16> _dataTable;
+
+ static SimpleBinaryOpTest__MaxUInt16()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ }
+
+ public SimpleBinaryOpTest__MaxUInt16()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Max(
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Max(
+ Avx.LoadVector256((UInt16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt16*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Max(
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<UInt16>), typeof(Vector256<UInt16>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<UInt16>), typeof(Vector256<UInt16>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt16*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<UInt16>), typeof(Vector256<UInt16>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Max(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((UInt16*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((UInt16*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MaxUInt16();
+ var result = Avx2.Max(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Max(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt16> left, Vector256<UInt16> right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray1 = new UInt16[Op1ElementCount];
+ UInt16[] inArray2 = new UInt16[Op2ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray1 = new UInt16[Op1ElementCount];
+ UInt16[] inArray2 = new UInt16[Op2ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(UInt16[] left, UInt16[] right, UInt16[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Max(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Max(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Max)}<UInt16>(Vector256<UInt16>, Vector256<UInt16>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.UInt32.cs
new file mode 100644
index 0000000000..98982ff2f6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Max.UInt32.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MaxUInt32()
+ {
+ var test = new SimpleBinaryOpTest__MaxUInt32();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MaxUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ private static UInt32[] _data1 = new UInt32[Op1ElementCount];
+ private static UInt32[] _data2 = new UInt32[Op2ElementCount];
+
+ private static Vector256<UInt32> _clsVar1;
+ private static Vector256<UInt32> _clsVar2;
+
+ private Vector256<UInt32> _fld1;
+ private Vector256<UInt32> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32> _dataTable;
+
+ static SimpleBinaryOpTest__MaxUInt32()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ }
+
+ public SimpleBinaryOpTest__MaxUInt32()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Max(
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Max(
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Max(
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Max(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Max(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MaxUInt32();
+ var result = Avx2.Max(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Max(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt32> left, Vector256<UInt32> right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray1 = new UInt32[Op1ElementCount];
+ UInt32[] inArray2 = new UInt32[Op2ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray1 = new UInt32[Op1ElementCount];
+ UInt32[] inArray2 = new UInt32[Op2ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(UInt32[] left, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Max(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Max(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Max)}<UInt32>(Vector256<UInt32>, Vector256<UInt32>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Byte.cs
new file mode 100644
index 0000000000..1144fe86e9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Byte.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MinByte()
+ {
+ var test = new SimpleBinaryOpTest__MinByte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MinByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ private static Byte[] _data1 = new Byte[Op1ElementCount];
+ private static Byte[] _data2 = new Byte[Op2ElementCount];
+
+ private static Vector256<Byte> _clsVar1;
+ private static Vector256<Byte> _clsVar2;
+
+ private Vector256<Byte> _fld1;
+ private Vector256<Byte> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Byte, Byte, Byte> _dataTable;
+
+ static SimpleBinaryOpTest__MinByte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ }
+
+ public SimpleBinaryOpTest__MinByte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Min(
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Min(
+ Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Min(
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Min(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MinByte();
+ var result = Avx2.Min(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Min(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Byte> left, Vector256<Byte> right, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray1 = new Byte[Op1ElementCount];
+ Byte[] inArray2 = new Byte[Op2ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Byte[] inArray1 = new Byte[Op1ElementCount];
+ Byte[] inArray2 = new Byte[Op2ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Byte[] left, Byte[] right, Byte[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Min(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Min(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Min)}<Byte>(Vector256<Byte>, Vector256<Byte>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Int16.cs
new file mode 100644
index 0000000000..5cd0fd5707
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Int16.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MinInt16()
+ {
+ var test = new SimpleBinaryOpTest__MinInt16();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MinInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ private static Int16[] _data1 = new Int16[Op1ElementCount];
+ private static Int16[] _data2 = new Int16[Op2ElementCount];
+
+ private static Vector256<Int16> _clsVar1;
+ private static Vector256<Int16> _clsVar2;
+
+ private Vector256<Int16> _fld1;
+ private Vector256<Int16> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Int16, Int16, Int16> _dataTable;
+
+ static SimpleBinaryOpTest__MinInt16()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ }
+
+ public SimpleBinaryOpTest__MinInt16()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Min(
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Min(
+ Avx.LoadVector256((Int16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int16*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Min(
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Int16>), typeof(Vector256<Int16>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int16>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Int16>), typeof(Vector256<Int16>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int16*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Int16>), typeof(Vector256<Int16>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Min(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Int16>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Int16>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Int16*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Int16*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MinInt16();
+ var result = Avx2.Min(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Min(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int16> left, Vector256<Int16> right, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray1 = new Int16[Op1ElementCount];
+ Int16[] inArray2 = new Int16[Op2ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Int16[] inArray1 = new Int16[Op1ElementCount];
+ Int16[] inArray2 = new Int16[Op2ElementCount];
+ Int16[] outArray = new Int16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Int16[] left, Int16[] right, Int16[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Min(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Min(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Min)}<Int16>(Vector256<Int16>, Vector256<Int16>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Int32.cs
new file mode 100644
index 0000000000..280dbfaa70
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.Int32.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MinInt32()
+ {
+ var test = new SimpleBinaryOpTest__MinInt32();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MinInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ private static Int32[] _data1 = new Int32[Op1ElementCount];
+ private static Int32[] _data2 = new Int32[Op2ElementCount];
+
+ private static Vector256<Int32> _clsVar1;
+ private static Vector256<Int32> _clsVar2;
+
+ private Vector256<Int32> _fld1;
+ private Vector256<Int32> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Int32, Int32, Int32> _dataTable;
+
+ static SimpleBinaryOpTest__MinInt32()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ }
+
+ public SimpleBinaryOpTest__MinInt32()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Min(
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Min(
+ Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Min(
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Min(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MinInt32();
+ var result = Avx2.Min(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Min(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int32> left, Vector256<Int32> right, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray1 = new Int32[Op1ElementCount];
+ Int32[] inArray2 = new Int32[Op2ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray1 = new Int32[Op1ElementCount];
+ Int32[] inArray2 = new Int32[Op2ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Int32[] left, Int32[] right, Int32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Min(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Min(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Min)}<Int32>(Vector256<Int32>, Vector256<Int32>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.SByte.cs
new file mode 100644
index 0000000000..c2cd75a4a2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.SByte.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MinSByte()
+ {
+ var test = new SimpleBinaryOpTest__MinSByte();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MinSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ private static SByte[] _data1 = new SByte[Op1ElementCount];
+ private static SByte[] _data2 = new SByte[Op2ElementCount];
+
+ private static Vector256<SByte> _clsVar1;
+ private static Vector256<SByte> _clsVar2;
+
+ private Vector256<SByte> _fld1;
+ private Vector256<SByte> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<SByte, SByte, SByte> _dataTable;
+
+ static SimpleBinaryOpTest__MinSByte()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ }
+
+ public SimpleBinaryOpTest__MinSByte()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Min(
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Min(
+ Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Min(
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Min(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MinSByte();
+ var result = Avx2.Min(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Min(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<SByte> left, Vector256<SByte> right, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray1 = new SByte[Op1ElementCount];
+ SByte[] inArray2 = new SByte[Op2ElementCount];
+ SByte[] outArray = new SByte[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ SByte[] inArray1 = new SByte[Op1ElementCount];
+ SByte[] inArray2 = new SByte[Op2ElementCount];
+ SByte[] outArray = new SByte[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(SByte[] left, SByte[] right, SByte[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Min(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Min(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Min)}<SByte>(Vector256<SByte>, Vector256<SByte>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.UInt16.cs
new file mode 100644
index 0000000000..9b07ddfd83
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.UInt16.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MinUInt16()
+ {
+ var test = new SimpleBinaryOpTest__MinUInt16();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MinUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ private static UInt16[] _data1 = new UInt16[Op1ElementCount];
+ private static UInt16[] _data2 = new UInt16[Op2ElementCount];
+
+ private static Vector256<UInt16> _clsVar1;
+ private static Vector256<UInt16> _clsVar2;
+
+ private Vector256<UInt16> _fld1;
+ private Vector256<UInt16> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16> _dataTable;
+
+ static SimpleBinaryOpTest__MinUInt16()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ }
+
+ public SimpleBinaryOpTest__MinUInt16()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Min(
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Min(
+ Avx.LoadVector256((UInt16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt16*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Min(
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<UInt16>), typeof(Vector256<UInt16>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<UInt16>), typeof(Vector256<UInt16>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt16*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<UInt16>), typeof(Vector256<UInt16>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Min(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((UInt16*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((UInt16*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MinUInt16();
+ var result = Avx2.Min(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Min(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt16> left, Vector256<UInt16> right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray1 = new UInt16[Op1ElementCount];
+ UInt16[] inArray2 = new UInt16[Op2ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt16[] inArray1 = new UInt16[Op1ElementCount];
+ UInt16[] inArray2 = new UInt16[Op2ElementCount];
+ UInt16[] outArray = new UInt16[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(UInt16[] left, UInt16[] right, UInt16[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Min(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Min(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Min)}<UInt16>(Vector256<UInt16>, Vector256<UInt16>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.UInt32.cs
new file mode 100644
index 0000000000..8272e8582a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Min.UInt32.cs
@@ -0,0 +1,330 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void MinUInt32()
+ {
+ var test = new SimpleBinaryOpTest__MinUInt32();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__MinUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ private static UInt32[] _data1 = new UInt32[Op1ElementCount];
+ private static UInt32[] _data2 = new UInt32[Op2ElementCount];
+
+ private static Vector256<UInt32> _clsVar1;
+ private static Vector256<UInt32> _clsVar2;
+
+ private Vector256<UInt32> _fld1;
+ private Vector256<UInt32> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32> _dataTable;
+
+ static SimpleBinaryOpTest__MinUInt32()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ }
+
+ public SimpleBinaryOpTest__MinUInt32()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Min(
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr)
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Min(
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Min(
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr))
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr)
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Min), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr))
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Min(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Min(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__MinUInt32();
+ var result = Avx2.Min(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Min(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt32> left, Vector256<UInt32> right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray1 = new UInt32[Op1ElementCount];
+ UInt32[] inArray2 = new UInt32[Op2ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray1 = new UInt32[Op1ElementCount];
+ UInt32[] inArray2 = new UInt32[Op2ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(UInt32[] left, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != Math.Min(left[0], right[0]))
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != Math.Min(left[i], right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Min)}<UInt32>(Vector256<UInt32>, Vector256<UInt32>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask.cs
new file mode 100644
index 0000000000..c33b4f2562
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask.cs
@@ -0,0 +1,77 @@
+// 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;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.Intrinsics;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static unsafe int Main(string[] args)
+ {
+ int testResult = Pass;
+
+ if (Avx2.IsSupported)
+ {
+ using (TestTable<byte> byteTable = new TestTable<byte>(new byte[32] { 255, 2, 0, 80, 0, 7, 0, 1, 2, 7, 80, 0, 123, 127, 5, 255, 255, 2, 0, 80, 0, 7, 0, 1, 2, 7, 80, 0, 123, 127, 5, 255 }))
+ {
+
+ var vf1 = Unsafe.Read<Vector256<byte>>(byteTable.inArray1Ptr);
+ var res = Avx2.MoveMask(vf1);
+
+ if (res != -2147385343)
+ {
+ Console.WriteLine("AVX2 MoveMask failed on byte:");
+ Console.WriteLine(res);
+ testResult = Fail;
+ }
+ }
+
+ using (TestTable<sbyte> sbyteTable = new TestTable<sbyte>(new sbyte[32] { -1, 2, 0, 6, 0, 7, 111, 1, 2, 55, 80, 0, 11, 127, 5, -9, -1, 2, 0, 6, 0, 7, 111, 1, 2, 55, 80, 0, 11, 127, 5, -9 }))
+ {
+
+ var vf1 = Unsafe.Read<Vector256<sbyte>>(sbyteTable.inArray1Ptr);
+ var res = Avx2.MoveMask(vf1);
+
+ if (res != -2147385343)
+ {
+ Console.WriteLine("AVX2 MoveMask failed on sbyte:");
+ Console.WriteLine(res);
+ testResult = Fail;
+ }
+ }
+ }
+
+
+ return testResult;
+ }
+
+ public unsafe struct TestTable<T> : IDisposable where T : struct
+ {
+ public T[] inArray1;
+ public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
+ GCHandle inHandle1;
+
+ public TestTable(T[] a)
+ {
+ this.inArray1 = a;
+ inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
+ }
+
+ public void Dispose()
+ {
+ inHandle1.Free();
+ }
+ }
+
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask_r.csproj
new file mode 100644
index 0000000000..868b0ce2e8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask_r.csproj
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{EC7AD883-41EA-4BDC-BFBE-77A78B727D76}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MoveMask.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask_ro.csproj
new file mode 100644
index 0000000000..06ad5dc47f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/MoveMask_ro.csproj
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{4D4CC0B8-3894-4F6F-868B-C93A7B722B5C}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MoveMask.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Byte.cs
index f18d55b594..6db5c68632 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleBinaryOpTest__OrByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int16.cs
index d74fbdf53e..63c83e45a7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleBinaryOpTest__OrInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int32.cs
index b34a427820..8ee4521b25 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleBinaryOpTest__OrInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int64.cs
index 178237473d..1e13397d30 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleBinaryOpTest__OrInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.SByte.cs
index fa7e9c54cb..cfead69ed5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleBinaryOpTest__OrSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt16.cs
index a5f48f5550..98459c4d6c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleBinaryOpTest__OrUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt32.cs
index 289d048511..8bb9bbbc06 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleBinaryOpTest__OrUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt64.cs
index 98e2349c71..ffd4564e3b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Or.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleBinaryOpTest__OrUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Avx2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Avx2.cs
new file mode 100644
index 0000000000..056d7d0ea9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Avx2.cs
@@ -0,0 +1,22 @@
+// 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;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Permute2x128.Int32.2"] = Permute2x128Int322,
+ ["Permute2x128.UInt32.2"] = Permute2x128UInt322,
+ ["Permute2x128.Int64.2"] = Permute2x128Int642,
+ ["Permute2x128.UInt64.2"] = Permute2x128UInt642,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Int32.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Int32.2.cs
new file mode 100644
index 0000000000..1f650764e9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Int32.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128Int322()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Int322();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128Int322
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ private static Int32[] _data1 = new Int32[Op1ElementCount];
+ private static Int32[] _data2 = new Int32[Op2ElementCount];
+
+ private static Vector256<Int32> _clsVar1;
+ private static Vector256<Int32> _clsVar2;
+
+ private Vector256<Int32> _fld1;
+ private Vector256<Int32> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Int32, Int32, Int32> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128Int322()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ }
+
+ public SimpleBinaryOpTest__Permute2x128Int322()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Permute2x128(
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Permute2x128(
+ Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Permute2x128(
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<Int32>), typeof(Vector256<Int32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Int32>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Int32>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Int32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Int32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Int322();
+ var result = Avx2.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int32> left, Vector256<Int32> right, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray1 = new Int32[Op1ElementCount];
+ Int32[] inArray2 = new Int32[Op2ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Int32[] inArray1 = new Int32[Op1ElementCount];
+ Int32[] inArray2 = new Int32[Op2ElementCount];
+ Int32[] outArray = new Int32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Int32[] left, Int32[] right, Int32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != right[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 3 ? (result[i] != left[i - 4]) : (result[i] != right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Permute2x128)}<Int32>(Vector256<Int32>.2, Vector256<Int32>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Int64.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Int64.2.cs
new file mode 100644
index 0000000000..0662227675
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.Int64.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128Int642()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Int642();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128Int642
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ private static Int64[] _data1 = new Int64[Op1ElementCount];
+ private static Int64[] _data2 = new Int64[Op2ElementCount];
+
+ private static Vector256<Int64> _clsVar1;
+ private static Vector256<Int64> _clsVar2;
+
+ private Vector256<Int64> _fld1;
+ private Vector256<Int64> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<Int64, Int64, Int64> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128Int642()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ }
+
+ public SimpleBinaryOpTest__Permute2x128Int642()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Permute2x128(
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Permute2x128(
+ Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int64*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Permute2x128(
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<Int64>), typeof(Vector256<Int64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<Int64>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<Int64>), typeof(Vector256<Int64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((Int64*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<Int64>), typeof(Vector256<Int64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<Int64>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((Int64*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128Int642();
+ var result = Avx2.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<Int64> left, Vector256<Int64> right, void* result, [CallerMemberName] string method = "")
+ {
+ Int64[] inArray1 = new Int64[Op1ElementCount];
+ Int64[] inArray2 = new Int64[Op2ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ Int64[] inArray1 = new Int64[Op1ElementCount];
+ Int64[] inArray2 = new Int64[Op2ElementCount];
+ Int64[] outArray = new Int64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(Int64[] left, Int64[] right, Int64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != right[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 1 ? (result[i] != left[i - 2]) : (result[i] != right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Permute2x128)}<Int64>(Vector256<Int64>.2, Vector256<Int64>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.UInt32.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.UInt32.2.cs
new file mode 100644
index 0000000000..ca46e060b0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.UInt32.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128UInt322()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128UInt322();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128UInt322
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ private static UInt32[] _data1 = new UInt32[Op1ElementCount];
+ private static UInt32[] _data2 = new UInt32[Op2ElementCount];
+
+ private static Vector256<UInt32> _clsVar1;
+ private static Vector256<UInt32> _clsVar2;
+
+ private Vector256<UInt32> _fld1;
+ private Vector256<UInt32> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128UInt322()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ }
+
+ public SimpleBinaryOpTest__Permute2x128UInt322()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Permute2x128(
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Permute2x128(
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Permute2x128(
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<UInt32>), typeof(Vector256<UInt32>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((UInt32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((UInt32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128UInt322();
+ var result = Avx2.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt32> left, Vector256<UInt32> right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray1 = new UInt32[Op1ElementCount];
+ UInt32[] inArray2 = new UInt32[Op2ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt32[] inArray1 = new UInt32[Op1ElementCount];
+ UInt32[] inArray2 = new UInt32[Op2ElementCount];
+ UInt32[] outArray = new UInt32[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(UInt32[] left, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != right[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 3 ? (result[i] != left[i - 4]) : (result[i] != right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Permute2x128)}<UInt32>(Vector256<UInt32>.2, Vector256<UInt32>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.UInt64.2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.UInt64.2.cs
new file mode 100644
index 0000000000..15a271b266
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Permute2x128.UInt64.2.cs
@@ -0,0 +1,337 @@
+// 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.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ private static void Permute2x128UInt642()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128UInt642();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Avx.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local works
+ test.RunLclFldScenario();
+
+ // Validates passing an instance member works
+ test.RunFldScenario();
+ }
+ else
+ {
+ // Validates we throw on unsupported hardware
+ test.RunUnsupportedScenario();
+ }
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class SimpleBinaryOpTest__Permute2x128UInt642
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ private static UInt64[] _data1 = new UInt64[Op1ElementCount];
+ private static UInt64[] _data2 = new UInt64[Op2ElementCount];
+
+ private static Vector256<UInt64> _clsVar1;
+ private static Vector256<UInt64> _clsVar2;
+
+ private Vector256<UInt64> _fld1;
+ private Vector256<UInt64> _fld2;
+
+ private SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64> _dataTable;
+
+ static SimpleBinaryOpTest__Permute2x128UInt642()
+ {
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ }
+
+ public SimpleBinaryOpTest__Permute2x128UInt642()
+ {
+ Succeeded = true;
+
+ var random = new Random();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Avx2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ var result = Avx2.Permute2x128(
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray2Ptr),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ var result = Avx2.Permute2x128(
+ Avx.LoadVector256((UInt64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt64*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ var result = Avx2.Permute2x128(
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray2Ptr)),
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<UInt64>), typeof(Vector256<UInt64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray1Ptr),
+ Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray2Ptr),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<UInt64>), typeof(Vector256<UInt64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadVector256((UInt64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadVector256((UInt64*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ var result = typeof(Avx2).GetMethod(nameof(Avx2.Permute2x128), new Type[] { typeof(Vector256<UInt64>), typeof(Vector256<UInt64>), typeof(byte) })
+ .Invoke(null, new object[] {
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray1Ptr)),
+ Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray2Ptr)),
+ (byte)2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ var result = Avx2.Permute2x128(
+ _clsVar1,
+ _clsVar2,
+ 2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ var left = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray1Ptr);
+ var right = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArray2Ptr);
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ var left = Avx.LoadVector256((UInt64*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadVector256((UInt64*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ var left = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray1Ptr));
+ var right = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArray2Ptr));
+ var result = Avx2.Permute2x128(left, right, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclFldScenario()
+ {
+ var test = new SimpleBinaryOpTest__Permute2x128UInt642();
+ var result = Avx2.Permute2x128(test._fld1, test._fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunFldScenario()
+ {
+ var result = Avx2.Permute2x128(_fld1, _fld2, 2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector256<UInt64> left, Vector256<UInt64> right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray1 = new UInt64[Op1ElementCount];
+ UInt64[] inArray2 = new UInt64[Op2ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray1 = new UInt64[Op1ElementCount];
+ UInt64[] inArray2 = new UInt64[Op2ElementCount];
+ UInt64[] outArray = new UInt64[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+
+ ValidateResult(inArray1, inArray2, outArray, method);
+ }
+
+ private void ValidateResult(UInt64[] left, UInt64[] right, UInt64[] result, [CallerMemberName] string method = "")
+ {
+ if (result[0] != right[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (i > 1 ? (result[i] != left[i - 2]) : (result[i] != right[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ Console.WriteLine($"{nameof(Avx2)}.{nameof(Avx2.Permute2x128)}<UInt64>(Vector256<UInt64>.2, Vector256<UInt64>): {method} failed:");
+ Console.WriteLine($" left: ({string.Join(", ", left)})");
+ Console.WriteLine($" right: ({string.Join(", ", right)})");
+ Console.WriteLine($" result: ({string.Join(", ", result)})");
+ Console.WriteLine();
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs
index 65d93f357d..5b38d5eb08 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs
@@ -104,6 +104,18 @@ namespace JIT.HardwareIntrinsics.X86
["InsertVector128.UInt32.1.Load"] = InsertVector128UInt321Load,
["InsertVector128.Int64.1.Load"] = InsertVector128Int641Load,
["InsertVector128.UInt64.1.Load"] = InsertVector128UInt641Load,
+ ["Max.Int16"] = MaxInt16,
+ ["Max.Byte"] = MaxByte,
+ ["Max.Int32"] = MaxInt32,
+ ["Max.SByte"] = MaxSByte,
+ ["Max.UInt16"] = MaxUInt16,
+ ["Max.UInt32"] = MaxUInt32,
+ ["Min.Int16"] = MinInt16,
+ ["Min.Byte"] = MinByte,
+ ["Min.Int32"] = MinInt32,
+ ["Min.SByte"] = MinSByte,
+ ["Min.UInt16"] = MinUInt16,
+ ["Min.UInt32"] = MinUInt32,
["Or.Byte"] = OrByte,
["Or.Int16"] = OrInt16,
["Or.Int32"] = OrInt32,
@@ -112,6 +124,10 @@ namespace JIT.HardwareIntrinsics.X86
["Or.UInt16"] = OrUInt16,
["Or.UInt32"] = OrUInt32,
["Or.UInt64"] = OrUInt64,
+ ["Permute2x128.Int32.2"] = Permute2x128Int322,
+ ["Permute2x128.UInt32.2"] = Permute2x128UInt322,
+ ["Permute2x128.Int64.2"] = Permute2x128Int642,
+ ["Permute2x128.UInt64.2"] = Permute2x128UInt642,
["ShiftLeftLogical.Int16.1"] = ShiftLeftLogicalInt161,
["ShiftLeftLogical.UInt16.1"] = ShiftLeftLogicalUInt161,
["ShiftLeftLogical.Int32.1"] = ShiftLeftLogicalInt321,
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.ConvertToVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.ConvertToVector256.cs
new file mode 100644
index 0000000000..0848ebb1be
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.ConvertToVector256.cs
@@ -0,0 +1,30 @@
+// 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;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["ConvertToVector256UInt16.Byte"] = ConvertToVector256UInt16Byte,
+ ["ConvertToVector256Int16.SByte"] = ConvertToVector256Int16SByte,
+ ["ConvertToVector256UInt32.Byte"] = ConvertToVector256UInt32Byte,
+ ["ConvertToVector256Int32.Int16"] = ConvertToVector256Int32Int16,
+ ["ConvertToVector256Int32.SByte"] = ConvertToVector256Int32SByte,
+ ["ConvertToVector256UInt32.UInt16"] = ConvertToVector256UInt32UInt16,
+ ["ConvertToVector256UInt64.Byte"] = ConvertToVector256UInt64Byte,
+ ["ConvertToVector256Int64.Int16"] = ConvertToVector256Int64Int16,
+ ["ConvertToVector256Int64.Int32"] = ConvertToVector256Int64Int32,
+ ["ConvertToVector256Int64.SByte"] = ConvertToVector256Int64SByte,
+ ["ConvertToVector256UInt64.UInt16"] = ConvertToVector256UInt64UInt16,
+ ["ConvertToVector256UInt64.UInt32"] = ConvertToVector256UInt64UInt32,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.1.cs
index 007043b604..4cc6a69350 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.16.cs
index d43acc0c09..a38f968bf1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt1616
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.1.cs
index a6e39e42dc..a7cd9f9b2c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.32.cs
index d3628de45b..f4fd0c2844 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt3232
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.1.cs
index 98488c3274..346d1b0e9e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.64.cs
index c5e5350ae3..3c9520d17b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.Int64.64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt6464
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt6464()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.1.cs
index 77cb0e8e41..82ff5e985d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.16.cs
index 1d87bb6bd5..9704991ef2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt1616
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.1.cs
index e89589eea4..e7a4c80edb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.32.cs
index bb0c7e779a..69a727d6e8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt3232
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.1.cs
index 488943b9cb..145d23313d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.64.cs
index 81ccc1d901..f71e4ce517 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical.UInt64.64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt6464
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt6464()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Byte.1.cs
index 578b530618..6a84ddf7be 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Byte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int16.1.cs
index f320ee1091..c79430a237 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int32.1.cs
index 913d5e29b0..c215777974 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int64.1.cs
index 90f853913e..2ff1810c71 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.SByte.1.cs
index a9a9b05a5e..1f7cca825a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.SByte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneSByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneSByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt16.1.cs
index 8aff89a2be..b2a019de44 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt32.1.cs
index c2acdd5e0a..2ab40fd699 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt64.1.cs
index 28ae6e0ae1..7f75ba48d4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftLeftLogical128BitLane.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.1.cs
index bdf3ff20b8..92717b230c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightArithmeticInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightArithmeticInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.16.cs
index 20baccec61..36d5864e1d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightArithmeticInt1616
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightArithmeticInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.1.cs
index 981aff6b64..266b014377 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightArithmeticInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightArithmeticInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.32.cs
index 1cf60a09ef..0869e6316d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightArithmetic.Int32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightArithmeticInt3232
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightArithmeticInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.1.cs
index 52f8d6dd2f..c16999ca66 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.16.cs
index e49aa1070d..d6edfd687d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt1616
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.1.cs
index 3cfcad2671..f5d0f5d1bd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.32.cs
index e961421ec0..82a1c7ac6c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt3232
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.1.cs
index cc59a8d4a0..d0a2651ca0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.64.cs
index 12fde26463..aa0b01e5d5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.Int64.64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt6464
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt6464()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.1.cs
index a7a261bab8..6b2b2a804b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.16.cs
index a7a1e1ca75..0a15497903 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt1616
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.1.cs
index 286a458ea2..dc966abcf1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.32.cs
index 8d83525093..cc21fd1b12 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt3232
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.1.cs
index c0a3ad47d3..edcb324936 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.64.cs
index e9f341d6c2..737f16c0db 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical.UInt64.64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt6464
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt6464()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Byte.1.cs
index 86fe0427bd..93078a8392 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Byte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int16.1.cs
index ac314d3065..ee65a4ae23 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int32.1.cs
index e7bca796d5..422f23570a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int64.1.cs
index 85cdea3c7d..1286612155 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.SByte.1.cs
index a419e1ad1f..d9221f3fb2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.SByte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneSByte1
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneSByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt16.1.cs
index d08ec3fee7..8b1f3fa7c1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt161
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt32.1.cs
index f6a02a0829..074706267e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt321
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt64.1.cs
index 679327cd57..ba0f42a631 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ShiftRightLogical128BitLane.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt641
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Byte.cs
index 17c4065edb..73723503f9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleBinaryOpTest__SubtractByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int16.cs
index 75e824a81f..4729c2e9cf 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleBinaryOpTest__SubtractInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int32.cs
index b1135f71a4..d9274da2fe 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleBinaryOpTest__SubtractInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int64.cs
index ae319c8eaa..2066b4116c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleBinaryOpTest__SubtractInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.SByte.cs
index 32b6fd0dbf..cf5c34531c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleBinaryOpTest__SubtractSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt16.cs
index 9ff706862b..eb9d675a98 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleBinaryOpTest__SubtractUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt32.cs
index adf1dd7cf8..6b0d32edf8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleBinaryOpTest__SubtractUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt64.cs
index 868a810104..34953a389a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Subtract.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleBinaryOpTest__SubtractUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Byte.cs
index 9f978854ad..aa3bc6ba6e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
}
public SimpleBinaryOpTest__XorByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int16.cs
index 051d37d02a..a7866e8ec0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
}
public SimpleBinaryOpTest__XorInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int32.cs
index 232765e01f..809b1f7ed2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
}
public SimpleBinaryOpTest__XorInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int64.cs
index 358ea889a4..0276a29e07 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
}
public SimpleBinaryOpTest__XorInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.SByte.cs
index 6cd6442e3a..49f5784cf1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorSByte
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
}
public SimpleBinaryOpTest__XorSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt16.cs
index 2a1d24dbca..c175a5dd65 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorUInt16
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
}
public SimpleBinaryOpTest__XorUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt32.cs
index 1e1b9185fa..924d6705e7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorUInt32
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
}
public SimpleBinaryOpTest__XorUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt64.cs
index 9415610619..d178951b04 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Xor.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorUInt64
{
- private const int VectorSize = 32;
+ private static readonly int LargestVectorSize = 32;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
}
public SimpleBinaryOpTest__XorUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Avx2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/IsSupported.cs b/tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported.cs
index abdc108536..6bc3cba771 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/IsSupported.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported.cs
@@ -36,15 +36,10 @@ namespace IntelHardwareIntrinsicTest
Convert.ToBoolean(typeof(Ssse3).GetMethod(issupported).Invoke(null, null)) != Ssse3.IsSupported ||
Convert.ToBoolean(typeof(Sse41).GetMethod(issupported).Invoke(null, null)) != Sse41.IsSupported ||
Convert.ToBoolean(typeof(Sse42).GetMethod(issupported).Invoke(null, null)) != Sse42.IsSupported ||
- Convert.ToBoolean(typeof(Aes).GetMethod(issupported).Invoke(null, null)) != Aes.IsSupported ||
Convert.ToBoolean(typeof(Avx).GetMethod(issupported).Invoke(null, null)) != Avx.IsSupported ||
Convert.ToBoolean(typeof(Avx2).GetMethod(issupported).Invoke(null, null)) != Avx2.IsSupported ||
- Convert.ToBoolean(typeof(Fma).GetMethod(issupported).Invoke(null, null)) != Fma.IsSupported ||
Convert.ToBoolean(typeof(Lzcnt).GetMethod(issupported).Invoke(null, null)) != Lzcnt.IsSupported ||
- Convert.ToBoolean(typeof(Bmi1).GetMethod(issupported).Invoke(null, null)) != Bmi1.IsSupported ||
- Convert.ToBoolean(typeof(Bmi2).GetMethod(issupported).Invoke(null, null)) != Bmi2.IsSupported ||
- Convert.ToBoolean(typeof(Popcnt).GetMethod(issupported).Invoke(null, null)) != Popcnt.IsSupported ||
- Convert.ToBoolean(typeof(Pclmulqdq).GetMethod(issupported).Invoke(null, null)) != Pclmulqdq.IsSupported
+ Convert.ToBoolean(typeof(Popcnt).GetMethod(issupported).Invoke(null, null)) != Popcnt.IsSupported
)
{
result = false;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/IsSupported_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported_r.csproj
index e77c5dc2ad..e77c5dc2ad 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/IsSupported_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported_r.csproj
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/IsSupported_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported_ro.csproj
index e8f88b5a40..e8f88b5a40 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/IsSupported_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/IsSupported_ro.csproj
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs
new file mode 100644
index 0000000000..479b529e07
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs
@@ -0,0 +1,644 @@
+// 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;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.CompilerServices;
+
+internal partial class IntelHardwareIntrinsicTest
+{
+ private const int Pass = 100;
+ private const int Fail = -1;
+
+ private static Vector128<float>[] s_v128_array;
+ private static Vector128<float> s_v128_0;
+ private static Vector128<float> s_v128_1;
+ private static Vector128<float> s_v128_2;
+ private static Vector128<float> s_v128_3;
+
+ private static Vector128<short>[] s_v128i_array;
+ private static Vector128<short> s_v128i_0;
+ private static Vector128<short> s_v128i_1;
+ private static Vector128<short> s_v128i_2;
+ private static Vector128<short> s_v128i_3;
+
+ private static Vector256<float>[] s_v256_array;
+ private static Vector256<float> s_v256_0;
+ private static Vector256<float> s_v256_1;
+ private static Vector256<float> s_v256_2;
+ private static Vector256<float> s_v256_3;
+
+ private static Vector256<byte>[] s_v256i_array;
+ private static Vector256<byte> s_v256i_0;
+ private static Vector256<byte> s_v256i_1;
+ private static Vector256<byte> s_v256i_2;
+ private static Vector256<byte> s_v256i_3;
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static void init()
+ {
+ Random random = new Random(100);
+
+ if (Sse.IsSupported)
+ {
+ s_v128_array = new Vector128<float>[10];
+ for (int i = 0; i < 10; i++)
+ {
+ s_v128_array[i] = Sse.SetAllVector128(random.Next(100));
+ }
+ s_v128_0 = Sse.SetAllVector128((float)random.Next(100));
+ s_v128_1 = Sse.SetAllVector128((float)random.Next(100));
+ s_v128_2 = Sse.SetAllVector128((float)random.Next(100));
+ s_v128_3 = Sse.SetAllVector128((float)random.Next(100));
+ }
+
+ if (Sse2.IsSupported)
+ {
+ s_v128i_array = new Vector128<short>[10];
+ for (int i = 0; i < 10; i++)
+ {
+ s_v128i_array[i] = Sse2.SetAllVector128((short)random.Next(100));
+ }
+ s_v128i_0 = Sse2.SetAllVector128((short)random.Next(100));
+ s_v128i_1 = Sse2.SetAllVector128((short)random.Next(100));
+ s_v128i_2 = Sse2.SetAllVector128((short)random.Next(100));
+ s_v128i_3 = Sse2.SetAllVector128((short)random.Next(100));
+ }
+
+ if (Avx.IsSupported)
+ {
+ s_v256_array = new Vector256<float>[10];
+ for (int i = 0; i < 10; i++)
+ {
+ s_v256_array[i] = Avx.SetAllVector256((float)random.Next(100));
+ }
+ s_v256_0 = Avx.SetAllVector256((float)random.Next(100));
+ s_v256_1 = Avx.SetAllVector256((float)random.Next(100));
+ s_v256_2 = Avx.SetAllVector256((float)random.Next(100));
+ s_v256_3 = Avx.SetAllVector256((float)random.Next(100));
+ }
+
+ if (Avx2.IsSupported)
+ {
+ s_v256i_array = new Vector256<byte>[10];
+ for (int i = 0; i < 10; i++)
+ {
+ s_v256i_array[i] = Avx.SetAllVector256((byte)random.Next(100));
+ }
+ s_v256i_0 = Avx.SetAllVector256((byte)random.Next(100));
+ s_v256i_1 = Avx.SetAllVector256((byte)random.Next(100));
+ s_v256i_2 = Avx.SetAllVector256((byte)random.Next(100));
+ s_v256i_3 = Avx.SetAllVector256((byte)random.Next(100));
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector128<float> F1_v128(float t)
+ {
+ float ti = 1 - t;
+ float t0 = ti * ti * ti;
+ float t1 = 3 * ti * ti * t;
+ float t2 = 3 * ti * t * t;
+ float t3 = t * t * t;
+ Vector128<float> tmp1 = Sse.Add(Sse.Subtract(Sse.SetAllVector128(t0), s_v128_0), Sse.Subtract(Sse.SetAllVector128(t1), s_v128_1));
+ Vector128<float> tmp2 = Sse.Add(Sse.Subtract(Sse.SetAllVector128(t2), s_v128_2), Sse.Subtract(Sse.SetAllVector128(t3), s_v128_3));
+ return Sse.Add(tmp1, tmp2);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector128<float> F2_v128(float u)
+ {
+ if (u < 0)
+ return s_v128_array[0];
+ if (u >= 1)
+ return s_v128_array[1];
+ if (u < 0.1)
+ return s_v128_array[2];
+ if (u > 0.9)
+ return s_v128_array[3];
+ return F1_v128(u);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector128<short> F1_v128i(int t)
+ {
+ int ti = 1 - t;
+ int t0 = ti * ti * ti;
+ int t1 = 3 * ti * ti * t;
+ int t2 = 3 * ti * t * t;
+ int t3 = t * t * t;
+ Vector128<short> tmp1 = Sse2.Add(Sse2.Subtract(Sse2.SetAllVector128((short)t0), s_v128i_0), Sse2.Subtract(Sse2.SetAllVector128((short)t1), s_v128i_1));
+ Vector128<short> tmp2 = Sse2.Add(Sse2.Subtract(Sse2.SetAllVector128((short)t2), s_v128i_2), Sse2.Subtract(Sse2.SetAllVector128((short)t3), s_v128i_3));
+ return Sse2.Add(tmp1, tmp2);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector128<short> F2_v128i(short u)
+ {
+ if (u < 0)
+ return s_v128i_array[0];
+ if (u >= 10)
+ return s_v128i_array[1];
+ if (u < 0.1)
+ return s_v128i_array[2];
+ if (u > 90)
+ return s_v128i_array[3];
+ return F1_v128i(u);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector256<float> F1_v256(float t)
+ {
+ float ti = 1 - t;
+ float t0 = ti * ti * ti;
+ float t1 = 3 * ti * ti * t;
+ float t2 = 3 * ti * t * t;
+ float t3 = t * t * t;
+ Vector256<float> tmp1 = Avx.Add(Avx.Subtract(Avx.SetAllVector256(t0), s_v256_0), Avx.Subtract(Avx.SetAllVector256(t1), s_v256_1));
+ Vector256<float> tmp2 = Avx.Add(Avx.Subtract(Avx.SetAllVector256(t2), s_v256_2), Avx.Subtract(Avx.SetAllVector256(t3), s_v256_3));
+ return Avx.Add(tmp1, tmp2);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector256<float> F2_v256(float u)
+ {
+ if (u < 0)
+ return s_v256_array[0];
+ if (u >= 1)
+ return s_v256_array[1];
+ if (u < 0.1)
+ return s_v256_array[2];
+ if (u > 0.9)
+ return s_v256_array[3];
+ return F1_v256(u);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector256<byte> F1_v256i(int t)
+ {
+ int ti = 1 - t;
+ int t0 = ti * ti * ti;
+ int t1 = 3 * ti * ti * t;
+ int t2 = 3 * ti * t * t;
+ int t3 = t * t * t;
+ Vector256<byte> tmp1 = Avx2.Add(Avx2.Subtract(Avx.SetAllVector256((byte)t0), s_v256i_0), Avx2.Subtract(Avx.SetAllVector256((byte)t1), s_v256i_1));
+ Vector256<byte> tmp2 = Avx2.Add(Avx2.Subtract(Avx.SetAllVector256((byte)t2), s_v256i_2), Avx2.Subtract(Avx.SetAllVector256((byte)t3), s_v256i_3));
+ return Avx2.Add(tmp1, tmp2);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector256<byte> F2_v256i(byte u)
+ {
+ if (u < 0)
+ return s_v256i_array[0];
+ if (u >= 10)
+ return s_v256i_array[1];
+ if (u < 0.1)
+ return s_v256i_array[2];
+ if (u > 90)
+ return s_v256i_array[3];
+ return F1_v256i(u);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector128<T> Vector128One<T>() where T : struct
+ {
+ if (typeof(T) == typeof(float))
+ {
+ return Sse.StaticCast<float, T>(Sse.SetAllVector128(1.0f));
+ }
+ else if (typeof(T) == typeof(double))
+ {
+ return Sse.StaticCast<double, T>(Sse2.SetAllVector128((double)1));
+ }
+ else if (typeof(T) == typeof(byte))
+ {
+ return Sse.StaticCast<byte, T>(Sse2.SetAllVector128((byte)1));
+ }
+ else if (typeof(T) == typeof(sbyte))
+ {
+ return Sse.StaticCast<sbyte, T>(Sse2.SetAllVector128((sbyte)1));
+ }
+ else if (typeof(T) == typeof(short))
+ {
+ return Sse.StaticCast<short, T>(Sse2.SetAllVector128((short)1));
+ }
+ else if (typeof(T) == typeof(ushort))
+ {
+ return Sse.StaticCast<ushort, T>(Sse2.SetAllVector128((ushort)1));
+ }
+ else if (typeof(T) == typeof(int))
+ {
+ return Sse.StaticCast<int, T>(Sse2.SetAllVector128((int)1));
+ }
+ else if (typeof(T) == typeof(uint))
+ {
+ return Sse.StaticCast<uint, T>(Sse2.SetAllVector128((uint)1));
+ }
+ else if (typeof(T) == typeof(long))
+ {
+ return Sse.StaticCast<long, T>(Sse2.SetAllVector128((long)1));
+ }
+ else if (typeof(T) == typeof(ulong))
+ {
+ return Sse.StaticCast<ulong, T>(Sse2.SetAllVector128((ulong)1));
+ }
+ else
+ {
+ throw new NotSupportedException();
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector256<T> Vector256One<T>() where T : struct
+ {
+ return Avx.SetAllVector256((T)Convert.ChangeType(1, typeof(T)));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector128<T> Vector128PlusOne<T>(Vector128<T> v1) where T : struct
+ {
+ Vector128<T> v2 = Vector128One<T>();
+ if (typeof(T) == typeof(float))
+ {
+ return Sse.StaticCast<float, T>(Sse.Add(Sse.StaticCast<T, float>(v1), Sse.StaticCast<T, float>(v2)));
+ }
+ else if (typeof(T) == typeof(double))
+ {
+ return Sse.StaticCast<double, T>(Sse2.Add(Sse.StaticCast<T, double>(v1), Sse.StaticCast<T, double>(v2)));
+ }
+ else if (typeof(T) == typeof(byte))
+ {
+ return Sse.StaticCast<byte, T>(Sse2.Add(Sse.StaticCast<T, byte>(v1), Sse.StaticCast<T, byte>(v2)));
+ }
+ else if (typeof(T) == typeof(sbyte))
+ {
+ return Sse.StaticCast<sbyte, T>(Sse2.Add(Sse.StaticCast<T, sbyte>(v1), Sse.StaticCast<T, sbyte>(v2)));
+ }
+ else if (typeof(T) == typeof(short))
+ {
+ return Sse.StaticCast<short, T>(Sse2.Add(Sse.StaticCast<T, short>(v1), Sse.StaticCast<T, short>(v2)));
+ }
+ else if (typeof(T) == typeof(ushort))
+ {
+ return Sse.StaticCast<ushort, T>(Sse2.Add(Sse.StaticCast<T, ushort>(v1), Sse.StaticCast<T, ushort>(v2)));
+ }
+ else if (typeof(T) == typeof(int))
+ {
+ return Sse.StaticCast<int, T>(Sse2.Add(Sse.StaticCast<T, int>(v1), Sse.StaticCast<T, int>(v2)));
+ }
+ else if (typeof(T) == typeof(uint))
+ {
+ return Sse.StaticCast<uint, T>(Sse2.Add(Sse.StaticCast<T, uint>(v1), Sse.StaticCast<T, uint>(v2)));
+ }
+ else if (typeof(T) == typeof(long))
+ {
+ return Sse.StaticCast<long, T>(Sse2.Add(Sse.StaticCast<T, long>(v1), Sse.StaticCast<T, long>(v2)));
+ }
+ else if (typeof(T) == typeof(ulong))
+ {
+ return Sse.StaticCast<ulong, T>(Sse2.Add(Sse.StaticCast<T, ulong>(v1), Sse.StaticCast<T, ulong>(v2)));
+ }
+ else
+ {
+ throw new NotSupportedException();
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector256<T> Vector256PlusOne<T>(Vector256<T> v1) where T : struct
+ {
+ Vector256<T> v2 = Vector256One<T>();
+ if (typeof(T) == typeof(float))
+ {
+ return Avx.StaticCast<float, T>(Avx.Add(Avx.StaticCast<T, float>(v1), Avx.StaticCast<T, float>(v2)));
+ }
+ else if (typeof(T) == typeof(double))
+ {
+ return Avx.StaticCast<double, T>(Avx.Add(Avx.StaticCast<T, double>(v1), Avx.StaticCast<T, double>(v2)));
+ }
+ else if (typeof(T) == typeof(byte))
+ {
+ return Avx.StaticCast<byte, T>(Avx2.Add(Avx.StaticCast<T, byte>(v1), Avx.StaticCast<T, byte>(v2)));
+ }
+ else if (typeof(T) == typeof(sbyte))
+ {
+ return Avx.StaticCast<sbyte, T>(Avx2.Add(Avx.StaticCast<T, sbyte>(v1), Avx.StaticCast<T, sbyte>(v2)));
+ }
+ else if (typeof(T) == typeof(short))
+ {
+ return Avx.StaticCast<short, T>(Avx2.Add(Avx.StaticCast<T, short>(v1), Avx.StaticCast<T, short>(v2)));
+ }
+ else if (typeof(T) == typeof(ushort))
+ {
+ return Avx.StaticCast<ushort, T>(Avx2.Add(Avx.StaticCast<T, ushort>(v1), Avx.StaticCast<T, ushort>(v2)));
+ }
+ else if (typeof(T) == typeof(int))
+ {
+ return Avx.StaticCast<int, T>(Avx2.Add(Avx.StaticCast<T, int>(v1), Avx.StaticCast<T, int>(v2)));
+ }
+ else if (typeof(T) == typeof(uint))
+ {
+ return Avx.StaticCast<uint, T>(Avx2.Add(Avx.StaticCast<T, uint>(v1), Avx.StaticCast<T, uint>(v2)));
+ }
+ else if (typeof(T) == typeof(long))
+ {
+ return Avx.StaticCast<long, T>(Avx2.Add(Avx.StaticCast<T, long>(v1), Avx.StaticCast<T, long>(v2)));
+ }
+ else if (typeof(T) == typeof(ulong))
+ {
+ return Avx.StaticCast<ulong, T>(Avx2.Add(Avx.StaticCast<T, ulong>(v1), Avx.StaticCast<T, ulong>(v2)));
+ }
+ else
+ {
+ throw new NotSupportedException();
+ }
+ }
+
+ public static unsafe int Vector128ReturnTest()
+ {
+ Vector128<float> v1 = Sse.SetAllVector128(2.0f);
+ Vector128<float> vres1 = Vector128PlusOne<float>(v1);
+
+ float* result1 = stackalloc float[4];
+ Sse.Store(result1, vres1);
+
+ for (int i = 0; i < 4; ++i)
+ {
+ if (result1[i] != 3.0f)
+ {
+ Console.WriteLine("Expected result is " + 3.0f);
+ Console.WriteLine("Instead got " + result1[i]);
+ Console.WriteLine("FAILED");
+ return Fail;
+ }
+ }
+
+
+ Vector128<int> v2 = Sse2.SetAllVector128((int)5);
+ Vector128<int> vres2 = Vector128PlusOne<int>(v2);
+
+ int* result2 = stackalloc int[4];
+ Sse2.Store(result2, vres2);
+
+ for (int i = 0; i < 4; ++i)
+ {
+ if (result2[i] != 6)
+ {
+ Console.WriteLine("Expected result is " + 6);
+ Console.WriteLine("Instead got " + result2[i]);
+ Console.WriteLine("FAILED");
+ return Fail;
+ }
+ }
+
+ return Pass;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector128<short> GetVector128Int16One()
+ {
+ return Sse2.SetAllVector128((short)1);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector128<short> GetVector128Int16PlusOne(Vector128<short> v1)
+ {
+ Vector128<short> v2 = GetVector128Int16One();
+ return Sse2.Add(v1, v2);
+ }
+
+ public static unsafe int Vector128Int16ReturnTest()
+ {
+ Vector128<short> v1 = Sse2.SetVector128(10, 9, 8, 7, 6, 5, 4, 3);
+ Vector128<short> vres = GetVector128Int16PlusOne(v1);
+
+ short* result = stackalloc short[8];
+ Sse2.Store(result, vres);
+
+ if ((result[0] != 4) || (result[1] != 5) || (result[2] != 6) || (result[3] != 7) ||
+ (result[4] != 8) || (result[5] != 9) || (result[6] != 10) || (result[7] != 11))
+ {
+ Console.WriteLine("Vector128Int16ReturnTest did not return expected value");
+ Console.Write("[ ");
+ for (int i = 0; i < 8; i++)
+ {
+ Console.Write(result[i] + ", ");
+ }
+ Console.Write("]");
+ return Fail;
+ }
+
+ return Pass;
+ }
+
+ public static unsafe int Vector256ReturnTest()
+ {
+ Vector256<float> v1 = Avx.SetAllVector256(2.0f);
+ Vector256<float> vres1 = Vector256PlusOne<float>(v1);
+
+ float* result1 = stackalloc float[8];
+ Avx.Store(result1, vres1);
+
+ for (int i = 0; i < 8; ++i)
+ {
+ if (result1[i] != 3.0f)
+ {
+ Console.WriteLine("Expected result is " + 3.0f);
+ Console.WriteLine("Instead got " + result1[i]);
+ Console.WriteLine("FAILED");
+ return Fail;
+ }
+ }
+
+
+ Vector256<int> v2 = Avx.SetAllVector256((int)5);
+ Vector256<int> vres2 = Vector256PlusOne<int>(v2);
+
+ int* result2 = stackalloc int[8];
+ Avx.Store(result2, vres2);
+
+ for (int i = 0; i < 8; ++i)
+ {
+ if (result2[i] != 6)
+ {
+ Console.WriteLine("Expected result is " + 6);
+ Console.WriteLine("Instead got " + result2[i]);
+ Console.WriteLine("FAILED");
+ return Fail;
+ }
+ }
+
+ return Pass;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector256<int> GetVector256Int32One()
+ {
+ return Avx.SetAllVector256(1);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static Vector256<int> GetVector256Int32PlusOne(Vector256<int> v1)
+ {
+ Vector256<int> v2 = GetVector256Int32One();
+ return Avx2.Add(v1, v2);
+ }
+
+ public static unsafe int Vector256Int32ReturnTest()
+ {
+ Vector256<int> v1 = Avx.SetVector256(10, 9, 8, 7, 6, 5, 4, 3);
+ Vector256<int> vres = GetVector256Int32PlusOne(v1);
+
+ int* result = stackalloc int[8];
+ Avx.Store(result, vres);
+
+ if ((result[0] != 4) || (result[1] != 5) || (result[2] != 6) || (result[3] != 7) ||
+ (result[4] != 8) || (result[5] != 9) || (result[6] != 10) || (result[7] != 11))
+ {
+ Console.WriteLine("Vector256Int32ReturnTest did not return expected value");
+ Console.Write("[ ");
+ for (int i = 0; i < 8; i++)
+ {
+ Console.Write(result[i] + ", ");
+ }
+ Console.Write("]");
+ return Fail;
+ }
+
+ return Pass;
+ }
+
+ public static unsafe int Main()
+ {
+ init();
+
+ if (Sse2.IsSupported)
+ {
+ Vector128<float> result_v128 = F2_v128(0.5F);
+ Vector128<float> expectedResult_v128 = F1_v128(0.5F);
+
+ float* result = stackalloc float[4];
+ Sse.Store(result, result_v128);
+ float* expResult = stackalloc float[4];
+ Sse.Store(expResult, expectedResult_v128);
+
+ for (int i = 0; i < 4; i++)
+ {
+ if (result[i] != expResult[i])
+ {
+ Console.WriteLine("Vector128<float> test FAILED");
+ Console.Write("[ ");
+ for (int j = 0; j < 4; j++)
+ {
+ Console.Write(result[j] + ", ");
+ }
+ Console.WriteLine("]");
+ return Fail;
+ }
+ }
+
+ if (Vector128ReturnTest() != Pass)
+ {
+ Console.WriteLine("Vector128ReturnTest FAILED");
+ return Fail;
+ }
+
+ Vector128<short> result_v128i = F2_v128i(6);
+ Vector128<short> expectedResult_v128i = F1_v128i(6);
+
+ short* results = stackalloc short[8];
+ Sse2.Store(results, result_v128i);
+ short* expResults = stackalloc short[8];
+ Sse2.Store(expResults, expectedResult_v128i);
+
+ for (int i = 0; i < 8; i++)
+ {
+ if (results[i] != expResults[i])
+ {
+ Console.WriteLine("Vector128<short> test FAILED");
+ Console.Write("[ ");
+ for (int j = 0; j < 8; j++)
+ {
+ Console.Write(results[j] + ", ");
+ }
+ Console.WriteLine("]");
+ return Fail;
+ }
+ }
+
+ if (Vector128Int16ReturnTest() != Pass)
+ {
+ Console.WriteLine("Vector128Int16ReturnTest FAILED");
+ return Fail;
+ }
+ }
+
+ if (Avx2.IsSupported)
+ {
+ Vector256<float> result_v256 = F2_v256(0.7F);
+ Vector256<float> expectedResult_v256 = F1_v256(0.7F);
+
+ float* result = stackalloc float[8];
+ Avx.Store(result, result_v256);
+ float* expResult = stackalloc float[8];
+ Avx.Store(expResult, expectedResult_v256);
+
+ for (int i = 0; i < 8; i++)
+ {
+ if (result[i] != expResult[i])
+ {
+ Console.WriteLine("Vector256<float> test FAILED");
+ Console.Write("[ ");
+ for (int j = 0; j < 8; j++)
+ {
+ Console.Write(result[j] + ", ");
+ }
+ Console.WriteLine("]");
+ return Fail;
+ }
+ }
+
+ if (Vector256ReturnTest() != Pass)
+ {
+ Console.WriteLine("Vector256ReturnTest FAILED");
+ return Fail;
+ }
+
+ Vector256<byte> result_v256i = F2_v256i(7);
+ Vector256<byte> expectedResult_v256i = F1_v256i(7);
+
+ byte* resultb = stackalloc byte[32];
+ Avx.Store(resultb, result_v256i);
+ byte* expResultb = stackalloc byte[32];
+ Avx.Store(expResultb, expectedResult_v256i);
+
+ for (int i = 0; i < 32; i++)
+ {
+ if (resultb[i] != expResultb[i])
+ {
+ Console.WriteLine("Vector256<byte> test FAILED");
+ Console.Write("[ ");
+ for (int j = 0; j < 32; j++)
+ {
+ Console.Write(resultb[j] + ", ");
+ }
+ Console.WriteLine("]");
+ return Fail;
+ }
+ }
+
+ if (Vector256Int32ReturnTest() != Pass)
+ {
+ Console.WriteLine("Vector128Int16ReturnTest FAILED");
+ return Fail;
+ }
+ }
+
+ Console.WriteLine("PASSED");
+ return Pass;
+ }
+} \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet_r.csproj
new file mode 100644
index 0000000000..99a878cbd2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet_r.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="VectorRet.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet_ro.csproj
new file mode 100644
index 0000000000..26ed29ac51
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet_ro.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="VectorRet.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest.template
index dee7f6c590..5f152248ce 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest.template
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class AlternatingBinaryOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = VectorSize / sizeof({Op2BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public AlternatingBinaryOpTest__{Method}{RetBaseType}()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new AlternatingBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new AlternatingBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest_DataTable.cs
index a2f9977ea6..207dcff702 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/AlternatingBinOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -59,7 +60,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest.template
index bb60168666..94adda7d95 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest.template
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = VectorSize / sizeof({Op2BaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public BooleanBinaryOpTest__{Method}{RetBaseType}()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new BooleanBinaryOpTest__DataTable<{Op1BaseType}, {Op2BaseType}>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<{Op1BaseType}, {Op2BaseType}>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount];
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount];
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest_DataTable.cs
index 36b94502b2..f3822fa09a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanBinOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -52,7 +53,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest.template
index b16b17a45f..f5674e8d2a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest.template
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = VectorSize / sizeof({Op2BaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public BooleanComparisonOpTest__{Method}{RetBaseType}()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new BooleanComparisonOpTest__DataTable<{Op1BaseType}, {Op2BaseType}>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<{Op1BaseType}, {Op2BaseType}>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount];
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount];
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest_DataTable.cs
index 320c20f1dc..051baa0f5d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -52,7 +53,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest.template
index 53c9cacd13..eb49edb9f9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest.template
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = VectorSize / sizeof({Op2BaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public BooleanTwoComparisonOpTest__{Method}{RetBaseType}()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<{Op1BaseType}, {Op2BaseType}>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<{Op1BaseType}, {Op2BaseType}>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount];
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount];
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest_DataTable.cs
index 6733d6bf3f..618b284632 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanTwoCmpOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -52,7 +53,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest.template
index 422c4603ac..551e51398c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest.template
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
public BooleanComparisonOpTest__{Method}{RetBaseType}()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- _dataTable = new BooleanUnaryOpTest__DataTable<{Op1BaseType}>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<{Op1BaseType}>(_data, LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest_DataTable.cs
index b38a7b4d3f..cd478f3dca 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanUnOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -44,7 +45,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractScalarTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractScalarTest.template
index 0fb09bb987..0ac2b50e1e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractScalarTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractScalarTest.template
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractStoreTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractStoreTest.template
index e686366914..3a1af15f42 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractStoreTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractStoreTest.template
@@ -86,10 +86,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}Store
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int RetElementCount = 16 / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
@@ -104,7 +104,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}Store()
@@ -114,10 +114,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -250,8 +250,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
@@ -261,8 +261,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractVector128Test.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractVector128Test.template
index 7765e86fe6..49fb80e55f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractVector128Test.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ExtractVector128Test.template
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int RetElementCount = 16 / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx b/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
index 07f6be07da..101300b81b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
@@ -21,694 +21,728 @@ using System.IO;
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] SseInputs = new []
{
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] + right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "AddScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(~BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(~BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] == right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareEqualOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] == right[0]) != result"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareEqualUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] == right[0]) != result"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] > right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] > right[0]) != result"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] > right[0]) != result"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] >= right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrEqualOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] >= right[0]) != result"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrEqualUnorderedScalar",["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] >= right[0]) != result"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] < right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] < right[0]) != result"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] < right[0]) != result"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] <= right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrEqualOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] <= right[0]) != result"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrEqualUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] <= right[0]) != result"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] != right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotEqualOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] != right[0]) != result"}),
- ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotEqualUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] != right[0]) != result"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] > right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotGreaterThanScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotGreaterThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] >= right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotGreaterThanOrEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] < right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotLessThanScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotLessThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] <= right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotLessThanOrEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareOrdered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((!float.IsNaN(left[i]) && !float.IsNaN(right[i])) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareUnordered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((float.IsNaN(left[i]) || float.IsNaN(right[i])) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Divide", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] / right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "DivideScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(Math.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(Math.Max(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "MaxScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(Math.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(Math.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(Math.Min(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "MinScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(Math.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Multiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] * right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "MultiplyScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] - right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "SubtractScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] + right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "AddScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(~BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(~BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] == right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareEqualOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] == right[0]) != result"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareEqualUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] == right[0]) != result"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] > right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] > right[0]) != result"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] > right[0]) != result"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] >= right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrEqualOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] >= right[0]) != result"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareGreaterThanOrEqualUnorderedScalar",["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] >= right[0]) != result"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] < right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] < right[0]) != result"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] < right[0]) != result"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] <= right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrEqualOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] <= right[0]) != result"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareLessThanOrEqualUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] <= right[0]) != result"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] != right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotEqualOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] != right[0]) != result"}),
+ ("BooleanCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotEqualUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Boolean", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(left[0] != right[0]) != result"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] > right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotGreaterThanScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotGreaterThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] >= right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotGreaterThanOrEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] < right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotLessThanScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotLessThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] <= right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareNotLessThanOrEqualScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareOrdered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((!float.IsNaN(left[i]) && !float.IsNaN(right[i])) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareUnordered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((float.IsNaN(left[i]) || float.IsNaN(right[i])) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Divide", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] / right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "DivideScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(Math.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(Math.Max(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "MaxScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(Math.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(Math.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(Math.Min(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "MinScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(Math.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Multiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] * right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "MultiplyScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] - right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "SubtractScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
};
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse2Inputs = new []
{
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] + right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] + right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.AddSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.AddSaturate(left[i], right[i], result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.AddSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.AddSaturate(left[i], right[i], result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.AddSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.AddSaturate(left[i], right[i], result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))",["NextValueOp2"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.AddSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.AddSaturate(left[i], right[i], result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] + right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(~BitConverter.DoubleToInt64Bits(left[0]) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(~BitConverter.DoubleToInt64Bits(left[i]) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Average", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)((left[0] + right[0] + 1) >> 1) != result[0]", ["ValidateRemainingResults"] = "(byte)((left[i] + right[i] + 1) >> 1) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Average", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))",["NextValueOp2"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)((left[0] + right[0] + 1) >> 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)((left[i] + right[i] + 1) >> 1) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] == right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((byte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((byte)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((short)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((int)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((ushort)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((ushort)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((uint)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((uint)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] > right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((short)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((int)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] >= right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] < right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] < right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] < right[i]) ? unchecked((short)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] < right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] < right[i]) ? unchecked((int)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] < right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] < right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] <= right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] != right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != (!(left[i] > right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotGreaterThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != (!(left[i] >= right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != (!(left[i] < right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotLessThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != (!(left[i] <= right[i]) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareOrdered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((!double.IsNaN(left[0]) && !double.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((!double.IsNaN(left[i]) && !double.IsNaN(right[i])) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareUnordered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((double.IsNaN(left[0]) || double.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((double.IsNaN(left[i]) || double.IsNaN(right[i])) ? -1 : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Divide", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] / right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] / right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "DivideScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] / right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "Math.Max(left[0], right[0]) != result[0]", ["ValidateRemainingResults"] = "Math.Max(left[i], right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "Math.Max(left[0], right[0]) != result[0]", ["ValidateRemainingResults"] = "Math.Max(left[i], right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "MaxScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MinValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MinValue))", ["ValidateFirstResult"] = "Math.Min(left[0], right[0]) != result[0]", ["ValidateRemainingResults"] = "Math.Min(left[i], right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MinValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MinValue))", ["ValidateFirstResult"] = "Math.Min(left[0], right[0]) != result[0]", ["ValidateRemainingResults"] = "Math.Min(left[i], right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "MinScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Multiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] * right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] * right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "MultiplyScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] * right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) | BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) | BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] | right[i]) != result[i]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(byte.MinValue, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(ushort.MinValue, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "random.NextDouble()", ["ValidateFirstResult"] = "result[0] != firstOp[0]", ["ValidateRemainingResults"] = "result[i] != firstOp[0]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(uint)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(long)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(long)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ulong)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0!= result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)8", ["ValidateFirstResult"] = "result[0] != 0", ["ValidateRemainingResults"] = "result[i] != 8"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)8", ["ValidateFirstResult"] = "result[0] != 0", ["ValidateRemainingResults"] = "result[i] != 8"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 15) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 15) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 31) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 31) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(uint)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(long)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(long)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(ulong)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0!= result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)8", ["ValidateFirstResult"] = "result[0] != 8", ["ValidateRemainingResults"] = "(i == 15 ? result[i] != 0 : result[i] != 8)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)8", ["ValidateFirstResult"] = "result[0] != 8", ["ValidateRemainingResults"] = "(i == 15 ? result[i] != 0 : result[i] != 8)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "(i == 7 ? result[i] != 0 : result[i] != 2048)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "(i == 7 ? result[i] != 0 : result[i] != 2048)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)8", ["ValidateFirstResult"] = "result[0] != 134217728", ["ValidateRemainingResults"] = "(i == 3 ? result[i] != 0 : result[i] != 134217728)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)8", ["ValidateFirstResult"] = "result[0] != 134217728", ["ValidateRemainingResults"] = "(i == 3 ? result[i] != 0 : result[i] != 134217728)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)8", ["ValidateFirstResult"] = "result[0] != 576460752303423488L", ["ValidateRemainingResults"] = "(result[i] != 0)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)8", ["ValidateFirstResult"] = "result[0] != 576460752303423488UL", ["ValidateRemainingResults"] = "(result[i] != 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] - right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] - right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.SubtractSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.SubtractSaturate(left[i], right[i], result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.SubtractSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.SubtractSaturate(left[i], right[i], result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.SubtractSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.SubtractSaturate(left[i], right[i], result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))",["NextValueOp2"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.SubtractSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.SubtractSaturate(left[i], right[i], result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] - right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) ^ BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) ^ BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] + right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] + right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.AddSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.AddSaturate(left[i], right[i], result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.AddSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.AddSaturate(left[i], right[i], result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.AddSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.AddSaturate(left[i], right[i], result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))",["NextValueOp2"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.AddSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.AddSaturate(left[i], right[i], result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AddScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] + right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "And", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(~BitConverter.DoubleToInt64Bits(left[0]) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(~BitConverter.DoubleToInt64Bits(left[i]) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "AndNot", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Average", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)((left[0] + right[0] + 1) >> 1) != result[0]", ["ValidateRemainingResults"] = "(byte)((left[i] + right[i] + 1) >> 1) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Average", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))",["NextValueOp2"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)((left[0] + right[0] + 1) >> 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)((left[i] + right[i] + 1) >> 1) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] == right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((byte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((byte)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((short)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((int)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((ushort)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((ushort)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((uint)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((uint)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] > right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((short)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((int)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] >= right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] < right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] < right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] < right[i]) ? unchecked((short)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] < right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] < right[i]) ? unchecked((int)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] < right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] < right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareLessThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] <= right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((left[i] != right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != (!(left[i] > right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotGreaterThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != (!(left[i] >= right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotLessThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != (!(left[i] < right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareNotLessThanOrEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != (!(left[i] <= right[i]) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareOrdered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((!double.IsNaN(left[0]) && !double.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((!double.IsNaN(left[i]) && !double.IsNaN(right[i])) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareUnordered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((double.IsNaN(left[0]) || double.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((double.IsNaN(left[i]) || double.IsNaN(right[i])) ? -1 : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Divide", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] / right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] / right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "DivideScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] / right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "Math.Max(left[0], right[0]) != result[0]", ["ValidateRemainingResults"] = "Math.Max(left[i], right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "Math.Max(left[0], right[0]) != result[0]", ["ValidateRemainingResults"] = "Math.Max(left[i], right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "MaxScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MinValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MinValue))", ["ValidateFirstResult"] = "Math.Min(left[0], right[0]) != result[0]", ["ValidateRemainingResults"] = "Math.Min(left[i], right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MinValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MinValue))", ["ValidateFirstResult"] = "Math.Min(left[0], right[0]) != result[0]", ["ValidateRemainingResults"] = "Math.Min(left[i], right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "MinScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Multiply", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] * right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] * right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "MultiplyScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] * right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) | BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) | BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Or", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] | right[i]) != result[i]"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(Random.Next(byte.MinValue, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(Random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(Random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(Random.Next(ushort.MinValue, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(Random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(Random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(Random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(Random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "Random.NextDouble()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(uint)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(long)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(long)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ulong)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0!= result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)8", ["ValidateFirstResult"] = "result[0] != 0", ["ValidateRemainingResults"] = "result[i] != 8"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)8", ["ValidateFirstResult"] = "result[0] != 0", ["ValidateRemainingResults"] = "result[i] != 8"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 15) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 15) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 31) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 31) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(uint)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(long)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(long)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(ulong)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0!= result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)8", ["ValidateFirstResult"] = "result[0] != 8", ["ValidateRemainingResults"] = "(i == 15 ? result[i] != 0 : result[i] != 8)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)8", ["ValidateFirstResult"] = "result[0] != 8", ["ValidateRemainingResults"] = "(i == 15 ? result[i] != 0 : result[i] != 8)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "(i == 7 ? result[i] != 0 : result[i] != 2048)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "(i == 7 ? result[i] != 0 : result[i] != 2048)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)8", ["ValidateFirstResult"] = "result[0] != 134217728", ["ValidateRemainingResults"] = "(i == 3 ? result[i] != 0 : result[i] != 134217728)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)8", ["ValidateFirstResult"] = "result[0] != 134217728", ["ValidateRemainingResults"] = "(i == 3 ? result[i] != 0 : result[i] != 134217728)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)8", ["ValidateFirstResult"] = "result[0] != 576460752303423488L", ["ValidateRemainingResults"] = "(result[i] != 0)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)8", ["ValidateFirstResult"] = "result[0] != 576460752303423488UL", ["ValidateRemainingResults"] = "(result[i] != 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] - right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] - right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Subtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.SubtractSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.SubtractSaturate(left[i], right[i], result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.SubtractSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.SubtractSaturate(left[i], right[i], result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.SubtractSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.SubtractSaturate(left[i], right[i], result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))",["NextValueOp2"] = "(ushort)(random.Next(ushort.MinValue,ushort.MaxValue))", ["ValidateFirstResult"] = "Sse2Verify.SubtractSaturate(left[0], right[0], result[0])", ["ValidateRemainingResults"] = "Sse2Verify.SubtractSaturate(left[i], right[i], result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SubtractScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] - right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) ^ BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) ^ BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] ^ right[i]) != result[i]"}),
};
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse3Inputs = new []
{
- ("AlternatingBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse2", ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i] - right[i])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i + 1]) != BitConverter.DoubleToInt64Bits(left[i + 1] + right[i + 1])"}),
- ("AlternatingBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse" , ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i] - right[i])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i + 1]) != BitConverter.SingleToInt32Bits(left[i + 1] + right[i + 1])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalAdd", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[i1]) != BitConverter.DoubleToInt64Bits(left[i3] + left[i3 + 1])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i2]) != BitConverter.DoubleToInt64Bits(right[i3] + right[i3 + 1])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse", ["Method"] = "HorizontalAdd", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[i1]) != BitConverter.SingleToInt32Bits(left[i3] + left[i3 + 1])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i2]) != BitConverter.SingleToInt32Bits(right[i3] + right[i3 + 1])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[i1]) != BitConverter.DoubleToInt64Bits(left[i3] - left[i3 + 1])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i2]) != BitConverter.DoubleToInt64Bits(right[i3] - right[i3 + 1])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse", ["Method"] = "HorizontalSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[i1]) != BitConverter.SingleToInt32Bits(left[i3] - left[i3 + 1])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i2]) != BitConverter.SingleToInt32Bits(right[i3] - right[i3 + 1])"}),
+ ("AlternatingBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse2", ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i] - right[i])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i + 1]) != BitConverter.DoubleToInt64Bits(left[i + 1] + right[i + 1])"}),
+ ("AlternatingBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse" , ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i] - right[i])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i + 1]) != BitConverter.SingleToInt32Bits(left[i + 1] + right[i + 1])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalAdd", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[i1]) != BitConverter.DoubleToInt64Bits(left[i3] + left[i3 + 1])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i2]) != BitConverter.DoubleToInt64Bits(right[i3] + right[i3 + 1])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse", ["Method"] = "HorizontalAdd", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[i1]) != BitConverter.SingleToInt32Bits(left[i3] + left[i3 + 1])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i2]) != BitConverter.SingleToInt32Bits(right[i3] + right[i3 + 1])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[i1]) != BitConverter.DoubleToInt64Bits(left[i3] - left[i3 + 1])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i2]) != BitConverter.DoubleToInt64Bits(right[i3] - right[i3 + 1])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse", ["Method"] = "HorizontalSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[i1]) != BitConverter.SingleToInt32Bits(left[i3] - left[i3 + 1])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i2]) != BitConverter.SingleToInt32Bits(right[i3] - right[i3 + 1])"}),
};
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Ssse3Inputs = new []
{
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Abs", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Abs(firstOp[0])", ["ValidateRemainingResults"] = "result[i] != Math.Abs(firstOp[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Abs", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue + 1, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Abs(firstOp[0])", ["ValidateRemainingResults"] = "result[i] != Math.Abs(firstOp[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Abs", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue + 1, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Abs(firstOp[0])", ["ValidateRemainingResults"] = "result[i] != Math.Abs(firstOp[i])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalAdd", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[i1] != (short)(left[i3] + left[i3 + 1])", ["ValidateRemainingResults"] = "result[i2] != (short)(right[i3] + right[i3 + 1])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalAdd", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[i1] != (int)(left[i3] + left[i3 + 1])", ["ValidateRemainingResults"] = "result[i2] != (int)(right[i3] + right[i3 + 1])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalAddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[i1] != Math.Clamp((left[i3] + left[i3 + 1]), short.MinValue, short.MaxValue)", ["ValidateRemainingResults"] = "result[i2] != Math.Clamp((right[i3] + right[i3 + 1]), short.MinValue, short.MaxValue)"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[i1] != (short)(left[i3] - left[i3 + 1])", ["ValidateRemainingResults"] = "result[i2] != (short)(right[i3] - right[i3 + 1])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[i1] != (int)(left[i3] - left[i3 + 1])", ["ValidateRemainingResults"] = "result[i2] != (int)(right[i3] - right[i3 + 1])"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalSubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[i1] != Math.Clamp((left[i3] - left[i3 + 1]), short.MinValue, short.MaxValue)", ["ValidateRemainingResults"] = "result[i2] != Math.Clamp((right[i3] - right[i3 + 1]), short.MinValue, short.MaxValue)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "MultiplyAddAdjacent", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Clamp(((right[1] * left[1]) + (right[0] * left[0])), short.MinValue, short.MaxValue)", ["ValidateRemainingResults"] = "result[i] != Math.Clamp(((right[(i * 2) + 1] * left[(i * 2) + 1]) + (right[i * 2] * left[i * 2])), short.MinValue, short.MaxValue)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "MultiplyHighRoundScale", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != (short)((((left[0] * right[0]) >> 14) + 1) >> 1)", ["ValidateRemainingResults"] = "result[i] != (short)((((left[i] * right[i]) >> 14) + 1) >> 1)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Shuffle", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((right[0] < 0) ? 0 : left[right[0] & 0x0F])", ["ValidateRemainingResults"] = "result[i] != ((right[i] < 0) ? 0 : left[right[i] & 0x0F])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Sign", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != (right[0] < 0 ? (sbyte)(-left[0]) : (right[0] > 0 ? left[0] : 0))", ["ValidateRemainingResults"] = "result[i] != (right[i] < 0 ? (sbyte)(-left[i]) : (right[i] > 0 ? left[i] : 0))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Sign", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue + 1, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != (right[0] < 0 ? (short)(-left[0]) : (right[0] > 0 ? left[0] : 0))", ["ValidateRemainingResults"] = "result[i] != (right[i] < 0 ? (short)(-left[i]) : (right[i] > 0 ? left[i] : 0))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Sign", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue + 1, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != (right[0] < 0 ? (int)(-left[0]) : (right[0] > 0 ? left[0] : 0))", ["ValidateRemainingResults"] = "result[i] != (right[i] < 0 ? (int)(-left[i]) : (right[i] > 0 ? left[i] : 0))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Abs", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Abs(firstOp[0])", ["ValidateRemainingResults"] = "result[i] != Math.Abs(firstOp[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Abs", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue + 1, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Abs(firstOp[0])", ["ValidateRemainingResults"] = "result[i] != Math.Abs(firstOp[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Abs", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue + 1, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Abs(firstOp[0])", ["ValidateRemainingResults"] = "result[i] != Math.Abs(firstOp[i])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalAdd", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[i1] != (short)(left[i3] + left[i3 + 1])", ["ValidateRemainingResults"] = "result[i2] != (short)(right[i3] + right[i3 + 1])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalAdd", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[i1] != (int)(left[i3] + left[i3 + 1])", ["ValidateRemainingResults"] = "result[i2] != (int)(right[i3] + right[i3 + 1])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalAddSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[i1] != Math.Clamp((left[i3] + left[i3 + 1]), short.MinValue, short.MaxValue)", ["ValidateRemainingResults"] = "result[i2] != Math.Clamp((right[i3] + right[i3 + 1]), short.MinValue, short.MaxValue)"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[i1] != (short)(left[i3] - left[i3 + 1])", ["ValidateRemainingResults"] = "result[i2] != (short)(right[i3] - right[i3 + 1])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[i1] != (int)(left[i3] - left[i3 + 1])", ["ValidateRemainingResults"] = "result[i2] != (int)(right[i3] - right[i3 + 1])"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "HorizontalSubtractSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[i1] != Math.Clamp((left[i3] - left[i3 + 1]), short.MinValue, short.MaxValue)", ["ValidateRemainingResults"] = "result[i2] != Math.Clamp((right[i3] - right[i3 + 1]), short.MinValue, short.MaxValue)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "MultiplyAddAdjacent", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Clamp(((right[1] * left[1]) + (right[0] * left[0])), short.MinValue, short.MaxValue)", ["ValidateRemainingResults"] = "result[i] != Math.Clamp(((right[(i * 2) + 1] * left[(i * 2) + 1]) + (right[i * 2] * left[i * 2])), short.MinValue, short.MaxValue)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "MultiplyHighRoundScale", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != (short)((((left[0] * right[0]) >> 14) + 1) >> 1)", ["ValidateRemainingResults"] = "result[i] != (short)((((left[i] * right[i]) >> 14) + 1) >> 1)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Shuffle", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((right[0] < 0) ? 0 : left[right[0] & 0x0F])", ["ValidateRemainingResults"] = "result[i] != ((right[i] < 0) ? 0 : left[right[i] & 0x0F])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Sign", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != (right[0] < 0 ? (sbyte)(-left[0]) : (right[0] > 0 ? left[0] : 0))", ["ValidateRemainingResults"] = "result[i] != (right[i] < 0 ? (sbyte)(-left[i]) : (right[i] > 0 ? left[i] : 0))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Sign", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue + 1, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != (right[0] < 0 ? (short)(-left[0]) : (right[0] > 0 ? left[0] : 0))", ["ValidateRemainingResults"] = "result[i] != (right[i] < 0 ? (short)(-left[i]) : (right[i] > 0 ? left[i] : 0))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Ssse3", ["LoadIsa"] = "Sse2", ["Method"] = "Sign", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue + 1, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != (right[0] < 0 ? (int)(-left[0]) : (right[0] > 0 ? left[0] : 0))", ["ValidateRemainingResults"] = "result[i] != (right[i] < 0 ? (int)(-left[i]) : (right[i] > 0 ? left[i] : 0))"}),
};
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse41Inputs = new []
{
- ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Op3VectorType"] = "Vector128", ["Op3BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp3"] = "(byte)(((i % 2) == 0) ? 128 : 1)", ["ValidateFirstResult"] = "((thirdOp[0] >> 7) & 1) == 1 ? secondOp[0] != result[0] : firstOp[0] != result[0]", ["ValidateRemainingResults"] = "((thirdOp[i] >> 7) & 1) == 1 ? secondOp[i] != result[i] : firstOp[i] != result[i]"}),
- ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["Op3VectorType"] = "Vector128", ["Op3BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["NextValueOp3"] = "(double)(((i % 2) == 0) ? -0.0 : 1.0)", ["ValidateFirstResult"] = "((BitConverter.DoubleToInt64Bits(thirdOp[0]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[0]) != BitConverter.DoubleToInt64Bits(result[0]) : BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "((BitConverter.DoubleToInt64Bits(thirdOp[i]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[i]) != BitConverter.DoubleToInt64Bits(result[i]) : BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector128", ["Op3BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp3"] = "(sbyte)(((i % 2) == 0) ? -128 : 1)", ["ValidateFirstResult"] = "((thirdOp[0] >> 7) & 1) == 1 ? secondOp[0] != result[0] : firstOp[0] != result[0]", ["ValidateRemainingResults"] = "((thirdOp[i] >> 7) & 1) == 1 ? secondOp[i] != result[i] : firstOp[i] != result[i]"}),
- ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector128", ["Op3BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["NextValueOp3"] = "(float)(((i % 2) == 0) ? -0.0 : 1.0)", ["ValidateFirstResult"] = "((BitConverter.SingleToInt32Bits(thirdOp[0]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[0]) != BitConverter.SingleToInt32Bits(result[0]) : BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "((BitConverter.SingleToInt32Bits(thirdOp[i]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[i]) != BitConverter.SingleToInt32Bits(result[i]) : BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Ceiling", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Ceiling", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[i]))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "CeilingScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "CeilingScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((long)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((ulong)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((ulong)(-1)) : 0)"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[1]))"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[1]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Floor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Floor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "FloorScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "FloorScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "1", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Data"] = "(float)2", ["Imm"] = "0", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)0", ["ValidateFirstResult"] = "(i == 0 ? BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((float)2) : BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((float)0))"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "129", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Data"] = "(float)2", ["Imm"] = "217", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(i == 2 ? BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(firstOp[i]) : BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((float)0))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "MultiplyLow", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != BitConverter.ToInt32(BitConverter.GetBytes(((long)(left[0])) * right[0]), 0)", ["ValidateRemainingResults"] = "result[i] != BitConverter.ToInt32(BitConverter.GetBytes(((long)(left[i])) * right[i]), 0)"}),
- ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "PackUnsignedSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[i1] != ((left[i3 - inner] > 0xFFFF) ? 0xFFFF : ((left[i3 - inner] < 0) ? 0 : BitConverter.ToUInt16(BitConverter.GetBytes(left[i3 - inner]), 0)))", ["ValidateRemainingResults"] = "result[i2] != ((right[i3 - inner] > 0xFFFF) ? 0xFFFF : ((right[i3 - inner] < 0) ? 0 : BitConverter.ToUInt16(BitConverter.GetBytes(right[i3 - inner]), 0)))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundCurrentDirection", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundCurrentDirection", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[i]))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundCurrentDirectionScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundCurrentDirectionScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToNearestInteger", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[i], MidpointRounding.AwayFromZero))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToNearestInteger", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[i], MidpointRounding.AwayFromZero))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToNearestIntegerScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(right[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToNearestIntegerScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(right[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToNegativeInfinity", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToNegativeInfinity", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToNegativeInfinityScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToNegativeInfinityScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToPositiveInfinity", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToPositiveInfinity", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[i]))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToPositiveInfinityScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToPositiveInfinityScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToZero", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits((firstOp[0] > 0) ? Math.Floor(firstOp[0]) : Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits((firstOp[i] > 0) ? Math.Floor(firstOp[i]) : Math.Ceiling(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToZero", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits((firstOp[0] > 0) ? MathF.Floor(firstOp[0]) : MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((firstOp[i] > 0) ? MathF.Floor(firstOp[i]) : MathF.Ceiling(firstOp[i]))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToZeroScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits((right[0] > 0) ? Math.Floor(right[0]) : Math.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToZeroScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits((right[0] > 0) ? MathF.Floor(right[0]) : MathF.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
- ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & byte.MaxValue) == 0"}),
- ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & -1) == 0"}),
- ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & -1) == 0"}),
- ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & -1) == 0"}),
- ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & -1) == 0"}),
- ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & ushort.MaxValue) == 0"}),
- ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & uint.MaxValue) == 0"}),
- ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & ulong.MaxValue) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Op3VectorType"] = "Vector128", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp3"] = "(byte)(((i % 2) == 0) ? 128 : 1)", ["ValidateFirstResult"] = "((thirdOp[0] >> 7) & 1) == 1 ? secondOp[0] != result[0] : firstOp[0] != result[0]", ["ValidateRemainingResults"] = "((thirdOp[i] >> 7) & 1) == 1 ? secondOp[i] != result[i] : firstOp[i] != result[i]"}),
+ ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["Op3VectorType"] = "Vector128", ["Op3BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["NextValueOp3"] = "(double)(((i % 2) == 0) ? -0.0 : 1.0)", ["ValidateFirstResult"] = "((BitConverter.DoubleToInt64Bits(thirdOp[0]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[0]) != BitConverter.DoubleToInt64Bits(result[0]) : BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "((BitConverter.DoubleToInt64Bits(thirdOp[i]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[i]) != BitConverter.DoubleToInt64Bits(result[i]) : BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector128", ["Op3BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp3"] = "(sbyte)(((i % 2) == 0) ? -128 : 1)", ["ValidateFirstResult"] = "((thirdOp[0] >> 7) & 1) == 1 ? secondOp[0] != result[0] : firstOp[0] != result[0]", ["ValidateRemainingResults"] = "((thirdOp[i] >> 7) & 1) == 1 ? secondOp[i] != result[i] : firstOp[i] != result[i]"}),
+ ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector128", ["Op3BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["NextValueOp3"] = "(float)(((i % 2) == 0) ? -0.0 : 1.0)", ["ValidateFirstResult"] = "((BitConverter.SingleToInt32Bits(thirdOp[0]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[0]) != BitConverter.SingleToInt32Bits(result[0]) : BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "((BitConverter.SingleToInt32Bits(thirdOp[i]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[i]) != BitConverter.SingleToInt32Bits(result[i]) : BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Ceiling", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Ceiling", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "CeilingScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "CeilingScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((long)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((ulong)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((ulong)(-1)) : 0)"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[1]))"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[1]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Floor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Floor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "FloorScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "FloorScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Data"] = "(float)2", ["Imm"] = "0", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)0", ["ValidateFirstResult"] = "(i == 0 ? BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((float)2) : BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((float)0))"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Data"] = "(float)2", ["Imm"] = "217", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(i == 2 ? BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(firstOp[i]) : BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((float)0))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Min", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "MultiplyLow", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != BitConverter.ToInt32(BitConverter.GetBytes(((long)(left[0])) * right[0]), 0)", ["ValidateRemainingResults"] = "result[i] != BitConverter.ToInt32(BitConverter.GetBytes(((long)(left[i])) * right[i]), 0)"}),
+ ("HorizontalBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "PackUnsignedSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[i1] != ((left[i3 - inner] > 0xFFFF) ? 0xFFFF : ((left[i3 - inner] < 0) ? 0 : BitConverter.ToUInt16(BitConverter.GetBytes(left[i3 - inner]), 0)))", ["ValidateRemainingResults"] = "result[i2] != ((right[i3 - inner] > 0xFFFF) ? 0xFFFF : ((right[i3 - inner] < 0) ? 0 : BitConverter.ToUInt16(BitConverter.GetBytes(right[i3 - inner]), 0)))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundCurrentDirection", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundCurrentDirection", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundCurrentDirectionScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundCurrentDirectionScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToNearestInteger", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[i], MidpointRounding.AwayFromZero))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToNearestInteger", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[i], MidpointRounding.AwayFromZero))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToNearestIntegerScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(right[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToNearestIntegerScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(right[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToNegativeInfinity", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToNegativeInfinity", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToNegativeInfinityScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToNegativeInfinityScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToPositiveInfinity", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToPositiveInfinity", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToPositiveInfinityScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToPositiveInfinityScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToZero", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits((firstOp[0] > 0) ? Math.Floor(firstOp[0]) : Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits((firstOp[i] > 0) ? Math.Floor(firstOp[i]) : Math.Ceiling(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToZero", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits((firstOp[0] > 0) ? MathF.Floor(firstOp[0]) : MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((firstOp[i] > 0) ? MathF.Floor(firstOp[i]) : MathF.Ceiling(firstOp[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "RoundToZeroScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits((right[0] > 0) ? Math.Floor(right[0]) : Math.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "RoundToZeroScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits((right[0] > 0) ? MathF.Floor(right[0]) : MathF.Ceiling(right[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
+ ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & byte.MaxValue) == 0"}),
+ ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & -1) == 0"}),
+ ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & -1) == 0"}),
+ ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & -1) == 0"}),
+ ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & -1) == 0"}),
+ ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & ushort.MaxValue) == 0"}),
+ ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & uint.MaxValue) == 0"}),
+ ("BooleanUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllOnes", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~value[i] & ulong.MaxValue) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestAllZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestMixOnesZeros", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
};
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse42Inputs = new []
{
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse42", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((long)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse42", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((long)(-1)) : 0)"}),
};
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] AvxInputs = new []
{
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] + right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] + right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] + right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] - right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "((i % 2 != 0) && (BitConverter.DoubleToInt64Bits(left[i] + right[i]) != BitConverter.DoubleToInt64Bits(result[i]))) || ((i % 2 == 0) && (BitConverter.DoubleToInt64Bits(left[i] - right[i]) != BitConverter.DoubleToInt64Bits(result[i])))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "((i % 2 != 0) && (BitConverter.SingleToInt32Bits(left[i] + right[i]) != BitConverter.SingleToInt32Bits(result[i]))) || ((i % 2 == 0) && (BitConverter.SingleToInt32Bits(left[i] - right[i]) != BitConverter.SingleToInt32Bits(result[i])))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[i]) & BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "((~BitConverter.DoubleToInt64Bits(left[0])) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "((~BitConverter.DoubleToInt64Bits(left[i])) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "((~BitConverter.SingleToInt32Bits(left[0])) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "((~BitConverter.SingleToInt32Bits(left[i])) & BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["Op3VectorType"] = "Vector256", ["Op3BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["NextValueOp3"] = "(double)(((i % 2) == 0) ? -0.0 : 1.0)", ["ValidateFirstResult"] = "((BitConverter.DoubleToInt64Bits(thirdOp[0]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[0]) != BitConverter.DoubleToInt64Bits(result[0]) : BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "((BitConverter.DoubleToInt64Bits(thirdOp[i]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[i]) != BitConverter.DoubleToInt64Bits(result[i]) : BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector256", ["Op3BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["NextValueOp3"] = "(float)(((i % 2) == 0) ? -0.0 : 1.0)", ["ValidateFirstResult"] = "((BitConverter.SingleToInt32Bits(thirdOp[0]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[0]) != BitConverter.SingleToInt32Bits(result[0]) : BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "((BitConverter.SingleToInt32Bits(thirdOp[i]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[i]) != BitConverter.SingleToInt32Bits(result[i]) : BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Ceiling", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Ceiling", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[i]))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Divide", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] / right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] / right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Divide", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] / right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateEvenIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])) : (BitConverter.DoubleToInt64Bits(firstOp[i - 1]) != BitConverter.DoubleToInt64Bits(result[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateEvenIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])) : (BitConverter.SingleToInt32Bits(firstOp[i - 1]) != BitConverter.SingleToInt32Bits(result[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateOddIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[1]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.SingleToInt32Bits(firstOp[i + 1]) != BitConverter.SingleToInt32Bits(result[i])) : (BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i]))"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "20", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[20])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "20", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[20])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "11", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[11])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "11", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[11])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "6", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "6", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "3", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "3", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse", ["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[4])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(firstOp[i + 4]))"}),
- ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[2])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(firstOp[i + 2]))"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "20", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "20", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "11", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2",["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2",["Imm"] = "11", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "6", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "6", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "3", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "3", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(0,sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(0,short.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0,ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(left[0])", ["ValidateRemainingResults"] = "(i > 3 ? BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(right[i - 4]) : BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i]))"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(left[0])", ["ValidateRemainingResults"] = "(i > 1 ? BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(right[i - 2]) : BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Floor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Floor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(MathF.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(MathF.Max(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(MathF.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(MathF.Min(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Multiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] * right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] * right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Multiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] * right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) | BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) | BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[i]) | BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Permute", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[1])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[4]) != BitConverter.SingleToInt32Bits(firstOp[5])"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Permute", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[1])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[2]) != BitConverter.DoubleToInt64Bits(firstOp[2]) || BitConverter.DoubleToInt64Bits(result[2]) != BitConverter.DoubleToInt64Bits(firstOp[2])"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse", ["Method"] = "Permute", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Imm"] = "2", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[2])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[1]) != BitConverter.SingleToInt32Bits(firstOp[0]) || BitConverter.SingleToInt32Bits(result[2]) != BitConverter.SingleToInt32Bits(firstOp[0])"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "Permute", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Imm"] = "2", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[1]) != BitConverter.DoubleToInt64Bits(firstOp[1])"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundCurrentDirection", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundCurrentDirection", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToNearestInteger", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[i], MidpointRounding.AwayFromZero))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToNearestInteger", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[i], MidpointRounding.AwayFromZero))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToNegativeInfinity", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToNegativeInfinity", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToPositiveInfinity", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToPositiveInfinity", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToZero", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits((firstOp[0] > 0) ? Math.Floor(firstOp[0]) : Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits((firstOp[i] > 0) ? Math.Floor(firstOp[i]) : Math.Ceiling(firstOp[i]))"}),
- ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToZero", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits((firstOp[0] > 0) ? MathF.Floor(firstOp[0]) : MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((firstOp[i] > 0) ? MathF.Floor(firstOp[i]) : MathF.Ceiling(firstOp[i]))"}),
- ("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Shuffle", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(left[1])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[7]) != BitConverter.SingleToInt32Bits(right[4])"}),
- ("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Shuffle", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(left[1])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[3]) != BitConverter.DoubleToInt64Bits(right[2])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] - right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] - right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] - right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) ^ BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) ^ BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[i]) ^ BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] + right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] + right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] + right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] - right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "((i % 2 != 0) && (BitConverter.DoubleToInt64Bits(left[i] + right[i]) != BitConverter.DoubleToInt64Bits(result[i]))) || ((i % 2 == 0) && (BitConverter.DoubleToInt64Bits(left[i] - right[i]) != BitConverter.DoubleToInt64Bits(result[i])))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "((i % 2 != 0) && (BitConverter.SingleToInt32Bits(left[i] + right[i]) != BitConverter.SingleToInt32Bits(result[i]))) || ((i % 2 == 0) && (BitConverter.SingleToInt32Bits(left[i] - right[i]) != BitConverter.SingleToInt32Bits(result[i])))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[i]) & BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "((~BitConverter.DoubleToInt64Bits(left[0])) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "((~BitConverter.DoubleToInt64Bits(left[i])) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "((~BitConverter.SingleToInt32Bits(left[0])) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "((~BitConverter.SingleToInt32Bits(left[i])) & BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["Op3VectorType"] = "Vector256", ["Op3BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["NextValueOp3"] = "(double)(((i % 2) == 0) ? -0.0 : 1.0)", ["ValidateFirstResult"] = "((BitConverter.DoubleToInt64Bits(thirdOp[0]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[0]) != BitConverter.DoubleToInt64Bits(result[0]) : BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "((BitConverter.DoubleToInt64Bits(thirdOp[i]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[i]) != BitConverter.DoubleToInt64Bits(result[i]) : BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector256", ["Op3BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["NextValueOp3"] = "(float)(((i % 2) == 0) ? -0.0 : 1.0)", ["ValidateFirstResult"] = "((BitConverter.SingleToInt32Bits(thirdOp[0]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[0]) != BitConverter.SingleToInt32Bits(result[0]) : BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "((BitConverter.SingleToInt32Bits(thirdOp[i]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[i]) != BitConverter.SingleToInt32Bits(result[i]) : BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Ceiling", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Ceiling", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Divide", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] / right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] / right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Divide", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] / right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateEvenIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])) : (BitConverter.DoubleToInt64Bits(firstOp[i - 1]) != BitConverter.DoubleToInt64Bits(result[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateEvenIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])) : (BitConverter.SingleToInt32Bits(firstOp[i - 1]) != BitConverter.SingleToInt32Bits(result[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateOddIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[1]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.SingleToInt32Bits(firstOp[i + 1]) != BitConverter.SingleToInt32Bits(result[i])) : (BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i]))"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "20", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[20])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "20", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[20])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "52", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[20])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "52", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[20])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "11", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[11])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "11", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[11])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "27", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[11])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "27", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[11])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "6", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "6", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "22", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "22", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "3", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "3", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "19", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "19", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse", ["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "ExtendToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (RetElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[4])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(firstOp[i + 4]))"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[2])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(firstOp[i + 2]))"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "20", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "20", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "52", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "52", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "11", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2",["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2",["Imm"] = "11", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "27", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2",["Imm"] = "27", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "6", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "6", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "22", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "22", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "3", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "3", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "19", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "19", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(0,sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(0,short.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0,ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(left[0])", ["ValidateRemainingResults"] = "(i > 3 ? BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(right[i - 4]) : BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i]))"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(left[0])", ["ValidateRemainingResults"] = "(i > 1 ? BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(right[i - 2]) : BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Floor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Floor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(Math.Max(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(MathF.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(MathF.Max(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[0], right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(Math.Min(left[i], right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(MathF.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(MathF.Min(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Multiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] * right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] * right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Multiply", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] * right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) | BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) | BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[i]) | BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Permute", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[1])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[4]) != BitConverter.SingleToInt32Bits(firstOp[5])"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Permute", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[1])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[2]) != BitConverter.DoubleToInt64Bits(firstOp[2]) || BitConverter.DoubleToInt64Bits(result[2]) != BitConverter.DoubleToInt64Bits(firstOp[2])"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse", ["Method"] = "Permute", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Imm"] = "2", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[2])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[1]) != BitConverter.SingleToInt32Bits(firstOp[0]) || BitConverter.SingleToInt32Bits(result[2]) != BitConverter.SingleToInt32Bits(firstOp[0])"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Sse2",["Method"] = "Permute", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Imm"] = "2", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[1]) != BitConverter.DoubleToInt64Bits(firstOp[1])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "PermuteVar", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "BitConverter.Int32BitsToSingle(1)", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[1]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "i > 3 ? (BitConverter.SingleToInt32Bits(left[5]) != BitConverter.SingleToInt32Bits(result[i])) : (BitConverter.SingleToInt32Bits(left[1]) != BitConverter.SingleToInt32Bits(result[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "PermuteVar", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "BitConverter.Int64BitsToDouble(1)", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "i > 1 ? (BitConverter.DoubleToInt64Bits(left[2]) != BitConverter.DoubleToInt64Bits(result[i])) : (BitConverter.DoubleToInt64Bits(left[0]) != BitConverter.DoubleToInt64Bits(result[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundCurrentDirection", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundCurrentDirection", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToNearestInteger", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Round(firstOp[i], MidpointRounding.AwayFromZero))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToNearestInteger", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[0], MidpointRounding.AwayFromZero))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Round(firstOp[i], MidpointRounding.AwayFromZero))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToNegativeInfinity", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToNegativeInfinity", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToPositiveInfinity", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Ceiling(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToPositiveInfinity", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Ceiling(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToZero", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits((firstOp[0] > 0) ? Math.Floor(firstOp[0]) : Math.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits((firstOp[i] > 0) ? Math.Floor(firstOp[i]) : Math.Ceiling(firstOp[i]))"}),
+ ("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "RoundToZero", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits((firstOp[0] > 0) ? MathF.Floor(firstOp[0]) : MathF.Ceiling(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((firstOp[i] > 0) ? MathF.Floor(firstOp[i]) : MathF.Ceiling(firstOp[i]))"}),
+ ("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Shuffle", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(left[1])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[7]) != BitConverter.SingleToInt32Bits(right[4])"}),
+ ("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Shuffle", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(left[1])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[3]) != BitConverter.DoubleToInt64Bits(right[2])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] - right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] - right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] - right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(~left[i] & right[i]) == 0"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanTwoCmpOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestNotZAndNotC", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "((left[i] & right[i]) == 0)", ["ValidateRemainingResults"] = "((~left[i] & right[i]) == 0)"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "TestZ", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["NextValueOp2"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.DoubleToInt64Bits(left[0]) ^ BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(left[i]) ^ BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["NextValueOp2"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[i]) ^ BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
};
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Avx2Inputs = new []
{
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] + right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(~left[i] & right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Average", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)((left[0] + right[0] + 1) >> 1) != result[0]", ["ValidateRemainingResults"] = "(byte)((left[i] + right[i] + 1) >> 1) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Average", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(ushort)((left[0] + right[0] + 1) >> 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)((left[i] + right[i] + 1) >> 1) != result[i]"}),
- ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["Op3VectorType"] = "Vector256", ["Op3BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp3"] = "(byte)(((i % 2) == 0) ? 128 : 1)", ["ValidateFirstResult"] = "((thirdOp[0] >> 7) & 1) == 1 ? secondOp[0] != result[0] : firstOp[0] != result[0]", ["ValidateRemainingResults"] = "((thirdOp[i] >> 7) & 1) == 1 ? secondOp[i] != result[i] : firstOp[i] != result[i]"}),
- ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector256", ["Op3BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp3"] = "(sbyte)(((i % 2) == 0) ? -128 : 1)", ["ValidateFirstResult"] = "((thirdOp[0] >> 7) & 1) == 1 ? secondOp[0] != result[0] : firstOp[0] != result[0]", ["ValidateRemainingResults"] = "((thirdOp[i] >> 7) & 1) == 1 ? secondOp[i] != result[i] : firstOp[i] != result[i]"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["VectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["VectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["VectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["VectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["VectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["VectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["VectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["VectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[i]))"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[i]))"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["VectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[i]))"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["VectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[i]))"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((byte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((byte)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((short)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((int)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((long)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((ushort)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((ushort)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((uint)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((uint)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((ulong)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((ulong)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((short)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((int)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((long)(-1)) : 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
- ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
- ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
- ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
- ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
- ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
- ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
- ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
- ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
- ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
- ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
- ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
- ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
- ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
- ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
- ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
- ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
- ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(0,sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(0,short.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0,ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
- ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] | right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] | right[i]) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(uint)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(long)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(long)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ulong)(firstOp[i] << 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0!= result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)8", ["ValidateFirstResult"] = "result[0] != 0", ["ValidateRemainingResults"] = "(i == 16 ? result[i] != 0 : result[i] != 8)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)8", ["ValidateFirstResult"] = "result[0] != 0", ["ValidateRemainingResults"] = "(i == 16 ? result[i] != 0 : result[i] != 8)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 15) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 15) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 31) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 31) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(uint)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(long)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(long)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(ulong)(firstOp[i] >> 1) != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0!= result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)8", ["ValidateFirstResult"] = "result[0] != 8", ["ValidateRemainingResults"] = "(i == 31 || i == 15 ? result[i] != 0 : result[i] != 8)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)8", ["ValidateFirstResult"] = "result[0] != 8", ["ValidateRemainingResults"] = "(i == 31 || i == 15 ? result[i] != 0 : result[i] != 8)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "(i == 7 || i == 15 ? result[i] != 0 : result[i] != 2048)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "(i == 7 || i == 15 ? result[i] != 0 : result[i] != 2048)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)8", ["ValidateFirstResult"] = "result[0] != 134217728", ["ValidateRemainingResults"] = "(i == 3 || i == 7 ? result[i] != 0 : result[i] != 134217728)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)8", ["ValidateFirstResult"] = "result[0] != 134217728", ["ValidateRemainingResults"] = "(i == 3 || i == 7 ? result[i] != 0 : result[i] != 134217728)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)8", ["ValidateFirstResult"] = "result[0] != 576460752303423488L", ["ValidateRemainingResults"] = "(i == 2 ? result[i] != 576460752303423488L : result[i] != 0)"}),
- ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)8", ["ValidateFirstResult"] = "result[0] != 576460752303423488UL", ["ValidateRemainingResults"] = "(i == 2 ? result[i] != 576460752303423488UL : result[i] != 0)"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] - right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["VectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["VectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["VectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["VectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["VectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["VectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["VectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] ^ right[i]) != result[i]"}),
- ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["VectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Add", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] + right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] + right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "And", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "AndNot", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(~left[0] & right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(~left[i] & right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Average", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)((left[0] + right[0] + 1) >> 1) != result[0]", ["ValidateRemainingResults"] = "(byte)((left[i] + right[i] + 1) >> 1) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Average", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(ushort)((left[0] + right[0] + 1) >> 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)((left[i] + right[i] + 1) >> 1) != result[i]"}),
+ ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["Op3VectorType"] = "Vector256", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp3"] = "(byte)(((i % 2) == 0) ? 128 : 1)", ["ValidateFirstResult"] = "((thirdOp[0] >> 7) & 1) == 1 ? secondOp[0] != result[0] : firstOp[0] != result[0]", ["ValidateRemainingResults"] = "((thirdOp[i] >> 7) & 1) == 1 ? secondOp[i] != result[i] : firstOp[i] != result[i]"}),
+ ("SimpleTernOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "BlendVariable", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector256", ["Op3BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp3"] = "(sbyte)(((i % 2) == 0) ? -128 : 1)", ["ValidateFirstResult"] = "((thirdOp[0] >> 7) & 1) == 1 ? secondOp[0] != result[0] : firstOp[0] != result[0]", ["ValidateRemainingResults"] = "((thirdOp[i] >> 7) & 1) == 1 ? secondOp[i] != result[i] : firstOp[i] != result[i]"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[i]))"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[i]))"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "(firstOp[0] != result[i])"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(float)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[i]))"}),
+ ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Sse2", ["Method"] = "BroadcastScalarToVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(double)(random.NextDouble())", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[i]))"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((byte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((byte)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((short)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((int)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((long)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((ushort)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((ushort)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((uint)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((uint)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareEqual", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] == right[0]) ? unchecked((ulong)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] == right[i]) ? unchecked((ulong)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((short)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((short)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((int)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((long)(-1)) : 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
+ ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
+ ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
+ ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
+ ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
+ ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
+ ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
+ ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
+ ("ExtractVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[8]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 8])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[4]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 4])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
+ ("ExtractStoreTest.template", new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
+ ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
+ ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
+ ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
+ ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
+ ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
+ ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
+ ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
+ ("InsertVector128Test.template",new Dictionary<string, string>{["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(0, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(0,sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 15 ? result[i] != right[i - 16] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(0,short.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0,ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 7 ? result[i] != right[i - 8] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 3 ? result[i] != right[i - 4] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
+ ("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0,int.MaxValue))", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "(i > 1 ? result[i] != right[i - 2] : result[i] != left[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(byte.MinValue, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(byte.MinValue, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Max", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(byte.MinValue, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(byte.MinValue, byte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Min", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != Math.Min(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Min(left[i], right[i])"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] | right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Or", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] | right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] | right[i]) != result[i]"}),
+ ("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Permute2x128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["Imm"] = "2", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != right[0]", ["ValidateRemainingResults"] = "i > 3 ? (result[i] != left[i - 4]) : (result[i] != right[i])"}),
+ ("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Permute2x128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["Imm"] = "2", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != right[0]", ["ValidateRemainingResults"] = "i > 3 ? (result[i] != left[i - 4]) : (result[i] != right[i])"}),
+ ("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Permute2x128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["Imm"] = "2", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != right[0]", ["ValidateRemainingResults"] = "i > 1 ? (result[i] != left[i - 2]) : (result[i] != right[i])"}),
+ ("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Permute2x128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["Imm"] = "2", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "result[0] != right[0]", ["ValidateRemainingResults"] = "i > 1 ? (result[i] != left[i - 2]) : (result[i] != right[i])"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(uint)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(long)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(long)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ulong)(firstOp[i] << 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0!= result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)8", ["ValidateFirstResult"] = "result[0] != 0", ["ValidateRemainingResults"] = "(i == 16 ? result[i] != 0 : result[i] != 8)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)8", ["ValidateFirstResult"] = "result[0] != 0", ["ValidateRemainingResults"] = "(i == 16 ? result[i] != 0 : result[i] != 8)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftLeftLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "result[i] != 2048"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 15) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 15) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightArithmetic", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 31) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 31) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "(short)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(int)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(uint)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(long)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(long)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(firstOp[0] >> 1) != result[0]", ["ValidateRemainingResults"] = "(ulong)(firstOp[i] >> 1) != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(0, short.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0!= result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "0 != result[0]", ["ValidateRemainingResults"] = "0 != result[i]"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)8", ["ValidateFirstResult"] = "result[0] != 8", ["ValidateRemainingResults"] = "(i == 31 || i == 15 ? result[i] != 0 : result[i] != 8)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)8", ["ValidateFirstResult"] = "result[0] != 8", ["ValidateRemainingResults"] = "(i == 31 || i == 15 ? result[i] != 0 : result[i] != 8)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "(i == 7 || i == 15 ? result[i] != 0 : result[i] != 2048)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)8", ["ValidateFirstResult"] = "result[0] != 2048", ["ValidateRemainingResults"] = "(i == 7 || i == 15 ? result[i] != 0 : result[i] != 2048)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)8", ["ValidateFirstResult"] = "result[0] != 134217728", ["ValidateRemainingResults"] = "(i == 3 || i == 7 ? result[i] != 0 : result[i] != 134217728)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)8", ["ValidateFirstResult"] = "result[0] != 134217728", ["ValidateRemainingResults"] = "(i == 3 || i == 7 ? result[i] != 0 : result[i] != 134217728)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)8", ["ValidateFirstResult"] = "result[0] != 576460752303423488L", ["ValidateRemainingResults"] = "(i == 2 ? result[i] != 576460752303423488L : result[i] != 0)"}),
+ ("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ShiftRightLogical128BitLane", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)8", ["ValidateFirstResult"] = "result[0] != 576460752303423488UL", ["ValidateRemainingResults"] = "(i == 2 ? result[i] != 576460752303423488UL : result[i] != 0)"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Subtract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] - right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] - right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)(random.Next(0, byte.MaxValue))", ["NextValueOp2"] = "(byte)(random.Next(0, byte.MaxValue))", ["ValidateFirstResult"] = "(byte)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(byte)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["NextValueOp2"] = "(short)(random.Next(short.MinValue, short.MaxValue))", ["ValidateFirstResult"] = "(short)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(short)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(int)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(int)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(int)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["NextValueOp2"] = "(long)(random.Next(int.MinValue, int.MaxValue))", ["ValidateFirstResult"] = "(long)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(long)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["NextValueOp2"] = "(sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue))", ["ValidateFirstResult"] = "(sbyte)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(sbyte)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["NextValueOp2"] = "(ushort)(random.Next(0, ushort.MaxValue))", ["ValidateFirstResult"] = "(ushort)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ushort)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(uint)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(uint)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(uint)(left[i] ^ right[i]) != result[i]"}),
+ ("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "Xor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)(random.Next(0, int.MaxValue))", ["NextValueOp2"] = "(ulong)(random.Next(0, int.MaxValue))", ["ValidateFirstResult"] = "(ulong)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] ^ right[i]) != result[i]"}),
};
private static void ProcessInputs(string isa, (string templateFileName, Dictionary<string, string> templateData)[] inputs)
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenericUnOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenericUnOpTest.template
index 3285e506ff..bfd71e722b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenericUnOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenericUnOpTest.template
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
public SimpleUnaryOpTest__{Method}{RetBaseType}()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -262,8 +262,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest.template
index bc05d9b04d..a78e426316 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest.template
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = VectorSize / sizeof({Op2BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public HorizontalBinaryOpTest__{Method}{RetBaseType}()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new HorizontalBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult({Op1BaseType}[] left, {Op2BaseType}[] right, {RetBaseType}[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof({RetBaseType})); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest_DataTable.cs
index eb6af4a498..ac69cd8564 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/HorizontalBinOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -59,7 +60,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmBinOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmBinOpTest.template
index e24445932a..c8e2a864b9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmBinOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmBinOpTest.template
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = VectorSize / sizeof({Op2BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -286,9 +286,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -299,9 +299,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmUnOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmUnOpTest.template
index 6403add2cd..49fb80e55f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmUnOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ImmUnOpTest.template
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertLoadTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertLoadTest.template
index 7759c8645b..eaf1b64df5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertLoadTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertLoadTest.template
@@ -87,11 +87,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}Load
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = 16 / sizeof({Op2BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -109,9 +109,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}Load()
@@ -121,13 +121,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -288,9 +288,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -301,9 +301,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertScalarTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertScalarTest.template
index 22eaf24bdb..cc330e715b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertScalarTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertScalarTest.template
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
public SimpleUnaryOpTest__{Method}{RetBaseType}{Imm}()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertVector128Test.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertVector128Test.template
index 535ab774e6..e95bb2b8d7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertVector128Test.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/InsertVector128Test.template
@@ -86,11 +86,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = 16 / sizeof({Op2BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -108,9 +108,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public SimpleBinaryOpTest__{Method}{RetBaseType}{Imm}()
@@ -120,13 +120,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -287,9 +287,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -300,9 +300,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest.template
index cb0b807147..69e1d7342e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest.template
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void {Method}{RetBaseType}()
{
- bool skipIf32Bit = typeof({Op1BaseType}) == typeof(Int64) ? true :
- typeof({Op1BaseType}) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof({Op1BaseType}) == typeof(Int64)) ||
+ (typeof({Op1BaseType}) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if ({LoadIsa}.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
- private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static {Op1BaseType} _clsVar;
private {Op1BaseType} _fld;
- private SimpleScalarUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<{RetBaseType}> _dataTable;
static SimpleScalarUnaryOpTest__{Method}{RetBaseType}()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = {NextValueOp1};
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Marshal.SizeOf<{Op1BaseType}>());
+ _clsVar = {NextValueOp1};
}
public SimpleScalarUnaryOpTest__{Method}{RetBaseType}()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = {NextValueOp1};
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Marshal.SizeOf<{Op1BaseType}>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = {NextValueOp1};
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], VectorSize);
+ _fld = {NextValueOp1};
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<{RetBaseType}>(new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = {NextValueOp1};
var result = {Isa}.{Method}(
- Unsafe.Read<{Op1BaseType}>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1BaseType}) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<{Op1BaseType}>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, ({RetVectorType}<{RetBaseType}>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = {NextValueOp1};
var method = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1BaseType}) });
- {Op1BaseType} parameter = ({Op1BaseType}) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, ({RetVectorType}<{RetBaseType}>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<{Op1BaseType}>(_dataTable.inArrayPtr);
+ var firstOp = {NextValueOp1};
var result = {Isa}.{Method}(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,27 +168,14 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult({Op1BaseType} firstOp, void* result, [CallerMemberName] string method = "")
{
- {Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
- {RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- {Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult({Op1BaseType}[] firstOp, {RetBaseType}[] result, [CallerMemberName] string method = "")
+ private void ValidateResult({Op1BaseType} firstOp, {RetBaseType}[] result, [CallerMemberName] string method = "")
{
if ({ValidateFirstResult})
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest_DataTable.cs
index 8c3b9a0699..b510aed999 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -10,39 +11,28 @@ using System.Runtime.Intrinsics.X86;
namespace JIT.HardwareIntrinsics.X86
{
- public unsafe struct SimpleScalarUnaryOpTest__DataTable<TResult, TOp1> : IDisposable
+ public unsafe struct SimpleScalarUnaryOpTest__DataTable<TResult> : IDisposable
where TResult : struct
- where TOp1 : struct
{
- private static byte inArrayElementSize;
- public byte[] inArray;
public byte[] outArray;
- private GCHandle inHandle;
private GCHandle outHandle;
private byte simdSize;
- public SimpleScalarUnaryOpTest__DataTable(TOp1[] inArray, TResult[] outArray, int simdSize)
+ public SimpleScalarUnaryOpTest__DataTable(TResult[] outArray, int simdSize)
{
- inArrayElementSize = (byte) Marshal.SizeOf<TOp1>();
- this.inArray = new byte[inArrayElementSize * 2];
this.outArray = new byte[simdSize * 2];
- this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.simdSize = unchecked((byte)(simdSize));
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<TOp1, byte>(ref inArray[0]), (uint)(2 * inArrayElementSize));
}
- public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), simdSize);
public void Dispose()
{
- inHandle.Free();
outHandle.Free();
}
@@ -53,7 +43,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest.template
index 8df00cedc1..1644045e8e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest.template
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = VectorSize / sizeof({Op2BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
}
public SimpleBinaryOpTest__{Method}{RetBaseType}()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- _dataTable = new SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
{Op2BaseType}[] inArray2 = new {Op2BaseType}[Op2ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest_DataTable.cs
index a1fc26e86c..ff80da4e88 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -59,7 +60,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest.template
index 6b62c21680..703578ff2c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest.template
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int Op2ElementCount = VectorSize / sizeof({Op2BaseType});
- private const int Op3ElementCount = VectorSize / sizeof({Op3BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>() / sizeof({Op2BaseType});
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<{Op3VectorType}<{Op3BaseType}>>() / sizeof({Op3BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
private static {Op2BaseType}[] _data2 = new {Op2BaseType}[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _clsVar2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = {NextValueOp3}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op3VectorType}<{Op3BaseType}>, byte>(ref _clsVar3), ref Unsafe.As<{Op3BaseType}, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op3VectorType}<{Op3BaseType}>, byte>(ref _clsVar3), ref Unsafe.As<{Op3BaseType}, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<{Op3VectorType}<{Op3BaseType}>>());
}
public SimpleTernaryOpTest__{Method}{RetBaseType}()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2VectorType}<{Op2BaseType}>, byte>(ref _fld2), ref Unsafe.As<{Op2BaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = {NextValueOp3}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op3VectorType}<{Op3BaseType}>, byte>(ref _fld3), ref Unsafe.As<{Op3BaseType}, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op3VectorType}<{Op3BaseType}>, byte>(ref _fld3), ref Unsafe.As<{Op3BaseType}, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<{Op3VectorType}<{Op3BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = {NextValueOp2}; }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = {NextValueOp3}; }
- _dataTable = new SimpleTernaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}, {Op3BaseType}>(_data1, _data2, _data3, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}, {Op3BaseType}>(_data1, _data2, _data3, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
{Op3BaseType}[] inArray3 = new {Op3BaseType}[Op3ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
{Op3BaseType}[] inArray3 = new {Op3BaseType}[Op3ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op3BaseType}, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op2BaseType}, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<{Op2VectorType}<{Op2BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op3BaseType}, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<{Op3VectorType}<{Op3BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest_DataTable.cs
index ab445ff5bd..8c6014509a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleTernOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -67,7 +68,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest.template
index ff0098aff2..d2bc824346 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest.template
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__{Method}{RetBaseType}
{
- private const int VectorSize = {VectorSize};
+ private static readonly int LargestVectorSize = {LargestVectorSize};
- private const int Op1ElementCount = VectorSize / sizeof({Op1BaseType});
- private const int RetElementCount = VectorSize / sizeof({RetBaseType});
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
private static {Op1BaseType}[] _data = new {Op1BaseType}[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
}
public SimpleUnaryOpTest__{Method}{RetBaseType}()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld), ref Unsafe.As<{Op1BaseType}, byte>(ref _data[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = {NextValueOp1}; }
- _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
public bool IsSupported => {Isa}.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
{Op1BaseType}[] inArray = new {Op1BaseType}[Op1ElementCount];
{RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest_DataTable.cs
index c4c9ddf830..5240a21919 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest_DataTable.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest_DataTable.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
@@ -51,7 +52,12 @@ namespace JIT.HardwareIntrinsics.X86
// to compute the aligned address.
var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
- return (void*)(buffer + misalignment);
+ var result = (void*)(buffer + misalignment);
+
+ Debug.Assert(((ulong)(result) % expectedAlignment) == 0);
+ Debug.Assert((ulong)(result) <= ((ulong)(result) + expectedAlignment));
+
+ return result;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Add.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Add.Single.cs
index 534445a08a..ea6ec79a1b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Add.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Add.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__AddSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/AddScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/AddScalar.Single.cs
index 1f82193694..a2b42bd243 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/AddScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/AddScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__AddScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/And.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/And.Single.cs
index 7601cdd34a..9dc28b1a26 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/And.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/And.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__AndSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/AndNot.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/AndNot.Single.cs
index 44a00de99a..842dca0de3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/AndNot.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/AndNot.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__AndNotSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqual.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqual.Single.cs
index 5ebe139b4e..41d365c4ea 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqual.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqual.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareEqualSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.Boolean.cs
index 51f4ce2dbd..28f81e3166 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareEqualOrderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareEqualOrderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualScalar.Single.cs
index e4adeb9e31..04f31d7364 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareEqualScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.Boolean.cs
index 135be02253..b2989738b7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareEqualUnorderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareEqualUnorderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThan.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThan.Single.cs
index 7fbceb2101..ffea1c1462 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThan.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThan.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareGreaterThanSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqual.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqual.Single.cs
index bcfd2ea8c3..cae02ca9fb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqual.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqual.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanOrEqualSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareGreaterThanOrEqualSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.Boolean.cs
index 08c508bb9a..2f82c7ba90 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareGreaterThanOrEqualOrderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareGreaterThanOrEqualOrderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualScalar.Single.cs
index a1282c17c5..0a36d79da3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanOrEqualScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareGreaterThanOrEqualScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.Boolean.cs
index 6cd9870696..157c1d6eb2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareGreaterThanOrEqualUnorderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareGreaterThanOrEqualUnorderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.Boolean.cs
index 772e1c50ca..f0160bf1a5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareGreaterThanOrderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareGreaterThanOrderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanScalar.Single.cs
index 356c99e469..56239855af 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareGreaterThanScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.Boolean.cs
index 02162413d8..7d4141f3da 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareGreaterThanUnorderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareGreaterThanUnorderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThan.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThan.Single.cs
index 85c177104c..f5f44bc1e5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThan.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThan.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareLessThanSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqual.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqual.Single.cs
index c991d755a3..95a355bd04 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqual.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqual.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanOrEqualSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareLessThanOrEqualSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.Boolean.cs
index 347564ee9e..2c79172c5a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareLessThanOrEqualOrderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareLessThanOrEqualOrderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualScalar.Single.cs
index 9ec5684236..576add2b4a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanOrEqualScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareLessThanOrEqualScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.Boolean.cs
index 28da15f675..ea632d0818 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareLessThanOrEqualUnorderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareLessThanOrEqualUnorderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.Boolean.cs
index 4c63ee8174..a5d49e26b2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareLessThanOrderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareLessThanOrderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanScalar.Single.cs
index d945eb7dce..e7de0dd0b4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareLessThanScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.Boolean.cs
index 1ae76a70e5..746bd511e8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareLessThanUnorderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareLessThanUnorderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqual.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqual.Single.cs
index 2bd0474828..6415345bff 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqual.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqual.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotEqualSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotEqualSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.Boolean.cs
index 9513f0db14..9e62c8181f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareNotEqualOrderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareNotEqualOrderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualScalar.Single.cs
index f9c9c58e87..68e085a707 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotEqualScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotEqualScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.Boolean.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.Boolean.cs
index f1c4a524da..d5cc0d00b9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.Boolean.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.Boolean.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__CompareNotEqualUnorderedScalarBoolean
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public BooleanComparisonOpTest__CompareNotEqualUnorderedScalarBoolean()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanComparisonOpTest__DataTable<Single, Single>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -265,8 +265,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThan.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThan.Single.cs
index 0f89ef1d82..f23de3ae9a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThan.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThan.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotGreaterThanSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotGreaterThanSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqual.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqual.Single.cs
index d3241ce214..b674df86d5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqual.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqual.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotGreaterThanOrEqualSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotGreaterThanOrEqualSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqualScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqualScalar.Single.cs
index 1979c767bd..ee86e1e2bd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqualScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanOrEqualScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotGreaterThanOrEqualScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotGreaterThanOrEqualScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanScalar.Single.cs
index 898c705e7b..cef197a6a5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotGreaterThanScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotGreaterThanScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotGreaterThanScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThan.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThan.Single.cs
index c9fb66920b..d27660d612 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThan.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThan.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotLessThanSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotLessThanSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqual.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqual.Single.cs
index 396b0856a0..6d1f1825c5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqual.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqual.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotLessThanOrEqualSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotLessThanOrEqualSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqualScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqualScalar.Single.cs
index c252cd2c6d..b5e33e77ed 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqualScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanOrEqualScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotLessThanOrEqualScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotLessThanOrEqualScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanScalar.Single.cs
index ab2c08232b..dda2565eab 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotLessThanScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotLessThanScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareNotLessThanScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrdered.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrdered.Single.cs
index c315cde29b..c61e9f0cfa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrdered.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrdered.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareOrderedSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareOrderedSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrderedScalar.Single.cs
index 4fad34423e..3b4a66b941 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrderedScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareOrderedScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareOrderedScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareOrderedScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnordered.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnordered.Single.cs
index 2fb8baa856..9523f100fa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnordered.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnordered.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareUnorderedSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareUnorderedSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnorderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnorderedScalar.Single.cs
index e932e69922..30545475ad 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnorderedScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareUnorderedScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareUnorderedScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CompareUnorderedScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Divide.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Divide.Single.cs
index f76217fa6c..1ad17ed7d3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Divide.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Divide.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__DivideSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__DivideSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/DivideScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/DivideScalar.Single.cs
index f49ea039fa..82ac08e2d6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/DivideScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/DivideScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__DivideScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__DivideScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Max.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Max.Single.cs
index c6a4c6c769..69a1112582 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Max.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Max.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__MaxSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/MaxScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/MaxScalar.Single.cs
index 75e2ff255e..7e025c9fdd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/MaxScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/MaxScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__MaxScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Min.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Min.Single.cs
index dd89a5b076..6387eefcc0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Min.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Min.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__MinSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/MinScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/MinScalar.Single.cs
index 0634f8b3a1..d6089109b4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/MinScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/MinScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__MinScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Multiply.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Multiply.Single.cs
index 99a71d038d..aab7bb9cd2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Multiply.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Multiply.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplySingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__MultiplySingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/MultiplyScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/MultiplyScalar.Single.cs
index 1f5ad0c7a8..fb730d8bef 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/MultiplyScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/MultiplyScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplyScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__MultiplyScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Or.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Or.Single.cs
index a092544a21..3d790f8f44 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Or.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Or.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__OrSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Subtract.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Subtract.Single.cs
index 57c4b5615b..2b1ce21a7c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Subtract.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Subtract.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__SubtractSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SubtractScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SubtractScalar.Single.cs
index 4a48af3624..fda05d7fdf 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SubtractScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SubtractScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__SubtractScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Xor.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Xor.Single.cs
index 8f9eedc376..6a7c1e9c23 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Xor.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Xor.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__XorSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Byte.cs
index ceb40a96ab..a15a98a6e5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__AddByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Double.cs
index 10e9c81b4a..de3e2519b5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__AddDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int16.cs
index 25ac20670f..505e04214e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__AddInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int32.cs
index 4938b62b02..55003509fd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__AddInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int64.cs
index 1074967e0a..4bc63205f2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__AddInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.SByte.cs
index f62dbd853f..d91ea41e55 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__AddSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt16.cs
index 9bb80adc1f..20801eee38 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__AddUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt32.cs
index d00d51322b..bc81f3af81 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__AddUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt64.cs
index b73a3a8f85..e41697a175 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Add.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__AddUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Byte.cs
index 4a22bcfac3..83f78493e8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSaturateByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__AddSaturateByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Int16.cs
index 7a463912c0..79f90d19c3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSaturateInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__AddSaturateInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.SByte.cs
index fc11e93456..f2df53ab15 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSaturateSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__AddSaturateSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.UInt16.cs
index f3ec17f0dc..b1578f7ec4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddSaturate.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddSaturateUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__AddSaturateUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddScalar.Double.cs
index 67d07d1c1a..191f88ed99 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AddScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AddScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__AddScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Byte.cs
index f3924f31a9..4160d32ae4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__AndByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Double.cs
index 71c4854eb1..6c91107c38 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__AndDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int16.cs
index 092c73a107..69e46925cc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__AndInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int32.cs
index 1a93262033..eb509cddb7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__AndInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int64.cs
index fa7d363a18..010cc8b9f5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__AndInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.SByte.cs
index 4afd964e85..ce671243c1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__AndSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt16.cs
index 0418698763..363cfe3e35 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__AndUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt32.cs
index b7eb74ffc1..51e5b7e3aa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__AndUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt64.cs
index 1003aa9c13..741c313538 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/And.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__AndUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Byte.cs
index 832a36452b..f0d111d61b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__AndNotByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Double.cs
index f469ea8aa3..c2fe12e454 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__AndNotDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int16.cs
index cd6edc32ab..dc41c4565a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__AndNotInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int32.cs
index a609d2d118..bdde65ae2d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__AndNotInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int64.cs
index e0a58e3270..34108a44bc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__AndNotInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.SByte.cs
index 051a6a5d73..d02e70af35 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__AndNotSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt16.cs
index 244b58a497..f5f4a0cb46 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__AndNotUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt32.cs
index 1b60c18221..c6c1716c08 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__AndNotUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt64.cs
index 6fcdc0b82d..565b71ca28 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/AndNot.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AndNotUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__AndNotUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.Byte.cs
index 11327ef082..f60ba8f852 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AverageByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__AverageByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.UInt16.cs
index a6cd504a7b..4735dc81aa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Average.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__AverageUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__AverageUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Byte.cs
index b9c107ad9a..f4717b2848 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__CompareEqualByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Double.cs
index 31d308d106..82800a5750 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareEqualDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int16.cs
index ec8247280e..2ba89e3ff7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__CompareEqualInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int32.cs
index 438d87310e..42a5be79c9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__CompareEqualInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.SByte.cs
index 9327cc116d..e497a9a367 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__CompareEqualSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt16.cs
index 1d1d92dc6a..951309a095 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__CompareEqualUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt32.cs
index 65a4372fa1..b44d47219c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareEqual.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__CompareEqualUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Double.cs
index d05ea8a3b7..d57c30a745 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareGreaterThanDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int16.cs
index 21f15db676..143878261a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__CompareGreaterThanInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int32.cs
index a5211eb3ed..9587d0d8f7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__CompareGreaterThanInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.SByte.cs
index 181d9d4146..cecf67fa9b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThan.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__CompareGreaterThanSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThanOrEqual.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThanOrEqual.Double.cs
index f366b4591d..fa4d06dfaa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThanOrEqual.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareGreaterThanOrEqual.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanOrEqualDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareGreaterThanOrEqualDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Double.cs
index 54a880f4e7..310f3d4e29 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareLessThanDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int16.cs
index a0e162d694..2b2b5f5140 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__CompareLessThanInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int32.cs
index fbaa85b7c7..cc4f8eefb5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__CompareLessThanInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.SByte.cs
index c11bb11933..9ce1350e71 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThan.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__CompareLessThanSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThanOrEqual.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThanOrEqual.Double.cs
index 2fcaf8ec0c..7cff72660f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThanOrEqual.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareLessThanOrEqual.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareLessThanOrEqualDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareLessThanOrEqualDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotEqual.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotEqual.Double.cs
index bdbc2d2cb7..0ba136f05b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotEqual.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotEqual.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotEqualDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareNotEqualDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThan.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThan.Double.cs
index c4bf1a7530..17de1547cb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThan.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThan.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotGreaterThanDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareNotGreaterThanDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThanOrEqual.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThanOrEqual.Double.cs
index 135c267291..6a625d04c7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThanOrEqual.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotGreaterThanOrEqual.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotGreaterThanOrEqualDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareNotGreaterThanOrEqualDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThan.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThan.Double.cs
index 7e09d7299d..869e08a279 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThan.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThan.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotLessThanDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareNotLessThanDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThanOrEqual.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThanOrEqual.Double.cs
index aba54b1d74..0666009ae5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThanOrEqual.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareNotLessThanOrEqual.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareNotLessThanOrEqualDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareNotLessThanOrEqualDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareOrdered.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareOrdered.Double.cs
index c0fcd14646..474ebc7ba1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareOrdered.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareOrdered.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareOrderedDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareOrderedDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareUnordered.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareUnordered.Double.cs
index 26f6215127..e38a939797 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareUnordered.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/CompareUnordered.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareUnorderedDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CompareUnorderedDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Divide.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Divide.Double.cs
index 5be2f34960..da4e34b77f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Divide.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Divide.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__DivideDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__DivideDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/DivideScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/DivideScalar.Double.cs
index 287b40b627..01f4d3be40 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/DivideScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/DivideScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__DivideScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__DivideScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.1.cs
index 3b3c5e1ab5..f2f11953ff 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ExtractInt161()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.129.cs
index 3a450f7922..e2d3a00135 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.Int16.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt16129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ExtractInt16129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.1.cs
index 24487a2dbb..4683cb8583 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ExtractUInt161()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.129.cs
index facafddf76..ce9513aa82 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Extract.UInt16.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt16129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ExtractUInt16129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.1.cs
index 90d8edb9a6..0f2f4e6823 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__InsertInt161()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.129.cs
index d488389ec3..619d91856e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.Int16.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt16129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__InsertInt16129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.1.cs
index 3f5b2704bd..70b29d1e3b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__InsertUInt161()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.129.cs
index 09e4c6933d..2c16bc861f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Insert.UInt16.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt16129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__InsertUInt16129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Byte.cs
index cad2cafc16..7224345858 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__MaxByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Double.cs
index b282c730d0..52a2920f98 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__MaxDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Int16.cs
index 4d022ed9b2..c60ad296a2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Max.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__MaxInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaxScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaxScalar.Double.cs
index 3030073569..0f72b2e122 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaxScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaxScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__MaxScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Byte.cs
index 872f85c62e..6670eaee78 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MinValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MinValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__MinByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MinValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MinValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MinValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MinValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Double.cs
index 49eda34e59..17ed799177 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__MinDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Int16.cs
index b3e86cc8ba..b9a1a1ef2c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Min.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MinValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MinValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__MinInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MinValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MinValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MinValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MinValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MinScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MinScalar.Double.cs
index f63a9208fa..81ddf32e02 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MinScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MinScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__MinScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Byte.cs
index 8507e514bc..bef832700a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Byte.cs
@@ -76,11 +76,14 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplyByte
{
- private const int VectorSize = 16;
- private const int ElementCount = VectorSize / sizeof(Byte);
-
- private static Byte[] _data1 = new Byte[ElementCount];
- private static Byte[] _data2 = new Byte[ElementCount];
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ private static Byte[] _data1 = new Byte[Op1ElementCount];
+ private static Byte[] _data2 = new Byte[Op2ElementCount];
private static Vector128<Byte> _clsVar1;
private static Vector128<Byte> _clsVar2;
@@ -94,9 +97,10 @@ namespace JIT.HardwareIntrinsics.X86
{
var random = new Random();
- for (var i = 0; i < ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data2[0]), Unsafe.SizeOf<Vector128<UInt16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data1[0]), Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__MultiplyByte()
@@ -105,12 +109,14 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
- for (var i = 0; i < ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), Unsafe.SizeOf<Vector128<UInt16>>());
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), Unsafe.SizeOf<Vector128<UInt16>>());
- for (var i = 0; i < ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte>(_data1, _data2, new Byte[ElementCount], VectorSize);
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -260,26 +266,26 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(Vector128<Byte> left, Vector128<Byte> right, void* result, [CallerMemberName] string method = "")
{
- Byte[] inArray1 = new Byte[ElementCount];
- Byte[] inArray2 = new Byte[ElementCount];
- Byte[] outArray = new Byte[ElementCount];
+ Byte[] inArray1 = new Byte[Op1ElementCount];
+ Byte[] inArray2 = new Byte[Op2ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "")
{
- Byte[] inArray1 = new Byte[ElementCount];
- Byte[] inArray2 = new Byte[ElementCount];
- Byte[] outArray = new Byte[ElementCount];
+ Byte[] inArray1 = new Byte[Op1ElementCount];
+ Byte[] inArray2 = new Byte[Op2ElementCount];
+ Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Double.cs
index 01495135d5..5adb4d14a4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Multiply.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplyDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__MultiplyDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MultiplyScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MultiplyScalar.Double.cs
index 9c8a27c3bd..7be0a029d0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MultiplyScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MultiplyScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplyScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__MultiplyScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Byte.cs
index ff638cf3f7..af8e8c098e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__OrByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Double.cs
index 72f6c5651e..7c8eeb8dd8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__OrDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int16.cs
index 898a63a377..eae8b5f433 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__OrInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int32.cs
index 674e8e6bdc..32d05fefb4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__OrInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int64.cs
index 3e15eac690..8570ab158b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__OrInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.SByte.cs
index cffcbb6579..7775bc0812 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__OrSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt16.cs
index 643ab5b8d3..0f2aa04bdc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__OrUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt32.cs
index a981df138b..4a9234c9a3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__OrUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt64.cs
index eb8c2d67aa..9403d32eb7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Or.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__OrUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__OrUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs
index a5a197e3fa..010cd2629a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128Byte()
{
- bool skipIf32Bit = typeof(Byte) == typeof(Int64) ? true :
- typeof(Byte) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(Byte) == typeof(Int64)) ||
+ (typeof(Byte) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128Byte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
- private static Byte[] _data = new Byte[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static Byte _clsVar;
private Byte _fld;
- private SimpleScalarUnaryOpTest__DataTable<Byte, Byte> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<Byte> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128Byte()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Marshal.SizeOf<Byte>());
+ _clsVar = (byte)(Random.Next(byte.MinValue, byte.MaxValue));
}
public SimpleScalarUnaryOpTest__SetAllVector128Byte()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Marshal.SizeOf<Byte>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (byte)(random.Next(byte.MinValue, byte.MaxValue));
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _fld = (byte)(Random.Next(byte.MinValue, byte.MaxValue));
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<Byte>(new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = (byte)(Random.Next(byte.MinValue, byte.MaxValue));
var result = Sse2.SetAllVector128(
- Unsafe.Read<Byte>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Byte) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<Byte>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = (byte)(Random.Next(byte.MinValue, byte.MaxValue));
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Byte) });
- Byte parameter = (Byte) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Byte>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<Byte>(_dataTable.inArrayPtr);
+ var firstOp = (byte)(Random.Next(byte.MinValue, byte.MaxValue));
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(Byte firstOp, void* result, [CallerMemberName] string method = "")
{
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(Byte firstOp, Byte[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs
index 323c057290..190d30661c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128Double()
{
- bool skipIf32Bit = typeof(Double) == typeof(Int64) ? true :
- typeof(Double) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(Double) == typeof(Int64)) ||
+ (typeof(Double) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128Double
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
- private static Double[] _data = new Double[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static Double _clsVar;
private Double _fld;
- private SimpleScalarUnaryOpTest__DataTable<Double, Double> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<Double> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128Double()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = random.NextDouble();
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Marshal.SizeOf<Double>());
+ _clsVar = Random.NextDouble();
}
public SimpleScalarUnaryOpTest__SetAllVector128Double()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = random.NextDouble();
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Marshal.SizeOf<Double>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = random.NextDouble();
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _fld = Random.NextDouble();
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<Double>(new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = Random.NextDouble();
var result = Sse2.SetAllVector128(
- Unsafe.Read<Double>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Double) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<Double>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = Random.NextDouble();
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Double) });
- Double parameter = (Double) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<Double>(_dataTable.inArrayPtr);
+ var firstOp = Random.NextDouble();
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(Double firstOp, void* result, [CallerMemberName] string method = "")
{
- Double[] inArray = new Double[Op1ElementCount];
- Double[] outArray = new Double[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(Double[] firstOp, Double[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(Double firstOp, Double[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs
index a8bbab56f8..43d9a83388 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128Int16()
{
- bool skipIf32Bit = typeof(Int16) == typeof(Int64) ? true :
- typeof(Int16) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(Int16) == typeof(Int64)) ||
+ (typeof(Int16) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128Int16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
- private static Int16[] _data = new Int16[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static Int16 _clsVar;
private Int16 _fld;
- private SimpleScalarUnaryOpTest__DataTable<Int16, Int16> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<Int16> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128Int16()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (short)(random.Next(short.MinValue, short.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Marshal.SizeOf<Int16>());
+ _clsVar = (short)(Random.Next(short.MinValue, short.MaxValue));
}
public SimpleScalarUnaryOpTest__SetAllVector128Int16()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (short)(random.Next(short.MinValue, short.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Marshal.SizeOf<Int16>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (short)(random.Next(short.MinValue, short.MaxValue));
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _fld = (short)(Random.Next(short.MinValue, short.MaxValue));
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<Int16>(new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = (short)(Random.Next(short.MinValue, short.MaxValue));
var result = Sse2.SetAllVector128(
- Unsafe.Read<Int16>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int16) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<Int16>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = (short)(Random.Next(short.MinValue, short.MaxValue));
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int16) });
- Int16 parameter = (Int16) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int16>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<Int16>(_dataTable.inArrayPtr);
+ var firstOp = (short)(Random.Next(short.MinValue, short.MaxValue));
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(Int16 firstOp, void* result, [CallerMemberName] string method = "")
{
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(Int16 firstOp, Int16[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs
index 033a4498f2..9ebad56657 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128Int32()
{
- bool skipIf32Bit = typeof(Int32) == typeof(Int64) ? true :
- typeof(Int32) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(Int32) == typeof(Int64)) ||
+ (typeof(Int32) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128Int32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
- private static Int32[] _data = new Int32[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static Int32 _clsVar;
private Int32 _fld;
- private SimpleScalarUnaryOpTest__DataTable<Int32, Int32> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<Int32> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128Int32()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (int)(random.Next(int.MinValue, int.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Marshal.SizeOf<Int32>());
+ _clsVar = (int)(Random.Next(int.MinValue, int.MaxValue));
}
public SimpleScalarUnaryOpTest__SetAllVector128Int32()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (int)(random.Next(int.MinValue, int.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Marshal.SizeOf<Int32>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (int)(random.Next(int.MinValue, int.MaxValue));
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _fld = (int)(Random.Next(int.MinValue, int.MaxValue));
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<Int32>(new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = (int)(Random.Next(int.MinValue, int.MaxValue));
var result = Sse2.SetAllVector128(
- Unsafe.Read<Int32>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int32) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<Int32>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = (int)(Random.Next(int.MinValue, int.MaxValue));
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int32) });
- Int32 parameter = (Int32) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<Int32>(_dataTable.inArrayPtr);
+ var firstOp = (int)(Random.Next(int.MinValue, int.MaxValue));
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(Int32 firstOp, void* result, [CallerMemberName] string method = "")
{
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(Int32 firstOp, Int32[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs
index 297ed3d220..c97deb51c0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128Int64()
{
- bool skipIf32Bit = typeof(Int64) == typeof(Int64) ? true :
- typeof(Int64) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(Int64) == typeof(Int64)) ||
+ (typeof(Int64) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128Int64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
- private static Int64[] _data = new Int64[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static Int64 _clsVar;
private Int64 _fld;
- private SimpleScalarUnaryOpTest__DataTable<Int64, Int64> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<Int64> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128Int64()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (long)(random.Next(int.MinValue, int.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Marshal.SizeOf<Int64>());
+ _clsVar = (long)(Random.Next(int.MinValue, int.MaxValue));
}
public SimpleScalarUnaryOpTest__SetAllVector128Int64()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (long)(random.Next(int.MinValue, int.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Marshal.SizeOf<Int64>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (long)(random.Next(int.MinValue, int.MaxValue));
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _fld = (long)(Random.Next(int.MinValue, int.MaxValue));
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<Int64>(new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = (long)(Random.Next(int.MinValue, int.MaxValue));
var result = Sse2.SetAllVector128(
- Unsafe.Read<Int64>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int64) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<Int64>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = (long)(Random.Next(int.MinValue, int.MaxValue));
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int64) });
- Int64 parameter = (Int64) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int64>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<Int64>(_dataTable.inArrayPtr);
+ var firstOp = (long)(Random.Next(int.MinValue, int.MaxValue));
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(Int64 firstOp, void* result, [CallerMemberName] string method = "")
{
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(Int64 firstOp, Int64[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs
index a5a0f5d188..355d90bd96 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128SByte()
{
- bool skipIf32Bit = typeof(SByte) == typeof(Int64) ? true :
- typeof(SByte) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(SByte) == typeof(Int64)) ||
+ (typeof(SByte) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128SByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
- private static SByte[] _data = new SByte[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static SByte _clsVar;
private SByte _fld;
- private SimpleScalarUnaryOpTest__DataTable<SByte, SByte> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<SByte> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128SByte()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Marshal.SizeOf<SByte>());
+ _clsVar = (sbyte)(Random.Next(sbyte.MinValue, sbyte.MaxValue));
}
public SimpleScalarUnaryOpTest__SetAllVector128SByte()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Marshal.SizeOf<SByte>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue));
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _fld = (sbyte)(Random.Next(sbyte.MinValue, sbyte.MaxValue));
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<SByte>(new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = (sbyte)(Random.Next(sbyte.MinValue, sbyte.MaxValue));
var result = Sse2.SetAllVector128(
- Unsafe.Read<SByte>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(SByte) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<SByte>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = (sbyte)(Random.Next(sbyte.MinValue, sbyte.MaxValue));
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(SByte) });
- SByte parameter = (SByte) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<SByte>(_dataTable.inArrayPtr);
+ var firstOp = (sbyte)(Random.Next(sbyte.MinValue, sbyte.MaxValue));
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(SByte firstOp, void* result, [CallerMemberName] string method = "")
{
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(SByte firstOp, SByte[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs
index 7db4dcc036..b11e3362de 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128UInt16()
{
- bool skipIf32Bit = typeof(UInt16) == typeof(Int64) ? true :
- typeof(UInt16) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(UInt16) == typeof(Int64)) ||
+ (typeof(UInt16) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128UInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
- private static UInt16[] _data = new UInt16[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static UInt16 _clsVar;
private UInt16 _fld;
- private SimpleScalarUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<UInt16> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128UInt16()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (ushort)(random.Next(ushort.MinValue, ushort.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Marshal.SizeOf<UInt16>());
+ _clsVar = (ushort)(Random.Next(ushort.MinValue, ushort.MaxValue));
}
public SimpleScalarUnaryOpTest__SetAllVector128UInt16()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (ushort)(random.Next(ushort.MinValue, ushort.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Marshal.SizeOf<UInt16>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (ushort)(random.Next(ushort.MinValue, ushort.MaxValue));
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _fld = (ushort)(Random.Next(ushort.MinValue, ushort.MaxValue));
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<UInt16>(new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = (ushort)(Random.Next(ushort.MinValue, ushort.MaxValue));
var result = Sse2.SetAllVector128(
- Unsafe.Read<UInt16>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt16) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<UInt16>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = (ushort)(Random.Next(ushort.MinValue, ushort.MaxValue));
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt16) });
- UInt16 parameter = (UInt16) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<UInt16>(_dataTable.inArrayPtr);
+ var firstOp = (ushort)(Random.Next(ushort.MinValue, ushort.MaxValue));
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(UInt16 firstOp, void* result, [CallerMemberName] string method = "")
{
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(UInt16 firstOp, UInt16[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs
index 4bc9879439..548cf6e4a1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128UInt32()
{
- bool skipIf32Bit = typeof(UInt32) == typeof(Int64) ? true :
- typeof(UInt32) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(UInt32) == typeof(Int64)) ||
+ (typeof(UInt32) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128UInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
- private static UInt32[] _data = new UInt32[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static UInt32 _clsVar;
private UInt32 _fld;
- private SimpleScalarUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<UInt32> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128UInt32()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (uint)(random.Next(0, int.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Marshal.SizeOf<UInt32>());
+ _clsVar = (uint)(Random.Next(0, int.MaxValue));
}
public SimpleScalarUnaryOpTest__SetAllVector128UInt32()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (uint)(random.Next(0, int.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Marshal.SizeOf<UInt32>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (uint)(random.Next(0, int.MaxValue));
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _fld = (uint)(Random.Next(0, int.MaxValue));
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<UInt32>(new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = (uint)(Random.Next(0, int.MaxValue));
var result = Sse2.SetAllVector128(
- Unsafe.Read<UInt32>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt32) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<UInt32>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = (uint)(Random.Next(0, int.MaxValue));
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt32) });
- UInt32 parameter = (UInt32) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<UInt32>(_dataTable.inArrayPtr);
+ var firstOp = (uint)(Random.Next(0, int.MaxValue));
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(UInt32 firstOp, void* result, [CallerMemberName] string method = "")
{
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(UInt32 firstOp, UInt32[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs
index 5a4dbd3b50..3881ae6726 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs
@@ -21,8 +21,8 @@ namespace JIT.HardwareIntrinsics.X86
{
private static void SetAllVector128UInt64()
{
- bool skipIf32Bit = typeof(UInt64) == typeof(Int64) ? true :
- typeof(UInt64) == typeof(UInt64) ? true : false;
+ bool skipIf32Bit = (typeof(UInt64) == typeof(Int64)) ||
+ (typeof(UInt64) == typeof(UInt64));
if (skipIf32Bit && !Environment.Is64BitProcess)
{
@@ -33,23 +33,17 @@ namespace JIT.HardwareIntrinsics.X86
if (test.IsSupported)
{
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
+ // Validates basic functionality works
+ test.RunBasicScenario();
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario();
- }
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
// Validates passing a static member works
test.RunClsVarScenario();
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
+ // Validates passing a local works
+ test.RunLclVarScenario();
// Validates passing the field of a local works
test.RunLclFldScenario();
@@ -72,83 +66,54 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleScalarUnaryOpTest__SetAllVector128UInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = 2;
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
- private static UInt64[] _data = new UInt64[Op1ElementCount];
+ private static readonly Random Random = new Random();
private static UInt64 _clsVar;
private UInt64 _fld;
- private SimpleScalarUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
+ private SimpleScalarUnaryOpTest__DataTable<UInt64> _dataTable;
static SimpleScalarUnaryOpTest__SetAllVector128UInt64()
{
- var random = new Random();
-
- for (int i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (ulong)(random.Next(0, int.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Marshal.SizeOf<UInt64>());
+ _clsVar = (ulong)(Random.Next(0, int.MaxValue));
}
public SimpleScalarUnaryOpTest__SetAllVector128UInt64()
{
Succeeded = true;
- var random = new Random();
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (ulong)(random.Next(0, int.MaxValue));
- }
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Marshal.SizeOf<UInt64>());
-
- for (var i = 0; i < Op1ElementCount; i++)
- {
- _data[i] = (ulong)(random.Next(0, int.MaxValue));
- }
-
- _dataTable = new SimpleScalarUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _fld = (ulong)(Random.Next(0, int.MaxValue));
+ _dataTable = new SimpleScalarUnaryOpTest__DataTable<UInt64>(new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
- public void RunBasicScenario_UnsafeRead()
+ public void RunBasicScenario()
{
+ var firstOp = (ulong)(Random.Next(0, int.MaxValue));
var result = Sse2.SetAllVector128(
- Unsafe.Read<UInt64>(_dataTable.inArrayPtr)
+ firstOp
);
Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt64) });
- var result = method.Invoke(null, new object[] { Unsafe.Read<UInt64>(_dataTable.inArrayPtr)});
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunReflectionScenario()
{
+ var firstOp = (ulong)(Random.Next(0, int.MaxValue));
var method = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt64) });
- UInt64 parameter = (UInt64) _dataTable.inArray[0];
- var result = method.Invoke(null, new object[] { parameter });
+ var result = method.Invoke(null, new object[] { firstOp });
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result));
- ValidateResult(parameter, _dataTable.outArrayPtr);
+ ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
@@ -161,9 +126,9 @@ namespace JIT.HardwareIntrinsics.X86
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
- public void RunLclVarScenario_UnsafeRead()
+ public void RunLclVarScenario()
{
- var firstOp = Unsafe.Read<UInt64>(_dataTable.inArrayPtr);
+ var firstOp = (ulong)(Random.Next(0, int.MaxValue));
var result = Sse2.SetAllVector128(firstOp);
Unsafe.Write(_dataTable.outArrayPtr, result);
@@ -193,7 +158,7 @@ namespace JIT.HardwareIntrinsics.X86
try
{
- RunBasicScenario_UnsafeRead();
+ RunBasicScenario();
}
catch (PlatformNotSupportedException)
{
@@ -203,29 +168,16 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(UInt64 firstOp, void* result, [CallerMemberName] string method = "")
{
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
- ValidateResult(inArray, outArray, method);
+ ValidateResult(firstOp, outArray, method);
}
- private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
+ private void ValidateResult(UInt64 firstOp, UInt64[] result, [CallerMemberName] string method = "")
{
- if (result[0] != firstOp[0])
+ if (result[0] != firstOp)
{
Succeeded = false;
}
@@ -233,7 +185,7 @@ namespace JIT.HardwareIntrinsics.X86
{
for (var i = 1; i < RetElementCount; i++)
{
- if (result[i] != firstOp[0])
+ if (result[i] != firstOp)
{
Succeeded = false;
break;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.1.cs
index 923650f35d..58a8d25f4c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.16.cs
index 4247066bb8..2d0c6df18d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt1616
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.1.cs
index cb889f0db8..24a390ecc8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.32.cs
index 33b2d587c3..2e83c1c95a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt3232
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.1.cs
index 0f9b881608..45cc4d0e72 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.64.cs
index 35bb98c15b..39591dfb91 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.Int64.64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalInt6464
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalInt6464()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.1.cs
index 54345fcbb7..a701aaa765 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.16.cs
index d8afd389ab..f1a6b7451b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt1616
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.1.cs
index 8ce9abf18e..bf9223cdad 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.32.cs
index 14ae467c02..3cce6d0bba 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt3232
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.1.cs
index 96adcee208..0c55130706 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.64.cs
index f1c0d36018..14a737bf91 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical.UInt64.64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogicalUInt6464
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogicalUInt6464()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Byte.1.cs
index 740d827e43..f7f792cea4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Byte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneByte1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int16.1.cs
index 59e9baa436..b0f048dbc5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int32.1.cs
index b97429190e..ffb3330874 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int64.1.cs
index 4c9e1f349c..9473a37f02 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.SByte.1.cs
index 7db3c44e83..a45eb1ec08 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.SByte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneSByte1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneSByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt16.1.cs
index 7262558556..21d868141c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt32.1.cs
index d9f8e932b5..0ed76400d7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt64.1.cs
index 9bdb404d2f..fce9edd57d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftLeftLogical128BitLane.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ShiftLeftLogical128BitLaneUInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.1.cs
index 47b0e2cf67..77661070b1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightArithmeticInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightArithmeticInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.16.cs
index 48e5524e67..ae94e8cc4e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightArithmeticInt1616
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightArithmeticInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.1.cs
index b6370ade18..d0a8f72966 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightArithmeticInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightArithmeticInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.32.cs
index 5a0fba1d77..74edfe1dc8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightArithmetic.Int32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightArithmeticInt3232
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightArithmeticInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.1.cs
index ef050e5474..40d3f043dd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.16.cs
index 54b9dfe2a0..528e674bc7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt1616
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(0, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.1.cs
index a9c87d5cbd..72bc20b35d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.32.cs
index db62c8284a..65c0a1dbf2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt3232
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.1.cs
index a307b6bc27..3c5806c59f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.64.cs
index ec3026ddbc..c3b9f43beb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int64.64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalInt6464
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalInt6464()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.1.cs
index 06f508f9e2..09dae4f4c1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.16.cs
index e275bc6830..5a1834ab58 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt16.16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt1616
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt1616()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.1.cs
index d33f3f5847..9f72c36ec7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.32.cs
index 35c4c106d3..a9b488a186 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt32.32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt3232
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt3232()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.1.cs
index d9ded20263..b7b06facf6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.64.cs
index 0665bf0eb0..a240f3c135 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.UInt64.64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogicalUInt6464
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ShiftRightLogicalUInt6464()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Byte.1.cs
index 0887871211..4629e10551 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Byte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneByte1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int16.1.cs
index fc3930bd01..ae70e60011 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int32.1.cs
index 19cfbbd1b0..8e2b7b006a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int64.1.cs
index c061f03364..5ad3c2e285 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.Int64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.SByte.1.cs
index 86d78e109f..a90ee473cc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.SByte.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneSByte1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneSByte1()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt16.1.cs
index c8ed4495fa..71217bd456 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt16.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt16.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt161
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt161()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt32.1.cs
index 60275e5534..a0e439f664 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt32.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt321()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt64.1.cs
index c667802dc9..55e9d47418 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical128BitLane.UInt64.1.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ShiftRightLogical128BitLaneUInt641()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)8; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -266,8 +266,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Byte.cs
index 205e1f7bb8..c8de3ae5a5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__SubtractByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Double.cs
index 0ebd0f14da..98c5826e16 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__SubtractDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int16.cs
index 500297f9cd..0906300e61 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__SubtractInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int32.cs
index 061f315941..7c2dc5dbf1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__SubtractInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int64.cs
index f83b1a2ce3..5a67978f7f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__SubtractInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.SByte.cs
index 4eb10c2b35..54f955b377 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__SubtractSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt16.cs
index 0ac431e7fb..8e16038192 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__SubtractUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt32.cs
index 1647d0b1fa..263c3531d4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__SubtractUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt64.cs
index 0f1d080da9..fa62449631 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Subtract.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__SubtractUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Byte.cs
index be63a5ff6b..2f72bb0d86 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractSaturateByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__SubtractSaturateByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Int16.cs
index 6429111d9c..9d9e2a5516 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractSaturateInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__SubtractSaturateInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.SByte.cs
index 857f930dfa..2afaabd494 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractSaturateSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__SubtractSaturateSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.UInt16.cs
index 7f21b4b8f3..c7d80e1d82 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractSaturate.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractSaturateUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__SubtractSaturateUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(ushort.MinValue,ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractScalar.Double.cs
index 53953811af..eb9aeefd0d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SubtractScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SubtractScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__SubtractScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Byte.cs
index f7a7f469b0..7ca399c522 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Byte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__XorByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Double.cs
index 479399f36c..1b0f5bc46b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__XorDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int16.cs
index c6756e80f9..28a768f7cb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__XorInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int32.cs
index dd20fb5351..2a3d6f78bd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__XorInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int64.cs
index a7515744c6..6c2fc07308 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__XorInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.SByte.cs
index d9be054c46..5edc54402f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__XorSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt16.cs
index 687351b893..63888399a2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__XorUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt32.cs
index ddf6feca11..65625241b4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__XorUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt64.cs
index 720c11f03a..7cbf13db5e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Xor.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__XorUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__XorUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse2.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Double.cs
index 420097c5f5..19afb61f20 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class AlternatingBinaryOpTest__AddSubtractDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public AlternatingBinaryOpTest__AddSubtractDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new AlternatingBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new AlternatingBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Single.cs
index a5a1b4e5af..8021924e07 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/AddSubtract.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class AlternatingBinaryOpTest__AddSubtractSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public AlternatingBinaryOpTest__AddSubtractSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new AlternatingBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new AlternatingBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Double.cs
index ee0c9b37c0..432d3b5c87 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalAddDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public HorizontalBinaryOpTest__HorizontalAddDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Double[] left, Double[] right, Double[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Double)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Single.cs
index ddcd847b70..4ade0e035d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalAdd.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalAddSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public HorizontalBinaryOpTest__HorizontalAddSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Single[] left, Single[] right, Single[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Single)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Double.cs
index 2363341167..823fa9f4b5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalSubtractDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public HorizontalBinaryOpTest__HorizontalSubtractDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Double[] left, Double[] right, Double[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Double)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Single.cs
index 1818e3f8b6..2a7a413085 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse3/HorizontalSubtract.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalSubtractSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public HorizontalBinaryOpTest__HorizontalSubtractSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Single[] left, Single[] right, Single[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Single)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Byte.cs
index 83d013da28..99ff3ef49c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Byte.cs
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__BlendVariableByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int Op3ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (byte)(((i % 2) == 0) ? 128 : 1); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar3), ref Unsafe.As<Byte, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar3), ref Unsafe.As<Byte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleTernaryOpTest__BlendVariableByte()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (byte)(((i % 2) == 0) ? 128 : 1); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld3), ref Unsafe.As<Byte, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld3), ref Unsafe.As<Byte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (byte)(((i % 2) == 0) ? 128 : 1); }
- _dataTable = new SimpleTernaryOpTest__DataTable<Byte, Byte, Byte, Byte>(_data1, _data2, _data3, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<Byte, Byte, Byte, Byte>(_data1, _data2, _data3, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray3 = new Byte[Op3ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray3 = new Byte[Op3ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Double.cs
index 780323bc33..24f57157dc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Double.cs
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__BlendVariableDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int Op3ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(((i % 2) == 0) ? -0.0 : 1.0); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar3), ref Unsafe.As<Double, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleTernaryOpTest__BlendVariableDouble()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(((i % 2) == 0) ? -0.0 : 1.0); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld3), ref Unsafe.As<Double, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(((i % 2) == 0) ? -0.0 : 1.0); }
- _dataTable = new SimpleTernaryOpTest__DataTable<Double, Double, Double, Double>(_data1, _data2, _data3, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<Double, Double, Double, Double>(_data1, _data2, _data3, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray3 = new Double[Op3ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray3 = new Double[Op3ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.SByte.cs
index e1dd0cbd27..fcbbb7dda2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.SByte.cs
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__BlendVariableSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int Op3ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar3), ref Unsafe.As<SByte, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar3), ref Unsafe.As<SByte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleTernaryOpTest__BlendVariableSByte()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld3), ref Unsafe.As<SByte, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld3), ref Unsafe.As<SByte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); }
- _dataTable = new SimpleTernaryOpTest__DataTable<SByte, SByte, SByte, SByte>(_data1, _data2, _data3, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<SByte, SByte, SByte, SByte>(_data1, _data2, _data3, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray3 = new SByte[Op3ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray3 = new SByte[Op3ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Single.cs
index d588508e67..e1b2263d3c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Single.cs
@@ -85,12 +85,12 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleTernaryOpTest__BlendVariableSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int Op3ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -111,11 +111,11 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(((i % 2) == 0) ? -0.0 : 1.0); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar3), ref Unsafe.As<Single, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleTernaryOpTest__BlendVariableSingle()
@@ -125,16 +125,16 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(((i % 2) == 0) ? -0.0 : 1.0); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld3), ref Unsafe.As<Single, byte>(ref _data3[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld3), ref Unsafe.As<Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(((i % 2) == 0) ? -0.0 : 1.0); }
- _dataTable = new SimpleTernaryOpTest__DataTable<Single, Single, Single, Single>(_data1, _data2, _data3, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleTernaryOpTest__DataTable<Single, Single, Single, Single>(_data1, _data2, _data3, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -299,10 +299,10 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray3 = new Single[Op3ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), firstOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), secondOp);
- Unsafe.Write(Unsafe.AsPointer(ref inArray3[0]), thirdOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), firstOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), secondOp);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), thirdOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
@@ -314,10 +314,10 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray3 = new Single[Op3ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(thirdOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Double.cs
index bf992e8dc2..34a80ca358 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__CeilingDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__CeilingDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Single.cs
index 55a154f438..3638f258a4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Ceiling.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__CeilingSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__CeilingSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Double.cs
index be34065c6c..ab1f72df7c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CeilingScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__CeilingScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Single.cs
index 062e94977e..0f26dd152e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CeilingScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CeilingScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__CeilingScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.Int64.cs
index 7da279a1a2..ddfb665df7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__CompareEqualInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.UInt64.cs
index 970b5dc5d0..ac372c3901 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/CompareEqual.UInt64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareEqualUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleBinaryOpTest__CompareEqualUInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt64, UInt64, UInt64>(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray2 = new UInt64[Op2ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.Byte.cs
index 724262161a..67ee09b11d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int16Byte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int16Byte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Byte>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Byte>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.SByte.cs
index 4d98935107..8f4ea820dd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int16.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int16SByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int16SByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, SByte>(_data, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int16, SByte>(_data, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Byte.cs
index 0b51a421ad..f48f8d48e9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int32Byte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int32Byte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Byte>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Byte>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Int16.cs
index 86a7eaa48d..ed1d1ee976 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int32Int16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int32Int16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int16>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int16>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.SByte.cs
index 43e389b2d4..73f87e4e42 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int32SByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int32SByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, SByte>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, SByte>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.UInt16.cs
index a2ca6846c4..27976d60b0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int32.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int32UInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int32UInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, UInt16>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, UInt16>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Byte.cs
index 0e51ba138d..63ea6c7c34 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int64Byte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int64Byte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Byte>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Byte>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int16.cs
index b631e92532..fa76d77890 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int64Int16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int64Int16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int16>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int16>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int32.cs
index 34e5d02890..870ad738a3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int64Int32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int64Int32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int32>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int32>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.SByte.cs
index 519070152a..ba2859cc68 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int64SByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int64SByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, SByte>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, SByte>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt16.cs
index afb456fd24..1ea8e06a20 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int64UInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int64UInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, UInt16>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, UInt16>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt32.cs
index 5eb6e4e693..9e58baad22 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128Int64.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ConvertToVector128Int64UInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ConvertToVector128Int64UInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, UInt32>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, UInt32>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.1.cs
index e5583d322b..da59ecd7ed 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractByte1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__ExtractByte1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.129.cs
index 9b2072b925..8cc0b1c3c9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Byte.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractByte129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__ExtractByte129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.1.cs
index 5635609eb4..3e78afdbc0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ExtractInt321()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.129.cs
index c1e0f4500e..d8c9565bdf 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int32.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt32129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__ExtractInt32129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.1.cs
index 4f4fb7d109..1e6f97bcf1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ExtractInt641()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.129.cs
index 15a11cb65e..948c09a72c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractInt64129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__ExtractInt64129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.1.cs
index 73bd616b67..8265030323 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractSByte1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__ExtractSByte1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.129.cs
index 219bdc47ab..f4c2258f66 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.SByte.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractSByte129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__ExtractSByte129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(0, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.1.cs
index 4315fda964..d82cd423b6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractSingle1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__ExtractSingle1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.129.cs
index 78b40d049c..f9d6e7bef7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Single.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractSingle129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__ExtractSingle129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.1.cs
index 1545207481..0e9cf6807b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ExtractUInt321()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.129.cs
index 3d38f36744..95182b0ca3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt32.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt32129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__ExtractUInt32129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.1.cs
index f7e3300162..c67da3dece 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ExtractUInt641()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.129.cs
index 53d42020da..0a8598ab78 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__ExtractUInt64129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__ExtractUInt64129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -273,8 +273,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -284,8 +284,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Double.cs
index f2325436ff..9be27a2cd2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__FloorDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__FloorDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Single.cs
index 19d2d55e91..125584edf6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Floor.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__FloorSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__FloorSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Double.cs
index 6de23a8740..1a2b520655 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__FloorScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__FloorScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Single.cs
index 2b3d9f0d35..d646f4b320 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/FloorScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__FloorScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__FloorScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.1.cs
index 173d44e91f..d5e06087cd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertByte1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__InsertByte1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.129.cs
index 26d0b8ab47..80cbdb80d3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Byte.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertByte129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleUnaryOpTest__InsertByte129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.1.cs
index 404cbb56a0..6cb04a42fd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__InsertInt321()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.129.cs
index d5d09c4d04..000fab8ff6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int32.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt32129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__InsertInt32129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.1.cs
index ff48f25b03..bf125e848f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__InsertInt641()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.129.cs
index ff396b3fe1..15a1495116 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertInt64129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleUnaryOpTest__InsertInt64129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray = new Int64[Op1ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.1.cs
index bec049220f..f58c0f12c0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertSByte1
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__InsertSByte1()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.129.cs
index d1c339b99c..168a59a002 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.SByte.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertSByte129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__InsertSByte129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.0.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.0.cs
index 294fb0ecb9..13d060d7b0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.0.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.0.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertSingle0
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__InsertSingle0()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.217.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.217.cs
index 7b3fcc762c..64872177fd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.217.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Single.217.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertSingle217
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__InsertSingle217()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.1.cs
index 4568cc8916..b5814ef976 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt321
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__InsertUInt321()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.129.cs
index 060909cbfe..4109ba3e56 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt32.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt32129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleUnaryOpTest__InsertUInt32129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.1.cs
index 966c3ab247..c923ee1ad7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.1.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt641
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__InsertUInt641()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.129.cs
index 2ad20b9637..22bd2b58a9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.129.cs
@@ -92,10 +92,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__InsertUInt64129
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int RetElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -110,7 +110,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public SimpleUnaryOpTest__InsertUInt64129()
@@ -120,10 +120,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -280,8 +280,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
@@ -291,8 +291,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray = new UInt64[Op1ElementCount];
UInt64[] outArray = new UInt64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.Int32.cs
index a96260b530..d7ff58d931 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__MaxInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.SByte.cs
index 9dd962dedd..17baef2bd1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__MaxSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt16.cs
index 60160a8915..8c31b75252 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__MaxUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt32.cs
index cf9b9cc844..15740cee8a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Max.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MaxUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__MaxUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.Int32.cs
index df30b2ac82..8dca101e42 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__MinInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.SByte.cs
index d7186fd7ea..e7abc4d198 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__MinSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt16.cs
index 04ae1dee62..8488da65fb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleBinaryOpTest__MinUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, UInt16, UInt16>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray2 = new UInt16[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt32.cs
index 7f05a49152..14e80d7b45 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Min.UInt32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MinUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public SimpleBinaryOpTest__MinUInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray2 = new UInt32[Op2ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MinHorizontal.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MinHorizontal.cs
index 904624b387..e4401045a6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MinHorizontal.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MinHorizontal.cs
@@ -94,10 +94,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__MinHorizontal
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -112,7 +112,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public SimpleUnaryOpTest__MinHorizontal()
@@ -122,10 +122,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -268,8 +268,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -279,8 +279,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray = new UInt16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultipleSumAbsoluteDifferences.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultipleSumAbsoluteDifferences.cs
index 9e33e92258..e905f3049d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultipleSumAbsoluteDifferences.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultipleSumAbsoluteDifferences.cs
@@ -94,11 +94,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultipleSumAbsoluteDifferences
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -116,9 +116,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public SimpleBinaryOpTest__MultipleSumAbsoluteDifferences()
@@ -128,13 +128,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, Byte, Byte>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<UInt16, Byte, Byte>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -319,9 +319,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, imm8, outArray, method);
}
@@ -332,9 +332,9 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray2 = new Byte[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, imm8, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultiplyLow.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultiplyLow.Int32.cs
index 2178a2c204..e5f348ee47 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultiplyLow.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/MultiplyLow.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplyLowInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__MultiplyLowInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/PackUnsignedSaturate.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/PackUnsignedSaturate.UInt16.cs
index 47db6aee22..556ff291b0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/PackUnsignedSaturate.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/PackUnsignedSaturate.UInt16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__PackUnsignedSaturateUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public HorizontalBinaryOpTest__PackUnsignedSaturateUInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<UInt16, Int32, Int32>(_data1, _data2, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<UInt16, Int32, Int32>(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] left, Int32[] right, UInt16[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(UInt16)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Double.cs
index b8c25f73d7..4eeedb70cd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundCurrentDirectionDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__RoundCurrentDirectionDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Single.cs
index 137859853c..987a7d6db7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirection.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundCurrentDirectionSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__RoundCurrentDirectionSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Double.cs
index b0bc41778c..d1a94bf212 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundCurrentDirectionScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__RoundCurrentDirectionScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Single.cs
index 3639a34c11..812d9809c9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundCurrentDirectionScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundCurrentDirectionScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__RoundCurrentDirectionScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Double.cs
index 7b5de3c39e..9d98e55704 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToNearestIntegerDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__RoundToNearestIntegerDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Single.cs
index a02f1f688b..b4d42a2508 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestInteger.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToNearestIntegerSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__RoundToNearestIntegerSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Double.cs
index b9c135cd05..b715709c4e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundToNearestIntegerScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__RoundToNearestIntegerScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Single.cs
index 8d9d228e35..b00afe9cef 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNearestIntegerScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundToNearestIntegerScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__RoundToNearestIntegerScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Double.cs
index e8de8a03bd..cd7c55f7ab 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToNegativeInfinityDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__RoundToNegativeInfinityDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Single.cs
index 1ec37c8721..0b12a931ae 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinity.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToNegativeInfinitySingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__RoundToNegativeInfinitySingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Double.cs
index 17bf996ff9..2c67fe099d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundToNegativeInfinityScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__RoundToNegativeInfinityScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Single.cs
index cb10c0a22c..3b5ea8c33b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToNegativeInfinityScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundToNegativeInfinityScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__RoundToNegativeInfinityScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Double.cs
index 02a2a21a58..66e782f703 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToPositiveInfinityDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__RoundToPositiveInfinityDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Single.cs
index f2aefd81d4..f9308c0e54 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinity.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToPositiveInfinitySingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__RoundToPositiveInfinitySingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Double.cs
index ed6e5df289..54bd3c22fb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundToPositiveInfinityScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__RoundToPositiveInfinityScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Single.cs
index 87a81a74e0..24565086a9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToPositiveInfinityScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundToPositiveInfinityScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__RoundToPositiveInfinityScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Double.cs
index a0e82c70e0..a58150b542 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Double.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToZeroDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleUnaryOpTest__RoundToZeroDouble()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Single.cs
index c85ab32ca5..30fc2ddf33 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZero.Single.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__RoundToZeroSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data = new Single[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleUnaryOpTest__RoundToZeroSingle()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Double.cs
index 4919a390f6..6ee0e0ed94 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Double.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundToZeroScalarDouble
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Double);
- private const int Op2ElementCount = VectorSize / sizeof(Double);
- private const int RetElementCount = VectorSize / sizeof(Double);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
public SimpleBinaryOpTest__RoundToZeroScalarDouble()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Double, Double, Double>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Double[] inArray2 = new Double[Op2ElementCount];
Double[] outArray = new Double[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Single.cs
index a56aad9b5d..c653838004 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/RoundToZeroScalar.Single.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__RoundToZeroScalarSingle
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Single);
- private const int Op2ElementCount = VectorSize / sizeof(Single);
- private const int RetElementCount = VectorSize / sizeof(Single);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
}
public SimpleBinaryOpTest__RoundToZeroScalarSingle()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Single, Single, Single>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Byte.cs
index 6157c244dc..9cd052cfde 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Byte.cs
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__TestAllOnesByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data = new Byte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public BooleanComparisonOpTest__TestAllOnesByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanUnaryOpTest__DataTable<Byte>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<Byte>(_data, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
Byte[] inArray = new Byte[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
Byte[] inArray = new Byte[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int16.cs
index 23841864cb..f14704207b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int16.cs
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__TestAllOnesInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public BooleanComparisonOpTest__TestAllOnesInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanUnaryOpTest__DataTable<Int16>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<Int16>(_data, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
Int16[] inArray = new Int16[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
Int16[] inArray = new Int16[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int32.cs
index 2cbbbf5201..cea53a44eb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int32.cs
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__TestAllOnesInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public BooleanComparisonOpTest__TestAllOnesInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanUnaryOpTest__DataTable<Int32>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<Int32>(_data, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
Int32[] inArray = new Int32[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
Int32[] inArray = new Int32[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int64.cs
index 4c0891f5bf..d79048dad8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.Int64.cs
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__TestAllOnesInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data = new Int64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public BooleanComparisonOpTest__TestAllOnesInt64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanUnaryOpTest__DataTable<Int64>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<Int64>(_data, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
Int64[] inArray = new Int64[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
Int64[] inArray = new Int64[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.SByte.cs
index df3f3b8c89..23ba8fd8f8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.SByte.cs
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__TestAllOnesSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public BooleanComparisonOpTest__TestAllOnesSByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanUnaryOpTest__DataTable<SByte>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<SByte>(_data, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
SByte[] inArray = new SByte[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
SByte[] inArray = new SByte[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt16.cs
index cb9a8d7c22..25a81c9d84 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt16.cs
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__TestAllOnesUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data = new UInt16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public BooleanComparisonOpTest__TestAllOnesUInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanUnaryOpTest__DataTable<UInt16>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<UInt16>(_data, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
UInt16[] inArray = new UInt16[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
UInt16[] inArray = new UInt16[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt32.cs
index f2ff4be8bc..35fac0dd30 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt32.cs
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__TestAllOnesUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data = new UInt32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public BooleanComparisonOpTest__TestAllOnesUInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanUnaryOpTest__DataTable<UInt32>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<UInt32>(_data, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
UInt32[] inArray = new UInt32[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
UInt32[] inArray = new UInt32[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt64.cs
index 5b8c89c87e..e03327885b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllOnes.UInt64.cs
@@ -86,9 +86,9 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanComparisonOpTest__TestAllOnesUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data = new UInt64[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public BooleanComparisonOpTest__TestAllOnesUInt64()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanUnaryOpTest__DataTable<UInt64>(_data, VectorSize);
+ _dataTable = new BooleanUnaryOpTest__DataTable<UInt64>(_data, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -246,7 +246,7 @@ namespace JIT.HardwareIntrinsics.X86
{
UInt64[] inArray = new UInt64[Op1ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), value);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), value);
ValidateResult(inArray, result, method);
}
@@ -255,7 +255,7 @@ namespace JIT.HardwareIntrinsics.X86
{
UInt64[] inArray = new UInt64[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(value), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Byte.cs
index 87c213d441..d329b3cf24 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestAllZerosByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public BooleanBinaryOpTest__TestAllZerosByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int16.cs
index aa7cf28272..7f190d7573 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestAllZerosInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public BooleanBinaryOpTest__TestAllZerosInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int32.cs
index 0f5bc9f5ef..2cb24b400a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestAllZerosInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public BooleanBinaryOpTest__TestAllZerosInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int64.cs
index 0625e05ba9..f9747826ac 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestAllZerosInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public BooleanBinaryOpTest__TestAllZerosInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.SByte.cs
index 27b59ee0e6..89147982bd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestAllZerosSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public BooleanBinaryOpTest__TestAllZerosSByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt16.cs
index c0cf917ecc..b307e480a9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestAllZerosUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public BooleanBinaryOpTest__TestAllZerosUInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt32.cs
index 83a0c46a96..bbe9c771d6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestAllZerosUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public BooleanBinaryOpTest__TestAllZerosUInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt64.cs
index 4612b354ef..4dd5c9fe49 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestAllZeros.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestAllZerosUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public BooleanBinaryOpTest__TestAllZerosUInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Byte.cs
index 56d9f9a2f2..ea33829664 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public BooleanBinaryOpTest__TestCByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int16.cs
index 1d025d9185..d677f97e45 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public BooleanBinaryOpTest__TestCInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int32.cs
index cbbb29a513..cc53b741dd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public BooleanBinaryOpTest__TestCInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int64.cs
index a901ab097f..951ab0a56f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public BooleanBinaryOpTest__TestCInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.SByte.cs
index f3e20b3772..c69e298f16 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public BooleanBinaryOpTest__TestCSByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt16.cs
index 982d2135b6..c071eb873f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public BooleanBinaryOpTest__TestCUInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt32.cs
index 042a6c405e..54efe4c3a7 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public BooleanBinaryOpTest__TestCUInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt64.cs
index 0e618798ff..25b5691478 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestC.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestCUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public BooleanBinaryOpTest__TestCUInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Byte.cs
index f3c2225874..a044b9622b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestMixOnesZerosByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public BooleanTwoComparisonOpTest__TestMixOnesZerosByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Byte, Byte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Byte, Byte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int16.cs
index 88ef85f4e1..1ffc56b094 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestMixOnesZerosInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public BooleanTwoComparisonOpTest__TestMixOnesZerosInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int16, Int16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int16, Int16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int32.cs
index ff18aeb526..f2d75b6ce6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestMixOnesZerosInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public BooleanTwoComparisonOpTest__TestMixOnesZerosInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int32, Int32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int32, Int32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int64.cs
index 09d2c7867b..a9e44fea5e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestMixOnesZerosInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public BooleanTwoComparisonOpTest__TestMixOnesZerosInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int64, Int64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int64, Int64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.SByte.cs
index 85e65ac4d3..db9e226655 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestMixOnesZerosSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public BooleanTwoComparisonOpTest__TestMixOnesZerosSByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<SByte, SByte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<SByte, SByte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt16.cs
index aa3bdac725..082d5b2dfe 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestMixOnesZerosUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public BooleanTwoComparisonOpTest__TestMixOnesZerosUInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt16, UInt16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt16, UInt16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt32.cs
index 24194ea446..b03d93278e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestMixOnesZerosUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public BooleanTwoComparisonOpTest__TestMixOnesZerosUInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt32, UInt32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt32, UInt32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt64.cs
index 3e6acc7772..d4b5693b83 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestMixOnesZeros.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestMixOnesZerosUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public BooleanTwoComparisonOpTest__TestMixOnesZerosUInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt64, UInt64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt64, UInt64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Byte.cs
index fc62e87d89..bd5c61caa4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Byte, Byte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Byte, Byte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int16.cs
index 25102e4761..f9d7dbd778 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int16, Int16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int16, Int16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int32.cs
index 93de213186..207c6d7c02 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int32, Int32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int32, Int32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int64.cs
index 7bcc0c20b4..7fd51e2c00 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int64, Int64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<Int64, Int64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.SByte.cs
index 923d950dd7..af0aeb2f48 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCSByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<SByte, SByte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<SByte, SByte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt16.cs
index 1c27aca89f..b3e015a461 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCUInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt16, UInt16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt16, UInt16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt32.cs
index 4d9c0d53a0..8b20066446 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCUInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt32, UInt32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt32, UInt32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt64.cs
index 323d04b757..51910e00cd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestNotZAndNotC.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanTwoComparisonOpTest__TestNotZAndNotCUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public BooleanTwoComparisonOpTest__TestNotZAndNotCUInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt64, UInt64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanTwoComparisonOpTest__DataTable<UInt64, UInt64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -276,8 +276,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -287,8 +287,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Byte.cs
index 33743f407f..b4be6da0dd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Byte[] _data2 = new Byte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public BooleanBinaryOpTest__TestZByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Byte, Byte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] inArray2 = new Byte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int16.cs
index 03331d9ff0..c5311a0648 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public BooleanBinaryOpTest__TestZInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int16, Int16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray1 = new Int16[Op1ElementCount];
Int16[] inArray2 = new Int16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int32.cs
index 71db570611..517be60540 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public BooleanBinaryOpTest__TestZInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int32, Int32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int64.cs
index 2702727b24..73f604343a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.Int64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public BooleanBinaryOpTest__TestZInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<Int64, Int64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray1 = new Int64[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.SByte.cs
index fb50f5617d..2c1e944101 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.SByte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public BooleanBinaryOpTest__TestZSByte()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<SByte, SByte>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt16.cs
index 261ff2190d..d7ca475697 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt16);
- private const int Op2ElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static UInt16[] _data1 = new UInt16[Op1ElementCount];
private static UInt16[] _data2 = new UInt16[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
}
public BooleanBinaryOpTest__TestZUInt16()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld1), ref Unsafe.As<UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ushort)(random.Next(0, ushort.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt16, UInt16>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt16[] inArray1 = new UInt16[Op1ElementCount];
UInt16[] inArray2 = new UInt16[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt32.cs
index 6127ee3fe0..c741395f48 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt32);
- private const int Op2ElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static UInt32[] _data1 = new UInt32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
}
public BooleanBinaryOpTest__TestZUInt32()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (uint)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (uint)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt32, UInt32>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt32[] inArray1 = new UInt32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt64.cs
index e7c2a11f19..82717fa638 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/TestZ.UInt64.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class BooleanBinaryOpTest__TestZUInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(UInt64);
- private const int Op2ElementCount = VectorSize / sizeof(UInt64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
private static UInt64[] _data1 = new UInt64[Op1ElementCount];
private static UInt64[] _data2 = new UInt64[Op2ElementCount];
@@ -106,9 +106,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
}
public BooleanBinaryOpTest__TestZUInt64()
@@ -118,13 +118,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld1), ref Unsafe.As<UInt64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld2), ref Unsafe.As<UInt64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (ulong)(random.Next(0, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (ulong)(random.Next(0, int.MaxValue)); }
- _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, VectorSize);
+ _dataTable = new BooleanBinaryOpTest__DataTable<UInt64, UInt64>(_data1, _data2, LargestVectorSize);
}
public bool IsSupported => Sse41.IsSupported;
@@ -277,8 +277,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), right);
ValidateResult(inArray1, inArray2, result, method);
}
@@ -288,8 +288,8 @@ namespace JIT.HardwareIntrinsics.X86
UInt64[] inArray1 = new UInt64[Op1ElementCount];
UInt64[] inArray2 = new UInt64[Op2ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
ValidateResult(inArray1, inArray2, result, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse42/CompareGreaterThan.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse42/CompareGreaterThan.Int64.cs
index 763f931361..0520e3ea12 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse42/CompareGreaterThan.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse42/CompareGreaterThan.Int64.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__CompareGreaterThanInt64
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int64);
- private const int Op2ElementCount = VectorSize / sizeof(Int64);
- private const int RetElementCount = VectorSize / sizeof(Int64);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static Int64[] _data1 = new Int64[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public SimpleBinaryOpTest__CompareGreaterThanInt64()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (long)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Sse42.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int64[] inArray2 = new Int64[Op2ElementCount];
Int64[] outArray = new Int64[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.Byte.cs
index 68716f6518..43f6a6ab4f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.Byte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.Byte.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__AbsByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(Byte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static SByte[] _data = new SByte[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__AbsByte()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, SByte>(_data, new Byte[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<Byte, SByte>(_data, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray = new SByte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt16.cs
index 8aad8e8b6f..f1ead046a0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt16.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__AbsUInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(UInt16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
private static Int16[] _data = new Int16[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue + 1, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleUnaryOpTest__AbsUInt16()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue + 1, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)(random.Next(short.MinValue + 1, short.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, Int16>(_data, new UInt16[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, Int16>(_data, new UInt16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray = new Int16[Op1ElementCount];
UInt16[] outArray = new UInt16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt32.cs
index 7807e01865..5a8fd7d919 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Abs.UInt32.cs
@@ -85,10 +85,10 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleUnaryOpTest__AbsUInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(UInt32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
private static Int32[] _data = new Int32[Op1ElementCount];
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue + 1, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__AbsUInt32()
@@ -113,10 +113,10 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue + 1, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)(random.Next(int.MinValue + 1, int.MaxValue)); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, Int32>(_data, new UInt32[RetElementCount], VectorSize);
+ _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, Int32>(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
@@ -270,8 +270,8 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray = new Int32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
ValidateResult(inArray, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int16.cs
index 8cbc5b9006..0ea25e566f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalAddInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public HorizontalBinaryOpTest__HorizontalAddInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int16[] left, Int16[] right, Int16[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Int16)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int32.cs
index dbbbea936b..e6f00bb4b9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAdd.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalAddInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public HorizontalBinaryOpTest__HorizontalAddInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] left, Int32[] right, Int32[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Int32)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAddSaturate.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAddSaturate.Int16.cs
index 4df9a9c661..90406774b9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAddSaturate.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalAddSaturate.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalAddSaturateInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public HorizontalBinaryOpTest__HorizontalAddSaturateInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int16[] left, Int16[] right, Int16[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Int16)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int16.cs
index 457f0ed4d4..6ce559137a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalSubtractInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public HorizontalBinaryOpTest__HorizontalSubtractInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int16[] left, Int16[] right, Int16[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Int16)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int32.cs
index eb20803525..b947270472 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtract.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalSubtractInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public HorizontalBinaryOpTest__HorizontalSubtractInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] left, Int32[] right, Int32[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Int32)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtractSaturate.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtractSaturate.Int16.cs
index 369adf3edd..ec96f733f0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtractSaturate.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/HorizontalSubtractSaturate.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class HorizontalBinaryOpTest__HorizontalSubtractSaturateInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public HorizontalBinaryOpTest__HorizontalSubtractSaturateInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new HorizontalBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new HorizontalBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,16 +292,16 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int16[] left, Int16[] right, Int16[] result, [CallerMemberName] string method = "")
{
- for (var outer = 0; outer < (VectorSize / 16); outer++)
+ for (var outer = 0; outer < (LargestVectorSize / 16); outer++)
{
for (var inner = 0; inner < (8 / sizeof(Int16)); inner++)
{
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyAddAdjacent.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyAddAdjacent.Int16.cs
index 113a594188..6b24d63c3f 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyAddAdjacent.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyAddAdjacent.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplyAddAdjacentInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Byte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__MultiplyAddAdjacentInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Byte, SByte>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Byte, SByte>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Byte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyHighRoundScale.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyHighRoundScale.Int16.cs
index 1c71d910fc..9e6225e8c5 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyHighRoundScale.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/MultiplyHighRoundScale.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__MultiplyHighRoundScaleInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__MultiplyHighRoundScaleInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Shuffle.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Shuffle.SByte.cs
index 877c5bb9a6..b1adce8c1c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Shuffle.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Shuffle.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__ShuffleSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__ShuffleSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int16.cs
index 2193a3bb21..aac13e9752 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int16.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int16.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SignInt16
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int16);
- private const int Op2ElementCount = VectorSize / sizeof(Int16);
- private const int RetElementCount = VectorSize / sizeof(Int16);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static Int16[] _data1 = new Int16[Op1ElementCount];
private static Int16[] _data2 = new Int16[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue + 1, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
}
public SimpleBinaryOpTest__SignInt16()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue + 1, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld1), ref Unsafe.As<Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (short)(random.Next(short.MinValue + 1, short.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int16, Int16, Int16>(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int16[] inArray2 = new Int16[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int16>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int32.cs
index ab27528c2e..541ed84282 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.Int32.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SignInt32
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(Int32);
- private const int Op2ElementCount = VectorSize / sizeof(Int32);
- private const int RetElementCount = VectorSize / sizeof(Int32);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue + 1, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleBinaryOpTest__SignInt32()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue + 1, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (int)(random.Next(int.MinValue + 1, int.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (int)(random.Next(int.MinValue, int.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<Int32, Int32, Int32>(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int32>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.SByte.cs
index 9947f0e9a7..21e07f5804 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.SByte.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Ssse3/Sign.SByte.cs
@@ -85,11 +85,11 @@ namespace JIT.HardwareIntrinsics.X86
public sealed unsafe class SimpleBinaryOpTest__SignSByte
{
- private const int VectorSize = 16;
+ private static readonly int LargestVectorSize = 16;
- private const int Op1ElementCount = VectorSize / sizeof(SByte);
- private const int Op2ElementCount = VectorSize / sizeof(SByte);
- private const int RetElementCount = VectorSize / sizeof(SByte);
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
@@ -107,9 +107,9 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleBinaryOpTest__SignSByte()
@@ -119,13 +119,13 @@ namespace JIT.HardwareIntrinsics.X86
var random = new Random();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue + 1, sbyte.MaxValue)); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); }
- _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], VectorSize);
+ _dataTable = new SimpleBinaryOpTest__DataTable<SByte, SByte, SByte>(_data1, _data2, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Ssse3.IsSupported;
@@ -279,9 +279,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
- Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), left);
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), right);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
@@ -292,9 +292,9 @@ namespace JIT.HardwareIntrinsics.X86
SByte[] inArray2 = new SByte[Op2ElementCount];
SByte[] outArray = new SByte[RetElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), VectorSize);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), VectorSize);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<SByte>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
diff --git a/tests/src/JIT/Performance/CodeQuality/Span/SpanBench.cs b/tests/src/JIT/Performance/CodeQuality/Span/SpanBench.cs
index 10bb4c5f25..3acedaf187 100644
--- a/tests/src/JIT/Performance/CodeQuality/Span/SpanBench.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Span/SpanBench.cs
@@ -960,7 +960,7 @@ namespace Span
for (int i = 0; i < iterationCount; i++)
{
- var byteSpan = span.AsBytes();
+ var byteSpan = MemoryMarshal.AsBytes(span);
// Under a condition that we know is false but the jit doesn't,
// add a read from 'byteSpan' to make sure it's not dead, and an assignment
// to 'span' so the AsBytes call won't get hoisted.
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_544983/DevDiv_544983.il b/tests/src/JIT/Regression/JitBlue/DevDiv_544983/DevDiv_544983.il
index 8ca630e1d7..da4afe1c1b 100644
--- a/tests/src/JIT/Regression/JitBlue/DevDiv_544983/DevDiv_544983.il
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_544983/DevDiv_544983.il
@@ -2,10 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-// The bug that this test captures was a case where a call to a divide helper
-// was being removed as dead code, but the GT_FIELD_LIST node for the long
-// argument was left. Such nodes must always be contained, and if they become
-// dead, all of their children must be marked as unused.
+// The bug that this test captures was a case where odd float register became free,
+// the corresponding even register was already free, and there was a double interval
+// waiting for the even/odd pair, which wasn't added yet because the odd half was still occupied.
.assembly extern mscorlib { auto }
.assembly extern System.Runtime { auto }
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_544985/DevDiv_544985.il b/tests/src/JIT/Regression/JitBlue/DevDiv_544985/DevDiv_544985.il
new file mode 100644
index 0000000000..907b3e0bc2
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_544985/DevDiv_544985.il
@@ -0,0 +1,187 @@
+// 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.
+
+.assembly extern mscorlib { auto }
+.assembly extern System.Runtime { auto }
+.assembly extern System.Console { auto }
+
+.assembly DevDiv_544985 { }
+
+.class public auto ansi beforefieldinit DevDiv_544985
+ extends [System.Runtime]System.Object
+{
+ .method public hidebysig static int32
+ Test(int32 argI0, int32 argI1, int32 argI2, int16 argS3, int16 argS4, int16 argS5) cil managed noinlining
+ {
+ .locals init ([0] int64 locL0, int32 locI1, int8 locB2, int64 locL3, uint8 locUB4, uint16 locUS5,
+ uint16 locUS6, uint8 locUB7, int16 locS8)
+ ldc.i8 1
+ stloc.0
+ ldc.i4 1
+ stloc.1
+ ldc.i4 1
+ stloc.2
+ ldc.i8 1
+ stloc.3
+ ldc.i4 1
+ stloc 4
+ ldc.i4 1
+ stloc 5
+ ldc.i4 1
+ stloc 6
+ ldc.i4 1
+ stloc 7
+ ldc.i4 1
+ stloc 8
+
+ ldc.i8 1
+ ldarg.s 0x5
+ stloc 0x4
+ pop
+ ldc.r8 2.7998176471286444e+172
+ ldarg.s 0x5
+ stloc.s 0x2
+ ldarg.s 0x3
+ stloc 0x8
+ ldc.i8 0x330BB4E2
+ ldloc 0x0
+ ldc.i8 0x9C6A2B5
+ and
+ not
+ ceq
+ neg
+ ldloc.s 0x4
+ ldloc 0x3
+ conv.i1
+ or
+ dup
+ neg
+ sub
+ nop
+ ldc.i8 0x27AF808A
+ pop
+ and
+ stloc.s 0x6
+ ldloc.s 0x0
+ ldloc 0x7
+ shr
+ conv.i8
+ conv.r4
+ ldloc 0x5
+ conv.u1
+ starg 0x3
+ neg
+ ldc.r8 3.7091607632075579e+195
+ conv.i8
+ neg
+ neg
+ ldloc 0x7
+ ldloc.s 0x2
+ cgt.un
+ ldloc 0x0
+ ldc.i8 0xBCF8E9DB
+ conv.i8
+ rem.un
+ conv.ovf.i4
+ div
+ shr
+ not
+ conv.r8
+ div
+ neg
+ ldc.r8 -1.8469687730371883e+160
+ ckfinite
+ ldc.r8 6.7655721550212406e+3 // 6.7655721550212406e+303
+ conv.r4
+ ldarg.s 0x4
+ conv.r4
+ rem
+ neg
+ conv.r4
+ rem
+ conv.ovf.i8
+ ldc.r8 -2.8239060779835572e+06 // -2.8239060779835572e+056
+ ckfinite
+ conv.i8
+ add
+ ldloc.s 0x0
+ ldloc 0x0
+ add
+ pop
+ pop
+ ldc.i8 0x2AEA9007
+ ldloc.s 0x3
+ conv.r.un
+ conv.i8
+ div.un
+ neg
+ ldloc 0x4
+ conv.i8
+ ldarg.s 0x4
+ shl
+ clt.un
+ conv.r8
+ conv.r4
+ nop
+ mul
+ neg
+ clt
+ ldarg 0x4
+ conv.r4
+ ckfinite
+ ckfinite
+ pop
+ ret
+
+ } // end of method DevDiv_544985:Test
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ .locals init ([0] int32 retVal, [1] int32 testResult)
+
+ ldc.i4 100
+ stloc.0
+ ldc.i4 1
+ ldc.i4 2
+ ldc.i4 3
+ ldc.i4 4
+ ldc.i4 5
+ ldc.i4 6
+ call int32 DevDiv_544985::Test(int32 argI0, int32 argI1, int32 argI2, int16 argS3, int16 argS4, int16 argS5)
+ stloc.1
+ ldloc.1
+ ldc.i4.0
+ ceq
+ brtrue.s L1
+
+ ldstr "Test Result = "
+ call void [System.Console]System.Console::Write(string)
+ ldloc.1
+ call void [System.Console]System.Console::WriteLine(int32)
+ ldstr "FAIL"
+ call void [System.Console]System.Console::WriteLine(string)
+ ldc.i4.m1
+ stloc.0
+ br L2
+
+ L1: ldstr "PASS"
+ call void [System.Console]System.Console::WriteLine(string)
+
+ L2: ldloc.0
+ ret
+ } // end of method DevDiv_544985:Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 8 (0x8)
+ .maxstack 8
+ ldarg.0
+ call instance void [System.Runtime]System.Object::.ctor()
+ ret
+ } // end of method DevDiv_544985:.ctor
+
+} // end of class DevDiv_544985
+
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_544985/DevDiv_544985.ilproj b/tests/src/JIT/Regression/JitBlue/DevDiv_544985/DevDiv_544985.ilproj
new file mode 100644
index 0000000000..da5195d1bf
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_544985/DevDiv_544985.ilproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_545497/DevDiv_545497.il b/tests/src/JIT/Regression/JitBlue/DevDiv_545497/DevDiv_545497.il
new file mode 100644
index 0000000000..fa6bf4997d
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_545497/DevDiv_545497.il
@@ -0,0 +1,117 @@
+// 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.
+
+// The bug that this test captures was a case where arm LSRA built wrong uses order for
+// the IL_0090 shift operand.
+
+.assembly extern System.Runtime { auto }
+.assembly DevDiv_524309 {}
+
+.class private auto ansi beforefieldinit DevDiv_545497
+ extends [System.Runtime]System.Object
+{
+ .method private hidebysig static uint8
+ ILGEN_METHOD(float32 a,
+ uint32 b,
+ uint64 c) cil managed
+ {
+ .maxstack 194
+ .locals init (float64, bool, unsigned int64)
+ IL_0000: ldloc.s 0x01
+ IL_0002: conv.r.un
+ IL_0028: conv.ovf.u8.un
+ IL_002c: ldloc.s 0x00
+ IL_002e: conv.ovf.i8.un
+ IL_002f: stloc 0x0002
+ IL_0033: ldarg 0x0002
+ IL_003f: ldloc 0x0001
+ IL_0043: ldloc.s 0x01
+ IL_0045: shl
+ IL_0047: shr.un
+ IL_0049: ldarg.s 0x01
+ IL_005b: conv.i1
+ IL_005d: conv.ovf.u
+ IL_005e: ldloc 0x0001
+ IL_0063: ldc.i4 0
+ IL_0071: ldloc 0x0002
+ IL_007a: conv.ovf.i1.un
+ IL_007b: stloc 0x0001
+ IL_007f: conv.i1
+ IL_0081: rem.un
+ IL_0082: ldarg 0x0002
+ IL_0087: dup
+ IL_0088: add.ovf.un
+ IL_008a: ldloc.s 0x01
+ IL_008c: ldloc 0x0001
+ IL_0090: shr // This shift moves loc0x01 >> loc0x01 and exposed the original issue.
+ IL_0091: conv.ovf.i8
+ IL_0092: mul
+ IL_0093: ldloc.s 0x01
+ IL_0095: ldarg.s 0x01
+ IL_0097: div.un
+ IL_0098: starg 0x0001
+ IL_009c: ldloc 0x0002
+ IL_00b0: clt
+ IL_00b2: conv.ovf.i1.un
+ IL_00b3: sub.ovf.un
+ IL_00b7: sub.ovf
+ IL_00b9: shr.un
+ IL_00ba: ldloc.s 0x01
+ IL_00bc: conv.ovf.u8.un
+ IL_00bd: and
+ IL_00bf: clt.un
+ IL_00c1: ret
+ } // end of method DevDiv_545497::ILGEN_METHOD
+
+ .method private hidebysig static int32
+ Main() cil managed
+ {
+ .entrypoint
+ // Code size 31 (0x1f)
+ .maxstack 3
+ .locals init (int32 V_0)
+ IL_0000: nop
+ .try
+ {
+ IL_0001: nop
+ IL_0002: ldc.r4 0.0
+ IL_0007: ldc.i4.0
+ IL_0008: ldc.i4.0
+ IL_0009: conv.i8
+ IL_000a: call uint8 DevDiv_545497::ILGEN_METHOD(float32,
+ uint32,
+ uint64)
+ IL_000f: pop
+ IL_0010: nop
+ IL_0011: leave.s IL_0018
+
+ } // end .try
+ catch [System.Runtime]System.Object
+ {
+ IL_0013: pop
+ IL_0014: nop
+ IL_0015: nop
+ IL_0016: leave.s IL_0018
+
+ } // end handler
+ IL_0018: ldc.i4.s 100
+ IL_001a: stloc.0
+ IL_001b: br.s IL_001d
+
+ IL_001d: ldloc.0
+ IL_001e: ret
+ } // end of method DevDiv_545497::Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 8 (0x8)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [System.Runtime]System.Object::.ctor()
+ IL_0006: nop
+ IL_0007: ret
+ } // end of method DevDiv_545497::.ctor
+
+} // end of class DevDiv_545497
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_545497/DevDiv_545497.ilproj b/tests/src/JIT/Regression/JitBlue/DevDiv_545497/DevDiv_545497.ilproj
new file mode 100644
index 0000000000..5934cf63ac
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_545497/DevDiv_545497.ilproj
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).il" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_545500/DevDiv_545500.il b/tests/src/JIT/Regression/JitBlue/DevDiv_545500/DevDiv_545500.il
new file mode 100644
index 0000000000..9d66bcbe18
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_545500/DevDiv_545500.il
@@ -0,0 +1,177 @@
+// 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.
+
+// The bug that this test captures was a case where a call to a divide helper
+// was being removed as dead code, but the GT_FIELD_LIST node for the int64
+// argument was left. Such nodes must always be contained, and if they become
+// dead, all of their children must be marked as unused.
+
+.assembly extern mscorlib { auto }
+.assembly extern System.Runtime { auto }
+.assembly extern System.Console { auto }
+
+.assembly DevDiv_545500 { }
+
+.class public auto ansi beforefieldinit DevDiv_545500
+ extends [System.Runtime]System.Object
+{
+ .method public hidebysig static uint8
+ Test(float32 f, int32 i, int64 l) cil managed noinlining
+ {
+ .locals init ([0] float64 d, bool b, int64 l2)
+ ldc.r8 100.0
+ conv.r4
+ conv.ovf.u8.un
+ ldc.i8 0x70B9
+ not
+ not
+ neg
+ add.ovf
+ not
+ ldarg 0x1
+ ldarg 0x1
+ div
+ ldarg 0x1
+ ldarg 0x1
+ and
+ and
+ shr.un
+ conv.u8
+ conv.r8
+ nop
+ conv.ovf.i8.un
+ ldc.i8 0xB03F
+ ldloc.s 0x0
+ ckfinite
+ conv.ovf.u8
+ ldc.i4 0x9260
+ conv.i8
+ or
+ conv.ovf.u8
+ clt.un
+ neg
+ conv.i8
+ conv.ovf.u4
+ shr
+ conv.ovf.u.un
+ brtrue L1
+ ldloc.s 0x1
+ not
+ conv.r4
+ ldloc 0x0
+ add
+ ldarg 0x0
+ ldloc.s 0x0
+ mul
+ conv.r4
+ conv.r8
+ add
+ ldarg 0x0
+ ldloc 0x0
+ cgt.un
+ neg
+ conv.r8
+ neg
+ conv.r4
+ ldloc.s 0x2
+ neg
+ conv.ovf.i2.un
+ ldc.i4 0xAAC7
+ conv.r8
+ conv.ovf.i1
+ xor
+ conv.r.un
+ conv.r8
+ ldc.r8 -2.9830006130986561e+135
+ starg 0x0
+ neg
+ mul
+ stloc 0x0
+ conv.ovf.i8
+ nop
+ starg.s 0x2
+L1: ldarg.s 0x1
+ neg
+ ldloc.s 0x2
+ conv.r.un
+ ldarg.s 0x0
+ ldarg.s 0x0
+ cgt
+ conv.r.un
+ cgt
+ neg
+ add
+ conv.r.un
+ ckfinite
+ conv.u8
+ conv.i
+ conv.i2
+ ldarg 0x1
+ neg
+ ldloc.s 0x1
+ ldloc.s 0x0
+ conv.ovf.i4.un
+ shl
+ add
+ conv.u8
+ ldarg 0x2
+ ldc.i8 0x5ACB
+ ldarg.s 0x2
+ sub
+ add
+ ldc.i8 0x9B4E
+ div.un
+ conv.u8
+ cgt
+ shr.un
+ neg
+ ret
+ } // end of method DevDiv_545500:Test
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ .locals init ([0] int32 retVal, [1] int32 testResult)
+
+ ldc.i4 100
+ stloc.0
+ ldc.r4 1.0
+ ldc.i4 1
+ ldc.i8 3
+ call uint8 DevDiv_545500::Test(float32 f, int32 i, int64 l)
+ stloc.1
+ ldloc.1
+ ldc.i4.1
+ ceq
+ brtrue.s L1
+
+ ldstr "Test Result = "
+ call void [System.Console]System.Console::Write(string)
+ ldloc.1
+ call void [System.Console]System.Console::WriteLine(int32)
+ ldstr "FAIL"
+ call void [System.Console]System.Console::WriteLine(string)
+ ldc.i4.m1
+ stloc.0
+ br L2
+
+ L1: ldstr "PASS"
+ call void [System.Console]System.Console::WriteLine(string)
+
+ L2: ldloc.0
+ ret
+ } // end of method DevDiv_545500:Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 8 (0x8)
+ .maxstack 8
+ ldarg.0
+ call instance void [System.Runtime]System.Object::.ctor()
+ ret
+ } // end of method DevDiv_545500:.ctor
+
+} // end of class DevDiv_545500
+
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_545500/DevDiv_545500.ilproj b/tests/src/JIT/Regression/JitBlue/DevDiv_545500/DevDiv_545500.ilproj
new file mode 100644
index 0000000000..da5195d1bf
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_545500/DevDiv_545500.ilproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_545504/DevDiv_545504.cs b/tests/src/JIT/Regression/JitBlue/DevDiv_545504/DevDiv_545504.cs
new file mode 100644
index 0000000000..80817c0d5c
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_545504/DevDiv_545504.cs
@@ -0,0 +1,116 @@
+// 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.
+//
+
+// The bug captured by this test was an ARM failure where:
+// - We have a fairly large frame going into the backend, but still not enough to trigger]
+// the need to reserve REG_OPT_RSVD.
+// - The backend (decomposition in particular) generates many new locals, making the
+// frame large enough to require REG_OPT_RSVD.
+// - The bug was that the analysis was being done prior to decomposition and lowering,
+// thus missing this case.
+// - The fix was to move this analysis just prior to actual register allocation.
+
+using System;
+using System.Runtime.CompilerServices;
+
+public class DevDiv_545504
+{
+ public const int Pass = 100;
+ public const int Fail = -1;
+
+ struct Struct_64bytes
+ {
+ long m_l0;
+ long m_l1;
+ long m_l2;
+ long m_l3;
+ long m_l4;
+ long m_l5;
+ long m_l6;
+ long m_l7;
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public Struct_64bytes(long l)
+ {
+ m_l0 = l;
+ m_l1 = l + 1;
+ m_l2 = l + 2;
+ m_l3 = l + 3;
+ m_l4 = l + 4;
+ m_l5 = l + 5;
+ m_l6= l + 6;
+ m_l7= l + 7;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+ public long Compute()
+ {
+ long result = ((m_l0 << (int)m_l1) >> (int)(m_l2 / 2)) +
+ ((m_l3 << (int)m_l4) >> (int)(m_l5 / 2)) +
+ m_l6 + m_l7;
+ return result;
+ }
+ }
+
+ struct Struct_512bytes
+ {
+ Struct_64bytes m_s0;
+ Struct_64bytes m_s1;
+ Struct_64bytes m_s2;
+ Struct_64bytes m_s3;
+ Struct_64bytes m_s4;
+ Struct_64bytes m_s5;
+ Struct_64bytes m_s6;
+ Struct_64bytes m_s7;
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public Struct_512bytes(long l)
+ {
+ m_s0 = new Struct_64bytes(l);
+ m_s1 = new Struct_64bytes(l + 1);
+ m_s2 = new Struct_64bytes(l + 2);
+ m_s3 = new Struct_64bytes(l + 3);
+ m_s4 = new Struct_64bytes(l + 4);
+ m_s5 = new Struct_64bytes(l + 5);
+ m_s6 = new Struct_64bytes(l + 6);
+ m_s7 = new Struct_64bytes(l + 7);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
+ public long Compute()
+ {
+ long result = ((m_s0.Compute() << (int)m_s1.Compute()) >> (int)(m_s2.Compute() / 2)) +
+ ((m_s3.Compute() << (int)m_s4.Compute()) >> (int)(m_s5.Compute() / 2)) +
+ m_s6.Compute() + m_s7.Compute();
+ return result;
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static long test(int count)
+ {
+ Struct_512bytes s0 = new Struct_512bytes(0);
+ Struct_512bytes s1 = new Struct_512bytes(1);
+ Struct_512bytes s2 = new Struct_512bytes(2);
+ Struct_512bytes s3 = new Struct_512bytes(3);
+ Struct_512bytes s4 = new Struct_512bytes(4);
+ Struct_512bytes s5 = new Struct_512bytes(5);
+
+ long result = ((s0.Compute() << (int)s1.Compute()) >> (int)(s2.Compute() / 2)) +
+ ((s3.Compute() << (int)s4.Compute()) >> (int)(s5.Compute() / 2));
+
+ Console.WriteLine("Result: " + result);
+ return result;
+ }
+ public static int Main()
+ {
+ int result = (int)test(10);
+ if (result != 267386880)
+ {
+ return Fail;
+ }
+ return Pass;
+ }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_545504/DevDiv_545504.csproj b/tests/src/JIT/Regression/JitBlue/DevDiv_545504/DevDiv_545504.csproj
new file mode 100644
index 0000000000..6d58ab0227
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_545504/DevDiv_545504.csproj
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType></DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.il b/tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.il
new file mode 100644
index 0000000000..7d36305ed9
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.il
@@ -0,0 +1,97 @@
+// 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.
+
+.assembly extern mscorlib { auto }
+.assembly GitHub_13501 { }
+
+.class private Program extends [mscorlib]System.Object
+{
+ .method hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ .maxstack 8
+
+ T1: // Test that add.ovf.un(native int(0), int32(-1)) produces native int(0xFFFFFFFF),
+ // -1 is supposed to be treated as unsigned by add.ovf.un.
+ // Test_Cast_gtFoldExprConst is supposed to result in the compile time evaluation
+ // of the cast in gtFoldExprConst.
+
+ ldc.i4 0
+ conv.i
+ ldc.i4 0
+ call native int Program::Test_Cast_gtFoldExprConst(native int, bool)
+ ldc.i4 -1
+ conv.u
+ bne.un FAIL
+
+ T2: // Same test as above but using Test_Cast_EvalCastForConstantArgs. In this case
+ // -1 is the result of a more complex expression that can be evaluated at compile
+ // time by value numbering in EvalCastForConstantArgs.
+
+ ldc.i4 0
+ conv.i
+ ldc.i4 0
+ call native int Program::Test_Cast_EvalCastForConstantArgs(native int, bool)
+ ldc.i4 -1
+ conv.u
+ bne.un FAIL
+
+ T3: // Same test as above but using Test_Cast_Codegen. In this case -1 is passed
+ // as a parameter so the cast cannot be evaluated at compile time and actual
+ // cast code needs to be generated.
+
+ ldc.i4 0
+ conv.i
+ ldc.i4 -1
+ call native int Program::Test_Cast_Codegen(native int, int32)
+ ldc.i4 -1
+ conv.u
+ bne.un FAIL
+
+ PASS:
+ ldstr "PASS"
+ call void [System.Console]System.Console::WriteLine(string)
+ ldc.i4 100
+ ret
+ FAIL:
+ ldstr "FAIL"
+ call void [System.Console]System.Console::WriteLine(string)
+ ldc.i4 1
+ ret
+ }
+
+ .method static native int Test_Cast_gtFoldExprConst(native int, bool) cil managed noinlining
+ {
+ .maxstack 4
+
+ ldc.i4 -1
+ ldarg.0
+ add.ovf.un
+ ret
+ }
+
+ .method static native int Test_Cast_EvalCastForConstantArgs(native int, bool) cil managed noinlining
+ {
+ .maxstack 4
+
+ ldarg.1
+ brtrue L1
+ ldc.i4 -1
+ br L2
+ L1: ldc.i4 -1
+ L2: ldarg.0
+ add.ovf.un
+ ret
+ }
+
+ .method static native int Test_Cast_Codegen(native int, int32) cil managed noinlining
+ {
+ .maxstack 4
+
+ ldarg.1
+ ldarg.0
+ add.ovf.un
+ ret
+ }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.ilproj b/tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.ilproj
new file mode 100644
index 0000000000..918ae0ab40
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_13501/GitHub_13501.ilproj
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <CLRTestPriority>1</CLRTestPriority>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="GitHub_13501.il" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/opt/Devirtualization/box1.cs b/tests/src/JIT/opt/Devirtualization/box1.cs
new file mode 100644
index 0000000000..51121f37d8
--- /dev/null
+++ b/tests/src/JIT/opt/Devirtualization/box1.cs
@@ -0,0 +1,29 @@
+// 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;
+
+interface IPrint
+{
+ void Print();
+}
+
+struct X<T> : IPrint
+{
+ public X(T t) { _t = t; }
+ public void Print() { Console.WriteLine(_t); }
+ T _t;
+}
+
+class Y
+{
+ static int Main()
+ {
+ var s = new X<string>("hello, world!");
+ // Jit should devirtualize, remove box,
+ // change to call unboxed entry, then inline.
+ ((IPrint)s).Print();
+ return 100;
+ }
+}
diff --git a/tests/src/JIT/opt/Devirtualization/box1.csproj b/tests/src/JIT/opt/Devirtualization/box1.csproj
new file mode 100644
index 0000000000..a1390b0c17
--- /dev/null
+++ b/tests/src/JIT/opt/Devirtualization/box1.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="box1.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/opt/Devirtualization/box2.cs b/tests/src/JIT/opt/Devirtualization/box2.cs
new file mode 100644
index 0000000000..9e82ef2ff5
--- /dev/null
+++ b/tests/src/JIT/opt/Devirtualization/box2.cs
@@ -0,0 +1,24 @@
+// 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;
+using System.Threading;
+using System.Threading.Tasks;
+
+class Program
+{
+ static async Task<int> Main()
+ {
+ for (int i = 0; i < 10; i++)
+ {
+ // In the associated AwaitUnsafeOnCompleted, the
+ // jit should devirtualize, remove the box,
+ // and change to call unboxed entry, passing
+ // extra context argument.
+ await new ValueTask<string>(Task.Delay(1).ContinueWith(_ => default(string))).ConfigureAwait(false);
+ }
+
+ return 100;
+ }
+}
diff --git a/tests/src/JIT/opt/Devirtualization/box2.csproj b/tests/src/JIT/opt/Devirtualization/box2.csproj
new file mode 100644
index 0000000000..e821b3bca9
--- /dev/null
+++ b/tests/src/JIT/opt/Devirtualization/box2.csproj
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <Langversion>7.2</Langversion>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="box2.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/baseservices/exceptions/stacktrace/Tier1StackTrace.csproj b/tests/src/baseservices/exceptions/stacktrace/Tier1StackTrace.csproj
index c426338ea9..c0a2ca94b0 100644
--- a/tests/src/baseservices/exceptions/stacktrace/Tier1StackTrace.csproj
+++ b/tests/src/baseservices/exceptions/stacktrace/Tier1StackTrace.csproj
@@ -22,11 +22,11 @@
<PropertyGroup>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
-set COMPlus_EXPERIMENTAL_TieredCompilation=1
+set COMPlus_TieredCompilation=1
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
-export COMPlus_EXPERIMENTAL_TieredCompilation=1
+export COMPlus_TieredCompilation=1
]]></BashCLRTestPreCommands>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
diff --git a/tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj b/tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj
index f5fc1fc923..a37c1434e1 100644
--- a/tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj
+++ b/tests/src/baseservices/threading/regressions/269336/objmonhelper.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -10,6 +10,7 @@
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<CLRTestPriority>1</CLRTestPriority>
+ <GCStressIncompatible>true</GCStressIncompatible>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
diff --git a/tests/src/dirs.proj b/tests/src/dirs.proj
index 6bb138b706..b6f9f6daf7 100644
--- a/tests/src/dirs.proj
+++ b/tests/src/dirs.proj
@@ -32,15 +32,233 @@
<DisabledProjects Include="Loader\classloader\generics\regressions\DD117522\Test.csproj" />
<DisabledProjects Include="Loader\classloader\generics\GenericMethods\VSW491668.csproj" /> <!-- issue 5501 -->
</ItemGroup>
-
- <ItemGroup>
+
+ <!-- Unix builds do not support subgroups -->
+ <ItemGroup Condition="$(__BuildOS) != 'Windows_NT' And $(__TestGroupToBuild) == '1' And $(TestBuildSlice) == '1'">
+ <Project Include="*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <!-- Test build is divided in slices which can be created within Test Group
+ Priority 0 tests are build using Test Group 1 with 2 subgroups or slices -->
+
+ <ItemGroup Condition="$(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '1' And $(TestBuildSlice) == '1'">
<Project Include="*\**\*.csproj" Exclude="@(DisabledProjects)">
<AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
</Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="$(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '1' And $(TestBuildSlice) == '2'">
<Project Include="*\**\*.ilproj" Exclude="@(DisabledProjects)">
<AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
</Project>
</ItemGroup>
+
+ <!-- Test build is divided in slices which can be created within Test Group
+ Priority 1 or higher tests are build using Test Group 2 with 16 subgroups or slices -->
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '1')">
+ <Project Include="baseservices\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="Common\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="baseservices\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="Common\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '2')">
+ <Project Include="CoreMangLib\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="CoreMangLib\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '3')">
+ <Project Include="E*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="GC\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="hosting\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="Interop\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="E*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="GC\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="hosting\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="Interop\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '4')">
+ <Project Include="JIT\B*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\C*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\Directed\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '5')">
+ <Project Include="JIT\B*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\C*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\Directed\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '6')">
+ <Project Include="JIT\Generics\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\*Intrinsics\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\Generics\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\*Intrinsics\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '7')">
+ <Project Include="JIT\IL_Conformance\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\IL_Conformance\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '8')">
+ <Project Include="JIT\jit64\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\jit64\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '9')">
+ <Project Include="JIT\Methodical\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '10')">
+ <Project Include="JIT\Methodical\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '11')">
+ <Project Include="JIT\opt\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\Performance\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\S*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\opt\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\Performance\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="JIT\S*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '12')">
+ <Project Include="JIT\R*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '13')">
+ <Project Include="JIT\R*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '14')">
+ <Project Include="Loader\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '15')">
+ <Project Include="Loader\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
+ <ItemGroup Condition="($(__BuildOS) == 'Windows_NT' And $(__TestGroupToBuild) == '2' And $(TestBuildSlice) == '16')">
+ <Project Include="m*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="p*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="r*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="s*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="t*\**\*.csproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="m*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="p*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="r*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="s*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ <Project Include="t*\**\*.ilproj" Exclude="@(DisabledProjects)">
+ <AdditionalProperties>OSGroup=$(OSGroup)</AdditionalProperties>
+ </Project>
+ </ItemGroup>
+
</Target>
<Import Project="..\dir.traversal.targets" />
diff --git a/tests/src/performance/Scenario/JitBench/Runner/BenchmarkConfiguration.cs b/tests/src/performance/Scenario/JitBench/Runner/BenchmarkConfiguration.cs
index 42aa2e2698..a72963cec2 100644
--- a/tests/src/performance/Scenario/JitBench/Runner/BenchmarkConfiguration.cs
+++ b/tests/src/performance/Scenario/JitBench/Runner/BenchmarkConfiguration.cs
@@ -17,7 +17,7 @@ namespace JitBench
public BenchmarkConfiguration WithTiering()
{
- return WithModifier("Tiering", "COMPLUS_EXPERIMENTAL_TieredCompilation", "1");
+ return WithModifier("Tiering", "COMPLUS_TieredCompilation", "1");
}
public BenchmarkConfiguration WithMinOpts()
diff --git a/tests/src/performance/Scenario/JitBench/Runner/Program.cs b/tests/src/performance/Scenario/JitBench/Runner/Program.cs
index 9b81c94118..fc8615dbf8 100644
--- a/tests/src/performance/Scenario/JitBench/Runner/Program.cs
+++ b/tests/src/performance/Scenario/JitBench/Runner/Program.cs
@@ -163,7 +163,7 @@ namespace JitBench
static IEnumerable<BenchmarkConfiguration> GetBenchmarkConfigurations(CommandLineOptions options)
{
- string tieredEnv = Environment.GetEnvironmentVariable("COMPLUS_EXPERIMENTAL_TieredCompilation");
+ string tieredEnv = Environment.GetEnvironmentVariable("COMPLUS_TieredCompilation");
string minoptsEnv = Environment.GetEnvironmentVariable("COMPLUS_JitMinopts");
string r2rEnv = Environment.GetEnvironmentVariable("COMPLUS_ReadyToRun");
string ngenEnv = Environment.GetEnvironmentVariable("COMPLUS_ZapDisable");
diff --git a/tests/src/reflection/Tier1Collectible/Tier1Collectible.csproj b/tests/src/reflection/Tier1Collectible/Tier1Collectible.csproj
index a7772f64c2..926be4a475 100644
--- a/tests/src/reflection/Tier1Collectible/Tier1Collectible.csproj
+++ b/tests/src/reflection/Tier1Collectible/Tier1Collectible.csproj
@@ -21,11 +21,11 @@
<PropertyGroup>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
-set COMPlus_EXPERIMENTAL_TieredCompilation=1
+set COMPlus_TieredCompilation=1
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
-export COMPlus_EXPERIMENTAL_TieredCompilation=1
+export COMPlus_TieredCompilation=1
]]></BashCLRTestPreCommands>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
diff --git a/tests/src/sizeondisk/sodbench/SoDBench.cs b/tests/src/sizeondisk/sodbench/SoDBench.cs
index cd8c819266..fe40a4d54e 100644
--- a/tests/src/sizeondisk/sodbench/SoDBench.cs
+++ b/tests/src/sizeondisk/sodbench/SoDBench.cs
@@ -371,7 +371,7 @@ namespace SoDBench
{
FileName = s_dotnetExe.FullName,
// The UserSharedCompiler flag is set to false to prevent handles from being held that will later cause deletion of the installed SDK to fail.
- Arguments = $"publish -c Release --runtime {os} --output {publishDir.FullName} /p:UseSharedCompilation=false",
+ Arguments = $"publish -c Release --runtime {os} --output {publishDir.FullName} /p:UseSharedCompilation=false /p:UseRazorBuildServer=false",
UseShellExecute = false,
WorkingDirectory = deploymentSandbox.FullName
};
diff --git a/tests/src/tracing/tracevalidation/rundown/Rundown.cs b/tests/src/tracing/tracevalidation/rundown/Rundown.cs
index 6b064d289a..bdd8edd8ec 100644
--- a/tests/src/tracing/tracevalidation/rundown/Rundown.cs
+++ b/tests/src/tracing/tracevalidation/rundown/Rundown.cs
@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
-using System.IO;
-using Tracing.Tests.Common;
using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Parsers;
using Microsoft.Diagnostics.Tracing.Parsers.Clr;
+using System.IO;
+using System.Linq;
+using Tracing.Tests.Common;
namespace Tracing.Tests
{
@@ -14,9 +15,9 @@ namespace Tracing.Tests
{
// Additional assemblies will be seen, but these are ones we must see
string[] AssembliesExpected = new string[] {
- "rundown", // this assembly
+ "Common",
+ "Rundown", // this assembly
"System.Runtime",
- "Microsoft.Diagnostics.Tracing.TraceEvent",
"System.Diagnostics.Tracing",
"System.Private.CoreLib"
};
@@ -35,7 +36,7 @@ namespace Tracing.Tests
Console.WriteLine("\tStart: Process the trace file.");
- var assembliesLoaded = new HashSet<string>();
+ var assembliesLoaded = new List<string>();
int nonMatchingEventCount = 0;
using (var trace = TraceEventDispatcher.GetDispatcherFromFileName(netPerfFile.Path))
@@ -60,9 +61,9 @@ namespace Tracing.Tests
}
Console.WriteLine("\tEnd: Processing events from file.\n");
- foreach (var name in AssembliesExpected)
+ foreach (var expected in AssembliesExpected)
{
- Assert.True($"Assembly {name} in loaded assemblies", assembliesLoaded.Contains(name));
+ Assert.True($"Assembly {expected} in loaded assemblies", assembliesLoaded.Any(loaded => String.Equals(loaded, expected, StringComparison.OrdinalIgnoreCase)));
}
Assert.Equal(nameof(nonMatchingEventCount), nonMatchingEventCount, 0);
}
diff --git a/tests/src/tracing/tracevalidation/tracelogging/EventSourceTest.cs b/tests/src/tracing/tracevalidation/tracelogging/EventSourceTest.cs
index 4ef9eb2a7d..79969eabdc 100644
--- a/tests/src/tracing/tracevalidation/tracelogging/EventSourceTest.cs
+++ b/tests/src/tracing/tracevalidation/tracelogging/EventSourceTest.cs
@@ -72,6 +72,11 @@ namespace Tracing.Tests.Common
return;
}
+ if(data.ProviderName.Equals("Microsoft-DotNETCore-EventPipe"))
+ {
+ return;
+ }
+
Assert.True($"m_nextTestVerificationIndex({m_nextTestVerificationIndex}) < m_tests.Count({m_tests.Count})", m_nextTestVerificationIndex < m_tests.Count);
try
{
diff --git a/tests/testsFailing.arm.txt b/tests/testsFailing.arm.txt
new file mode 100644
index 0000000000..68ad6a3226
--- /dev/null
+++ b/tests/testsFailing.arm.txt
@@ -0,0 +1 @@
+GC/API/GC/GetAllocatedBytesForCurrentThread/GetAllocatedBytesForCurrentThread.sh